Commit 1bded002 authored by Tiago Cunha's avatar Tiago Cunha

Merge remote-tracking branch...

Merge remote-tracking branch 'refs/remotes/origin/feature/message-list-diff-util' into feature/message-list-diff-util
parents 24809ec5 9ef2911b
...@@ -24,7 +24,7 @@ abstract class AbstractChatRoomFragment extends AbstractFragment { ...@@ -24,7 +24,7 @@ abstract class AbstractChatRoomFragment extends AbstractFragment {
return super.onCreateView(inflater, container, savedInstanceState); return super.onCreateView(inflater, container, savedInstanceState);
} }
protected void setTitleText(@StringRes int stringResId) { protected void setToolbarTitle(@StringRes int stringResId) {
if (roomToolbar == null) { if (roomToolbar == null) {
return; return;
} }
...@@ -32,7 +32,7 @@ abstract class AbstractChatRoomFragment extends AbstractFragment { ...@@ -32,7 +32,7 @@ abstract class AbstractChatRoomFragment extends AbstractFragment {
roomToolbar.setTitle(stringResId); roomToolbar.setTitle(stringResId);
} }
protected void setTitleText(CharSequence title) { protected void setToolbarTitle(CharSequence title) {
if (roomToolbar == null) { if (roomToolbar == null) {
return; return;
} }
...@@ -40,7 +40,7 @@ abstract class AbstractChatRoomFragment extends AbstractFragment { ...@@ -40,7 +40,7 @@ abstract class AbstractChatRoomFragment extends AbstractFragment {
roomToolbar.setTitle(title); roomToolbar.setTitle(title);
} }
protected void setTitleDrawableLeft(@DrawableRes int drawableResId) { protected void setToolbarRoomIcon(@DrawableRes int drawableResId) {
if (roomToolbar == null) { if (roomToolbar == null) {
return; return;
} }
......
...@@ -13,13 +13,13 @@ public class HomeFragment extends AbstractChatRoomFragment { ...@@ -13,13 +13,13 @@ public class HomeFragment extends AbstractChatRoomFragment {
@Override @Override
protected void onSetupView() { protected void onSetupView() {
setTitleText(R.string.home_fragment_title); setToolbarTitle(R.string.home_fragment_title);
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
setTitleDrawableLeft(0); setToolbarRoomIcon(0);
setTitleText(R.string.home_fragment_title); setToolbarTitle(R.string.home_fragment_title);
} }
} }
...@@ -286,15 +286,15 @@ public class RoomFragment extends AbstractChatRoomFragment ...@@ -286,15 +286,15 @@ public class RoomFragment extends AbstractChatRoomFragment
String type = roomSubscription.getType(); String type = roomSubscription.getType();
if (RoomSubscription.TYPE_CHANNEL.equals(type)) { if (RoomSubscription.TYPE_CHANNEL.equals(type)) {
setTitleDrawableLeft(R.drawable.ic_hashtag_gray_24dp); setToolbarRoomIcon(R.drawable.ic_hashtag_gray_24dp);
} else if (RoomSubscription.TYPE_PRIVATE.equals(type)) { } else if (RoomSubscription.TYPE_PRIVATE.equals(type)) {
setTitleDrawableLeft(R.drawable.ic_lock_gray_24dp); setToolbarRoomIcon(R.drawable.ic_lock_gray_24dp);
} else if (RoomSubscription.TYPE_DIRECT_MESSAGE.equals(type)) { } else if (RoomSubscription.TYPE_DIRECT_MESSAGE.equals(type)) {
setTitleDrawableLeft(R.drawable.ic_at_gray_24dp); setToolbarRoomIcon(R.drawable.ic_at_gray_24dp);
} else { } else {
setTitleDrawableLeft(0); setToolbarRoomIcon(0);
} }
setTitleText(roomSubscription.getName()); setToolbarTitle(roomSubscription.getName());
} }
private void onUpdateLoadMessageProcedure(LoadMessageProcedure procedure) { private void onUpdateLoadMessageProcedure(LoadMessageProcedure procedure) {
......
...@@ -18,10 +18,9 @@ ...@@ -18,10 +18,9 @@
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:background="@color/white" app:theme="@style/Widget.RocketChat.RoomToolbar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:titleText="@string/app_name" app:titleText="@string/app_name"
app:titleTextColor="@color/titleTextColor"
app:titleDrawablePadding="@dimen/margin_8" /> app:titleDrawablePadding="@dimen/margin_8" />
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
......
...@@ -19,17 +19,10 @@ ...@@ -19,17 +19,10 @@
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:background="@color/white"
app:titleText="@string/app_name" app:titleText="@string/app_name"
app:titleTextColor="@color/titleTextColor"
app:titleDrawablePadding="@dimen/margin_8" app:titleDrawablePadding="@dimen/margin_8"
app:theme="@style/Widget.RocketChat.RoomToolbar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/button_menu"
android:background="@color/borderColor" />
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
<FrameLayout <FrameLayout
......
...@@ -7,7 +7,5 @@ ...@@ -7,7 +7,5 @@
<color name="colorAccentDark">#FF287DD7</color> <color name="colorAccentDark">#FF287DD7</color>
<color name="colorAccent_a40">#662D91FA</color> <color name="colorAccent_a40">#662D91FA</color>
<color name="textColorLink">#008ce3</color> <color name="textColorLink">#008ce3</color>
<color name="titleTextColor">#444444</color>
<color name="borderColor">#eaeaea</color>
<color name="white">#FFFEFEFF</color> <color name="white">#FFFEFEFF</color>
</resources> </resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Widget.RocketChat.RoomToolbar" parent="Widget.AppCompat.Toolbar">
<item name="titleTextAppearance">@style/TextAppearance.Widget.RocketChat.RoomToolbar.Title</item>
<item name="android:background">@color/white</item>
</style>
<style name="TextAppearance.Widget.RocketChat.RoomToolbar.Title"
parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textColor">#444444</item>
</style>
</resources>
\ No newline at end of file
...@@ -2,12 +2,12 @@ package chat.rocket.android.widget; ...@@ -2,12 +2,12 @@ package chat.rocket.android.widget;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes; 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.widget.TextViewCompat;
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;
...@@ -41,6 +41,17 @@ public class RoomToolbar extends Toolbar { ...@@ -41,6 +41,17 @@ public class RoomToolbar extends Toolbar {
return; return;
} }
TypedArray typedArrayBase = context.getTheme().obtainStyledAttributes(new int[]{
R.attr.titleTextAppearance
});
try {
TextViewCompat.setTextAppearance(titleTextView,
typedArrayBase.getResourceId(0,
android.support.v7.appcompat.R.style.TextAppearance_Widget_AppCompat_Toolbar_Title));
} finally {
typedArrayBase.recycle();
}
TypedArray typedArray = context.getTheme().obtainStyledAttributes( TypedArray typedArray = context.getTheme().obtainStyledAttributes(
attrs, attrs,
R.styleable.RoomToolbar, R.styleable.RoomToolbar,
...@@ -48,8 +59,6 @@ public class RoomToolbar extends Toolbar { ...@@ -48,8 +59,6 @@ public class RoomToolbar extends Toolbar {
try { try {
titleTextView.setText(typedArray.getText(R.styleable.RoomToolbar_titleText)); titleTextView.setText(typedArray.getText(R.styleable.RoomToolbar_titleText));
titleTextView
.setTextColor(typedArray.getColor(R.styleable.RoomToolbar_titleTextColor, Color.BLACK));
titleTextView.setCompoundDrawablePadding( titleTextView.setCompoundDrawablePadding(
typedArray.getLayoutDimension(R.styleable.RoomToolbar_titleDrawablePadding, 0)); typedArray.getLayoutDimension(R.styleable.RoomToolbar_titleDrawablePadding, 0));
} finally { } finally {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<TextView <TextView
android:id="@+id/toolbar_title" android:id="@+id/toolbar_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" /> android:gravity="center_vertical"/>
</merge> </merge>
\ No newline at end of file
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<resources> <resources>
<declare-styleable name="RoomToolbar"> <declare-styleable name="RoomToolbar">
<attr name="titleText" format="string" /> <attr name="titleText" format="string" />
<attr name="titleTextColor" format="color" />
<attr name="titleDrawablePadding" format="dimension" /> <attr name="titleDrawablePadding" format="dimension" />
</declare-styleable> </declare-styleable>
</resources> </resources>
\ No newline at end of file
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