去除闪屏页倒计时

This commit is contained in:
tongchao 2025-08-14 16:49:34 +08:00
parent 01b3c39833
commit 44ecd417b8
2 changed files with 4 additions and 59 deletions

View File

@ -8,16 +8,13 @@ import com.tairui.industrial_operation.databinding.ActivitySplashBinding;
import com.tairui.industrial_operation.ui.account.LoginActivity;
import com.tairui.industrial_operation.util.IntentUtil;
import com.tairui.industrial_operation.util.MyCountDownTimer;
import com.tairui.industrial_operation.util.SingleClickListener;
import android.text.TextUtils;
import android.view.View;
public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
private CountTimer countTimer;
private static final int INTERVAL = 1000;
private boolean isSkipAble = true;// 跳过按钮可以点击
@Override
protected Class<ActivitySplashBinding> getBindingClass() {
@ -26,12 +23,6 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
@Override
protected void onBindListener() {
binding.txtTimerSplash.setOnClickListener(new SingleClickListener() {
@Override
protected void onSingleClick(View v) {
skipTimeCountDown();
}
});
}
@Override
@ -40,37 +31,12 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
}
private void goMain() {
if (null != binding.txtTimerSplash) {
setGone(binding.txtTimerSplash, true);
countTimer = new CountTimer(1 * 1000, INTERVAL);
WeakReference<CountTimer> weakTimerCountDowner = new WeakReference<>(countTimer);
if (null != weakTimerCountDowner.get()) {
weakTimerCountDowner.get().start();
}
}
}
/**
* 跳过倒计时
*/
private void skipTimeCountDown() {
if (isSkipAble) {
isSkipAble = false;
if (null != binding.txtTimerSplash) {
binding.txtTimerSplash.setClickable(false);
}
if (null != countTimer) {
countTimer.cancel();
countTimer = null;
}
if (TextUtils.isEmpty(AppConfig.getInstance().getToken())) {
IntentUtil.startActivity(mContext, LoginActivity.class, null);
finish();
} else {
gotoMain();
}
}
}
@Override
protected void onDestroy() {
@ -104,11 +70,6 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
@Override
public void onTick(long millisUntilFinished) {
int time = (int) (millisUntilFinished / INTERVAL) + 1;
if (null != binding.txtTimerSplash) {
String TIME_PASS = "跳过 ";
binding.txtTimerSplash.setText(TIME_PASS + time);
}
}
@Override

View File

@ -14,21 +14,5 @@
android:layout_marginBottom="32dp"
android:src="@mipmap/ic_slogon" />
<TextView
android:id="@+id/txt_timer_splash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/margin_big"
android:layout_marginRight="15dp"
android:background="@drawable/container_timer_selector"
android:paddingLeft="15dp"
android:paddingTop="4dp"
android:paddingRight="15dp"
android:paddingBottom="4dp"
android:textColor="@color/white"
android:textSize="@dimen/font_size_small"
android:visibility="visible" />
</RelativeLayout>