當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageCacheColumn類代碼示例

本文整理匯總了Java中cn.eoe.app.db.ImageCacheColumn的典型用法代碼示例。如果您正苦於以下問題:Java ImageCacheColumn類的具體用法?Java ImageCacheColumn怎麽用?Java ImageCacheColumn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ImageCacheColumn類屬於cn.eoe.app.db包,在下文中一共展示了ImageCacheColumn類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getImageFromDB

import cn.eoe.app.db.ImageCacheColumn; //導入依賴的package包/類
private static Bitmap getImageFromDB(String imagePath, String imageUrl,
		DBHelper dbHelper) {
	Cursor cursor = queryFromDbByImgUrl(dbHelper, imageUrl);
	if (cursor.moveToFirst()) {
		long currTimestamp = (new Date()).getTime();
		long timestamp = cursor.getLong(cursor
				.getColumnIndex(ImageCacheColumn.TIMESTAMP));
		long spanTime = currTimestamp - timestamp;
		int Past_time = cursor.getInt(cursor
				.getColumnIndex(ImageCacheColumn.PAST_TIME));
		if (spanTime > Past_time * 24 * 60 * 60 * 1000) {
			// 過期
			// 刪除本地文件
			deleteImageFromLocal(imagePath);
			return null;
		} else {
			// 沒過期
			return getImageFromLocal(imagePath);
		}
	} else {
		return null;
	}
}
 
開發者ID:shengge,項目名稱:eoe-android-app,代碼行數:24,代碼來源:ImageUtil.java

示例2: saveImageByDb

import cn.eoe.app.db.ImageCacheColumn; //導入依賴的package包/類
private static void saveImageByDb(String imageUrl, DBHelper dbHelper) {
	String sql = null;
	if (queryFromDbByImgUrl(dbHelper, imageUrl).moveToFirst()) {
		sql = "update " + ImageCacheColumn.TABLE_NAME + " set "
				+ ImageCacheColumn.TIMESTAMP + "='"
				+ (new Date().getTime()) + "' where "
				+ ImageCacheColumn.Url + "='" + imageUrl + "'";
	} else {
		sql = "insert into " + ImageCacheColumn.TABLE_NAME + "("
				+ ImageCacheColumn.Url + "," + ImageCacheColumn.TIMESTAMP
				+ "," + ImageCacheColumn.PAST_TIME + ") values('"
				+ imageUrl + "'," + (new Date().getTime()) + "," + DayCount
				+ ")";
	}
	dbHelper.ExecSQL(sql);
}
 
開發者ID:shengge,項目名稱:eoe-android-app,代碼行數:17,代碼來源:ImageUtil.java

示例3: queryFromDbByImgUrl

import cn.eoe.app.db.ImageCacheColumn; //導入依賴的package包/類
private static Cursor queryFromDbByImgUrl(DBHelper dbHelper, String imageUrl) {
	// return dbHelper.query(ImageCacheColumn.TABLE_NAME, null,
	// ImageCacheColumn.Url + "=?", new String[] { imageUrl });
	return dbHelper.rawQuery("select * from " + ImageCacheColumn.TABLE_NAME
			+ "  where " + ImageCacheColumn.Url + "='" + imageUrl + "'",
			null);
}
 
開發者ID:shengge,項目名稱:eoe-android-app,代碼行數:8,代碼來源:ImageUtil.java


注:本文中的cn.eoe.app.db.ImageCacheColumn類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。