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)) { if (conversation.getMucOptions().isSelf(counterpart)) {
status = Message.STATUS_SEND_RECEIVED; status = Message.STATUS_SEND_RECEIVED;
isCarbon = true; //not really carbon but received from another resource 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)) { if (mXmppConnectionService.markMessage(conversation, remoteMsgId, status, serverMsgId)) {
return; return;
} else if (remoteMsgId == null || Config.IGNORE_ID_REWRITE_IN_MUC) { } 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; return null;
} }
public Element readElement(Tag currentTag) throws XmlPullParserException, public Element readElement(Tag currentTag) throws IOException {
IOException {
Element element = new Element(currentTag.getName()); Element element = new Element(currentTag.getName());
element.setAttributes(currentTag.getAttributes()); element.setAttributes(currentTag.getAttributes());
Tag nextTag = this.readTag(); Tag nextTag = this.readTag();

View File

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

View File

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

View File

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

View File

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