change font size in conversation overview

This commit is contained in:
Daniel Gultsch 2018-02-23 11:35:13 +01:00
parent cd75e55e3f
commit 6cfc6af886
4 changed files with 33 additions and 15 deletions

View File

@ -99,7 +99,15 @@ public class ConversationActivity extends XmppActivity implements OnConversation
invalidateActionBarTitle(); invalidateActionBarTitle();
Intent intent = pendingViewIntent.pop(); Intent intent = pendingViewIntent.pop();
if (intent != null) { 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); String uuid = intent.getStringExtra(EXTRA_CONVERSATION);
Conversation conversation = uuid != null ? xmppConnectionService.findConversationByUuid(uuid) : null; Conversation conversation = uuid != null ? xmppConnectionService.findConversationByUuid(uuid) : null;
if (conversation == null) { if (conversation == null) {
Log.d(Config.LOGTAG, "unable to view conversation with uuid:" + uuid); Log.d(Config.LOGTAG, "unable to view conversation with uuid:" + uuid);
return; return false;
} }
openConversation(conversation, intent.getExtras()); openConversation(conversation, intent.getExtras());
return true;
} }
@Override @Override

View File

@ -30,6 +30,7 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.app.Activity; import android.app.Activity;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.databinding.DataBindingUtil; import android.databinding.DataBindingUtil;
import android.os.Bundle; 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<Conversation> conversations = ((ConversationsOverviewFragment) fragment).conversations;
if (conversations.size() > 0) {
return conversations.get(0);
}
}
return null;
}
} }

View File

@ -35,7 +35,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toRightOf="@+id/conversation_image" android:layout_toRightOf="@+id/conversation_image"
android:paddingLeft="8dp"> android:paddingLeft="@dimen/avatar_item_distance">
<TextView <TextView
android:id="@+id/conversation_name" android:id="@+id/conversation_name"
@ -46,8 +46,7 @@
android:paddingRight="4dp" android:paddingRight="4dp"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:textColor="?attr/color_text_primary" android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textSize="?attr/TextSizeHeadline"
android:typeface="sans"/> android:typeface="sans"/>
<RelativeLayout <RelativeLayout
@ -67,9 +66,8 @@
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:text="@string/me" android:text="@string/me"
android:layout_marginRight="?attr/TextSeparation" android:layout_marginRight="?attr/TextSeparation"
android:textColor="?attr/color_text_secondary" android:textAppearance="@style/TextAppearance.Conversations.Body1.Secondary"
android:visibility="visible" android:visibility="visible"/>
android:textSize="?attr/TextSizeBody"/>
<LinearLayout android:layout_width="match_parent" <LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -94,8 +92,7 @@
android:scrollHorizontally="false" android:scrollHorizontally="false"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:textColor="?attr/color_text_primary" android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
android:textSize="?attr/TextSizeBody"/>
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:visibility="visible" android:visibility="visible"
@ -130,8 +127,7 @@
android:layout_alignBaseline="@+id/conversation_name" android:layout_alignBaseline="@+id/conversation_name"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:gravity="right" android:gravity="right"
android:textColor="?attr/color_text_secondary" android:textAppearance="@style/TextAppearance.AppCompat.Caption"/>
android:textSize="?attr/TextSizeInfo"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
</FrameLayout> </FrameLayout>

View File

@ -11,8 +11,8 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/color_background_primary" android:background="?attr/color_background_primary"
android:divider="@color/black12" android:divider="@android:color/transparent"
android:dividerHeight="1dp"/> android:dividerHeight="0dp"/>
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:id="@+id/fab" android:id="@+id/fab"