Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. public class SplashPresenter extends MvpBasePresenter<SplashView> {
  2.  
  3. @Override public void attachView(SplashView view) {
  4. super.attachView(view);
  5. new Handler().postDelayed(new Runnable() {
  6. @Override public void run() {
  7. launch();
  8. }
  9. }, 2000);
  10. }
  11.  
  12. @Override public void detachView(boolean retainInstance) {
  13. super.detachView(retainInstance);
  14. }
  15.  
  16. private void launch() {
  17. String imei = ImeiUtil.getIMEI();
  18.  
  19. List<ActivationInfo> infos = ActivationInfo.listAll(ActivationInfo.class);
  20. if (infos.size() == 1) {
  21. ActivationInfo info = infos.get(0);
  22. /*
  23. Log.d("I: ", "I: " + info.getBusinessName());
  24. Log.d("I: ", "I: " + info.getMobileNumber());
  25. Log.d("I: ", "I: " + info.getImei());
  26. Log.d("I: ", "I: " + imei);
  27. Log.d("I: ", "S: " + info.getStatus());
  28. */
  29. if (info.getStatus() == 1 && info.getImei().equalsIgnoreCase(imei)) {
  30. getView().start(HomeActivity.class);
  31. } else {
  32. //getView().start(ActivationActivity.class);
  33. getView().start(HomeActivity.class);
  34. }
  35. } else {
  36. getView().start(HomeActivity.class);
  37. // getView().start(RegisterActivity.class);
  38. }
  39. }
  40.  
  41. <RelativeLayout
  42. xmlns:android="http://schemas.android.com/apk/res/android"
  43. xmlns:tools="http://schemas.android.com/tools"
  44. android:layout_width="match_parent"
  45. android:layout_height="match_parent"
  46. tools:context=".MainActivity">
  47.  
  48. <ImageView
  49. android:contentDescription="@string/splash_image"
  50. android:layout_width="match_parent"
  51. android:layout_height="match_parent"
  52. android:adjustViewBounds="true"
  53. android:scaleType="centerCrop"
  54. android:src="@drawable/splash_english"/>
  55.  
  56. </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement