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,103 +6,108 @@
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"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ScrollView <ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="match_parent"
android:fillViewport="true">
<TextView <RelativeLayout
android:id="@+id/instructions" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="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"/>
<LinearLayout <TextView
android:id="@+id/phone_number_box" android:id="@+id/instructions"
android:layout_width="256dp"
android:layout_height="wrap_content"
android:layout_above="@+id/next"
android:layout_below="@+id/instructions"
android:layout_centerHorizontal="true"
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:longClickable="false" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
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: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:longClickable="false"
android:maxLines="1" />
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar"
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_gravity="center" /> android:gravity="center_horizontal"
</LinearLayout> android:padding="16dp"
<Button android:text="@string/enter_country_code_and_phone_number"
android:id="@+id/next" android:textAppearance="@style/TextAppearance.Conversations.Body1" />
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" <LinearLayout
style="@style/Widget.Conversations.Button.Borderless" android:id="@+id/phone_number_box"
android:layout_width="wrap_content" android:layout_width="256dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/next" android:layout_above="@+id/next"
android:textColor="?colorAccent"/> android:layout_below="@+id/instructions"
</RelativeLayout> android:layout_centerHorizontal="true"
</ScrollView> android:orientation="vertical">
<EditText
android:id="@+id/country"
style="@style/Widget.Conversations.EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cursorVisible="false"
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
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
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:id="@+id/number"
style="@style/Widget.Conversations.EditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="bottom|start"
android:hint="@string/phone_number"
android:imeOptions="flagNoExtractUi"
android:inputType="number"
android:longClickable="false"
android:maxLines="1" />
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout>
<Button
android:id="@+id/next"
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>
</ScrollView>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>
</LinearLayout> </LinearLayout>
</layout> </layout>

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>