From 6cfc6af8869c036f701b168f163927a36b8ce792 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 23 Feb 2018 11:35:13 +0100 Subject: [PATCH] change font size in conversation overview --- .../conversations/ui/ConversationActivity.java | 15 ++++++++++++--- .../ui/ConversationsOverviewFragment.java | 13 +++++++++++++ src/main/res/layout/conversation_list_row.xml | 16 ++++++---------- .../layout/fragment_conversations_overview.xml | 4 ++-- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index c044df758..4d15be96a 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -99,7 +99,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); + } } } @@ -117,14 +125,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/eu/siacs/conversations/ui/ConversationsOverviewFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java index d11d516b5..004f22eed 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java @@ -30,6 +30,7 @@ package eu.siacs.conversations.ui; import android.app.Activity; +import android.app.Fragment; import android.content.Context; import android.databinding.DataBindingUtil; import android.os.Bundle; @@ -190,4 +191,16 @@ public class ConversationsOverviewFragment extends XmppFragment implements Enhan } }; } + + public static Conversation getSuggestion(Activity activity) { + Fragment fragment = activity.getFragmentManager().findFragmentById(R.id.main_fragment); + if (fragment != null && fragment instanceof ConversationsOverviewFragment) { + List conversations = ((ConversationsOverviewFragment) fragment).conversations; + if (conversations.size() > 0) { + return conversations.get(0); + } + } + return null; + + } } diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml index 179128578..019e878a5 100644 --- a/src/main/res/layout/conversation_list_row.xml +++ b/src/main/res/layout/conversation_list_row.xml @@ -35,7 +35,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"> + android:textAppearance="@style/TextAppearance.Conversations.Body1.Secondary" + android:visibility="visible"/> + android:textAppearance="@style/TextAppearance.AppCompat.Body1"/> + android:textAppearance="@style/TextAppearance.AppCompat.Caption"/> diff --git a/src/main/res/layout/fragment_conversations_overview.xml b/src/main/res/layout/fragment_conversations_overview.xml index 47d29be49..52b4cdd5c 100644 --- a/src/main/res/layout/fragment_conversations_overview.xml +++ b/src/main/res/layout/fragment_conversations_overview.xml @@ -11,8 +11,8 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="?attr/color_background_primary" - android:divider="@color/black12" - android:dividerHeight="1dp"/> + android:divider="@android:color/transparent" + android:dividerHeight="0dp"/>