package de.christinecoenen.code.zapp.utils.video;

import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import android.widget.ImageView;

import butterknife.BindView;
import butterknife.ButterKnife;
import de.christinecoenen.code.zapp.R;

public class SwipeIndicatorView extends FrameLayout {

	@BindView(R.id.indicator)
	protected FrameLayout indicator;

	@BindView(R.id.icon)
	protected ImageView icon;

	public SwipeIndicatorView(@NonNull Context context) {
		super(context);
		init(context);
	}

	public SwipeIndicatorView(@NonNull Context context, @Nullable AttributeSet attrs) {
		super(context, attrs);
		init(context);
	}

	public SwipeIndicatorView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);
		init(context);
	}

	public void setIconResId(int resId) {
		icon.setImageResource(resId);
	}

	public void setValue(float value) {
		indicator.getLayoutParams().height = (int) (value * getHeight());
		indicator.requestLayout();

		setVisibility(VISIBLE);
	}

	@Override
	protected void onAttachedToWindow() {
		super.onAttachedToWindow();

		LayoutParams params = (LayoutParams) getLayoutParams();
		params.height = LayoutParams.MATCH_PARENT;
		params.width = 300;
		setLayoutParams(params);
	}

	private void init(Context context) {
		inflate(context, R.layout.view_swipe_indicator, this);
		ButterKnife.bind(this);

		setVisibility(GONE);
	}
}

@@ -94,229 +94,234 @@
 roid
-x.annotation.NonNull;%0Aimport androidx.annotation.Nullable;%0Aimport android.util.AttributeSet;%0Aimport android.widget.FrameLayout;%0Aimport android.widget.ImageView;%0A%0Aimport butterknife.BindView;%0Aimport butterknife.ButterKnife
+.util.AttributeSet;%0Aimport android.view.View;%0Aimport android.widget.FrameLayout;%0Aimport android.widget.ImageView;%0A%0Aimport androidx.annotation.NonNull;%0Aimport androidx.annotation.Nullable;%0A%0Aimport de.christinecoenen.code.zapp.R
 ;%0Aim
@@ -354,17 +354,53 @@
 de.zapp.
-R
+databinding.ViewSwipeIndicatorBinding
 ;%0A%0Apubli
@@ -454,44 +454,15 @@
 %7B%0A%0A%09
-@BindView(R.id.indicator)%0A%09protec
+priva
 te
-d
  Fra
@@ -485,41 +485,16 @@
 or;%0A
-%0A%09@BindView(R.id.icon)%0A%09protec
+%09priva
 te
-d
  Ima
@@ -1412,16 +1412,28 @@
 xt) %7B%0A%09%09
+View view = 
 inflate(
@@ -1483,32 +1483,139 @@
 s);%0A
+%0A
 %09%09
-ButterKnife.bind(this)
+ViewSwipeIndicatorBinding binding = ViewSwipeIndicatorBinding.bind(view);%0A%09%09indicator = binding.indicator;%0A%09%09icon = binding.icon
 ;%0A%0A%09

Use view binding for SwipeIndicatorView