diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-01 14:19:06 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-01 14:19:06 +0200 |
commit | cec483b70d6bd480ee6b3fa1be2fd2432a8d2ae6 (patch) | |
tree | 0b636cb00c900572131e81c8cc5a0d563f7503ce | |
parent | a70f8423f0389916b3c2d7b1b708feebce1aa59b (diff) |
removed 'preemptive grant' setting
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 3 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 6 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/SettingsActivity.java | 7 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/StartConversationActivity.java | 2 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/XmppActivity.java | 8 | ||||
-rw-r--r-- | src/main/res/values-de/strings.xml | 2 | ||||
-rw-r--r-- | src/main/res/values-el/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-es/strings.xml | 2 | ||||
-rw-r--r-- | src/main/res/values-eu/strings.xml | 2 | ||||
-rw-r--r-- | src/main/res/values-fr/strings.xml | 2 | ||||
-rw-r--r-- | src/main/res/values/defaults.xml | 1 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/main/res/xml/preferences.xml | 9 |
13 files changed, 16 insertions, 31 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 74c6a84f6..69b329dce 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -3006,8 +3006,7 @@ public class XmppConnectionService extends Service { } } - public void createContact(Contact contact) { - boolean autoGrant = getBooleanPreference("grant_new_contacts", R.bool.grant_new_contacts); + public void createContact(Contact contact, boolean autoGrant) { if (autoGrant) { contact.setOption(Contact.Options.PREEMPTIVE_GRANT); contact.setOption(Contact.Options.ASKING); diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index fcf28da2c..749d6a408 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -329,7 +329,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke public void onClick(View v) { final Contact contact = conversation == null ? null : conversation.getContact(); if (contact != null) { - activity.xmppConnectionService.createContact(contact); + activity.xmppConnectionService.createContact(contact, true); activity.switchToContactDetails(contact); } } @@ -1953,6 +1953,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke setupIme(); + final boolean scrolledToBottomAndNoPending = this.scrolledToBottom() && pendingScrollState.peek() == null; + this.binding.textSendButton.setContentDescription(activity.getString(R.string.send_message_to_x, conversation.getName())); this.binding.textinput.setKeyboardListener(null); this.binding.textinput.setText(""); @@ -1962,8 +1964,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke refresh(false); this.conversation.messagesLoaded.set(true); - final boolean scrolledToBottomAndNoPending = this.scrolledToBottom() && pendingScrollState.peek() == null; - Log.d(Config.LOGTAG, "scrolledToBottomAndNoPending=" + Boolean.toString(scrolledToBottomAndNoPending)); if (hasExtras || scrolledToBottomAndNoPending) { diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java index c832809d6..733642579 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java @@ -102,6 +102,8 @@ public class SettingsActivity extends XmppActivity implements } } + PreferenceScreen mainPreferenceScreen = (PreferenceScreen) mSettingsFragment.findPreference("main_screen"); + //this feature is only available on Huawei Android 6. PreferenceScreen huaweiPreferenceScreen = (PreferenceScreen) mSettingsFragment.findPreference("huawei"); if (huaweiPreferenceScreen != null) { @@ -110,6 +112,11 @@ public class SettingsActivity extends XmppActivity implements if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M || !isCallable(intent)) { PreferenceCategory generalCategory = (PreferenceCategory) mSettingsFragment.findPreference("general"); generalCategory.removePreference(huaweiPreferenceScreen); + if (generalCategory.getPreferenceCount() == 0) { + if (mainPreferenceScreen != null) { + mainPreferenceScreen.removePreference(generalCategory); + } + } } } diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index 5988461e0..04b3d860a 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -458,7 +458,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } else if (contact.showInRoster()) { throw new EnterJidDialog.JidError(getString(R.string.contact_already_exists)); } else { - xmppConnectionService.createContact(contact); + xmppConnectionService.createContact(contact, true); if (invite != null && invite.hasFingerprints()) { xmppConnectionService.verifyFingerprints(contact, invite.getFingerprints()); } diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 19bc5e96f..4ae530d37 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -674,13 +674,7 @@ public abstract class XmppActivity extends AppCompatActivity { builder.setTitle(contact.getJid().toString()); builder.setMessage(getString(R.string.not_in_roster)); builder.setNegativeButton(getString(R.string.cancel), null); - builder.setPositiveButton(getString(R.string.add_contact), - (dialog, which) -> { - final Jid jid = contact.getJid(); - Account account = contact.getAccount(); - Contact contact1 = account.getRoster().getContact(jid); - xmppConnectionService.createContact(contact1); - }); + builder.setPositiveButton(getString(R.string.add_contact), (dialog, which) -> xmppConnectionService.createContact(contact, true)); builder.create().show(); } diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 651fe4a18..533a2ee2c 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -122,8 +122,6 @@ <string name="openpgp_error">Fehler mit OpenKeychain</string> <string name="accept">Annehmen</string> <string name="error">Ein Fehler ist aufgetreten</string> - <string name="pref_grant_presence_updates">Online-Status</string> - <string name="pref_grant_presence_updates_summary">Erlaube neu hinzugefügten Kontakten meinen Online-Status zu sehen und frage um Erlaubnis, ihren sehen zu dürfen</string> <string name="your_account">Dein Profil</string> <string name="send_presence_updates">Online-Status senden</string> <string name="receive_presence_updates">Online-Status empfangen</string> diff --git a/src/main/res/values-el/strings.xml b/src/main/res/values-el/strings.xml index e858b762d..15ff5d562 100644 --- a/src/main/res/values-el/strings.xml +++ b/src/main/res/values-el/strings.xml @@ -88,7 +88,6 @@ <string name="openpgp_error">Το OpenKeychain ανέφερε κάποιο σφάλμα</string> <string name="accept">Αποδοχή</string> <string name="error">Έχει συμβεί κάποιο σφάλμα</string> - <string name="pref_grant_presence_updates">Χορήγηση ενημερώσεων παρουσίας</string> <string name="your_account">Ο λογαριασμός σας</string> <string name="send_presence_updates">Αποστολή ενημερώσεων παρουσίας</string> <string name="receive_presence_updates">Λήψη ενημερώσεων παρουσίας</string> diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml index dbb41aa73..4aa16119c 100644 --- a/src/main/res/values-es/strings.xml +++ b/src/main/res/values-es/strings.xml @@ -122,8 +122,6 @@ <string name="openpgp_error">OpenKeychain reportó un error</string> <string name="accept">Aceptar</string> <string name="error">Ha ocurrido un error</string> - <string name="pref_grant_presence_updates">Suscripción de presencia automática</string> - <string name="pref_grant_presence_updates_summary">De forma automática solicitar y conceder la suscripción de presencia de los contactos que has creado</string> <string name="your_account">Tu cuenta</string> <string name="send_presence_updates">Enviar actualizaciones de presencia</string> <string name="receive_presence_updates">Recibir actualizaciones de presencia</string> diff --git a/src/main/res/values-eu/strings.xml b/src/main/res/values-eu/strings.xml index 8932df618..55fbe20a2 100644 --- a/src/main/res/values-eu/strings.xml +++ b/src/main/res/values-eu/strings.xml @@ -112,8 +112,6 @@ <string name="openpgp_error">OpenKeychainek akats baten berri eman du</string> <string name="accept">Onartu</string> <string name="error">Akats bat gertatu da</string> - <string name="pref_grant_presence_updates">Presentzia eguneraketak eman</string> - <string name="pref_grant_presence_updates_summary">Prebentiboki presentzia eguneraketak eman eta eskatu sortu dituzun kontaktuetarako</string> <string name="your_account">Zure kontua</string> <string name="send_presence_updates">Presentzia eguneraketak bidali</string> <string name="receive_presence_updates">Presentzia eguneraketak jaso</string> diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml index 1187a3a6c..a811bd0f9 100644 --- a/src/main/res/values-fr/strings.xml +++ b/src/main/res/values-fr/strings.xml @@ -108,8 +108,6 @@ <string name="openpgp_error">OpenKeychain a signalé une erreur</string> <string name="accept">Accepter</string> <string name="error">Une erreur s\'est produite</string> - <string name="pref_grant_presence_updates">Autoriser les màj de disponibilité</string> - <string name="pref_grant_presence_updates_summary">Accorder et demander par avance les mises à jour de présence aux contacts que vous avez ajoutés</string> <string name="your_account">Votre compte</string> <string name="send_presence_updates">Envoyer mes màj de disponibilité</string> <string name="receive_presence_updates">Recevoir ses màj de disponibilité</string> diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml index 71f1d5937..67545e6a9 100644 --- a/src/main/res/values/defaults.xml +++ b/src/main/res/values/defaults.xml @@ -70,7 +70,6 @@ <string name="picture_compression">auto</string> <string name="image_compression">mid</string> <string name="video_compression">mid</string> - <bool name="grant_new_contacts">true</bool> <integer name="automatic_message_deletion">0</integer> <bool name="confirm_messages">true</bool> <bool name="allow_message_correction">true</bool> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 6e65e6803..5e7ac836e 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -121,8 +121,6 @@ <string name="openpgp_error">OpenKeychain reported an error</string> <string name="accept">Accept</string> <string name="error">An error has occurred</string> - <string name="pref_grant_presence_updates">Grant presence updates</string> - <string name="pref_grant_presence_updates_summary">Preemptively grant and request presence subscriptions for contacts you have created</string> <string name="your_account">Your account</string> <string name="send_presence_updates">Send presence updates</string> <string name="receive_presence_updates">Receive presence updates</string> diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 61120254a..830d0607f 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> +<PreferenceScreen + android:key="main_screen" + xmlns:android="http://schemas.android.com/apk/res/android"> <!--UI--> <PreferenceScreen android:icon="@drawable/ic_image_black_24dp" @@ -199,11 +201,6 @@ android:key="security" android:title="@string/pref_security_settings"> <CheckBoxPreference - android:defaultValue="@bool/grant_new_contacts" - android:key="grant_new_contacts" - android:summary="@string/pref_grant_presence_updates_summary" - android:title="@string/pref_grant_presence_updates" /> - <CheckBoxPreference android:defaultValue="@bool/confirm_messages" android:key="confirm_messages" android:summary="@string/pref_confirm_messages_summary" |