Commit 9ef2911b authored by Tiago Cunha's avatar Tiago Cunha Committed by GitHub

Merge branch 'develop' into feature/message-list-diff-util

parents 575a7ef2 094011b7
......@@ -24,7 +24,7 @@ abstract class AbstractChatRoomFragment extends AbstractFragment {
return super.onCreateView(inflater, container, savedInstanceState);
}
protected void setTitleText(@StringRes int stringResId) {
protected void setToolbarTitle(@StringRes int stringResId) {
if (roomToolbar == null) {
return;
}
......@@ -32,7 +32,7 @@ abstract class AbstractChatRoomFragment extends AbstractFragment {
roomToolbar.setTitle(stringResId);
}
protected void setTitleText(CharSequence title) {
protected void setToolbarTitle(CharSequence title) {
if (roomToolbar == null) {
return;
}
......@@ -40,7 +40,7 @@ abstract class AbstractChatRoomFragment extends AbstractFragment {
roomToolbar.setTitle(title);
}
protected void setTitleDrawableLeft(@DrawableRes int drawableResId) {
protected void setToolbarRoomIcon(@DrawableRes int drawableResId) {
if (roomToolbar == null) {
return;
}
......
......@@ -13,13 +13,13 @@ public class HomeFragment extends AbstractChatRoomFragment {
@Override
protected void onSetupView() {
setTitleText(R.string.home_fragment_title);
setToolbarTitle(R.string.home_fragment_title);
}
@Override
public void onResume() {
super.onResume();
setTitleDrawableLeft(0);
setTitleText(R.string.home_fragment_title);
setToolbarRoomIcon(0);
setToolbarTitle(R.string.home_fragment_title);
}
}
......@@ -267,15 +267,15 @@ public class RoomFragment extends AbstractChatRoomFragment
String type = roomSubscription.getType();
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)) {
setTitleDrawableLeft(R.drawable.ic_lock_gray_24dp);
setToolbarRoomIcon(R.drawable.ic_lock_gray_24dp);
} else if (RoomSubscription.TYPE_DIRECT_MESSAGE.equals(type)) {
setTitleDrawableLeft(R.drawable.ic_at_gray_24dp);
setToolbarRoomIcon(R.drawable.ic_at_gray_24dp);
} else {
setTitleDrawableLeft(0);
setToolbarRoomIcon(0);
}
setTitleText(roomSubscription.getName());
setToolbarTitle(roomSubscription.getName());
}
private void onUpdateLoadMessageProcedure(LoadMessageProcedure procedure) {
......
......@@ -18,10 +18,9 @@
android:id="@+id/activity_main_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:theme="@style/Widget.RocketChat.RoomToolbar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:titleText="@string/app_name"
app:titleTextColor="@color/titleTextColor"
app:titleDrawablePadding="@dimen/margin_8" />
</android.support.design.widget.AppBarLayout>
......
......@@ -19,17 +19,10 @@
android:id="@+id/activity_main_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:titleText="@string/app_name"
app:titleTextColor="@color/titleTextColor"
app:titleDrawablePadding="@dimen/margin_8"
app:theme="@style/Widget.RocketChat.RoomToolbar"
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>
<FrameLayout
......
......@@ -7,7 +7,5 @@
<color name="colorAccentDark">#FF287DD7</color>
<color name="colorAccent_a40">#662D91FA</color>
<color name="textColorLink">#008ce3</color>
<color name="titleTextColor">#444444</color>
<color name="borderColor">#eaeaea</color>
<color name="white">#FFFEFEFF</color>
</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;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
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.widget.TextViewCompat;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.View;
......@@ -41,6 +41,17 @@ public class RoomToolbar extends Toolbar {
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(
attrs,
R.styleable.RoomToolbar,
......@@ -48,8 +59,6 @@ public class RoomToolbar extends Toolbar {
try {
titleTextView.setText(typedArray.getText(R.styleable.RoomToolbar_titleText));
titleTextView
.setTextColor(typedArray.getColor(R.styleable.RoomToolbar_titleTextColor, Color.BLACK));
titleTextView.setCompoundDrawablePadding(
typedArray.getLayoutDimension(R.styleable.RoomToolbar_titleDrawablePadding, 0));
} finally {
......
......@@ -6,7 +6,7 @@
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" />
android:layout_height="match_parent"
android:gravity="center_vertical"/>
</merge>
\ No newline at end of file
......@@ -2,7 +2,6 @@
<resources>
<declare-styleable name="RoomToolbar">
<attr name="titleText" format="string" />
<attr name="titleTextColor" format="color" />
<attr name="titleDrawablePadding" format="dimension" />
</declare-styleable>
</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