Commit 28d63853 authored by Yusuke Iwaki's avatar Yusuke Iwaki

modify humberger icon to use DrawerArrowDrawable (refer to ActionBarDrawerToggle)

parent a32869da
......@@ -3,9 +3,8 @@ package chat.rocket.android.activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v4.widget.SlidingPaneLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.graphics.drawable.DrawerArrowDrawable;
import android.support.v7.widget.Toolbar;
import android.view.View;
......@@ -45,7 +44,6 @@ public class MainActivity extends AbstractAuthedActivity {
setContentView(R.layout.activity_main);
statusTicker = new StatusTicker();
setupToolbar();
setupSidebar();
if (roomId == null) {
showFragment(new HomeFragment());
......@@ -109,33 +107,32 @@ public class MainActivity extends AbstractAuthedActivity {
}
});
final DrawerArrowDrawable drawerArrowDrawable = new DrawerArrowDrawable(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
toolbar.setNavigationIcon(drawerArrowDrawable);
toolbar.setNavigationOnClickListener(view -> {
if (pane.isSlideable() && !pane.isOpen()) {
pane.openPane();
}
});
}
private void setupToolbar() {
Toolbar toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar == null) {
return;
}
actionBar.setDisplayShowTitleEnabled(false);
//ref: ActionBarDrawerToggle#setProgress
pane.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() {
@Override
public void onPanelSlide(View panel, float slideOffset) {
drawerArrowDrawable.setProgress(slideOffset);
}
if (findViewById(R.id.sliding_pane) == null) {
return;
}
@Override
public void onPanelOpened(View panel) {
drawerArrowDrawable.setVerticalMirror(true);
}
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(
VectorDrawableCompat.create(getResources(), R.drawable.ic_menu_black_24dp, null));
@Override
public void onPanelClosed(View panel) {
drawerArrowDrawable.setVerticalMirror(false);
}
});
}
private boolean closeSidebarIfNeeded() {
......
<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:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"
android:fillColor="#000000"/>
</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