package com.xunao.effectdemo.activity;

import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.Button;
import android.widget.ImageView;

import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;

import com.xunao.effectdemo.R;
import com.xunao.effectdemo.view.MyGuideCaseQueue;
import com.xunao.effectdemo.view.MyGuideCaseView;


/**
 * author : 程中强
 * e-mail : 740479946@qq.com
 * date : 2022/8/19:49
 * desc :
 * version: 1.0
 */
public class GuideActivity extends Activity {

	ImageView imageView,imvPlay,imvPause,imvReset;
	Button btn;
	private int mCenterX, mCenterY;
	@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
	@Override
	protected void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_guide);
		imageView = findViewById(R.id.imv);
		imvPlay = findViewById(R.id.imv_play);
		imvPause = findViewById(R.id.imv_pause);
		imvReset = findViewById(R.id.imv_reset);
		btn = findViewById(R.id.btn);

//		int measuredWidth = btn.getMeasuredWidth();
//		int measuredHeight = btn.getMeasuredHeight();
//		int maxRadius = Math.max(measuredWidth, measuredHeight);
//
//		Animator circularReveal = ViewAnimationUtils.createCircularReveal
//				(btn, 400, 400, 0, 2000);
//		circularReveal.setInterpolator(new LinearOutSlowInInterpolator());//out到in
//		circularReveal.setDuration(1000);



		btn.setOnClickListener(v->{
			new MyGuideCaseView.Builder(GuideActivity.this)
					.focusOn(btn)
					.backgroundColor(getResources().getColor(R.color.xui_config_color_red))
					.disableFocusAnimation()
					.fitWindowsAuto()
					.build()
					.show();


		});
		showGuideView();

	}

	private void showGuideView() {
		final MyGuideCaseView guideStep1 = new MyGuideCaseView.Builder(GuideActivity.this)
//				.title("请注意，这是第一步")
				.focusOn(imvPlay)
				.picture(R.mipmap.icon_zhi)
				.pictureGravity(Gravity.BOTTOM)
//				.disableFocusAnimation()
				.fitWindowsAuto()
				.build();

		final MyGuideCaseView guideStep2 = new MyGuideCaseView.Builder(GuideActivity.this)
//				.title("请注意，这是第二步")
				.focusOn(imvPause)
				.picture(R.mipmap.icon_zhi)
//				.disableFocusAnimation()
				.fitWindowsAuto()
				.build();

		final MyGuideCaseView guideStep3 = new MyGuideCaseView.Builder(GuideActivity.this)
//				.title("请注意，这是第三步")
				.focusOn(imvReset)
				.picture(R.mipmap.icon_zhi)
//				.disableFocusAnimation()
				.fitWindowsAuto()
				.build();


		new MyGuideCaseQueue()
				.add(guideStep1)
				.add(guideStep2)
				.add(guideStep3)
				.show();
	}
}
