mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
parent
a353ebd834
commit
f07ce7b1f1
@ -31,6 +31,8 @@ public class SmsMmsPreferenceFragment extends CorrectedPreferenceFragment {
|
|||||||
|
|
||||||
this.findPreference(MMS_PREF)
|
this.findPreference(MMS_PREF)
|
||||||
.setOnPreferenceClickListener(new ApnPreferencesClickListener());
|
.setOnPreferenceClickListener(new ApnPreferencesClickListener());
|
||||||
|
|
||||||
|
initializePlatformSpecificOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,7 +40,7 @@ public class SmsMmsPreferenceFragment extends CorrectedPreferenceFragment {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
((ApplicationPreferencesActivity) getActivity()).getSupportActionBar().setTitle(R.string.preferences__sms_mms);
|
((ApplicationPreferencesActivity) getActivity()).getSupportActionBar().setTitle(R.string.preferences__sms_mms);
|
||||||
|
|
||||||
initializePlatformSpecificOptions();
|
initializeDefaultPreference();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializePlatformSpecificOptions() {
|
private void initializePlatformSpecificOptions() {
|
||||||
@ -51,18 +53,6 @@ public class SmsMmsPreferenceFragment extends CorrectedPreferenceFragment {
|
|||||||
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
|
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
|
||||||
if (allSmsPreference != null) preferenceScreen.removePreference(allSmsPreference);
|
if (allSmsPreference != null) preferenceScreen.removePreference(allSmsPreference);
|
||||||
if (allMmsPreference != null) preferenceScreen.removePreference(allMmsPreference);
|
if (allMmsPreference != null) preferenceScreen.removePreference(allMmsPreference);
|
||||||
|
|
||||||
if (Util.isDefaultSmsProvider(getActivity())) {
|
|
||||||
defaultPreference.setIntent(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
|
|
||||||
defaultPreference.setTitle(getString(R.string.ApplicationPreferencesActivity_sms_enabled));
|
|
||||||
defaultPreference.setSummary(getString(R.string.ApplicationPreferencesActivity_touch_to_change_your_default_sms_app));
|
|
||||||
} else {
|
|
||||||
Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
|
|
||||||
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, getActivity().getPackageName());
|
|
||||||
defaultPreference.setIntent(intent);
|
|
||||||
defaultPreference.setTitle(getString(R.string.ApplicationPreferencesActivity_sms_disabled));
|
|
||||||
defaultPreference.setSummary(getString(R.string.ApplicationPreferencesActivity_touch_to_make_signal_your_default_sms_app));
|
|
||||||
}
|
|
||||||
} else if (defaultPreference != null) {
|
} else if (defaultPreference != null) {
|
||||||
preferenceScreen.removePreference(defaultPreference);
|
preferenceScreen.removePreference(defaultPreference);
|
||||||
}
|
}
|
||||||
@ -72,6 +62,23 @@ public class SmsMmsPreferenceFragment extends CorrectedPreferenceFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initializeDefaultPreference() {
|
||||||
|
if (VERSION.SDK_INT < VERSION_CODES.KITKAT) return;
|
||||||
|
|
||||||
|
Preference defaultPreference = findPreference(KITKAT_DEFAULT_PREF);
|
||||||
|
if (Util.isDefaultSmsProvider(getActivity())) {
|
||||||
|
defaultPreference.setIntent(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
|
||||||
|
defaultPreference.setTitle(getString(R.string.ApplicationPreferencesActivity_sms_enabled));
|
||||||
|
defaultPreference.setSummary(getString(R.string.ApplicationPreferencesActivity_touch_to_change_your_default_sms_app));
|
||||||
|
} else {
|
||||||
|
Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
|
||||||
|
intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, getActivity().getPackageName());
|
||||||
|
defaultPreference.setIntent(intent);
|
||||||
|
defaultPreference.setTitle(getString(R.string.ApplicationPreferencesActivity_sms_disabled));
|
||||||
|
defaultPreference.setSummary(getString(R.string.ApplicationPreferencesActivity_touch_to_make_signal_your_default_sms_app));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class ApnPreferencesClickListener implements Preference.OnPreferenceClickListener {
|
private class ApnPreferencesClickListener implements Preference.OnPreferenceClickListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user