use of com.nostra13.universalimageloader.core.ImageLoader in project GalleryFinal by pengjianbo.
the class MainActivity method initImageLoader.
// @Override
// protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// super.onActivityResult(requestCode, resultCode, data);
// if (requestCode == GalleryFinal.GALLERY_REQUEST_CODE) {
// if (resultCode == GalleryFinal.GALLERY_RESULT_SUCCESS) {
// List<PhotoInfo> photoInfoList = (List<PhotoInfo>) data.getSerializableExtra(GalleryFinal.GALLERY_RESULT_LIST_DATA);
// if (photoInfoList != null) {
// mPhotoList.addAll(photoInfoList);
// mChoosePhotoListAdapter.notifyDataSetChanged();
// }
// }
// }
// }
private void initImageLoader(Context context) {
// This configuration tuning is custom. You can tune every option, you may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
// 50 MiB
config.diskCacheSize(50 * 1024 * 1024);
config.tasksProcessingOrder(QueueProcessingType.LIFO);
// Remove for release app
config.writeDebugLogs();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
}
use of com.nostra13.universalimageloader.core.ImageLoader in project DanmakuFlameMaster by Bilibili.
the class UglyViewCacheStufferSampleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create global configuration and initialize ImageLoader with this config
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(13).build();
ImageLoader.getInstance().init(config);
setContentView(R.layout.activity_main);
findViews();
}
use of com.nostra13.universalimageloader.core.ImageLoader in project android-page-transition by xmuSistone.
the class MainActivity method initImageLoader.
@SuppressWarnings("deprecation")
private void initImageLoader() {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCacheExtraOptions(480, 800).threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 1).tasksProcessingOrder(QueueProcessingType.FIFO).denyCacheImageMultipleSizesInMemory().memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(// default
13).discCacheSize(// 缓冲大小
50 * 1024 * 1024).discCacheFileCount(// 缓冲文件数目
100).discCacheFileNameGenerator(// default
new HashCodeFileNameGenerator()).imageDownloader(// default
new BaseImageDownloader(this)).defaultDisplayImageOptions(// default
DisplayImageOptions.createSimple()).writeDebugLogs().build();
// 2.单例ImageLoader类的初始化
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
}
use of com.nostra13.universalimageloader.core.ImageLoader in project 9GAG by stormzhang.
the class App method initImageLoader.
// 初始化ImageLoader
public static void initImageLoader(Context context) {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().memoryCache(new LruMemoryCache(2 * 1024 * 1024)).discCacheSize(10 * 1024 * 1024).discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO).build();
ImageLoader.getInstance().init(config);
}
use of com.nostra13.universalimageloader.core.ImageLoader 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();
}
}
Aggregations