本文整理汇总了Java中com.loopj.android.image.WebImageCache类的典型用法代码示例。如果您正苦于以下问题:Java WebImageCache类的具体用法?Java WebImageCache怎么用?Java WebImageCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WebImageCache类属于com.loopj.android.image包,在下文中一共展示了WebImageCache类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ImagesHelper
import com.loopj.android.image.WebImageCache; //导入依赖的package包/类
public ImagesHelper(Context context) {
this.context = context;
this.sharedPreferences = this.context.getSharedPreferences(RainbowConst.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
// init cache
this.imgCache = new WebImageCache(this.context);
this.cacheSize = this.sharedPreferences.getInt(SHARED_CACHE_SIZE, 0);
checkCacheSize();
}
示例2: getCachedBitmap
import com.loopj.android.image.WebImageCache; //导入依赖的package包/类
public Bitmap getCachedBitmap() {
WebImageCache cache = useCache ? getWebImageCache() : null;
return cache != null ? cache.get(url) : null;
}
示例3: removeFromCache
import com.loopj.android.image.WebImageCache; //导入依赖的package包/类
public static void removeFromCache(String url) {
WebImageCache cache = getWebImageCache();
if (cache != null) {
cache.remove(url);
}
}
示例4: onOptionsItemSelected
import com.loopj.android.image.WebImageCache; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.mainmenu_openhab_preferences:
Intent settingsIntent = new Intent(this.getApplicationContext(), OpenHABPreferencesActivity.class);
startActivityForResult(settingsIntent, SETTINGS_REQUEST_CODE);
Util.overridePendingTransition(this, false);
return true;
case R.id.mainmenu_openhab_selectsitemap:
SharedPreferences settings =
PreferenceManager.getDefaultSharedPreferences(OpenHABMainActivity.this);
SharedPreferences.Editor preferencesEditor = settings.edit();
preferencesEditor.putString("default_openhab_sitemap", "");
preferencesEditor.commit();
selectSitemap(openHABBaseUrl, true);
return true;
case android.R.id.home:
Log.d(TAG, "Home selected");
if (pager.getCurrentItem() > 0) {
pager.setCurrentItem(0);
}
return true;
case R.id.mainmenu_openhab_clearcache:
Log.d(TAG, "Restarting");
// Get launch intent for application
Intent restartIntent = getBaseContext().getPackageManager()
.getLaunchIntentForPackage( getBaseContext().getPackageName() );
restartIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// Finish current activity
finish();
WebImageCache cache = new WebImageCache(getBaseContext());
cache.clear();
// Start launch activity
startActivity(restartIntent);
// Start launch activity
return true;
case R.id.mainmenu_openhab_writetag:
Intent writeTagIntent = new Intent(this.getApplicationContext(), OpenHABWriteTagActivity.class);
// TODO: get current display page url, which? how? :-/
OpenHABWidgetListFragment currentFragment = pagerAdapter.getFragment(pager.getCurrentItem());
writeTagIntent.putExtra("sitemapPage", currentFragment.getDisplayPageUrl());
startActivityForResult(writeTagIntent, WRITE_NFC_TAG_REQUEST_CODE);
Util.overridePendingTransition(this, false);
return true;
case R.id.mainmenu_openhab_info:
Intent infoIntent = new Intent(this.getApplicationContext(), OpenHABInfoActivity.class);
infoIntent.putExtra("openHABBaseUrl", openHABBaseUrl);
infoIntent.putExtra("username", openHABUsername);
infoIntent.putExtra("password", openHABPassword);
startActivityForResult(infoIntent, INFO_REQUEST_CODE);
Util.overridePendingTransition(this, false);
return true;
case R.id.mainmenu_voice_recognition:
launchVoiceRecognition();
return true;
case R.id.mainmenu_openhab_flipper:
this.startActivity(new Intent(this, MainActivity.class));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例5: onOptionsItemSelected
import com.loopj.android.image.WebImageCache; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.mainmenu_openhab_preferences:
Intent settingsIntent = new Intent(this.getApplicationContext(), OpenHABPreferencesActivity.class);
Util.overridePendingTransition(this, false);
return true;
case R.id.mainmenu_openhab_selectsitemap:
SharedPreferences settings =
PreferenceManager.getDefaultSharedPreferences(OpenHABWidgetListActivity.this);
Editor preferencesEditor = settings.edit();
preferencesEditor.putString("default_openhab_sitemap", "");
preferencesEditor.commit();
selectSitemap(openHABBaseUrl, true);
return true;
case android.R.id.home:
Log.d(HABApplication.getLogTag(), "Home selected - " + sitemapRootUrl);
// Get launch intent for application
Intent homeIntent = getBaseContext().getPackageManager()
.getLaunchIntentForPackage( getBaseContext().getPackageName() );
homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
homeIntent.setAction("org.openhab.habdroid.ui.OpwnHABWidgetListActivity");
homeIntent.putExtra("displayPageUrl", sitemapRootUrl);
homeIntent.putExtra("openHABBaseUrl", openHABBaseUrl);
homeIntent.putExtra("sitemapRootUrl", sitemapRootUrl);
Log.d(HABApplication.getLogTag(), String.format("openPage intent =>/ndisplayPageUrl = '%s'/nopenHABBaseUrl = '%s'/nsitemapRootUrl = '%s'", sitemapRootUrl, openHABBaseUrl, sitemapRootUrl));
// Finish current activity
finish();
// Start launch activity
startActivity(homeIntent);
Util.overridePendingTransition(this, true);
return true;
case R.id.mainmenu_openhab_clearcache:
Log.d(HABApplication.getLogTag(), "Restarting");
// Get launch intent for application
Intent restartIntent = getBaseContext().getPackageManager()
.getLaunchIntentForPackage( getBaseContext().getPackageName() );
restartIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// Finish current activity
finish();
WebImageCache cache = new WebImageCache(getBaseContext());
cache.clear();
// Start launch activity
startActivity(restartIntent);
// Start launch activity
return true;
case R.id.mainmenu_openhab_writetag:
Intent writeTagIntent = new Intent(this.getApplicationContext(), OpenHABWriteTagActivity.class);
writeTagIntent.putExtra("sitemapPage", this.displayPageUrl);
startActivityForResult(writeTagIntent, 0);
Util.overridePendingTransition(this, false);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例6: getWebImageCache
import com.loopj.android.image.WebImageCache; //导入依赖的package包/类
/**
* Returns the already initialized WebImageCache, if there's any. This method may return
* null if {@link MyWebImage#getWebImageCache(Context ctx)} was not called so far.
*
* @return WebImageCache|null
*/
public static WebImageCache getWebImageCache() {
return sWebImageCache;
}