High imitation Xiaomi Mall splash animation

High imitation Xiaomi Mall splash animation

Source code introduction

This is a high imitation of the Xiaomi Mall splash interface. The animation effects are exactly the same as those of the Xiaomi Mall. It is only for learning and communication use. Please do not use it for other purposes.
Source code running screenshot

Source code snippet:

  1. package com.example.testsplashview;
  2.   
  3. import android.content.BroadcastReceiver;
  4. import android.content.Context;
  5. import android.content.Intent;
  6. import android.content.IntentFilter;
  7. import android.os.Bundle;
  8. import android.os.Handler;
  9. import android.support.v4.app.Fragment;
  10. import android.support.v4.app.FragmentActivity;
  11. import android.support.v4.app.FragmentManager;
  12. import android.support.v4.app.FragmentTransaction;
  13. import android.support.v4.content.LocalBroadcastManager;
  14. import android.widget.Toast;
  15.   
  16. public   class WelcomeActivity extends FragmentActivity
  17. {
  18. private   static   final   long EXIT_DURATION_BETWEEN_BACKKEY_PRESSED = 1000L;
  19. private   int mBackKeyPressedCount;
  20. private Fragment[] mFragments;
  21. private BroadcastReceiver mPageShowReceiver = new BroadcastReceiver() {
  22.       
  23. @Override  
  24. public   void onReceive(Context context, Intent paramIntent) {
  25. String str = paramIntent.getAction();
  26. if ( "page0_animation_done" .equals(str)){
  27. Intent intent = new Intent();
  28. intent.setClass(getApplicationContext(), MainActivity. class );
  29. startActivity(intent);
  30. finish();
  31. }
  32. if ( "page1_animation_done" .equals(str))
  33. getSupportFragmentManager().beginTransaction().remove(page1).commitAllowingStateLoss();
  34. if ( "page2_animation_done" .equals(str))
  35. getSupportFragmentManager().beginTransaction().remove(page2).commitAllowingStateLoss();
  36. if ( "page3_animation_done" .equals(str))
  37. getSupportFragmentManager().beginTransaction().remove(page3).commitAllowingStateLoss();
  38. if ( "page4_animation_done" .equals(str))
  39. getSupportFragmentManager().beginTransaction().remove(page4).commitAllowingStateLoss();
  40. }
  41. };
  42. private BaseInShowPage page0;
  43. private BaseInShowPage page1;
  44. private BaseInShowPage page2;
  45. private BaseInShowPage page3;
  46. private BaseInShowPage page4;
  47. @Override  
  48. public   void onBackPressed()
  49. {
  50. mBackKeyPressedCount = ( 1 + mBackKeyPressedCount);
  51. if (mBackKeyPressedCount == 2 ){
  52. finish();
  53. } else {
  54. new Handler().postDelayed( new Runnable() {
  55.           
  56. @Override  
  57. public   void run() {
  58. mBackKeyPressedCount = 0 ;
  59. }
  60. }, EXIT_DURATION_BETWEEN_BACKKEY_PRESSED);
  61. }
  62. }
  63. @Override  
  64. protected   void onCreate(Bundle paramBundle)
  65. {
  66. super .onCreate(paramBundle);
  67. setContentView(R.layout.welcome_fragment);
  68. IntentFilter localIntentFilter = new IntentFilter();
  69. localIntentFilter.addAction( "page0_animation_done" );
  70. localIntentFilter.addAction( "page1_animation_done" );
  71. localIntentFilter.addAction( "page2_animation_done" );
  72. localIntentFilter.addAction( "page3_animation_done" );
  73. localIntentFilter.addAction( "page4_animation_done" );
  74. LocalBroadcastManager.getInstance( this ).registerReceiver(mPageShowReceiver, localIntentFilter);
  75. if (paramBundle != null )
  76. return ;
  77. page4 = new Page4();
  78. page3 = new Page3();
  79. page2 = new Page2();
  80. page1 = new Page1();
  81. page0 = new Page0();
  82. Fragment[] arrayOfFragment = new Fragment[ 5 ];
  83. arrayOfFragment[ 0 ] = page0;
  84. arrayOfFragment[ 1 ] = page4;
  85. arrayOfFragment[ 2 ] = page3;
  86. arrayOfFragment[ 3 ] = page2;
  87. arrayOfFragment[ 4 ] = page1;
  88. mFragments = arrayOfFragment;
  89. for ( int i = 0 ; i < mFragments.length; i++)
  90. getSupportFragmentManager().beginTransaction().add(R.id.fragmentview, mFragments[i]).addToBackStack( null ).commit();
  91. }
  92. @Override  
  93. protected   void onDestroy()
  94. {
  95. super .onDestroy();
  96. LocalBroadcastManager.getInstance( this ).unregisterReceiver(mPageShowReceiver);
  97. }
  98. }

Source code link: http://download..com/data/1975262

<<:  GuessGame——Guessing Game

>>:  Everything about Bitcoin in 2014 is in this report

Recommend

What is mohair? Why is it so expensive?

Nothing is more suitable for autumn than a furry ...

Tencent Big Data: 2014 Q3 Mobile Industry Data Report

[[124780]] Today, Tencent Big Data released the &...

Gaomi SEO Training: What are the various variations of words in search engines?

What are the various variations of words in searc...

Keep brand marketing promotion model!

In recent years, I have found that vertical Inter...

Analysis of Pinduoduo’s “Shake for Cash” campaign operations!

Have you participated in Pinduoduo’s “Shake for C...

【Wu Xiaobo】My Real Estate Planning Series Course Member

Course list 1 "Family Asset Allocation" ...

Analysis of WeChat Reading Products

This series of articles may reach nearly 50,000 w...

Analysis of Douyin and Kuaishou short video competitors

This article analyzes the development overview of...

22 truths about private domain traffic

The term private domain traffic has been popular ...

How to create your own entry in Baidu Encyclopedia? Is there any method?

Baidu Encyclopedia started in 2006. When it was f...

Kuaishou’s tips on how to create hits!

As a social method for the younger generation, &q...

TensorFlow implements image completion based on deep learning

[[191845]] Table of contents ■ Introduction ■ Ste...