~singpolyma/cheogram-android

01207ff6170c6a64a8e22c452d7486f04e5290da — Stephen Paul Weber a month ago 14a51f8
Use more features of the TextInputLayout
M src/cheogram/res/layout/command_checkbox_field.xml => src/cheogram/res/layout/command_checkbox_field.xml +2 -1
@@ 31,7 31,8 @@
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingLeft="16dp"
                android:textAppearance="@style/TextAppearance.Conversations.Status" />
                android:textAppearance="@style/TextAppearance.Conversations.Status"
                android:textColor="?android:textColorSecondary" />

        </LinearLayout>


M src/cheogram/res/layout/command_radio_edit_field.xml => src/cheogram/res/layout/command_radio_edit_field.xml +1 -1
@@ 47,7 47,7 @@
            android:paddingLeft="16dp"
            android:paddingRight="8dp"
            android:textAppearance="@style/TextAppearance.Conversations.Status"
            android:textColor="?attr/edit_text_color" />
            android:textColor="?android:textColorSecondary" />

    </LinearLayout>
</layout>

M src/cheogram/res/layout/command_result_field.xml => src/cheogram/res/layout/command_result_field.xml +1 -1
@@ 36,7 36,7 @@
            android:paddingLeft="8dp"
            android:paddingRight="8dp"
            android:textAppearance="@style/TextAppearance.Conversations.Status"
            android:textColor="?attr/edit_text_color" />
            android:textColor="?android:textColorSecondary" />

    </LinearLayout>
</layout>

M src/cheogram/res/layout/command_spinner_field.xml => src/cheogram/res/layout/command_spinner_field.xml +1 -1
@@ 32,7 32,7 @@
            android:paddingLeft="16dp"
            android:paddingRight="8dp"
            android:textAppearance="@style/TextAppearance.Conversations.Status"
            android:textColor="?attr/edit_text_color" />
            android:textColor="?android:textColorSecondary" />

    </LinearLayout>
</layout>

M src/cheogram/res/layout/command_text_field.xml => src/cheogram/res/layout/command_text_field.xml +5 -17
@@ 1,11 1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="16dp"
        android:orientation="vertical">

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/textinput_layout"


@@ 13,10 8,13 @@
            android:layout_height="wrap_content"
            android:paddingLeft="8dp"
            android:paddingRight="8dp"
            android:paddingBottom="16dp"
            app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error"
            app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint">
            app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint"
            app:helperTextTextAppearance="@style/TextAppearance.Conversations.Status"
            app:helperTextTextColor="?android:textColorSecondary">

            <EditText
            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/textinput"
                style="@style/Widget.Conversations.EditText"
                android:layout_width="match_parent"


@@ 28,14 26,4 @@

        </com.google.android.material.textfield.TextInputLayout>

        <TextView
            android:id="@+id/desc"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="16dp"
            android:paddingRight="8dp"
            android:textAppearance="@style/TextAppearance.Conversations.Status"
            android:textColor="?attr/edit_text_color" />

    </LinearLayout>
</layout>

M src/main/java/eu/siacs/conversations/entities/Conversation.java => src/main/java/eu/siacs/conversations/entities/Conversation.java +9 -6
@@ 37,6 37,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;
import com.google.android.material.textfield.TextInputLayout;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.Lists;



@@ 1342,8 1343,9 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl

                abstract public void bind(Element el);

                protected void setupInputType(Element field, TextView textinput) {
                protected void setupInputType(Element field, TextView textinput, TextInputLayout layout) {
                    int flags = 0;
                    if (layout != null) layout.setEndIconMode(TextInputLayout.END_ICON_NONE);
                    textinput.setInputType(flags | InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT);

                    String type = field.getAttribute("type");


@@ 1360,6 1362,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl

                        if (type.equals("text-private")) {
                            textinput.setInputType(flags | InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
                            if (layout != null) layout.setEndIconMode(TextInputLayout.END_ICON_PASSWORD_TOGGLE);
                        }
                    }



@@ 1576,7 1579,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
                    Element validate = field.findChild("validate", "http://jabber.org/protocol/xdata-validate");
                    binding.open.setVisibility((validate != null && validate.findChild("open", "http://jabber.org/protocol/xdata-validate") != null) ? View.VISIBLE : View.GONE);
                    binding.open.setText(mValue.getContent());
                    setupInputType(field, binding.open);
                    setupInputType(field, binding.open, null);

                    options.clear();
                    List<Option> theOptions = Option.forField(field);


@@ 1693,10 1696,10 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl

                    String desc = field.findChildContent("desc", "jabber:x:data");
                    if (desc == null) {
                        binding.desc.setVisibility(View.GONE);
                        binding.textinputLayout.setHelperTextEnabled(false);
                    } else {
                        binding.desc.setVisibility(View.VISIBLE);
                        binding.desc.setText(desc);
                        binding.textinputLayout.setHelperTextEnabled(true);
                        binding.textinputLayout.setHelperText(desc);
                    }

                    mValue = field.findChild("value", "jabber:x:data");


@@ 1704,7 1707,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
                        mValue = field.addChild("value", "jabber:x:data");
                    }
                    binding.textinput.setText(mValue.getContent());
                    setupInputType(field, binding.textinput);
                    setupInputType(field, binding.textinput, binding.textinputLayout);
                }

                @Override