去除闪屏页倒计时
This commit is contained in:
parent
01b3c39833
commit
44ecd417b8
@ -8,16 +8,13 @@ import com.tairui.industrial_operation.databinding.ActivitySplashBinding;
|
|||||||
import com.tairui.industrial_operation.ui.account.LoginActivity;
|
import com.tairui.industrial_operation.ui.account.LoginActivity;
|
||||||
import com.tairui.industrial_operation.util.IntentUtil;
|
import com.tairui.industrial_operation.util.IntentUtil;
|
||||||
import com.tairui.industrial_operation.util.MyCountDownTimer;
|
import com.tairui.industrial_operation.util.MyCountDownTimer;
|
||||||
import com.tairui.industrial_operation.util.SingleClickListener;
|
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
|
public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
|
||||||
|
|
||||||
private CountTimer countTimer;
|
private CountTimer countTimer;
|
||||||
private static final int INTERVAL = 1000;
|
private static final int INTERVAL = 1000;
|
||||||
private boolean isSkipAble = true;// 跳过按钮可以点击
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<ActivitySplashBinding> getBindingClass() {
|
protected Class<ActivitySplashBinding> getBindingClass() {
|
||||||
@ -26,12 +23,6 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindListener() {
|
protected void onBindListener() {
|
||||||
binding.txtTimerSplash.setOnClickListener(new SingleClickListener() {
|
|
||||||
@Override
|
|
||||||
protected void onSingleClick(View v) {
|
|
||||||
skipTimeCountDown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -40,35 +31,10 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void goMain() {
|
private void goMain() {
|
||||||
if (null != binding.txtTimerSplash) {
|
countTimer = new CountTimer(1 * 1000, INTERVAL);
|
||||||
setGone(binding.txtTimerSplash, true);
|
WeakReference<CountTimer> weakTimerCountDowner = new WeakReference<>(countTimer);
|
||||||
countTimer = new CountTimer(1 * 1000, INTERVAL);
|
if (null != weakTimerCountDowner.get()) {
|
||||||
WeakReference<CountTimer> weakTimerCountDowner = new WeakReference<>(countTimer);
|
weakTimerCountDowner.get().start();
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,11 +70,6 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick(long millisUntilFinished) {
|
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
|
@Override
|
||||||
|
@ -14,21 +14,5 @@
|
|||||||
android:layout_marginBottom="32dp"
|
android:layout_marginBottom="32dp"
|
||||||
android:src="@mipmap/ic_slogon" />
|
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>
|
</RelativeLayout>
|
Loading…
x
Reference in New Issue
Block a user