Search in sources :

Example 1 with FadeInBitmapDisplayer

use of com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer in project PhotoNoter by yydcdut.

the class PGEditMenuItemView method setIconForImageUrl.

public void setIconForImageUrl(String imageUrl) {
    ImageLoaderView imageLoaderView = (ImageLoaderView) mIconImageView;
    imageLoaderView.getOptionsBuilder().displayer(new FadeInBitmapDisplayer(400));
    imageLoaderView.setImageUrl(imageUrl);
}
Also used : FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)

Example 2 with FadeInBitmapDisplayer

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

the class PlaylistEditorActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    //Initialize Context and SharedPreferences.
    mContext = this;
    mApp = (Common) this.getApplicationContext();
    sharedPreferences = mContext.getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE);
    //Set the UI theme.
    if (mApp.getCurrentTheme() == Common.DARK_THEME) {
        setTheme(R.style.AppTheme);
    } else {
        setTheme(R.style.AppThemeLight);
    }
    super.onCreate(savedInstanceState);
    //Create a set of options to optimize the bitmap memory usage.
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    options.inJustDecodeBounds = false;
    options.inPurgeable = true;
    //Display Image Options.
    displayImageOptions = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.default_album_art).showImageOnFail(R.drawable.default_album_art).showStubImage(R.drawable.transparent_drawable).cacheInMemory(false).cacheOnDisc(true).decodingOptions(options).imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).displayer(new FadeInBitmapDisplayer(400)).delayBeforeLoading(100).build();
    //Attach tabs to the ActionBar.
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    //Add the artists tab.
    String artistsLabel = getResources().getString(R.string.artists);
    Tab tab = actionBar.newTab();
    tab.setText(artistsLabel);
    TabListener<ArtistsPickerFragment> artistsTabListener = new TabListener<ArtistsPickerFragment>(this, artistsLabel, ArtistsPickerFragment.class);
    tab.setTabListener(artistsTabListener);
    actionBar.addTab(tab);
    //Add the albums tab.
    String albumsLabel = getResources().getString(R.string.albums);
    tab = actionBar.newTab();
    tab.setText(albumsLabel);
    TabListener<AlbumsPickerFragment> albumsTabListener = new TabListener<AlbumsPickerFragment>(this, albumsLabel, AlbumsPickerFragment.class);
    tab.setTabListener(albumsTabListener);
    actionBar.addTab(tab);
    //Add the songs tab.
    String songsLabel = getResources().getString(R.string.songs);
    tab = actionBar.newTab();
    tab.setText(songsLabel);
    TabListener<SongsPickerFragment> songsTabListener = new TabListener<SongsPickerFragment>(this, songsLabel, SongsPickerFragment.class);
    tab.setTabListener(songsTabListener);
    actionBar.addTab(tab);
}
Also used : DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions) SpannableString(android.text.SpannableString) Tab(android.app.ActionBar.Tab) FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer) BitmapFactory(android.graphics.BitmapFactory) ActionBar(android.app.ActionBar)

Example 3 with FadeInBitmapDisplayer

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

the class Common method initDisplayImageOptions.

/**
     * Initializes a DisplayImageOptions object. The drawable shown
     * while an image is loading is based on the current theme.
     */
public void initDisplayImageOptions() {
    //Create a set of options to optimize the bitmap memory usage.
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    options.inJustDecodeBounds = false;
    options.inPurgeable = true;
    int emptyColorPatch = UIElementsHelper.getEmptyColorPatch(this);
    mDisplayImageOptions = null;
    mDisplayImageOptions = new DisplayImageOptions.Builder().showImageForEmptyUri(emptyColorPatch).showImageOnFail(emptyColorPatch).showImageOnLoading(emptyColorPatch).cacheInMemory(true).cacheOnDisc(true).decodingOptions(options).imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2).bitmapConfig(Bitmap.Config.ARGB_4444).delayBeforeLoading(400).displayer(new FadeInBitmapDisplayer(200)).build();
}
Also used : DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions) FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer) BitmapFactory(android.graphics.BitmapFactory)

Example 4 with FadeInBitmapDisplayer

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

the class MusicLibraryEditorActivity method onCreate.

