use of com.nostra13.universalimageloader.core.ImageLoader in project fdroidclient by f-droid.
the class AppListActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
((FDroidApp) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_app_list);
searchInput = (EditText) findViewById(R.id.search);
searchInput.addTextChangedListener(new CategoryTextWatcher(this, searchInput, this));
searchInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
// Hide the keyboard (http://stackoverflow.com/a/1109108 (when pressing search)
InputMethodManager inputManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(searchInput.getWindowToken(), 0);
// Change focus from the search input to the app list.
appView.requestFocus();
return true;
}
return false;
}
});
sortImage = (ImageView) findViewById(R.id.sort);
if (FDroidApp.isAppThemeLight()) {
sortImage.setImageResource(R.drawable.ic_last_updated_black);
} else {
sortImage.setImageResource(R.drawable.ic_last_updated_white);
}
sortImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (sortClauseSelected.equalsIgnoreCase(SortClause.LAST_UPDATED)) {
sortClauseSelected = SortClause.NAME;
if (FDroidApp.isAppThemeLight()) {
sortImage.setImageResource(R.drawable.ic_az_black);
} else {
sortImage.setImageResource(R.drawable.ic_az_white);
}
} else {
sortClauseSelected = SortClause.LAST_UPDATED;
if (FDroidApp.isAppThemeLight()) {
sortImage.setImageResource(R.drawable.ic_last_updated_black);
} else {
sortImage.setImageResource(R.drawable.ic_last_updated_white);
}
}
getSupportLoaderManager().restartLoader(0, null, AppListActivity.this);
appView.scrollToPosition(0);
}
});
emptyState = (TextView) findViewById(R.id.empty_state);
View backButton = findViewById(R.id.back);
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
View clearButton = findViewById(R.id.clear);
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
searchInput.setText("");
}
});
appAdapter = new AppListAdapter(this);
appView = (RecyclerView) findViewById(R.id.app_list);
appView.setHasFixedSize(true);
appView.setLayoutManager(new LinearLayoutManager(this));
appView.setAdapter(appAdapter);
appView.addOnScrollListener(new RecyclerView.OnScrollListener() {
private final ImageLoader imageLoader = ImageLoader.getInstance();
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
switch(newState) {
case RecyclerView.SCROLL_STATE_DRAGGING:
imageLoader.pause();
break;
case RecyclerView.SCROLL_STATE_IDLE:
imageLoader.resume();
break;
}
super.onScrollStateChanged(recyclerView, newState);
}
});
parseIntentForSearchQuery();
}
use of com.nostra13.universalimageloader.core.ImageLoader in project AndroidStudy by tinggengyan.
the class UILApplication method initImageLoader.
// init the image loader params
public static 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 NewPipe by TeamNewPipe.
the class ContentSettingsFragment method onPreferenceTreeClick.
@Override
public boolean onPreferenceTreeClick(Preference preference) {
if (preference.getKey().equals(thumbnailLoadToggleKey)) {
final ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.stop();
imageLoader.clearDiskCache();
imageLoader.clearMemoryCache();
imageLoader.resume();
Toast.makeText(preference.getContext(), R.string.thumbnail_cache_wipe_complete_notice, Toast.LENGTH_SHORT).show();
}
return super.onPreferenceTreeClick(preference);
}
use of com.nostra13.universalimageloader.core.ImageLoader in project MGit by maks.
the class BasicFunctions method setAvatarImage.
public static void setAvatarImage(ImageView imageView, String email) {
String avatarUri = "";
if (!email.isEmpty())
avatarUri = "avatar://" + md5(email);
ImageLoader im = BasicFunctions.getImageLoader();
im.displayImage(avatarUri, imageView);
}
use of com.nostra13.universalimageloader.core.ImageLoader in project summer-android by cn-cerc.
the class MyApp method initImageLoader.
/**
* ImageLoader 初始化
*/
private void initImageLoader() {
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(this);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
// 缓存的文件数量
config.discCacheFileCount(100);
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
// 100 MiB
config.diskCacheSize(200 * 1024 * 1024);
config.tasksProcessingOrder(QueueProcessingType.LIFO);
// webConfig.writeDebugLogs(); // Remove for release app
ImageLoader.getInstance().init(config.build());
}
Aggregations