aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java15
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationsMainActivity.java0
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java13
-rw-r--r--src/main/res/layout/conversation_list_row.xml57
-rw-r--r--src/main/res/layout/fragment_conversations_overview.xml9
5 files changed, 58 insertions, 36 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index faa8bdc37..c3fdfefa2 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -104,7 +104,15 @@ public class ConversationActivity extends XmppActivity implements OnConversation
invalidateActionBarTitle();
Intent intent = pendingViewIntent.pop();
if (intent != null) {
- processViewIntent(intent);
+ if (processViewIntent(intent)) {
+ return;
+ }
+ }
+ if (binding.secondaryFragment != null && ConversationFragment.getConversation(this) == null) {
+ Conversation conversation = ConversationsOverviewFragment.getSuggestion(this);
+ if (conversation != null) {
+ openConversation(conversation, null);
+ }
}
}
@@ -122,14 +130,15 @@ public class ConversationActivity extends XmppActivity implements OnConversation
}
}
- private void processViewIntent(Intent intent) {
+ private boolean processViewIntent(Intent intent) {
String uuid = intent.getStringExtra(EXTRA_CONVERSATION);
Conversation conversation = uuid != null ? xmppConnectionService.findConversationByUuid(uuid) : null;
if (conversation == null) {
Log.d(Config.LOGTAG, "unable to view conversation with uuid:" + uuid);
- return;
+ return false;
}
openConversation(conversation, intent.getExtras());
+ return true;
}
@Override
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsMainActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsMainActivity.java
deleted file mode 100644
index e69de29bb..000000000
--- a/src/main/java/de/pixart/messenger/ui/ConversationsMainActivity.java
+++ /dev/null
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java
index ecfbaf595..173d09cc7 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java
@@ -30,6 +30,7 @@
package de.pixart.messenger.ui;
import android.app.Activity;
+import android.app.Fragment;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.util.Log;
@@ -114,4 +115,16 @@ public class ConversationsOverviewFragment extends XmppFragment {
this.activity.xmppConnectionService.populateWithOrderedConversations(this.conversations);
this.conversationsAdapter.notifyDataSetChanged();
}
+
+ public static Conversation getSuggestion(Activity activity) {
+ Fragment fragment = activity.getFragmentManager().findFragmentById(R.id.main_fragment);
+ if (fragment != null && fragment instanceof ConversationsOverviewFragment) {
+ List<Conversation> conversations = ((ConversationsOverviewFragment) fragment).conversations;
+ if (conversations.size() > 0) {
+ return conversations.get(0);
+ }
+ }
+ return null;
+
+ }
} \ No newline at end of file
diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml
index fe5eec4a3..9addc66cb 100644
--- a/src/main/res/layout/conversation_list_row.xml
+++ b/src/main/res/layout/conversation_list_row.xml
@@ -27,9 +27,9 @@
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_alignParentLeft="true"
- android:scaleType="centerCrop"
android:background="@drawable/message_border"
android:padding="1dp"
+ android:scaleType="centerCrop"
app:riv_border_color="@color/grey500"
app:riv_border_width="1dp"
app:riv_corner_radius="28dp" />
@@ -39,7 +39,7 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/conversation_image"
- android:paddingLeft="8dp">
+ android:paddingLeft="@dimen/avatar_item_distance">
<TextView
android:id="@+id/conversation_name"
@@ -47,10 +47,10 @@
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/conversation_lastwrapper"
android:layout_toLeftOf="@+id/conversation_failed"
- android:paddingRight="4dp"
android:ellipsize="end"
android:maxLines="1"
- android:textAppearance="@style/TextAppearance.AppCompat"
+ android:paddingRight="4dp"
+ android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="@color/black87"
android:textSize="?attr/TextSizeHeadline" />
@@ -71,7 +71,7 @@
android:gravity="center_vertical"
android:minHeight="?attr/IconSize"
android:text="@string/me"
- android:textColor="@color/primary"
+ android:textAppearance="@style/TextAppearance.Conversations.Body1.Secondary"
android:visibility="visible" />
<LinearLayout
@@ -87,19 +87,18 @@
android:id="@+id/conversation_lastmsg_img"
android:layout_width="?attr/IconSize"
android:layout_height="?attr/IconSize"
- android:layout_marginRight="?attr/TextSeparation"/>/>
+ android:layout_marginRight="?attr/TextSeparation" />/>
<TextView
android:id="@+id/conversation_lastmsg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:ellipsize="end"
android:gravity="center_vertical"
+ android:maxLines="1"
android:minHeight="?attr/IconSize"
android:scrollHorizontally="false"
- android:maxLines="1"
- android:ellipsize="end"
- android:textColor="@color/black87"
- android:textSize="?attr/TextSizeBody" />
+ android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
</LinearLayout>
<LinearLayout
@@ -107,8 +106,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="false"
- android:layout_centerVertical="true"
android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
android:orientation="horizontal">
<ImageView
@@ -144,45 +143,45 @@
<TextView
android:id="@+id/conversation_unread"
- android:layout_toLeftOf="@+id/conversation_lastupdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/conversation_name"
- android:text="100"
- android:textColor="@color/grey50"
- android:textSize="?attr/TextSizeBody"
+ android:layout_margin="1dp"
+ android:layout_toLeftOf="@+id/conversation_lastupdate"
android:background="@drawable/rounded_rectangle_primary"
- android:visibility="gone"
+ android:paddingBottom="2dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
- android:paddingBottom="2dp"
- android:layout_margin="1dp" />
+ android:text="100"
+ android:textColor="@color/grey50"
+ android:textSize="?attr/TextSizeBody"
+ android:visibility="gone" />
+
<TextView
android:id="@+id/conversation_failed"
- android:layout_toLeftOf="@+id/conversation_unread"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/conversation_name"
- android:text="100"
- android:textColor="@color/grey50"
- android:textSize="?attr/TextSizeBody"
+ android:layout_margin="1dp"
+ android:layout_toLeftOf="@+id/conversation_unread"
android:background="@drawable/rounded_rectangle_red"
- android:visibility="gone"
+ android:paddingBottom="2dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
- android:paddingBottom="2dp"
- android:layout_margin="1dp" />
+ android:text="100"
+ android:textColor="@color/grey50"
+ android:textSize="?attr/TextSizeBody"
+ android:visibility="gone" />
<TextView
android:id="@+id/conversation_lastupdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
android:layout_alignBaseline="@+id/conversation_name"
- android:paddingLeft="4dp"
+ android:layout_alignParentRight="true"
android:gravity="right"
- android:textColor="@color/black54"
- android:textSize="?attr/TextSizeInfo" />
+ android:paddingLeft="4dp"
+ android:textAppearance="@style/TextAppearance.AppCompat.Caption" />
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
diff --git a/src/main/res/layout/fragment_conversations_overview.xml b/src/main/res/layout/fragment_conversations_overview.xml
index e400e291d..1f3d9e4e2 100644
--- a/src/main/res/layout/fragment_conversations_overview.xml
+++ b/src/main/res/layout/fragment_conversations_overview.xml
@@ -1,17 +1,18 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
- android:background="?attr/color_background_primary"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:background="?attr/color_background_primary">
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/grey50"
- android:divider="@color/black12"
- android:dividerHeight="1dp" />
+ android:divider="@android:color/transparent"
+ android:dividerHeight="0dp" />
+
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"