fix button alignment on Andrid <4.4

fixes #3625
This commit is contained in:
Daniel Gultsch 2020-01-24 09:14:52 +01:00
parent 37907e6d97
commit 09dff6310d
7 changed files with 142 additions and 106 deletions

View file

@ -452,6 +452,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
if (conversation.getMucOptions().isSelf(counterpart)) {
status = Message.STATUS_SEND_RECEIVED;
isCarbon = true; //not really carbon but received from another resource
//TODO this would be the place to change the body after something like mod_pastebin
if (mXmppConnectionService.markMessage(conversation, remoteMsgId, status, serverMsgId)) {
return;
} else if (remoteMsgId == null || Config.IGNORE_ID_REWRITE_IN_MUC) {

View file

@ -0,0 +1,20 @@
package eu.siacs.conversations.xml;
import com.google.common.io.ByteSource;
import java.io.IOException;
import java.io.InputStream;
public class XmlElementReader {
public static Element read(byte[] bytes) throws IOException {
return read(ByteSource.wrap(bytes).openStream());
}
public static Element read(InputStream inputStream) throws IOException {
final XmlReader xmlReader = new XmlReader();
xmlReader.setInputStream(inputStream);
return xmlReader.readElement(xmlReader.readTag());
}
}

View file

@ -87,8 +87,7 @@ public class XmlReader implements Closeable {
return null;
}
public Element readElement(Tag currentTag) throws XmlPullParserException,
IOException {
public Element readElement(Tag currentTag) throws IOException {
Element element = new Element(currentTag.getName());
element.setAttributes(currentTag.getAttributes());
Tag nextTag = this.readTag();

View file

@ -6,7 +6,9 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include android:id="@+id/toolbar" layout="@layout/toolbar" />
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<ScrollView
android:layout_width="match_parent"
@ -21,10 +23,10 @@
android:id="@+id/instructions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:gravity="center_horizontal"
android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:text="@string/enter_your_name_instructions"/>
android:padding="16dp"
android:text="@string/enter_your_name_instructions"
android:textAppearance="@style/TextAppearance.Conversations.Body1" />
<LinearLayout
android:id="@+id/name_box"
@ -36,22 +38,24 @@
android:orientation="vertical">
<EditText
android:imeOptions="flagNoExtractUi"
android:id="@+id/name"
style="@style/Widget.Conversations.EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/your_name"
android:imeOptions="flagNoExtractUi"
android:longClickable="false" />
</LinearLayout>
<Button
android:id="@+id/next"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
style="@style/Widget.Conversations.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="@string/next"
android:textColor="?colorAccent" />
</RelativeLayout>

View file

@ -6,7 +6,10 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include android:id="@+id/toolbar" layout="@layout/toolbar" />
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinator"
android:layout_width="match_parent"
@ -25,10 +28,10 @@
android:id="@+id/instructions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:gravity="center_horizontal"
android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:text="@string/enter_country_code_and_phone_number"/>
android:padding="16dp"
android:text="@string/enter_country_code_and_phone_number"
android:textAppearance="@style/TextAppearance.Conversations.Body1" />
<LinearLayout
android:id="@+id/phone_number_box"
@ -40,17 +43,17 @@
android:orientation="vertical">
<EditText
android:imeOptions="flagNoExtractUi"
android:id="@+id/country"
style="@style/Widget.Conversations.EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cursorVisible="false"
android:inputType="textNoSuggestions"
android:drawableEnd="@drawable/ic_arrow_drop_down_black_18dp"
android:drawableRight="@drawable/ic_arrow_drop_down_black_18dp"
android:focusable="false"
android:gravity="bottom|center_horizontal"
android:imeOptions="flagNoExtractUi"
android:inputType="textNoSuggestions"
android:longClickable="false" />
<LinearLayout
@ -59,28 +62,28 @@
android:orientation="horizontal">
<EditText
android:imeOptions="flagNoExtractUi"
android:id="@+id/country_code"
style="@style/Widget.Conversations.EditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="bottom|center_horizontal"
android:imeOptions="flagNoExtractUi"
android:inputType="number"
android:longClickable="false"
android:maxLength="3"
android:maxLines="1" />
<EditText
android:imeOptions="flagNoExtractUi"
android:id="@+id/number"
style="@style/Widget.Conversations.EditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:hint="@string/phone_number"
android:inputType="number"
android:gravity="bottom|start"
android:hint="@string/phone_number"
android:imeOptions="flagNoExtractUi"
android:inputType="number"
android:longClickable="false"
android:maxLines="1" />
</LinearLayout>
@ -92,13 +95,15 @@
android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout>
<Button
android:id="@+id/next"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
style="@style/Widget.Conversations.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="@string/next"
android:textColor="?colorAccent" />
</RelativeLayout>

View file

@ -154,6 +154,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="@string/next" />
@ -163,6 +164,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:text="@string/back"
android:textColor="?android:textColorSecondary" />
@ -182,8 +184,8 @@
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/pin_box" />
android:layout_below="@+id/pin_box"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</ScrollView>
</android.support.design.widget.CoordinatorLayout>

View file

@ -1,25 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:background="?android:selectableItemBackground">
android:background="?android:selectableItemBackground"
android:padding="16dp">
<TextView
android:id="@+id/country"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:textAppearance="@style/TextAppearance.Conversations.Subhead.Bold"
android:text="Germany"/>
android:text="Germany"
android:textAppearance="@style/TextAppearance.Conversations.Subhead.Bold" />
<TextView
android:id="@+id/country_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:textAppearance="@style/TextAppearance.Conversations.Subhead.Bold.Secondary"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="+49"/>
android:text="+49"
android:textAppearance="@style/TextAppearance.Conversations.Subhead.Bold.Secondary" />
</RelativeLayout>
</layout>