检查检查进度条动画
This commit is contained in:
@@ -11,11 +11,13 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.animation.AnimationSet;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@@ -32,10 +34,12 @@ import com.mogo.module.common.view.ImageViewClipBounds;
|
||||
import com.mogo.module.common.view.SpacesItemDecoration;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.CommonUtils;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.network.utils.NetworkStatusUtil;
|
||||
import com.tencent.bugly.beta.Beta;
|
||||
import com.tencent.bugly.beta.UpgradeInfo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -65,6 +69,9 @@ public class CheckActivity extends AppCompatActivity {
|
||||
private AnimatorSet setAnimation = null;
|
||||
private ValueAnimator mValueAnimator;
|
||||
private float movement = 1300f;
|
||||
//进度条
|
||||
private ProgressBar mProgressBar;
|
||||
private final static long DURATION_TIME = 3000;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -83,6 +90,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
scanLineImage = findViewById(R.id.scan_line_image);
|
||||
scanTopImageView = findViewById(R.id.scan_car_top_image);
|
||||
tipsImageView = findViewById(R.id.scan_car_tips);
|
||||
mProgressBar = findViewById(R.id.check_progress);
|
||||
context = mImageView.getContext();
|
||||
packageName = getPackageName(context);
|
||||
mImageView.setOnClickListener(v -> {
|
||||
@@ -171,7 +179,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
scanLineImage
|
||||
.animate()
|
||||
.translationX(movement)
|
||||
.setDuration(5000)
|
||||
.setDuration(DURATION_TIME)
|
||||
.setListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
@@ -210,14 +218,30 @@ public class CheckActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
Rect rect = new Rect(0, 0, (int) mValueAnimator.getAnimatedValue(), scanTopImageView.getHeight());
|
||||
setProgressBarRefresh((int) mValueAnimator.getAnimatedValue());
|
||||
scanTopImageView.setClip(rect);
|
||||
tipsImageView.setClip(rect);
|
||||
}
|
||||
});
|
||||
mValueAnimator.setDuration(5000);
|
||||
mValueAnimator.setDuration(DURATION_TIME);
|
||||
mValueAnimator.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 进度条状态刷新
|
||||
*/
|
||||
public void setProgressBarRefresh(int animateValue) {
|
||||
if (mProgressBar != null) {
|
||||
double scale = new BigDecimal((float) animateValue / scanBottomCarImage.getWidth())
|
||||
.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
|
||||
if (mProgressBar.getProgress() < 100) {
|
||||
mProgressBar.setProgress((int) scale);
|
||||
} else {
|
||||
findViewById(R.id.animationLayout).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* **************************************************************************************版本检测
|
||||
*/
|
||||
|
||||
@@ -84,7 +84,8 @@
|
||||
android:layout_width="@dimen/dp_520"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_57"
|
||||
android:progress="30"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/check_progress_text" />
|
||||
|
||||
Reference in New Issue
Block a user