aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/SettingsActivity.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
index bc80f90a..9a4e9f8e 100644
--- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
@@ -15,6 +15,7 @@ import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
+import android.provider.MediaStore;
import android.util.Log;
import android.widget.Toast;
@@ -92,6 +93,27 @@ public class SettingsActivity extends XmppActivity implements
}
}
+ boolean removeLocation = new Intent("eu.siacs.conversations.location.request").resolveActivity(getPackageManager()) == null;
+ boolean removeVoice = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION).resolveActivity(getPackageManager()) == null;
+
+ ListPreference quickAction = (ListPreference) mSettingsFragment.findPreference("quick_action");
+ if (quickAction != null && (removeLocation || removeVoice)) {
+ ArrayList<CharSequence> entries = new ArrayList<>(Arrays.asList(quickAction.getEntries()));
+ ArrayList<CharSequence> entryValues = new ArrayList<>(Arrays.asList(quickAction.getEntryValues()));
+ int index = entryValues.indexOf("location");
+ if (index > 0 && removeLocation) {
+ entries.remove(index);
+ entryValues.remove(index);
+ }
+ index = entryValues.indexOf("voice");
+ if (index > 0 && removeVoice) {
+ entries.remove(index);
+ entryValues.remove(index);
+ }
+ quickAction.setEntries(entries.toArray(new CharSequence[entries.size()]));
+ quickAction.setEntryValues(entryValues.toArray(new CharSequence[entryValues.size()]));
+ }
+
final Preference removeCertsPreference = mSettingsFragment.findPreference("remove_trusted_certificates");
removeCertsPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override