@SuppressWarnings("unchecked")
@Override
public void onCreate(Bundle savedInstanceState) {
    //Initialize Context and SharedPreferences.
    mContext = this;
    mApp = (Common) mContext.getApplicationContext();
    //Retrieve the name/icon of the library from the arguments.
    libraryName = getIntent().getExtras().getString("LIBRARY_NAME");
    libraryIconName = getIntent().getExtras().getString("LIBRARY_ICON");
    if (getIntent().getExtras().getSerializable("SONG_IDS_HASH_SET") != null) {
        songDBIdsList = (HashSet<String>) getIntent().getExtras().getSerializable("SONG_IDS_HASH_SET");
    }
    //Set the UI theme.
    if (mApp.getCurrentTheme() == Common.DARK_THEME) {
        setTheme(R.style.AppTheme);
    } else {
        setTheme(R.style.AppThemeLight);
    }
    super.onCreate(savedInstanceState);
    //Initialize the database helper.
    dbHelper = new DBAccessHelper(mContext.getApplicationContext());
    //Create a set of options to optimize the bitmap memory usage.
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    options.inJustDecodeBounds = false;
    options.inPurgeable = true;
    //Display Image Options.
    int defaultArt = UIElementsHelper.getIcon(mContext, "default_album_art_padded");
    displayImageOptions = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.default_album_art).showImageOnFail(R.drawable.default_album_art).showStubImage(R.drawable.transparent_drawable).cacheInMemory(false).cacheOnDisc(true).decodingOptions(options).imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).displayer(new FadeInBitmapDisplayer(400)).delayBeforeLoading(100).build();
    //Attach tabs to the ActionBar.
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    //Add the artists tab.
    String artistsLabel = getResources().getString(R.string.artists);
    Tab tab = actionBar.newTab();
    tab.setText(artistsLabel);
    TabListener<ArtistsPickerFragment> artistsTabListener = new TabListener<ArtistsPickerFragment>(this, artistsLabel, ArtistsPickerFragment.class);
    tab.setTabListener(artistsTabListener);
    actionBar.addTab(tab);
    //Add the albums tab.
    String albumsLabel = getResources().getString(R.string.albums);
    tab = actionBar.newTab();
    tab.setText(albumsLabel);
    TabListener<AlbumsPickerFragment> albumsTabListener = new TabListener<AlbumsPickerFragment>(this, albumsLabel, AlbumsPickerFragment.class);
    tab.setTabListener(albumsTabListener);
    actionBar.addTab(tab);
    //Add the songs tab.
    String songsLabel = getResources().getString(R.string.songs);
    tab = actionBar.newTab();
    tab.setText(songsLabel);
    TabListener<SongsPickerFragment> songsTabListener = new TabListener<SongsPickerFragment>(this, songsLabel, SongsPickerFragment.class);
    tab.setTabListener(songsTabListener);
    actionBar.addTab(tab);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        getWindow().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext));
        int topPadding = Common.getStatusBarHeight(mContext);
        View activityView = (View) findViewById(android.R.id.content);
        //Calculate ActionBar height
        TypedValue tv = new TypedValue();
        int actionBarHeight = 0;
        if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
            actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
        }
        if (activityView != null) {
            activityView.setPadding(0, topPadding + actionBarHeight, 0, 0);
        }
    }
}
Also used : DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions) DBAccessHelper(com.jams.music.player.DBHelpers.DBAccessHelper) SpannableString(android.text.SpannableString) View(android.view.View) Tab(android.app.ActionBar.Tab) FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer) BitmapFactory(android.graphics.BitmapFactory) ActionBar(android.app.ActionBar) TypedValue(android.util.TypedValue)

Example 5 with FadeInBitmapDisplayer

use of com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer in project Slide by ccrama.

the class ImageLoaderUnescape method initImageLoader.

public static void initImageLoader(Context context) {
    long discCacheSize = 1024 * 1024;
    DiskCache discCache;
    File dir = getCacheDirectory(context);
    int threadPoolSize;
    discCacheSize *= 100;
    threadPoolSize = 7;
    if (discCacheSize > 0) {
        try {
            dir.mkdir();
            discCache = new LruDiskCache(dir, new Md5FileNameGenerator(), discCacheSize);
        } catch (IOException e) {
            discCache = new UnlimitedDiskCache(dir);
        }
    } else {
        discCache = new UnlimitedDiskCache(dir);
    }
    options = new DisplayImageOptions.Builder().cacheOnDisk(true).bitmapConfig(Bitmap.Config.RGB_565).imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2).cacheInMemory(false).resetViewBeforeLoading(false).displayer(new FadeInBitmapDisplayer(250)).build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPoolSize(threadPoolSize).denyCacheImageMultipleSizesInMemory().diskCache(discCache).threadPoolSize(4).imageDownloader(new OkHttpImageDownloader(context)).defaultDisplayImageOptions(options).build();
    if (ImageLoader.getInstance().isInited()) {
        ImageLoader.getInstance().destroy();
    }
    imageLoader = ImageLoaderUnescape.getInstance();
    imageLoader.init(config);
}
Also used : Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) IOException(java.io.IOException) DiskCache(com.nostra13.universalimageloader.cache.disc.DiskCache) UnlimitedDiskCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache) LruDiskCache(com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiskCache) UnlimitedDiskCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache) OkHttpImageDownloader(me.ccrama.redditslide.util.OkHttpImageDownloader) FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer) LruDiskCache(com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiskCache) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Aggregations

FadeInBitmapDisplayer (com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)18 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)13 ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)9 File (java.io.File)5 BitmapFactory (android.graphics.BitmapFactory)4 View (android.view.View)4 UnlimitedDiskCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache)4 HashCodeFileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator)3 Md5FileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator)3 LruMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache)3 ActionBar (android.app.ActionBar)2 Tab (android.app.ActionBar.Tab)2 Bitmap (android.graphics.Bitmap)2 SpannableString (android.text.SpannableString)2 TypedValue (android.util.TypedValue)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 Palette (androidx.palette.graphics.Palette)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 ArtistInfoListener (com.naman14.timber.lastfmapi.callbacks.ArtistInfoListener)2