Adjust Conversation List toolbar to match RecyclerView alignment

This commit is contained in:
Moxie Marlinspike 2017-11-12 19:14:57 -08:00
parent 3097c2855e
commit bb878f8a67
7 changed files with 80 additions and 38 deletions

View File

@ -174,10 +174,11 @@
</activity>
<activity android:name=".ConversationListActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:exported="true" />
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/TextSecure.LightNoActionBar"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:exported="true" />
<activity-alias android:name=".RoutingActivity"
android:targetActivity=".ConversationListActivity"

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@id/container"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="?attr/actionBarStyle">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginLeft="8dp"
android:src="@drawable/icon_transparent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="25sp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="66dp"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<FrameLayout android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!--<fragment android:id="@+id/fragment"-->
<!--android:name="org.thoughtcrime.securesms.ConversationListFragment"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--tools:layout="@layout/conversation_list_fragment"/>-->
</LinearLayout>

View File

@ -23,6 +23,8 @@
tools:src="@drawable/ic_contact_picture"
android:contentDescription="@string/conversation_list_item_view__contact_photo_image"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="14dp"
android:layout_marginLeft="14dp" />
<RelativeLayout android:layout_width="match_parent"

View File

@ -42,9 +42,7 @@
<style name="TextSecure.DarkActionBar"
parent="@style/Widget.AppCompat.ActionBar">
<item name="android:icon">@drawable/actionbar_icon</item>
<item name="icon">@drawable/actionbar_icon</item>
<item name="background">@color/gray95</item>
<item name="logo">@drawable/actionbar_icon</item>
<item name="android:popupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="titleTextStyle">@style/TextSecure.TitleTextStyle</item>
@ -55,8 +53,6 @@
parent="@style/Widget.AppCompat.ActionBar">
<item name="background">@color/textsecure_primary</item>
<item name="elevation">2dp</item>
<item name="logo">@drawable/actionbar_icon</item>
<item name="icon">@drawable/actionbar_icon</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="titleTextStyle">@style/TextSecure.TitleTextStyle</item>
<item name="subtitleTextStyle">@style/TextSecure.SubtitleTextStyle</item>

View File

@ -2,25 +2,20 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="TextSecure.LightNoActionBar" parent="@style/Theme.AppCompat.Light.NoActionBar">
<style name="TextSecure.LightNoActionBar" parent="@style/TextSecure.LightTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="theme_type">light</item>
<item name="actionBarStyle">@style/TextSecure.LightActionBar</item>
<item name="actionBarTabBarStyle">@style/TextSecure.LightActionBar.TabBar</item>
<item name="colorPrimary">@color/textsecure_primary</item>
<item name="colorPrimaryDark">@color/textsecure_primary_dark</item>
<item name="colorAccent">@color/textsecure_primary_dark</item>
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyleLight</item>
<item name="android:alertDialogTheme">@style/AppCompatDialogStyleLight</item>
<item name="android:windowBackground">@color/gray5</item>
<item name="recipient_preference_blocked">#d00000</item>
<item name="contact_selection_label_text">#66000000</item>
<item name="contact_selection_push_user">#ff000000</item>
<item name="contact_selection_lay_user">#a0000000</item>
<item name="contact_selection_header_text">@color/textsecure_primary_dark</item>
<item name="dialog_background_color">@color/background_material_light</item>
<item name="pref_divider">@drawable/preference_divider_light</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.Fix</item>
<item name="media_overview_toolbar_background">@color/white</item>
<item name="media_overview_toolbar_foreground">@color/gray70</item>
@ -29,26 +24,21 @@
<item name="media_overview_document_background">@color/white</item>
</style>
<style name="TextSecure.DarkNoActionBar" parent="@style/Theme.AppCompat.NoActionBar">
<style name="TextSecure.DarkNoActionBar" parent="@style/TextSecure.DarkTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="theme_type">dark</item>
<item name="actionBarStyle">@style/TextSecure.DarkActionBar</item>
<item name="actionBarTabBarStyle">@style/TextSecure.DarkActionBar.TabBar</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="colorPrimary">@color/gray95</item>
<item name="colorAccent">@color/signal_primary_dark</item>
<item name="android:colorControlActivated">@color/signal_primary_dark</item>
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyleDark</item>
<item name="android:alertDialogTheme">@style/AppCompatDialogStyleDark</item>
<item name="android:windowBackground">@color/black</item>
<item name="recipient_preference_blocked">#d00000</item>
<item name="contact_selection_label_text">#66eeeeee</item>
<item name="contact_selection_push_user">#ffeeeeee</item>
<item name="contact_selection_lay_user">#afeeeeee</item>
<item name="contact_selection_header_text">#66eeeeee</item>
<item name="dialog_background_color">@color/background_material_dark</item>
<item name="pref_divider">@drawable/preference_divider_dark</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.Fix</item>
<item name="media_overview_toolbar_background">@color/black</item>
<item name="media_overview_toolbar_foreground">@color/white</item>

View File

@ -28,10 +28,12 @@ import android.support.annotation.NonNull;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.Toast;
import org.thoughtcrime.securesms.components.RatingManager;
@ -44,6 +46,7 @@ import org.thoughtcrime.securesms.notifications.MessageNotifier;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
@ -54,7 +57,7 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
{
private static final String TAG = ConversationListActivity.class.getSimpleName();
private final DynamicTheme dynamicTheme = new DynamicTheme ();
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
private ConversationListFragment fragment;
@ -71,9 +74,12 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
protected void onCreate(Bundle icicle, @NonNull MasterSecret masterSecret) {
this.masterSecret = masterSecret;
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
getSupportActionBar().setTitle(R.string.app_name);
fragment = initFragment(android.R.id.content, new ConversationListFragment(), masterSecret, dynamicLanguage.getCurrentLocale());
setContentView(R.layout.conversation_list_activity);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
fragment = initFragment(R.id.fragment_container, new ConversationListFragment(), masterSecret, dynamicLanguage.getCurrentLocale());
initializeContactUpdatesReceiver();

View File

@ -1,7 +1,6 @@
package org.thoughtcrime.securesms.components;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.support.v4.view.ViewCompat;
import android.text.Spannable;
@ -9,7 +8,6 @@ import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.text.style.TypefaceSpan;
@ -18,7 +16,6 @@ import android.util.AttributeSet;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.components.emoji.EmojiTextView;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.ResUtil;
import org.thoughtcrime.securesms.util.spans.CenterAlignedRelativeSizeSpan;
@ -39,9 +36,7 @@ public class FromTextView extends EmojiTextView {
}
public void setText(Recipient recipient, boolean read) {
int attributes[] = new int[]{R.attr.conversation_list_item_count_color};
TypedArray colors = getContext().obtainStyledAttributes(attributes);
String fromString = recipient.toShortString();
String fromString = recipient.toShortString();
int typeface;
@ -74,8 +69,6 @@ public class FromTextView extends EmojiTextView {
builder.append(fromSpan);
}
colors.recycle();
setText(builder);
if (recipient.isBlocked()) setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_block_grey600_18dp, 0, 0, 0);