diff --git a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java
index 5913dad17..520502025 100644
--- a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java
+++ b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java
@@ -15,6 +15,7 @@ import java.util.List;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
+import eu.siacs.conversations.ui.util.DelayedHintHelper;
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
import eu.siacs.conversations.xmpp.jid.Jid;
@@ -47,10 +48,8 @@ public class EnterJidDialog {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
View dialogView = LayoutInflater.from(context).inflate(R.layout.enter_jid_dialog, null);
- final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id);
- jabberIdDesc.setText(R.string.account_settings_jabber_id);
- final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account);
- final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid);
+ final Spinner spinner = dialogView.findViewById(R.id.account);
+ final AutoCompleteTextView jid = dialogView.findViewById(R.id.jid);
jid.setAdapter(new KnownHostsAdapter(context, R.layout.simple_list_item, knownHosts));
if (prefilledJid != null) {
jid.append(prefilledJid);
@@ -62,7 +61,7 @@ public class EnterJidDialog {
}
}
- jid.setHint(R.string.account_settings_example_jabber_id);
+ DelayedHintHelper.setHint(R.string.account_settings_example_jabber_id,jid);
if (account == null) {
StartConversationActivity.populateAccountSpinner(context, activatedAccounts, spinner);
@@ -80,38 +79,35 @@ public class EnterJidDialog {
builder.setPositiveButton(positiveButton, null);
this.dialog = builder.create();
- this.dialogOnClick = new View.OnClickListener() {
- @Override
- public void onClick(final View v) {
- final Jid accountJid;
- if (!spinner.isEnabled() && account == null) {
- return;
- }
- try {
- if (Config.DOMAIN_LOCK != null) {
- accountJid = Jid.fromParts((String) spinner.getSelectedItem(), Config.DOMAIN_LOCK, null);
- } else {
- accountJid = Jid.fromString((String) spinner.getSelectedItem());
- }
- } catch (final InvalidJidException e) {
- return;
- }
- final Jid contactJid;
- try {
- contactJid = Jid.fromString(jid.getText().toString());
- } catch (final InvalidJidException e) {
- jid.setError(context.getString(R.string.invalid_jid));
- return;
+ this.dialogOnClick = v -> {
+ final Jid accountJid;
+ if (!spinner.isEnabled() && account == null) {
+ return;
+ }
+ try {
+ if (Config.DOMAIN_LOCK != null) {
+ accountJid = Jid.fromParts((String) spinner.getSelectedItem(), Config.DOMAIN_LOCK, null);
+ } else {
+ accountJid = Jid.fromString((String) spinner.getSelectedItem());
}
+ } catch (final InvalidJidException e) {
+ return;
+ }
+ final Jid contactJid;
+ try {
+ contactJid = Jid.fromString(jid.getText().toString());
+ } catch (final InvalidJidException e) {
+ jid.setError(context.getString(R.string.invalid_jid));
+ return;
+ }
- if(listener != null) {
- try {
- if(listener.onEnterJidDialogPositive(accountJid, contactJid)) {
- dialog.dismiss();
- }
- } catch(JidError error) {
- jid.setError(error.toString());
+ if(listener != null) {
+ try {
+ if(listener.onEnterJidDialogPositive(accountJid, contactJid)) {
+ dialog.dismiss();
}
+ } catch(JidError error) {
+ jid.setError(error.toString());
}
}
};
diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
index a13d3f402..314bc1bbf 100644
--- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
@@ -76,6 +76,7 @@ import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate;
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
import eu.siacs.conversations.ui.adapter.ListItemAdapter;
import eu.siacs.conversations.ui.service.EmojiService;
+import eu.siacs.conversations.ui.util.DelayedHintHelper;
import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.XmppConnection;
@@ -493,9 +494,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
final View dialogView = getLayoutInflater().inflate(R.layout.join_conference_dialog, null);
final Spinner spinner = dialogView.findViewById(R.id.account);
final AutoCompleteTextView jid = dialogView.findViewById(R.id.jid);
- final TextView jabberIdDesc = dialogView.findViewById(R.id.jabber_id);
- jabberIdDesc.setText(R.string.conference_address);
- jid.setHint(R.string.conference_address_example);
+ DelayedHintHelper.setHint(R.string.conference_address_example,jid);
jid.setAdapter(new KnownHostsAdapter(this, R.layout.simple_list_item, mKnownConferenceHosts));
if (prefilledJid != null) {
jid.append(prefilledJid);
diff --git a/src/main/java/eu/siacs/conversations/ui/util/DelayedHintHelper.java b/src/main/java/eu/siacs/conversations/ui/util/DelayedHintHelper.java
new file mode 100644
index 000000000..805b8f217
--- /dev/null
+++ b/src/main/java/eu/siacs/conversations/ui/util/DelayedHintHelper.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2018, Daniel Gultsch All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package eu.siacs.conversations.ui.util;
+
+import android.os.Handler;
+import android.support.annotation.StringRes;
+import android.widget.EditText;
+
+public class DelayedHintHelper {
+
+ public static void setHint(@StringRes final int res, EditText editText) {
+ editText.setOnFocusChangeListener((v, hasFocus) -> {
+ if (hasFocus) {
+ new Handler().postDelayed(() -> editText.setHint(res), 200);
+ } else {
+ editText.setHint(null);
+ }
+ });
+ }
+
+}
diff --git a/src/main/res/layout/activity_change_password.xml b/src/main/res/layout/activity_change_password.xml
index c7e077d56..3f8ceff1b 100644
--- a/src/main/res/layout/activity_change_password.xml
+++ b/src/main/res/layout/activity_change_password.xml
@@ -39,10 +39,7 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:hint="@string/current_password"
- android:inputType="textPassword"
- android:textColor="?attr/color_text_primary"
- android:textColorHint="?attr/color_text_secondary"
- android:textSize="?attr/TextSizeBody"/>
+ android:inputType="textPassword"/>
+ android:inputType="textPassword"/>
diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml
index 9d9d0619f..7bb630ecb 100644
--- a/src/main/res/layout/activity_edit_account.xml
+++ b/src/main/res/layout/activity_edit_account.xml
@@ -61,10 +61,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
- android:inputType="textEmailAddress"
- android:textColor="?attr/color_text_primary"
- android:textColorHint="?attr/color_text_secondary"
- android:textSize="?attr/TextSizeBody"/>
+ android:inputType="textEmailAddress"/>
@@ -82,10 +79,7 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:hint="@string/password"
- android:inputType="textPassword"
- android:textColor="?attr/color_text_primary"
- android:textColorHint="?attr/color_text_secondary"
- android:textSize="?attr/TextSizeBody"/>
+ android:inputType="textPassword"/>
+ android:inputType="textNoSuggestions"/>
@@ -136,10 +127,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="number"
- android:maxLength="5"
- android:textColor="?attr/color_text_primary"
- android:textColorHint="?attr/color_text_secondary"
- android:textSize="?attr/TextSizeBody"/>
+ android:maxLength="5"/>
@@ -149,9 +137,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
- android:text="@string/register_account"
- android:textColor="?attr/color_text_primary"
- android:textSize="?attr/TextSizeBody"/>
+ android:text="@string/register_account"/>
diff --git a/src/main/res/layout/create_conference_dialog.xml b/src/main/res/layout/create_conference_dialog.xml
index d81ed0f20..0fc3ec258 100644
--- a/src/main/res/layout/create_conference_dialog.xml
+++ b/src/main/res/layout/create_conference_dialog.xml
@@ -7,36 +7,34 @@
android:paddingLeft="?attr/dialog_horizontal_padding"
android:paddingRight="?attr/dialog_horizontal_padding"
android:paddingTop="?attr/dialog_vertical_padding">
-
-
+ style="@style/InputLabel" />
+ android:layout_height="wrap_content"/>
-
+
-
+
+
+
+
+
diff --git a/src/main/res/layout/enter_jid_dialog.xml b/src/main/res/layout/enter_jid_dialog.xml
index 700fea9b2..de178726c 100644
--- a/src/main/res/layout/enter_jid_dialog.xml
+++ b/src/main/res/layout/enter_jid_dialog.xml
@@ -1,43 +1,35 @@
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingBottom="?attr/dialog_vertical_padding"
+ android:paddingLeft="?attr/dialog_horizontal_padding"
+ android:paddingRight="?attr/dialog_horizontal_padding"
+ android:paddingTop="?attr/dialog_vertical_padding">
+ android:text="@string/your_account"/>
+ android:layout_height="wrap_content"/>
-
+ android:hint="@string/account_settings_jabber_id">
-
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/join_conference_dialog.xml b/src/main/res/layout/join_conference_dialog.xml
index 6339a8a6d..d89b95c39 100644
--- a/src/main/res/layout/join_conference_dialog.xml
+++ b/src/main/res/layout/join_conference_dialog.xml
@@ -7,38 +7,30 @@
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingTop="16dp">
-
+ android:text="@string/your_account"/>
-
+ android:hint="@string/conference_address">
+
+
+
-
+ android:text="@string/save_as_bookmark"/>
\ No newline at end of file
diff --git a/src/main/res/layout/simple_list_item.xml b/src/main/res/layout/simple_list_item.xml
index 702119605..d6e9f0467 100644
--- a/src/main/res/layout/simple_list_item.xml
+++ b/src/main/res/layout/simple_list_item.xml
@@ -18,8 +18,7 @@
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textColor="?attr/color_text_primary"
- android:textSize="?attr/TextSizeBody"
+ android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:gravity="center_vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
diff --git a/src/main/res/values/dimens.xml b/src/main/res/values/dimens.xml
index c85e619ee..143ee59d3 100644
--- a/src/main/res/values/dimens.xml
+++ b/src/main/res/values/dimens.xml
@@ -15,6 +15,9 @@
8dp
96dp
+ 4dp
+ 4dp
+
4dp
8dp
diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml
index 5804acce0..6348a0346 100644
--- a/src/main/res/values/styles.xml
+++ b/src/main/res/values/styles.xml
@@ -2,4 +2,9 @@
+
\ No newline at end of file