Commit aa221c60 authored by Tiago Cunha's avatar Tiago Cunha Committed by Yusuke Iwaki

The toolbar

parent dab8c265
...@@ -18,9 +18,8 @@ ...@@ -18,9 +18,8 @@
android:id="@+id/activity_main_toolbar" android:id="@+id/activity_main_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:background="@color/white"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:mode="tablet"
app:titleText="@string/app_name" app:titleText="@string/app_name"
app:titleDrawablePadding="@dimen/margin_8" /> app:titleDrawablePadding="@dimen/margin_8" />
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white" android:background="@color/white"
app:mode="phone"
app:titleText="@string/app_name" app:titleText="@string/app_name"
app:titleTextColor="@color/titleTextColor" app:titleTextColor="@color/titleTextColor"
app:titleDrawablePadding="@dimen/margin_8" app:titleDrawablePadding="@dimen/margin_8"
......
...@@ -8,14 +8,17 @@ ...@@ -8,14 +8,17 @@
<LinearLayout <LinearLayout
android:id="@+id/user_info_container" android:id="@+id/user_info_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:background="?attr/colorPrimaryDark" android:background="?attr/colorPrimaryDark"
android:elevation="2dp" android:elevation="2dp"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="@dimen/margin_16"> android:paddingBottom="@dimen/margin_8"
android:paddingTop="@dimen/margin_8"
android:paddingLeft="@dimen/margin_16"
android:paddingRight="@dimen/margin_16">
<ImageView <ImageView
android:id="@+id/current_user_status" android:id="@+id/current_user_status"
...@@ -29,8 +32,8 @@ ...@@ -29,8 +32,8 @@
<ImageView <ImageView
android:id="@+id/current_user_avatar" android:id="@+id/current_user_avatar"
android:layout_width="48dp" android:layout_width="40dp"
android:layout_height="48dp" /> android:layout_height="40dp" />
<TextView <TextView
android:id="@+id/current_user_name" android:id="@+id/current_user_name"
......
...@@ -8,7 +8,6 @@ import android.support.annotation.DrawableRes; ...@@ -8,7 +8,6 @@ import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import android.support.graphics.drawable.VectorDrawableCompat; import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
...@@ -16,10 +15,7 @@ import android.widget.TextView; ...@@ -16,10 +15,7 @@ import android.widget.TextView;
public class CustomToolbar extends Toolbar { public class CustomToolbar extends Toolbar {
private static final String TABLET = "tablet";
private TextView titleTextView; private TextView titleTextView;
private int mode;
public CustomToolbar(Context context) { public CustomToolbar(Context context) {
super(context); super(context);
...@@ -56,7 +52,6 @@ public class CustomToolbar extends Toolbar { ...@@ -56,7 +52,6 @@ public class CustomToolbar extends Toolbar {
.setTextColor(typedArray.getColor(R.styleable.CustomToolbar_titleTextColor, Color.BLACK)); .setTextColor(typedArray.getColor(R.styleable.CustomToolbar_titleTextColor, Color.BLACK));
titleTextView.setCompoundDrawablePadding( titleTextView.setCompoundDrawablePadding(
typedArray.getLayoutDimension(R.styleable.CustomToolbar_titleDrawablePadding, 0)); typedArray.getLayoutDimension(R.styleable.CustomToolbar_titleDrawablePadding, 0));
mode = typedArray.getInt(R.styleable.CustomToolbar_mode, 0);
} finally { } finally {
typedArray.recycle(); typedArray.recycle();
} }
...@@ -89,10 +84,6 @@ public class CustomToolbar extends Toolbar { ...@@ -89,10 +84,6 @@ public class CustomToolbar extends Toolbar {
? VectorDrawableCompat.create(getResources(), drawableResId, null) ? VectorDrawableCompat.create(getResources(), drawableResId, null)
: null; : null;
if (drawable != null && mode == 1) {
DrawableCompat.setTint(drawable, Color.WHITE);
}
titleTextView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); titleTextView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
} }
} }
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" <merge xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<declare-styleable name="CustomToolbar"> <declare-styleable name="CustomToolbar">
<attr name="mode" format="enum">
<enum name="phone" value="0" />
<enum name="tablet" value="1" />
</attr>
<attr name="titleText" format="string" /> <attr name="titleText" format="string" />
<attr name="titleTextColor" format="color" /> <attr name="titleTextColor" format="color" />
<attr name="titleDrawablePadding" format="dimension" /> <attr name="titleDrawablePadding" format="dimension" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment