Java Code Examples for com.nostra13.universalimageloader.core.ImageLoader#getInstance()
The following examples show how to use
com.nostra13.universalimageloader.core.ImageLoader#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageAdapter.java From ChatView with MIT License | 6 votes |
public MessageAdapter(List<Message> verticalList, Context context,RecyclerView recyclerView) { this.messageList = verticalList; this.context = context; this.filterList = verticalList; filter = new MessageFilter(verticalList,this); imageLoader = ImageLoader.getInstance(); typeface = Typeface.createFromAsset(context.getAssets(), "fonts/product_san_regular.ttf"); mCompletionListener = new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { mp.release(); mediaPlayer = null; } }; }
Example 2
Source File: GalleryPreviewDetail.java From moviedb-android with Apache License 2.0 | 6 votes |
/** * Populate image using a url from extras, use the convenience factory method * {@link #newInstance(String)} to create this fragment. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); currImg = getArguments() != null ? getArguments().getString("currImg") : null; imageLoader = ImageLoader.getInstance(); options = new DisplayImageOptions.Builder() // Bitmaps in RGB_565 consume 2 times less memory than in ARGB_8888. .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.EXACTLY) .cacheInMemory(false) .showImageOnLoading(null) .showImageForEmptyUri(null) .showImageOnFail(null) .cacheOnDisk(true) .build(); }
Example 3
Source File: ReviewsFragment.java From 4pdaClient-plus with Apache License 2.0 | 6 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // recLifeCycle(getClass(), CALL_TO_SUPER); view = inflater.inflate(LAYOUT, container, false); // recLifeCycle(getClass(), RETURN_FROM_SUPER); mModelList = new Gson().fromJson(getArguments().getString(LIST_ARG), new TypeToken<ArrayList<ReviewsModel>>() {}.getType()); if (mModelList.size() != 0) { mRecyclerView = (RecyclerView) view.findViewById(R.id.devDbRecyclerView); mRecyclerView.setVisibility(View.VISIBLE); mAdapter = new ReviewsAdapter(getActivity(), mModelList, ImageLoader.getInstance()); mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); mRecyclerView.setAdapter(mAdapter); mAdapter.notifyDataSetChanged(); } else { /*CardView cardView = (CardView) view.findViewById(R.id.dev_db_error_message_con); cardView.setVisibility(View.VISIBLE);*/ TextView textView = ButterKnife.findById(view, R.id.dev_db_error_message); textView.setVisibility(View.VISIBLE); } return view; }
Example 4
Source File: PhotoListAdapter.java From AndroidInstagram with Apache License 2.0 | 6 votes |
public PhotoListAdapter(Context context) { mContext = context; DisplayImageOptions displayOptions = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.instagram_logo) .showImageForEmptyUri(R.drawable.instagram_logo) .showImageOnFail(R.drawable.instagram_logo) .cacheInMemory(true) .cacheOnDisc(false) .considerExifParams(true) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .writeDebugLogs() .defaultDisplayImageOptions(displayOptions) .build(); mImageLoader = ImageLoader.getInstance(); mImageLoader.init(config); mAnimator = new AnimateFirstDisplayListener(); }
Example 5
Source File: ImageLoaderTools.java From Social with Apache License 2.0 | 6 votes |
private static ImageLoader initImageLoader(Context context) { DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisc(true) .showStubImage(R.drawable.image_holder) .showImageForEmptyUri(R.drawable.image_holder) .showImageOnFail(R.drawable.image_holder) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .defaultDisplayImageOptions(defaultOptions)// .discCacheSize(DISK_CACHE_SIZE_BYTES) .memoryCacheSize(MEMORY_CACHE_SIZE_BYTES) .build(); ImageLoader tmpIL = ImageLoader.getInstance(); tmpIL.init(config); return tmpIL; }
Example 6
Source File: ImageLoaderUtil.java From sctalk with Apache License 2.0 | 5 votes |
public static void initImageLoaderConfig(Context context) { try { File cacheDir = StorageUtils.getOwnCacheDirectory(context, CommonUtil.getSavePath(SysConstant.FILE_SAVE_TYPE_IMAGE)); File reserveCacheDir = StorageUtils.getCacheDirectory(context); int maxMemory = (int) (Runtime.getRuntime().maxMemory() ); // 使用最大可用内存值的1/8作为缓存的大小。 int cacheSize = maxMemory/8; DisplayMetrics metrics=new DisplayMetrics(); WindowManager mWm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); mWm.getDefaultDisplay().getMetrics(metrics); IMImageLoaderConfig = new ImageLoaderConfiguration.Builder(context) .memoryCacheExtraOptions(metrics.widthPixels, metrics.heightPixels) .threadPriority(Thread.NORM_PRIORITY-2) // .denyCacheImageMultipleSizesInMemory() .memoryCache(new UsingFreqLimitedMemoryCache(cacheSize)) .diskCacheFileNameGenerator(new Md5FileNameGenerator()) .tasksProcessingOrder(QueueProcessingType.LIFO) .diskCacheExtraOptions(metrics.widthPixels, metrics.heightPixels, null) .diskCache(new UnlimitedDiscCache(cacheDir,reserveCacheDir,new Md5FileNameGenerator())) .diskCacheSize(1024 * 1024 * 1024) .diskCacheFileCount(1000) .build(); IMImageLoadInstance = ImageLoader.getInstance(); IMImageLoadInstance.init(IMImageLoaderConfig); }catch (Exception e){ logger.e(e.toString()); } }
Example 7
Source File: Global.java From PinchImageView with MIT License | 5 votes |
public static ImageLoader getImageLoader(Context context) { ImageLoader imageLoader = ImageLoader.getInstance(); if (!imageLoader.isInited()) { imageLoader.init(ImageLoaderConfiguration.createDefault(context)); } return imageLoader; }
Example 8
Source File: ImgViewer.java From 4pdaClient-plus with Apache License 2.0 | 5 votes |
public ImgAdapter() { this.inflater = LayoutInflater.from(ImgViewer.this); imageLoader = ImageLoader.getInstance(); options = App.getDefaultOptionsUIL() .bitmapConfig(Bitmap.Config.ARGB_8888) .considerExifParams(true) .build(); }
Example 9
Source File: PostListFragment.java From Broadsheet.ie-Android with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View layout = super.onCreateView(inflater, container, savedInstanceState); // Get original ListView and Frame ListView originalLv = (ListView) layout.findViewById(android.R.id.list); ViewGroup frame = (ViewGroup) originalLv.getParent(); // Remove old ListView frame.removeView(originalLv); // Create new PullToRefreshListView and add to Frame mPullRefreshListView = new PullToRefreshListView(getActivity()); frame.addView(mPullRefreshListView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() { @Override public void onRefresh(PullToRefreshBase<ListView> refreshView) { fetchPosts(null); } }); boolean pauseOnScroll = false; boolean pauseOnFling = true; PauseOnScrollListener listener = new PauseOnScrollListener(ImageLoader.getInstance(), pauseOnScroll, pauseOnFling); mPullRefreshListView.setOnScrollListener(listener); return layout; }
Example 10
Source File: NewsMainFragment.java From ForPDA with GNU General Public License v3.0 | 5 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); viewsReady(); setCardsBackground(); refreshLayout.setOnRefreshListener(this::loadData); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.addItemDecoration(new BrandFragment.SpacingItemDecoration(App.px8, true)); PauseOnScrollListener pauseOnScrollListener = new PauseOnScrollListener(ImageLoader.getInstance(), true, true); recyclerView.addOnScrollListener(pauseOnScrollListener); adapter = new NewsListAdapter(); adapter.setOnClickListener(this); recyclerView.setAdapter(adapter); }
Example 11
Source File: ImageLoadProxy.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
public static ImageLoader getImageLoader() { if (imageLoader == null) { synchronized (ImageLoadProxy.class) { imageLoader = ImageLoader.getInstance(); } } return imageLoader; }
Example 12
Source File: Kanner.java From foodie-app with Apache License 2.0 | 5 votes |
public void initImageLoader(Context context) { ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( context).threadPriority(Thread.NORM_PRIORITY - 2) .denyCacheImageMultipleSizesInMemory() .diskCacheFileNameGenerator(new Md5FileNameGenerator()) .tasksProcessingOrder(QueueProcessingType.LIFO) .writeDebugLogs().build(); ImageLoader.getInstance().init(config); options = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(true) .build(); mImageLoader = ImageLoader.getInstance(); }
Example 13
Source File: ShoppingCartActivity.java From ShoppingCartActivity with Apache License 2.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_shopping_cart_activity); initView(); ImageLoader imageLoader=ImageLoader.getInstance(); imageLoader.init(ImageLoaderConfiguration.createDefault(this)); }
Example 14
Source File: BlurImageView.java From BlurImageView with Apache License 2.0 | 5 votes |
private void init() { initUIL(); imageLoader = ImageLoader.getInstance(); initChildView(); initDisplayImageOptions(); }
Example 15
Source File: BaseActivity.java From Conquer with Apache License 2.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = this; initStatusBar(); initTheme(); initLayout(); userManager = BmobUserManager.getInstance(getApplicationContext()); manager = BmobChatManager.getInstance(getApplicationContext()); mApplication = CustomApplication.getInstance(); currentUser = BmobChatUser.getCurrentUser(context, User.class); DisplayMetrics metric = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metric); mScreenWidth = metric.widthPixels; mScreenHeight = metric.heightPixels; loader = ImageLoader.getInstance(); option_photo = new DisplayImageOptions.Builder().showImageOnLoading(R.drawable.default_photo) .showImageForEmptyUri(R.drawable.default_photo).showImageOnFail(R.drawable.default_photo) .cacheInMemory(true).cacheOnDisk(true).considerExifParams(true) .bitmapConfig(Bitmap.Config.RGB_565).displayer(new FadeInBitmapDisplayer(200)).build(); option_pic = new DisplayImageOptions.Builder().showImageOnLoading(R.drawable.pic_loading) .showImageForEmptyUri(R.drawable.pic_loading).showImageOnFail(R.drawable.pic_loading) .cacheInMemory(true).cacheOnDisk(true).considerExifParams(true) .bitmapConfig(Bitmap.Config.RGB_565).displayer(new FadeInBitmapDisplayer(200)).build(); dbUtils = DbUtils.create(context); }
Example 16
Source File: ImageLoadProxy.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
public static ImageLoader getImageLoader() { if (imageLoader == null) { synchronized (ImageLoadProxy.class) { imageLoader = ImageLoader.getInstance(); } } return imageLoader; }
Example 17
Source File: SkinWithLoadMoreAdapter.java From Theogony with MIT License | 4 votes |
public SkinWithLoadMoreAdapter(ArrayList<Skin> skins) { mImageLoader = ImageLoader.getInstance(); mSkins = skins; }
Example 18
Source File: BaseFragmentActivity.java From AndroidAppCodeFramework with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mImageLoader = ImageLoader.getInstance(); }
Example 19
Source File: SearchResultActivity.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_search_result); // get arguments String searchKey = getIntent().getStringExtra("key"); // set indicator enable Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); setSupportActionBar(mToolbar); if(getSupportActionBar() != null ) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); } // change status bar color tint, and this require SDK16 if (Build.VERSION.SDK_INT >= 16 ) { //&& Build.VERSION.SDK_INT <= 21) { // Android API 22 has more effects on status bar, so ignore // create our manager instance after the content view is set SystemBarTintManager tintManager = new SystemBarTintManager(this); // enable all tint tintManager.setStatusBarTintEnabled(true); tintManager.setNavigationBarTintEnabled(true); tintManager.setTintAlpha(0.15f); tintManager.setNavigationBarAlpha(0.0f); // set all color tintManager.setTintColor(getResources().getColor(android.R.color.black)); // set Navigation bar color if(Build.VERSION.SDK_INT >= 21) getWindow().setNavigationBarColor(getResources().getColor(R.color.myNavigationColorWhite)); } // set action bat title TextView mTextView = (TextView) findViewById(R.id.search_result_title); if(mTextView != null) mTextView.setText(getResources().getString(R.string.title_search) + searchKey); // init values Bundle bundle = new Bundle(); bundle.putString("type", "search"); bundle.putString("key", searchKey); // UIL setting if(ImageLoader.getInstance() == null || !ImageLoader.getInstance().isInited()) { GlobalConfig.initImageLoader(this); } // This code will produce more than one activity in stack, so I jump to new SearchActivity to escape it. getSupportFragmentManager().beginTransaction() .replace(R.id.result_fragment, NovelItemListFragment.newInstance(bundle), "fragment") .setTransitionStyle(FragmentTransaction.TRANSIT_NONE) .commit(); }
Example 20
Source File: MyMsgAdapter.java From Conquer with Apache License 2.0 | 4 votes |
public MyMsgAdapter(Context context, ArrayList<E> list) { super(context, list); loder = ImageLoader.getInstance(); }