本文整理汇总了Java中org.zirco.utils.ApplicationUtils.checkCardState方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationUtils.checkCardState方法的具体用法?Java ApplicationUtils.checkCardState怎么用?Java ApplicationUtils.checkCardState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.zirco.utils.ApplicationUtils
的用法示例。
在下文中一共展示了ApplicationUtils.checkCardState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doDownloadStart
import org.zirco.utils.ApplicationUtils; //导入方法依赖的package包/类
/**
* Initiate a download. Check the SD card and start the download runnable.
* @param url The url to download.
* @param userAgent The user agent.
* @param contentDisposition The content disposition.
* @param mimetype The mime type.
* @param contentLength The content length.
*/
private void doDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
if (ApplicationUtils.checkCardState(this, true)) {
DownloadItem item = new DownloadItem(this, url);
Controller.getInstance().addToDownload(item);
item.startDownload();
Toast.makeText(this, getString(R.string.Main_DownloadStartedMsg), Toast.LENGTH_SHORT).show();
}
}
示例2: doImportHistoryBookmarks
import org.zirco.utils.ApplicationUtils; //导入方法依赖的package包/类
/**
* Import the given file to bookmarks and history.
* @param fileName The file to import.
*/
private void doImportHistoryBookmarks(String fileName) {
if (ApplicationUtils.checkCardState(this, true)) {
mProgressDialog = ProgressDialog.show(this,
this.getResources().getString(R.string.Commons_PleaseWait),
this.getResources().getString(R.string.Commons_ImportingHistoryBookmarks));
XmlHistoryBookmarksImporter importer = new XmlHistoryBookmarksImporter(this, fileName, mProgressDialog);
new Thread(importer).start();
}
}
示例3: doExportHistoryBookmarks
import org.zirco.utils.ApplicationUtils; //导入方法依赖的package包/类
/**
* Export the bookmarks and history.
*/
private void doExportHistoryBookmarks() {
if (ApplicationUtils.checkCardState(this, true)) {
mProgressDialog = ProgressDialog.show(this,
this.getResources().getString(R.string.Commons_PleaseWait),
this.getResources().getString(R.string.Commons_ExportingHistoryBookmarks));
XmlHistoryBookmarksExporter exporter = new XmlHistoryBookmarksExporter(this,
DateUtils.getNowForFileName() + ".xml",
BookmarksProviderWrapper.getAllStockRecords(this.getContentResolver()),
mProgressDialog);
new Thread(exporter).start();
}
}
示例4: exportOldBookmarks
import org.zirco.utils.ApplicationUtils; //导入方法依赖的package包/类
/**
* Export bookmarks from the old database. Transform the query result
* into a MatrixCursor following the stock bookmarks database, so it
* can be exported with the XmlHistoryBookmarksExporter without any
* change on it.
* @param db The database.
*/
private void exportOldBookmarks(SQLiteDatabase db) {
Log.i("DbAdapter", "Start export of old bookmarks.");
try {
if (ApplicationUtils.checkCardState(mParent.mContext, false)) {
Log.i("DbAdapter", "Export of old bookmarks: SDCard checked.");
MatrixCursor cursor = null;
Cursor c = db.query( "BOOKMARKS",
new String[] { "_id",
"title",
"url",
"creation_date",
"count" },
null,
null,
null,
null,
null);
if (c != null) {
if (c.moveToFirst()) {
cursor = new MatrixCursor(new String[] {
Browser.BookmarkColumns.TITLE,
Browser.BookmarkColumns.URL,
Browser.BookmarkColumns.VISITS,
Browser.BookmarkColumns.DATE,
Browser.BookmarkColumns.CREATED,
Browser.BookmarkColumns.BOOKMARK
});
int titleColumn = c.getColumnIndex("title");
int urlColumn = c.getColumnIndex("url");
int creationDateColumn = c.getColumnIndex("creation_date");
int countColumn = c.getColumnIndex("count");
while (!c.isAfterLast()) {
Date date = DateUtils.convertFromDatabase(mParent.mContext, c.getString(creationDateColumn));
Object[] data = new Object[6];
data[0] = c.getString(titleColumn);
data[1] = c.getString(urlColumn);
data[2] = c.getInt(countColumn);
data[3] = date.getTime();
data[4] = date.getTime();
data[5] = 1;
cursor.addRow(data);
c.moveToNext();
}
}
c.close();
}
if (cursor != null) {
Log.i("DbAdapter", "Export of old bookmarks: Writing file.");
new Thread(new XmlHistoryBookmarksExporter(null, "auto-export.xml", cursor, null)).start();
}
}
} catch (Exception e) {
Log.i("DbAdapter", "Export of old bookmarks failed: " + e.getMessage());
}
Log.i("DbAdapter", "End of export of old bookmarks.");
}