本文整理匯總了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;
}
}
示例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);
}
示例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);
}