本文整理匯總了Java中org.chromium.chrome.browser.locale.LocaleManager類的典型用法代碼示例。如果您正苦於以下問題:Java LocaleManager類的具體用法?Java LocaleManager怎麽用?Java LocaleManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LocaleManager類屬於org.chromium.chrome.browser.locale包,在下文中一共展示了LocaleManager類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onClick
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
@Override
public void onClick(View v) {
if (v == mCancelButton) {
getActivity().finish();
} else if (v == mSaveButton) {
TemplateUrlService.getInstance().setSearchEngine(mSelectedIndex);
// If the user has manually set the default search engine, disable auto switching.
boolean manualSwitch = mSelectedIndex != mSearchEngineAdapter
.getInitialSearchEnginePosition();
if (manualSwitch) {
RecordUserAction.record("SearchEngine_ManualChange");
LocaleManager.getInstance().setSearchEngineAutoSwitch(false);
}
getActivity().finish();
}
}
示例2: searchEngineSelected
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
private String searchEngineSelected(int position) {
// Record the change in search engine.
mSelectedSearchEnginePosition = position;
String keyword = toKeyword(mSelectedSearchEnginePosition);
TemplateUrlService.getInstance().setSearchEngine(keyword);
// If the user has manually set the default search engine, disable auto switching.
boolean manualSwitch = mSelectedSearchEnginePosition != mInitialEnginePosition;
if (manualSwitch) {
RecordUserAction.record("SearchEngine_ManualChange");
LocaleManager.getInstance().setSearchEngineAutoSwitch(false);
}
notifyDataSetChanged();
return keyword;
}
示例3: recordDeferredStartupStats
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
private void recordDeferredStartupStats() {
RecordHistogram.recordLongTimesHistogram(
"UMA.Debug.EnableCrashUpload.DeferredStartUpDuration",
mDeferredStartupDuration,
TimeUnit.MILLISECONDS);
RecordHistogram.recordLongTimesHistogram(
"UMA.Debug.EnableCrashUpload.DeferredStartUpMaxTaskDuration",
mMaxTaskDuration,
TimeUnit.MILLISECONDS);
RecordHistogram.recordLongTimesHistogram(
"UMA.Debug.EnableCrashUpload.DeferredStartUpCompleteTime",
SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
TimeUnit.MILLISECONDS);
LocaleManager.getInstance().recordStartupMetrics();
}
示例4: onTemplateUrlServiceLoaded
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
@Override
public void onTemplateUrlServiceLoaded() {
TemplateUrlService.getInstance().unregisterLoadListener(this);
mSearchEnginePromoDialoType = LocaleManager.getInstance().getSearchEnginePromoShowType();
Runnable dismissRunnable = new Runnable() {
@Override
public void run() {
advanceToNextPage();
}
};
new DefaultSearchEngineDialogHelper(
mSearchEnginePromoDialoType, mEngineLayout, mButton, dismissRunnable);
if (getUserVisibleHint()) recordShown();
}
示例5: recordShown
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
private void recordShown() {
if (mSearchEnginePromoDialoType == null) return;
if (mShownRecorded) return;
if (mSearchEnginePromoDialoType == LocaleManager.SEARCH_ENGINE_PROMO_SHOW_NEW) {
RecordUserAction.record("SearchEnginePromo.NewDevice.Shown.FirstRun");
} else if (mSearchEnginePromoDialoType == LocaleManager.SEARCH_ENGINE_PROMO_SHOW_EXISTING) {
RecordUserAction.record("SearchEnginePromo.ExistingDevice.Shown.FirstRun");
}
mShownRecorded = true;
}
示例6: finishNativeInitialization
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
@Override
public void finishNativeInitialization() {
try {
TraceEvent.begin("ChromeTabbedActivity.finishNativeInitialization");
launchFirstRunExperience();
refreshSignIn();
ChromePreferenceManager preferenceManager = ChromePreferenceManager.getInstance(this);
// Promos can only be shown when we start with ACTION_MAIN intent and
// after FRE is complete.
if (!mIntentWithEffect && FirstRunStatus.getFirstRunFlowComplete()) {
// Only show promos on the second oppurtunity. This is because we show FRE on the
// first oppurtunity, and we don't want to show such content back to back.
if (preferenceManager.getPromosSkippedOnFirstStart()) {
// Data reduction promo should be temporarily suppressed if the sign in promo is
// shown to avoid nagging users too much.
if (!SigninPromoUtil.launchSigninPromoIfNeeded(this)) {
DataReductionPromoScreen.launchDataReductionPromo(this);
}
} else {
preferenceManager.setPromosSkippedOnFirstStart(true);
}
// Notify users experimenting with WebAPKs if they need to do extra steps to enable
// WebAPKs.
ChromeWebApkHost.launchWebApkRequirementsDialogIfNeeded(this);
}
initializeUI();
// The dataset has already been created, we need to initialize our state.
mTabModelSelectorImpl.notifyChanged();
getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
Window.PROGRESS_VISIBILITY_OFF);
// Check for incognito tabs to handle the case where Chrome was swiped away in the
// background.
int incognitoCount = TabWindowManager.getInstance().getIncognitoTabCount();
if (incognitoCount == 0) IncognitoNotificationManager.dismissIncognitoNotification();
// LocaleManager can only function after the native library is loaded.
mLocaleManager = LocaleManager.getInstance();
mLocaleManager.showSearchEnginePromoIfNeeded(this);
super.finishNativeInitialization();
} finally {
TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization");
}
}
示例7: createLocaleManager
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
/**
* @return An instance of {@link LocaleManager} that handles customized locale related logic.
*/
public LocaleManager createLocaleManager() {
return new LocaleManager();
}
示例8: loadUrl
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
@Override
protected void loadUrl(String url, int transition) {
mDelegate.loadUrl(url);
LocaleManager.getInstance().recordLocaleBasedSearchMetrics(true, url, transition);
}
示例9: finishNativeInitialization
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
@Override
public void finishNativeInitialization() {
try {
TraceEvent.begin("ChromeTabbedActivity.finishNativeInitialization");
refreshSignIn();
initializeUI();
// The dataset has already been created, we need to initialize our state.
mTabModelSelectorImpl.notifyChanged();
ApiCompatibilityUtils.setWindowIndeterminateProgress(getWindow());
// Check for incognito tabs to handle the case where Chrome was swiped away in the
// background.
if (TabWindowManager.getInstance().canDestroyIncognitoProfile()) {
IncognitoNotificationManager.dismissIncognitoNotification();
}
// LocaleManager can only function after the native library is loaded.
mLocaleManager = LocaleManager.getInstance();
boolean searchEnginePromoShown =
mLocaleManager.showSearchEnginePromoIfNeeded(this, null);
ChromePreferenceManager preferenceManager = ChromePreferenceManager.getInstance();
// Promos can only be shown when we start with ACTION_MAIN intent and
// after FRE is complete. Native initialization can finish before the FRE flow is
// complete, and this will only show promos on the second opportunity. This is
// because the FRE is shown on the first opportunity, and we don't want to show such
// content back to back.
if (!searchEnginePromoShown && !mIntentWithEffect
&& FirstRunStatus.getFirstRunFlowComplete()
&& preferenceManager.getPromosSkippedOnFirstStart()) {
// Data reduction promo should be temporarily suppressed if the sign in promo is
// shown to avoid nagging users too much.
if (!SigninPromoUtil.launchSigninPromoIfNeeded(this)) {
DataReductionPromoScreen.launchDataReductionPromo(this);
}
} else {
preferenceManager.setPromosSkippedOnFirstStart(true);
}
super.finishNativeInitialization();
} finally {
TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization");
}
}
示例10: shouldShowSearchEnginePage
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
@VisibleForTesting
protected boolean shouldShowSearchEnginePage() {
int searchPromoType = LocaleManager.getInstance().getSearchEnginePromoShowType();
return searchPromoType == LocaleManager.SEARCH_ENGINE_PROMO_SHOW_NEW
|| searchPromoType == LocaleManager.SEARCH_ENGINE_PROMO_SHOW_EXISTING;
}
示例11: showSearchEngineDialogIfNeeded
import org.chromium.chrome.browser.locale.LocaleManager; //導入依賴的package包/類
/**
* Called to launch the search engine dialog if it's needed.
* @param activity Activity that is launching the dialog.
* @param callback Called when the dialog has been dismissed.
* @return Whether or not the search dialog was shown.
*/
boolean showSearchEngineDialogIfNeeded(Activity activity, Callback<Boolean> callback) {
return LocaleManager.getInstance().showSearchEnginePromoIfNeeded(activity, callback);
}