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

The toolbar

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