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

Source: Internet
Author: User

Jamendo Source Code address: https://github.com/telecapoland/jamendo-android

SRC and res structure:

The module will be analyzed based on the process.

First, analyze the initial interface:

Start with the manifest file:

<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.

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.

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.