aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java22
-rw-r--r--src/main/res/values/arrays.xml8
2 files changed, 26 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
index 98f3939b9..ec8bc78d4 100644
--- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
@@ -150,6 +150,28 @@ public class SettingsActivity extends XmppActivity implements
automaticMessageDeletionList.setEntryValues(entryValues);
}
+ boolean removeVoice = !getApplicationContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_MICROPHONE);
+ boolean removeLocation = !getApplicationContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)
+ && !getApplicationContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_NETWORK);
+
+ 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");
if (removeCertsPreference != null) {
removeCertsPreference.setOnPreferenceClickListener(preference -> {
diff --git a/src/main/res/values/arrays.xml b/src/main/res/values/arrays.xml
index fe18139fd..ff36fe0ae 100644
--- a/src/main/res/values/arrays.xml
+++ b/src/main/res/values/arrays.xml
@@ -46,10 +46,10 @@
<string-array name="quick_action_values">
<item>none</item>
<item>recent</item>
- <item>photo</item>
- <item>picture</item>
- <item>voice</item>
- <item>location</item>
+ <item>TAKE_FROM_CAMERA</item>
+ <item>CHOOSE_PICTURE</item>
+ <item>RECORD_VOICE</item>
+ <item>SEND_LOCATION</item>
</string-array>
<string-array name="image_compression_values">