Source code analysis of Jamendo open-source online music player (1)

Source: Internet
Author: User

Src and res structure:

The module will be analyzed based on the process.
First, analyze the initial interface:

Start with the manifest file:
[Html]
<Application android: icon = "@ drawable/icon" android: label = "@ string/app_name" android: name = "JamendoApplication">
...
<Activity android: name = ". activity. SplashscreenActivity">
<Intent-filter>
<Action android: name = "android. intent. action. MAIN"> </action>
<Category android: name = "android. intent. category. LAUNCHER"> </category>
</Intent-filter>
</Activity>
</Application>
1. Global JamendoApplication
The central warehouse pre-processes some information and stores some public information, which is executed before the main activity.
Ii. launcher activity: SplashscreenActivity
When you enter the main activity, load the page first, and then judge from the configuration file whether the prompt dialog is required to pop up. After dimiss drops the dialog, a fade-out animation is triggered. The animation ends, HomeActivity is started, and the current activity is finished.
1. PreferenceManager. getdefasharsharedpreferences (this). getBoolean (FIRST_RUN_PREFERENCE, true)
Obtain the default configuration file from/data/package name/shared_prefs/. The default file name can be found in the source code: package name _ preferences. xml. If this parameter is set to true, a dialog box is displayed. This custom dialog box is simple.
2. Set the setOnDismissListener () Listener for the dialog. This listener is triggered when the back key or close on the dialog. It checks whether the checkbook on the dialog is selected, if this option is selected, the configuration will be changed. This dialog will not be displayed next time, and the animation will be triggered.
3. Execute the animation with handler delay.
[Plain]
AnimationUtils. loadAnimation (this, R. anim. fade_out); // load this fade-out animation
<Set xmlns: android = "http://schemas.android.com/apk/res/android"
Android: zAdjustment = "bottom" android: fillAfter = "false">
<Alpha android: fromAlpha = "1.0" android: toAlpha = "0"
Android: duration = "400"/>
</Set> // 1.0 indicates opacity, and 0.0 indicates full transparency. Duration code duration: 400 ms
EndAnimation. setFillAfter (true );
// This indicates that the animation is left in the last frame. By default, the animation is left in the first frame. If this sentence is commented out, the animation will appear in an opaque state after it ends, you can comment out the results
EndAnimation. setAnimationListener ();
// Set the listener of the animation in each state. HomeActivity will be started in the FLAG_ACTIVITY_CLEAR_TOP form at the end of the animation.
Next, analyze HomeActivity.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.