aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java6
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java7
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java8
5 files changed, 13 insertions, 13 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();
}