use of android.preference.Preference in project AndroidChromium by JackyAndroid.
the class AccountManagementFragment method configureGoogleActivityControls.
private void configureGoogleActivityControls() {
Preference pref = findPreference(PREF_GOOGLE_ACTIVITY_CONTROLS);
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Activity activity = getActivity();
((ChromeApplication) (activity.getApplicationContext())).createGoogleActivityController().openWebAndAppActivitySettings(activity, ChromeSigninController.get(activity).getSignedInAccountName());
RecordUserAction.record("Signin_AccountSettings_GoogleActivityControlsClicked");
return true;
}
});
}
use of android.preference.Preference in project AndroidChromium by JackyAndroid.
the class AccountManagementFragment method configureSyncSettings.
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;
}
});
}
use of android.preference.Preference in project AndroidChromium by JackyAndroid.
the class AccountManagementFragment method configureAddAccountPreference.
private void configureAddAccountPreference() {
ChromeBasePreference addAccount = (ChromeBasePreference) findPreference(PREF_ADD_ACCOUNT);
if (ChildAccountService.isChildAccount()) {
getPreferenceScreen().removePreference(addAccount);
} else {
addAccount.setTitle(getResources().getString(R.string.account_management_add_account_title));
addAccount.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (!isVisible() || !isResumed())
return false;
AccountManagementScreenHelper.logEvent(ProfileAccountManagementMetrics.ADD_ACCOUNT, mGaiaServiceType);
AccountAdder.getInstance().addAccount(getActivity(), AccountAdder.ADD_ACCOUNT_RESULT);
// Return to the last opened tab if triggered from the content area.
if (mGaiaServiceType != AccountManagementScreenHelper.GAIA_SERVICE_TYPE_NONE) {
if (isAdded())
getActivity().finish();
}
return true;
}
});
addAccount.setManagedPreferenceDelegate(new ManagedPreferenceDelegate() {
@Override
public boolean isPreferenceControlledByPolicy(Preference preference) {
return !canAddAccounts();
}
});
}
}
use of android.preference.Preference in project AndroidChromium by JackyAndroid.
the class DoNotTrackPreference method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.do_not_track_preferences);
getActivity().setTitle(R.string.do_not_track_title);
ChromeSwitchPreference doNotTrackSwitch = (ChromeSwitchPreference) findPreference(PREF_DO_NOT_TRACK_SWITCH);
boolean isDoNotTrackEnabled = PrefServiceBridge.getInstance().isDoNotTrackEnabled();
doNotTrackSwitch.setChecked(isDoNotTrackEnabled);
doNotTrackSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
PrefServiceBridge.getInstance().setDoNotTrackEnabled((boolean) newValue);
return true;
}
});
}
use of android.preference.Preference in project AndroidChromium by JackyAndroid.
the class PhysicalWebPreferenceFragment method initLaunchButton.
private void initLaunchButton() {
ButtonPreference physicalWebLaunch = (ButtonPreference) findPreference(PREF_PHYSICAL_WEB_LAUNCH);
physicalWebLaunch.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivity(createListUrlsIntent(getActivity()));
return true;
}
});
}
Aggregations