Search in sources :

Example 1 with CustomDefaultPreference

use of org.thoughtcrime.securesms.components.CustomDefaultPreference in project Signal-Android by signalapp.

the class CorrectedPreferenceFragment method onDisplayPreferenceDialog.

@Override
public void onDisplayPreferenceDialog(Preference preference) {
    DialogFragment dialogFragment = null;
    if (preference instanceof ColorPickerPreference) {
        dialogFragment = ColorPickerPreferenceDialogFragmentCompat.newInstance(preference.getKey());
    } else if (preference instanceof CustomDefaultPreference) {
        dialogFragment = CustomDefaultPreference.CustomDefaultPreferenceDialogFragmentCompat.newInstance(preference.getKey());
    }
    if (dialogFragment != null) {
        dialogFragment.setTargetFragment(this, 0);
        dialogFragment.show(getFragmentManager(), "android.support.v7.preference.PreferenceFragment.DIALOG");
    } else {
        super.onDisplayPreferenceDialog(preference);
    }
}
Also used : DialogFragment(android.support.v4.app.DialogFragment) ColorPickerPreference(org.thoughtcrime.securesms.preferences.widgets.ColorPickerPreference) CustomDefaultPreference(org.thoughtcrime.securesms.components.CustomDefaultPreference)

Example 2 with CustomDefaultPreference

use of org.thoughtcrime.securesms.components.CustomDefaultPreference in project Signal-Android by WhisperSystems.

the class CorrectedPreferenceFragment method onDisplayPreferenceDialog.

@Override
public void onDisplayPreferenceDialog(Preference preference) {
    DialogFragment dialogFragment = null;
    if (preference instanceof ColorPickerPreference) {
        dialogFragment = ColorPickerPreferenceDialogFragmentCompat.newInstance(preference.getKey());
    } else if (preference instanceof CustomDefaultPreference) {
        dialogFragment = CustomDefaultPreference.CustomDefaultPreferenceDialogFragmentCompat.newInstance(preference.getKey());
    }
    if (dialogFragment != null) {
        dialogFragment.setTargetFragment(this, 0);
        dialogFragment.show(getFragmentManager(), "android.support.v7.preference.PreferenceFragment.DIALOG");
    } else {
        super.onDisplayPreferenceDialog(preference);
    }
}
Also used : DialogFragment(androidx.fragment.app.DialogFragment) ColorPickerPreference(org.thoughtcrime.securesms.preferences.widgets.ColorPickerPreference) CustomDefaultPreference(org.thoughtcrime.securesms.components.CustomDefaultPreference)

Aggregations

CustomDefaultPreference (org.thoughtcrime.securesms.components.CustomDefaultPreference)2 ColorPickerPreference (org.thoughtcrime.securesms.preferences.widgets.ColorPickerPreference)2 DialogFragment (android.support.v4.app.DialogFragment)1 DialogFragment (androidx.fragment.app.DialogFragment)1