From cc9fa4c4a60306450b6e3a64c3e56edd41b3e86f Mon Sep 17 00:00:00 2001 From: Max Lv Date: Thu, 30 Apr 2015 17:29:40 +0800 Subject: [PATCH] refine the drawer indicator --- .../com/github/shadowsocks/Shadowsocks.scala | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/scala/com/github/shadowsocks/Shadowsocks.scala b/src/main/scala/com/github/shadowsocks/Shadowsocks.scala index be00be98..42ff638b 100644 --- a/src/main/scala/com/github/shadowsocks/Shadowsocks.scala +++ b/src/main/scala/com/github/shadowsocks/Shadowsocks.scala @@ -495,10 +495,16 @@ class Shadowsocks menuAdapter.setListener(this) listView.setAdapter(menuAdapter) drawer.setMenuView(listView) - // The drawable that replaces the up indicator in the action bar - drawer.setSlideDrawable(R.drawable.ic_drawer) - // Whether the previous drawable should be shown - drawer.setDrawerIndicatorEnabled(true) + + if (Utils.isLollipopOrAbove) { + drawer.setDrawerIndicatorEnabled(false) + } else { + // The drawable that replaces the up indicator in the action bar + drawer.setSlideDrawable(R.drawable.ic_drawer) + // Whether the previous drawable should be shown + drawer.setDrawerIndicatorEnabled(true) + } + if (!isSinglePane) { drawer.openMenu(false) } @@ -518,7 +524,7 @@ class Shadowsocks getWindow.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow.setStatusBarColor(getResources().getColor(R.color.grey3)); getActionBar.setDisplayHomeAsUpEnabled(true) - getActionBar.setDisplayShowHomeEnabled(false) + getActionBar.setHomeAsUpIndicator(R.drawable.ic_drawer) } else { getActionBar.setIcon(R.drawable.ic_stat_shadowsocks) } @@ -916,13 +922,13 @@ class Shadowsocks private def showQrCode() { val image = new ImageView(this) + image.setPadding(0, dp2px(20), 0, dp2px(20)) image.setLayoutParams(new LinearLayout.LayoutParams(-1, -1)) val qrcode = QRCode.from(Parser.generate(currentProfile)) .withSize(dp2px(250), dp2px(250)).asInstanceOf[QRCode] image.setImageBitmap(qrcode.bitmap()) new AlertDialog.Builder(this) - .setTitle(getString(R.string.qrcode)) .setCancelable(true) .setNegativeButton(getString(R.string.close), new DialogInterface.OnClickListener() { override def onClick(dialog: DialogInterface, id: Int) {