Commit 5bcdc732 authored by Lucio Maciel's avatar Lucio Maciel Committed by GitHub

Merge pull request #414 from filipedelimabrito/userstatus-on-toolbar

[FIX] Change menu icon color to white and the badge color
parents 5d95c19f f135794e
......@@ -4,7 +4,6 @@ import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.SlidingPaneLayout;
import android.support.v7.graphics.drawable.DrawerArrowDrawable;
import android.view.View;
import chat.rocket.android.LaunchUtil;
......@@ -81,8 +80,6 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
}
});
final DrawerArrowDrawable drawerArrowDrawable = new DrawerArrowDrawable(this);
toolbar.setNavigationIcon(drawerArrowDrawable);
toolbar.setNavigationOnClickListener(view -> {
if (pane.isSlideable() && !pane.isOpen()) {
pane.openPane();
......@@ -93,17 +90,17 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
pane.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() {
@Override
public void onPanelSlide(View panel, float slideOffset) {
drawerArrowDrawable.setProgress(slideOffset);
toolbar.setNavigationIconProgress(slideOffset);
}
@Override
public void onPanelOpened(View panel) {
drawerArrowDrawable.setVerticalMirror(true);
toolbar.setNavigationIconVerticalMirror(true);
}
@Override
public void onPanelClosed(View panel) {
drawerArrowDrawable.setVerticalMirror(false);
toolbar.setNavigationIconVerticalMirror(false);
closeUserActionContainer();
}
});
......
......@@ -8,6 +8,7 @@ import android.support.annotation.StringRes;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.graphics.drawable.DrawerArrowDrawable;
import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
......@@ -30,6 +31,8 @@ public class RoomToolbar extends Toolbar {
private Drawable publicChannelDrawable;
private Drawable userStatusDrawable;
private DrawerArrowDrawable drawerArrowDrawable;
public static final int STATUS_ONLINE = 1;
public static final int STATUS_BUSY = 2;
public static final int STATUS_AWAY = 3;
......@@ -52,7 +55,7 @@ public class RoomToolbar extends Toolbar {
private void initialize(Context context) {
View.inflate(context, R.layout.toolbar, this);
setNavigationIcon();
setNavigationIcon(context);
toolbarText = findViewById(R.id.text_toolbar);
roomTypeImage = findViewById(R.id.image_room_type);
......@@ -63,9 +66,18 @@ public class RoomToolbar extends Toolbar {
userStatusDrawable = VectorDrawableCompat.create(getResources(), R.drawable.ic_user_status_black_24dp, null);
}
private void setNavigationIcon() {
Drawable menuDrawable = VectorDrawableCompat.create(getResources(), R.drawable.ic_menu_white_24dp, null);
super.setNavigationIcon(menuDrawable);
private void setNavigationIcon(Context context) {
drawerArrowDrawable = new DrawerArrowDrawable(context);
drawerArrowDrawable.setColor(ContextCompat.getColor(context, android.R.color.white));
super.setNavigationIcon(drawerArrowDrawable);
}
public void setNavigationIconProgress(float progress) {
drawerArrowDrawable.setProgress(progress);
}
public void setNavigationIconVerticalMirror(boolean verticalMirror) {
drawerArrowDrawable.setVerticalMirror(verticalMirror);
}
@Override
......@@ -168,7 +180,7 @@ public class RoomToolbar extends Toolbar {
.beginConfig()
.useFont(Typeface.SANS_SERIF)
.endConfig()
.buildRound(icon, ContextCompat.getColor(getContext(), android.R.color.white));
.buildRound(icon, ContextCompat.getColor(getContext(), R.color.color_user_status_busy));
}
@Override
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
</vector>
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