Search in sources :

Example 26 with DisplayImageOptions

use of com.nostra13.universalimageloader.core.DisplayImageOptions in project JamsMusicPlayer by psaravan.

the class Common method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    //Application context.
    mContext = getApplicationContext();
    //SharedPreferences.
    mSharedPreferences = this.getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE);
    //Init the database.
    mDBAccessHelper = new DBAccessHelper(mContext);
    //Playback kickstarter.
    mPlaybackKickstarter = new PlaybackKickstarter(this.getApplicationContext());
    //Picasso.
    mPicasso = new Picasso.Builder(mContext).build();
    //ImageLoader.
    mImageLoader = ImageLoader.getInstance();
    mImageLoaderConfiguration = new ImageLoaderConfiguration.Builder(getApplicationContext()).memoryCache(new WeakMemoryCache()).memoryCacheSizePercentage(13).imageDownloader(new ByteArrayUniversalImageLoader(mContext)).build();
    mImageLoader.init(mImageLoaderConfiguration);
    //Init DisplayImageOptions.
    initDisplayImageOptions();
    //Log the user into Google Play Music only if the account is currently set up and active.
    if (mSharedPreferences.getBoolean("GOOGLE_PLAY_MUSIC_ENABLED", false) == true) {
        //Create a temp WebView to retrieve the user agent string.
        String userAgentString = "";
        if (mSharedPreferences.getBoolean("GOT_USER_AGENT", false) == false) {
            WebView webView = new WebView(getApplicationContext());
            webView.setVisibility(View.GONE);
            webView.loadUrl("http://www.google.com");
            userAgentString = webView.getSettings().getUserAgentString();
            mSharedPreferences.edit().putBoolean("GOT_USER_AGENT", true).commit();
            mSharedPreferences.edit().putString("USER_AGENT", userAgentString).commit();
            webView = null;
        }
        setGMusicClientCalls(GMusicClientCalls.getInstance(getApplicationContext()));
        GMusicClientCalls.setWebClientUserAgent(userAgentString);
        String accountName = mSharedPreferences.getString("GOOGLE_PLAY_MUSIC_ACCOUNT", "");
        //Authenticate with Google.
        AsyncGoogleMusicAuthenticationTask task = new AsyncGoogleMusicAuthenticationTask(mContext, false, accountName);
        task.execute();
    }
}
Also used : PlaybackKickstarter(com.jams.music.player.PlaybackKickstarter.PlaybackKickstarter) DBAccessHelper(com.jams.music.player.DBHelpers.DBAccessHelper) WeakMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache) AsyncGoogleMusicAuthenticationTask(com.jams.music.player.AsyncTasks.AsyncGoogleMusicAuthenticationTask) WebView(android.webkit.WebView) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Aggregations

DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)21 ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)15 FadeInBitmapDisplayer (com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)9 LruMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache)7 File (java.io.File)7 Bitmap (android.graphics.Bitmap)4 BitmapFactory (android.graphics.BitmapFactory)4 View (android.view.View)4 Md5FileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator)4 UnlimitedDiscCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache)3 UnlimitedDiskCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache)3 ImageSize (com.nostra13.universalimageloader.core.assist.ImageSize)3 ActionBar (android.app.ActionBar)2 Tab (android.app.ActionBar.Tab)2 Intent (android.content.Intent)2 SpannableString (android.text.SpannableString)2 TypedValue (android.util.TypedValue)2 ImageView (android.widget.ImageView)2 DBAccessHelper (com.jams.music.player.DBHelpers.DBAccessHelper)2 HashCodeFileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator)2