use of android.preference.Preference.OnPreferenceClickListener in project Aegis by Decad3nce.
the class AdvancedSettingsFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.advanced_preferences);
final Preference removeAdmin = findPreference("remove_admin");
final Preference installToSystem = findPreference("install_to_system");
final DevicePolicyManager mDPM = (DevicePolicyManager) getActivity().getSystemService(Context.DEVICE_POLICY_SERVICE);
if (mDPM.getActiveAdmins() == null || !mDPM.isAdminActive(AegisActivity.DEVICE_ADMIN_COMPONENT)) {
PreferenceCategory mCategory = (PreferenceCategory) findPreference("advanced_category");
mCategory.removePreference(removeAdmin);
}
Preference.OnPreferenceClickListener preferenceListener = (new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference.getKey().equals(ADVANCED_PREFERENCES_REMOVE_ADMIN)) {
if (mDPM.isAdminActive(AegisActivity.DEVICE_ADMIN_COMPONENT)) {
removeAdmin(mDPM, removeAdmin);
}
}
if (preference.getKey().equals(ADVANCED_PREFERENCES_INSTALL_TO_SYSTEM)) {
DialogFragment dialog = new InstallToSystemDialogFragment();
dialog.show(getActivity().getFragmentManager(), "InstallToSystemDialogFragment");
}
return false;
}
});
removeAdmin.setOnPreferenceClickListener(preferenceListener);
installToSystem.setOnPreferenceClickListener(preferenceListener);
}
use of android.preference.Preference.OnPreferenceClickListener 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.OnPreferenceClickListener 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.OnPreferenceClickListener 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.OnPreferenceClickListener 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