コード例 #1
0
ファイル: PreferencesTest.java プロジェクト: mirror/chromium
 /**
  * Launches the preferences menu and starts the preferences activity named fragmentName. Returns
  * the activity that was started.
  */
 public static Preferences startPreferences(Instrumentation instrumentation, String fragmentName) {
   Context context = instrumentation.getTargetContext();
   Intent intent = PreferencesLauncher.createIntentForSettingsPage(context, fragmentName);
   Activity activity = instrumentation.startActivitySync(intent);
   assertTrue(activity instanceof Preferences);
   return (Preferences) activity;
 }
コード例 #2
0
 private void onLocationLinkClicked() {
   if (!LocationSettings.getInstance().isSystemLocationSettingEnabled()) {
     mContext.startActivity(LocationSettings.getInstance().getSystemLocationSettingsIntent());
   } else {
     Intent settingsIntent =
         PreferencesLauncher.createIntentForSettingsPage(
             mContext, SingleWebsitePreferences.class.getName());
     String url =
         TemplateUrlService.getInstance()
             .getSearchEngineUrlFromTemplateUrl(toIndex(mSelectedSearchEnginePosition));
     Bundle fragmentArgs = SingleWebsitePreferences.createFragmentArgsForSite(url);
     fragmentArgs.putBoolean(
         SingleWebsitePreferences.EXTRA_LOCATION,
         locationEnabled(mSelectedSearchEnginePosition, true));
     settingsIntent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
     mContext.startActivity(settingsIntent);
   }
   mCallback.onDismissDialog();
 }