aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java16
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java13
3 files changed, 18 insertions, 16 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
index c7847f64b..c55a936cd 100644
--- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
@@ -227,7 +227,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
@Override
public String onValueEdited(String value) {
- xmppConnectionService.pushSubjectToConference(mConversation, value);
+ xmppConnectionService.pushSubjectToConference(mConversation, value.trim().isEmpty() ? null : value.trim());
return null;
}
};
@@ -324,7 +324,8 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
if (mConversation != null) {
quickEdit(mConversation.getMucOptions().getSubject(),
R.string.edit_subject_hint,
- this.onSubjectEdited);
+ this.onSubjectEdited,
+ true);
}
break;
case R.id.action_share_http:
diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
index a9f2a3e51..6ce1e7e70 100644
--- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
@@ -305,16 +305,12 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
case R.id.action_edit_contact:
Uri systemAccount = contact.getSystemAccount();
if (systemAccount == null) {
- quickEdit(contact.getDisplayName(), 0, new OnValueEdited() {
-
- @Override
- public String onValueEdited(String value) {
- contact.setServerName(value);
- ContactDetailsActivity.this.xmppConnectionService.pushContactToServer(contact);
- populateView();
- return null;
- }
- });
+ quickEdit(contact.getDisplayName(), 0, value -> {
+ contact.setServerName(value);
+ ContactDetailsActivity.this.xmppConnectionService.pushContactToServer(contact);
+ populateView();
+ return null;
+ }, true);
} else {
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setDataAndType(systemAccount, Contacts.CONTENT_ITEM_TYPE);
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index ef531f5fe..73a9e2f5f 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -710,18 +710,23 @@ public abstract class XmppActivity extends ActionBarActivity {
}
protected void quickEdit(String previousValue, int hint, OnValueEdited callback) {
- quickEdit(previousValue, callback, hint, false);
+ quickEdit(previousValue, callback, hint, false, false);
+ }
+
+ protected void quickEdit(String previousValue, int hint, OnValueEdited callback, boolean permitEmpty) {
+ quickEdit(previousValue, callback, hint, false, permitEmpty);
}
protected void quickPasswordEdit(String previousValue, OnValueEdited callback) {
- quickEdit(previousValue, callback, R.string.password, true);
+ quickEdit(previousValue, callback, R.string.password, true, false);
}
@SuppressLint("InflateParams")
private void quickEdit(final String previousValue,
final OnValueEdited callback,
final int hint,
- boolean password) {
+ boolean password,
+ boolean permitEmpty) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = getLayoutInflater().inflate(R.layout.quickedit, null);
final EditText editor = view.findViewById(R.id.editor);
@@ -746,7 +751,7 @@ public abstract class XmppActivity extends ActionBarActivity {
dialog.show();
View.OnClickListener clickListener = v -> {
String value = editor.getText().toString();
- if (!value.equals(previousValue) && value.trim().length() > 0) {
+ if (!value.equals(previousValue) && (!value.trim().isEmpty() || permitEmpty)) {
String error = callback.onValueEdited(value);
if (error != null) {
editor.setError(error);