org.chromium.chrome.browser.preferences.Preferences Java Examples
The following examples show how to use
org.chromium.chrome.browser.preferences.Preferences.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccountManagementFragment.java From delion with Apache License 2.0 | 6 votes |
private void configureSyncSettings() { final Preferences preferences = (Preferences) getActivity(); final Account account = ChromeSigninController.get(getActivity()).getSignedInUser(); findPreference(PREF_SYNC_SETTINGS) .setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { if (!isVisible() || !isResumed()) return false; if (ProfileSyncService.get() == null) return true; if (AndroidSyncSettings.isMasterSyncEnabled(preferences)) { Bundle args = new Bundle(); args.putString( SyncCustomizationFragment.ARGUMENT_ACCOUNT, account.name); preferences.startFragment( SyncCustomizationFragment.class.getName(), args); } else { openSyncSettingsPage(preferences); } return true; } }); }
Example #2
Source File: AccountManagementFragment.java From AndroidChromium with Apache License 2.0 | 6 votes |
private void configureSyncSettings() { final Preferences preferences = (Preferences) getActivity(); final Account account = ChromeSigninController.get(getActivity()).getSignedInUser(); findPreference(PREF_SYNC_SETTINGS) .setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { if (!isVisible() || !isResumed()) return false; if (ProfileSyncService.get() == null) return true; Bundle args = new Bundle(); args.putString(SyncCustomizationFragment.ARGUMENT_ACCOUNT, account.name); preferences.startFragment(SyncCustomizationFragment.class.getName(), args); return true; } }); }
Example #3
Source File: AccountManagementFragment.java From 365browser with Apache License 2.0 | 6 votes |
private void configureSyncSettings() { final Preferences preferences = (Preferences) getActivity(); findPreference(PREF_SYNC_SETTINGS) .setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { if (!isVisible() || !isResumed()) return false; if (ProfileSyncService.get() == null) return true; Bundle args = new Bundle(); args.putString( SyncCustomizationFragment.ARGUMENT_ACCOUNT, mSignedInAccountName); preferences.startFragment(SyncCustomizationFragment.class.getName(), args); return true; } }); }
Example #4
Source File: ChromeApplication.java From delion with Apache License 2.0 | 5 votes |
/** * Opens the single origin settings page for the given URL. * * @param url The URL to show the single origin settings for. This is a complete url * including scheme, domain, port, path, etc. */ protected void showSingleOriginSettings(String url) { Bundle fragmentArgs = SingleWebsitePreferences.createFragmentArgsForSite(url); Intent intent = PreferencesLauncher.createIntentForSettingsPage( this, SingleWebsitePreferences.class.getName()); intent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs); startActivity(intent); }
Example #5
Source File: GeolocationSnackbarController.java From delion with Apache License 2.0 | 5 votes |
@Override public void onAction(Object actionData) { View view = (View) actionData; UiUtils.hideKeyboard(view); Context context = view.getContext(); Intent intent = PreferencesLauncher.createIntentForSettingsPage(context, null); Bundle fragmentArgs = new Bundle(); fragmentArgs.putBoolean(MainPreferences.EXTRA_SHOW_SEARCH_ENGINE_PICKER, true); intent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs); context.startActivity(intent); }
Example #6
Source File: AccountManagementFragment.java From delion with Apache License 2.0 | 5 votes |
private void updateAccountsList() { PreferenceScreen prefScreen = getPreferenceScreen(); if (prefScreen == null) return; for (int i = 0; i < mAccountsListPreferences.size(); i++) { prefScreen.removePreference(mAccountsListPreferences.get(i)); } mAccountsListPreferences.clear(); final Preferences activity = (Preferences) getActivity(); Account[] accounts = AccountManagerHelper.get(activity).getGoogleAccounts(); int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER; for (Account account : accounts) { ChromeBasePreference pref = new ChromeBasePreference(activity); pref.setSelectable(false); pref.setTitle(account.name); boolean isChildAccount = ChildAccountService.isChildAccount(); pref.setIcon(new BitmapDrawable(getResources(), isChildAccount ? getBadgedUserPicture(account.name, getResources()) : getUserPicture(account.name, getResources()))); pref.setOrder(nextPrefOrder++); prefScreen.addPreference(pref); mAccountsListPreferences.add(pref); } }
Example #7
Source File: AccountManagementFragment.java From delion with Apache License 2.0 | 5 votes |
/** * Open the account management UI. * @param applicationContext An application context. * @param profile A user profile. * @param serviceType A signin::GAIAServiceType that triggered the dialog. */ public static void openAccountManagementScreen( Context applicationContext, Profile profile, int serviceType) { Intent intent = PreferencesLauncher.createIntentForSettingsPage(applicationContext, AccountManagementFragment.class.getName()); Bundle arguments = new Bundle(); arguments.putInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, serviceType); intent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, arguments); applicationContext.startActivity(intent); }
Example #8
Source File: AccountManagementFragment.java From AndroidChromium with Apache License 2.0 | 5 votes |
private void updateAccountsList() { PreferenceScreen prefScreen = getPreferenceScreen(); if (prefScreen == null) return; for (int i = 0; i < mAccountsListPreferences.size(); i++) { prefScreen.removePreference(mAccountsListPreferences.get(i)); } mAccountsListPreferences.clear(); final Preferences activity = (Preferences) getActivity(); Account[] accounts = AccountManagerHelper.get(activity).getGoogleAccounts(); int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER; for (Account account : accounts) { ChromeBasePreference pref = new ChromeBasePreference(activity); pref.setSelectable(false); pref.setTitle(account.name); boolean isChildAccount = ChildAccountService.isChildAccount(); pref.setIcon(new BitmapDrawable(getResources(), isChildAccount ? getBadgedUserPicture(account.name, getResources()) : getUserPicture(account.name, getResources()))); pref.setOrder(nextPrefOrder++); prefScreen.addPreference(pref); mAccountsListPreferences.add(pref); } }
Example #9
Source File: AccountManagementFragment.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Open the account management UI. * @param applicationContext An application context. * @param profile A user profile. * @param serviceType A signin::GAIAServiceType that triggered the dialog. */ public static void openAccountManagementScreen( Context applicationContext, Profile profile, int serviceType) { Intent intent = PreferencesLauncher.createIntentForSettingsPage(applicationContext, AccountManagementFragment.class.getName()); Bundle arguments = new Bundle(); arguments.putInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, serviceType); intent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, arguments); applicationContext.startActivity(intent); }
Example #10
Source File: SearchGeolocationDisclosureInfoBar.java From AndroidChromium with Apache License 2.0 | 5 votes |
@CalledByNative private static void showSettingsPage(String searchUrl) { Context context = ContextUtils.getApplicationContext(); Intent settingsIntent = PreferencesLauncher.createIntentForSettingsPage( context, SingleWebsitePreferences.class.getName()); Bundle fragmentArgs = SingleWebsitePreferences.createFragmentArgsForSite(searchUrl); settingsIntent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs); IntentUtils.safeStartActivity(context, settingsIntent); }
Example #11
Source File: AccountManagementFragment.java From 365browser with Apache License 2.0 | 5 votes |
private void updateAccountsList() { PreferenceScreen prefScreen = getPreferenceScreen(); if (prefScreen == null) return; for (int i = 0; i < mAccountsListPreferences.size(); i++) { prefScreen.removePreference(mAccountsListPreferences.get(i)); } mAccountsListPreferences.clear(); final Preferences activity = (Preferences) getActivity(); Account[] accounts = AccountManagerHelper.get().getGoogleAccounts(); int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER; for (Account account : accounts) { ChromeBasePreference pref = new ChromeBasePreference(activity); pref.setSelectable(false); pref.setTitle(account.name); boolean isChildAccount = mProfile.isChild(); pref.setUseReducedPadding(isChildAccount); pref.setIcon(new BitmapDrawable(getResources(), isChildAccount ? getBadgedUserPicture(account.name, getResources()) : getUserPicture(account.name, getResources()))); pref.setOrder(nextPrefOrder++); prefScreen.addPreference(pref); mAccountsListPreferences.add(pref); } }
Example #12
Source File: AccountManagementFragment.java From 365browser with Apache License 2.0 | 5 votes |
/** * Open the account management UI. * @param serviceType A signin::GAIAServiceType that triggered the dialog. */ public static void openAccountManagementScreen(int serviceType) { Intent intent = PreferencesLauncher.createIntentForSettingsPage( ContextUtils.getApplicationContext(), AccountManagementFragment.class.getName()); Bundle arguments = new Bundle(); arguments.putInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, serviceType); intent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, arguments); ContextUtils.getApplicationContext().startActivity(intent); }
Example #13
Source File: ClearBrowsingDataTabsFragment.java From 365browser with Apache License 2.0 | 5 votes |
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment. View view = inflater.inflate(R.layout.clear_browsing_data_tabs, container, false); // Get the ViewPager and set its PagerAdapter so that it can display items. ViewPager viewPager = (ViewPager) view.findViewById(R.id.clear_browsing_data_viewpager); viewPager.setAdapter( new ClearBrowsingDataPagerAdapter(getFragmentManager(), getActivity())); // Give the TabLayout the ViewPager. TabLayout tabLayout = (TabLayout) view.findViewById(R.id.clear_browsing_data_tabs); tabLayout.setupWithViewPager(viewPager); tabLayout.addOnTabSelectedListener(new TabSelectListener()); int tabIndex = adjustIndexForDirectionality( PrefServiceBridge.getInstance().getLastSelectedClearBrowsingDataTab()); TabLayout.Tab tab = tabLayout.getTabAt(tabIndex); if (tab != null) { tab.select(); } // Remove elevation to avoid shadow between title and tabs. Preferences activity = (Preferences) getActivity(); activity.getSupportActionBar().setElevation(0.0f); return view; }
Example #14
Source File: SearchGeolocationDisclosureInfoBar.java From 365browser with Apache License 2.0 | 5 votes |
@CalledByNative private static void showSettingsPage(String searchUrl) { Context context = ContextUtils.getApplicationContext(); Intent settingsIntent = PreferencesLauncher.createIntentForSettingsPage( context, SingleWebsitePreferences.class.getName()); Bundle fragmentArgs = SingleWebsitePreferences.createFragmentArgsForSite(searchUrl); settingsIntent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs); IntentUtils.safeStartActivity(context, settingsIntent); }