Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SplashPresenter extends MvpBasePresenter<SplashView> {
- @Override public void attachView(SplashView view) {
- super.attachView(view);
- new Handler().postDelayed(new Runnable() {
- @Override public void run() {
- launch();
- }
- }, 2000);
- }
- @Override public void detachView(boolean retainInstance) {
- super.detachView(retainInstance);
- }
- private void launch() {
- String imei = ImeiUtil.getIMEI();
- List<ActivationInfo> infos = ActivationInfo.listAll(ActivationInfo.class);
- if (infos.size() == 1) {
- ActivationInfo info = infos.get(0);
- /*
- Log.d("I: ", "I: " + info.getBusinessName());
- Log.d("I: ", "I: " + info.getMobileNumber());
- Log.d("I: ", "I: " + info.getImei());
- Log.d("I: ", "I: " + imei);
- Log.d("I: ", "S: " + info.getStatus());
- */
- if (info.getStatus() == 1 && info.getImei().equalsIgnoreCase(imei)) {
- getView().start(HomeActivity.class);
- } else {
- //getView().start(ActivationActivity.class);
- getView().start(HomeActivity.class);
- }
- } else {
- getView().start(HomeActivity.class);
- // getView().start(RegisterActivity.class);
- }
- }
- <RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".MainActivity">
- <ImageView
- android:contentDescription="@string/splash_image"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:adjustViewBounds="true"
- android:scaleType="centerCrop"
- android:src="@drawable/splash_english"/>
- </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement