当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationUtils类代码示例

本文整理汇总了Java中org.zirco.utils.ApplicationUtils的典型用法代码示例。如果您正苦于以下问题:Java ApplicationUtils类的具体用法?Java ApplicationUtils怎么用?Java ApplicationUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ApplicationUtils类属于org.zirco.utils包,在下文中一共展示了ApplicationUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSyncEnd

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
@Override
public void onSyncEnd(Throwable result) {
	mSyncThread.compareAndSet(mSyncTask, null);
	if (result != null) {
		String msg = String.format(getResources().getString(R.string.Errors_WeaveSyncFailedMessage), result.getMessage());
		Log.e("MainActivity: Sync failed.", msg);
		
		ApplicationUtils.showErrorDialog(this, R.string.Errors_WeaveSyncFailedTitle, msg);
	} else {
		Editor lastSyncDateEditor = PreferenceManager.getDefaultSharedPreferences(this).edit();
		lastSyncDateEditor.putLong(Constants.PREFERENCE_WEAVE_LAST_SYNC_DATE, new Date().getTime());
		lastSyncDateEditor.commit();
	}
	
	mProgressDialog.dismiss();
	fillData();
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:18,代码来源:WeaveBookmarksListActivity.java

示例2: fillData

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
/**
    * Fill the bookmark to the list UI. 
    */
private void fillData() {
	mCursor = BookmarksProviderWrapper.getStockBookmarks(getContentResolver(),
			PreferenceManager.getDefaultSharedPreferences(this).getInt(Constants.PREFERENCES_BOOKMARKS_SORT_MODE, 0));
   	startManagingCursor(mCursor);
   	
   	String[] from = new String[] { Browser.BookmarkColumns.TITLE, Browser.BookmarkColumns.URL};
   	int[] to = new int[] {R.id.BookmarkRow_Title, R.id.BookmarkRow_Url};
   	
   	mCursorAdapter = new BookmarksCursorAdapter(this,
   			R.layout.bookmark_row,
   			mCursor,
   			from,
   			to,
   			ApplicationUtils.getFaviconSizeForBookmarks(this));
   	
       mList.setAdapter(mCursorAdapter);
       
       setAnimation();
   }
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:23,代码来源:BookmarksListActivity.java

示例3: getNormalizedFavicon

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
/**
 * Get a Drawable of the current favicon, with its size normalized relative to current screen density.
 * @return The normalized favicon.
 */
private BitmapDrawable getNormalizedFavicon() {
	
	BitmapDrawable favIcon = new BitmapDrawable(getResources(), mCurrentWebView.getFavicon());
	
	if (mCurrentWebView.getFavicon() != null) {
		int imageButtonSize = ApplicationUtils.getImageButtonSize(this);
		int favIconSize = ApplicationUtils.getFaviconSize(this);
		
		Bitmap bm = Bitmap.createBitmap(imageButtonSize, imageButtonSize, Bitmap.Config.ARGB_4444);
		Canvas canvas = new Canvas(bm);
		
		favIcon.setBounds((imageButtonSize / 2) - (favIconSize / 2), (imageButtonSize / 2) - (favIconSize / 2), (imageButtonSize / 2) + (favIconSize / 2), (imageButtonSize / 2) + (favIconSize / 2));
		favIcon.draw(canvas);
		
		favIcon = new BitmapDrawable(getResources(), bm);
	}
	
	return favIcon;
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:24,代码来源:MainActivity.java

示例4: onCreate

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	Window w = getWindow();
	w.requestFeature(Window.FEATURE_LEFT_ICON);
	
	setContentView(R.layout.changelog_activity);
	
	w.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_info);
	
	TextView changelogText = (TextView) findViewById(R.id.ChangelogContent);		
	changelogText.setText(ApplicationUtils.getChangelogString(this));
	
	Button closeBtn = (Button) this.findViewById(R.id.ChangelogActivity_CloseBtn);
	 closeBtn.setOnClickListener(new View.OnClickListener() {

		 public void onClick(View view) {            	
			 finish();
		 }

	 });
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:24,代码来源:ChangelogActivity.java

示例5: fillData

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
/**
 * Fill the history list.
 */
private void fillData() {
	Cursor c = BookmarksProviderWrapper.getStockHistory(getContentResolver());
	
	mAdapter = new HistoryExpandableListAdapter(
			this,
			mBookmarkStarChangeListener,
			c,
			c.getColumnIndex(Browser.BookmarkColumns.DATE),
			ApplicationUtils.getFaviconSizeForBookmarks(this));
	
       setListAdapter(mAdapter);
       
       if (getExpandableListAdapter().getGroupCount() > 0) {
       	getExpandableListView().expandGroup(0);
       }
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:20,代码来源:HistoryListActivity.java

示例6: handleMessage

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
public void handleMessage(Message msg) {
	if (mProgressDialog != null) {
		mProgressDialog.dismiss();
	}
	
	if (mContext != null) {
		if (mErrorMessage == null) {
			ApplicationUtils.showOkDialog(mContext,
					android.R.drawable.ic_dialog_info,
					mContext.getResources().getString(R.string.Commons_HistoryBookmarksExportSDCardDoneTitle),
					String.format(mContext.getResources().getString(R.string.Commons_HistoryBookmarksExportSDCardDoneMessage), mFile.getAbsolutePath()));
		} else {
			ApplicationUtils.showOkDialog(mContext,
					android.R.drawable.ic_dialog_alert,
					mContext.getResources().getString(R.string.Commons_HistoryBookmarksExportSDCardFailedTitle),
					String.format(mContext.getResources().getString(R.string.Commons_HistoryBookmarksFailedMessage), mErrorMessage));
		}
	}
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:20,代码来源:XmlHistoryBookmarksExporter.java

示例7: onPageStarted

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
	
	// Some magic here: when performing WebView.loadDataWithBaseURL, the url is "file:///android_asset/startpage,
	// whereas when the doing a "previous" or "next", the url is "about:start", and we need to perform the
	// loadDataWithBaseURL here, otherwise it won't load.
	if (url.equals(Constants.URL_ABOUT_START)) {
		view.loadDataWithBaseURL("file:///android_asset/startpage/",
				ApplicationUtils.getStartPage(view.getContext()), "text/html", "UTF-8", "about:start");
	}
	
	((CustomWebView) view).notifyPageStarted();
	mMainActivity.onPageStarted(url);
	
	super.onPageStarted(view, url, favicon);
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:17,代码来源:CustomWebViewClient.java

示例8: onContextItemSelected

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
	AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
	
	WeaveBookmarkItem bookmarkItem = BookmarksProviderWrapper.getWeaveBookmarkById(getContentResolver(), info.id);
	
	switch (item.getItemId()) {
	case MENU_OPEN_IN_TAB:    	
           Intent i = new Intent();
           i.putExtra(Constants.EXTRA_ID_NEW_TAB, true);
           i.putExtra(Constants.EXTRA_ID_URL, bookmarkItem.getUrl());
           
           if (getParent() != null) {
           	getParent().setResult(RESULT_OK, i);
           } else {
           	setResult(RESULT_OK, i);            
           }
           
           finish();
           return true;
           
	case MENU_COPY_URL:			
   		ApplicationUtils.copyTextToClipboard(this,  bookmarkItem.getUrl(), getString(R.string.Commons_UrlCopyToastMessage));
   		return true;
   		
	case MENU_SHARE:
		ApplicationUtils.sharePage(this, bookmarkItem.getTitle(), bookmarkItem.getUrl());
		return true;
   		
	default: return super.onContextItemSelected(item);
	}
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:33,代码来源:WeaveBookmarksListActivity.java

示例9: doSync

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
private void doSync() {
	String authToken = ApplicationUtils.getWeaveAuthToken(this);
	
	if (authToken != null) {
		WeaveAccountInfo info = WeaveAccountInfo.createWeaveAccountInfo(authToken);
		mSyncTask = new WeaveSyncTask(this, this);
		
		mProgressDialog = new ProgressDialog(this);
		mProgressDialog.setIndeterminate(true);
		mProgressDialog.setTitle(R.string.WeaveSync_SyncTitle);
		mProgressDialog.setMessage(getString(R.string.WeaveSync_Connecting));
		mProgressDialog.setCancelable(true);
		mProgressDialog.setOnCancelListener(new OnCancelListener() {
			
			@Override
			public void onCancel(DialogInterface dialog) {
				mSyncTask.cancel(true);
			}
		});
		
		mProgressDialog.show();
		
		boolean retVal = mSyncThread.compareAndSet(null, mSyncTask);
		if (retVal) {
			mSyncTask.execute(info);
		}
		
		
	} else {
		ApplicationUtils.showErrorDialog(this, R.string.Errors_WeaveSyncFailedTitle, R.string.Errors_WeaveAuthFailedMessage);
	}
	
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:34,代码来源:WeaveBookmarksListActivity.java

示例10: 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();
    }
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:19,代码来源:MainActivity.java

示例11: navigateToUrl

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
/**
 * Navigate to the given url.
 * @param url The url.
 */
private void navigateToUrl(String url) {
	// Needed to hide toolbars properly.
	mUrlEditText.clearFocus();
	
	if ((url != null) &&
			(url.length() > 0)) {
	
		if (UrlUtils.isUrl(url)) {
			url = UrlUtils.checkUrl(url);
		} else {
			url = UrlUtils.getSearchUrl(this, url);
		}    		    	
		
		hideKeyboard(true);
		
		if (url.equals(Constants.URL_ABOUT_START)) {
			
			mCurrentWebView.loadDataWithBaseURL("file:///android_asset/startpage/",
					ApplicationUtils.getStartPage(this), "text/html", "UTF-8", Constants.URL_ABOUT_START);
			
		} else {
			
			// If the url is not from GWT mobile view, and is in the mobile view url list, then load it with GWT.
			if ((!url.startsWith(Constants.URL_GOOGLE_MOBILE_VIEW_NO_FORMAT)) &&
					(UrlUtils.checkInMobileViewUrlList(this, url))) {
				
				url = String.format(Constants.URL_GOOGLE_MOBILE_VIEW, url);    				
			}
			
			mCurrentWebView.loadUrl(url);    			
		}
	}
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:38,代码来源:MainActivity.java

示例12: clearWhiteList

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
/**
 * Display a confirmation dialog and clear the white list.
 */
private void clearWhiteList() {
	ApplicationUtils.showYesNoDialog(this,
			android.R.drawable.ic_dialog_alert,
			R.string.AdBlockerWhiteListActivity_ClearMessage,
			R.string.Commons_NoUndoMessage,
			new DialogInterface.OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
					doClearWhiteList();
				}			
	});      
   }
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:17,代码来源:AdBlockerWhiteListActivity.java

示例13: onContextItemSelected

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
	ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuItem.getMenuInfo();
	
	int type = ExpandableListView.getPackedPositionType(info.packedPosition);
	
	if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
		int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
		int child =	ExpandableListView.getPackedPositionChild(info.packedPosition);
		
		HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);
		
		switch (menuItem.getItemId()) {
		case MENU_OPEN_IN_TAB:
			doNavigateToUrl(item.getUrl(), true);
			break;
		case MENU_COPY_URL:
			ApplicationUtils.copyTextToClipboard(this, item.getUrl(), getString(R.string.Commons_UrlCopyToastMessage));
			break;
		case MENU_SHARE:
			ApplicationUtils.sharePage(this, item.getTitle(), item.getUrl());
			break;
		case MENU_DELETE_FROM_HISTORY:
			BookmarksProviderWrapper.deleteHistoryRecord(getContentResolver(), item.getId());
			fillData();
			break;
		default:
			break;
		}
	}
	
	return super.onContextItemSelected(menuItem);
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:34,代码来源:HistoryListActivity.java

示例14: clearHistory

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
/**
 * Display confirmation and clear history.
 */
private void clearHistory() {
	ApplicationUtils.showYesNoDialog(this,
			android.R.drawable.ic_dialog_alert,
			R.string.Commons_ClearHistory,
			R.string.Commons_NoUndoMessage,
			new DialogInterface.OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
	    			doClearHistory();
				}			
	});
   }
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:17,代码来源:HistoryListActivity.java

示例15: askForRestart

import org.zirco.utils.ApplicationUtils; //导入依赖的package包/类
/**
 * Ask user to restart the app. Do it if click on "Yes".
 */
private void askForRestart() {
	ApplicationUtils.showYesNoDialog(this,
			android.R.drawable.ic_dialog_alert,
			R.string.PreferencesActivity_RestartDialogTitle,
			R.string.PreferencesActivity_RestartDialogMessage,
			new DialogInterface.OnClickListener() {

		@Override
		public void onClick(DialogInterface dialog, int which) {
			MainActivity.INSTANCE.restartApplication();				
		}
		
	});
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:18,代码来源:PreferencesActivity.java


注:本文中的org.zirco.utils.ApplicationUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。