Detailed changes
@@ -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) {
@@ -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());
+ }
+
+}
@@ -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();
@@ -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,24 +38,26 @@
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"/>
+ android:textColor="?colorAccent" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
@@ -6,103 +6,108 @@
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"
android:layout_height="match_parent">
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fillViewport="true">
-
- <RelativeLayout
+ <ScrollView
android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TextView
- 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:layout_height="match_parent"
+ android:fillViewport="true">
- <LinearLayout
- android:id="@+id/phone_number_box"
- 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">
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
- <EditText
- android:imeOptions="flagNoExtractUi"
- android:id="@+id/country"
- style="@style/Widget.Conversations.EditText"
- android:layout_width="match_parent"
+ <TextView
+ android:id="@+id/instructions"
+ android:layout_width="wrap_content"
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" />
+ android:gravity="center_horizontal"
+ android:padding="16dp"
+ android:text="@string/enter_country_code_and_phone_number"
+ android:textAppearance="@style/TextAppearance.Conversations.Body1" />
<LinearLayout
- android:layout_width="match_parent"
+ android:id="@+id/phone_number_box"
+ android:layout_width="256dp"
android:layout_height="wrap_content"
- android:orientation="horizontal">
+ 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_code"
+ android:id="@+id/country"
style="@style/Widget.Conversations.EditText"
- android:layout_width="0dp"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_weight="1"
+ 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: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: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_weight="3"
- android:hint="@string/phone_number"
- android:inputType="number"
- android:gravity="bottom|start"
- android:longClickable="false"
- android:maxLines="1" />
+ android:layout_gravity="center" />
</LinearLayout>
- <ProgressBar
- android:id="@+id/progressBar"
- style="?android:attr/progressBarStyle"
+ <Button
+ android:id="@+id/next"
+ style="@style/Widget.Conversations.Button.Borderless"
android:layout_width="wrap_content"
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:text="@string/next"
- android:textColor="?colorAccent"/>
- </RelativeLayout>
- </ScrollView>
+ 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>
</LinearLayout>
</layout>
@@ -154,8 +154,9 @@
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:text="@string/next" />
<Button
android:id="@+id/back"
@@ -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>
@@ -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>