Skip to content

Commit 2c9ae75

Browse files
committed
Finally, fix the teensy back button in landscape.
Bug: 5993561 (and friends) Change-Id: I0ccde54ea145e945f1a02d0480585c32cd129911
1 parent c2ee231 commit 2c9ae75

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

packages/SystemUI/res/layout/navigation_bar.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
android:src="@drawable/ic_sysbar_back"
5555
systemui:keyCode="4"
5656
android:layout_weight="0"
57+
android:scaleType="center"
5758
systemui:glowBackground="@drawable/ic_sysbar_highlight"
5859
android:contentDescription="@string/accessibility_back"
5960
/>
@@ -214,6 +215,7 @@
214215
android:layout_height="80dp"
215216
android:layout_width="match_parent"
216217
android:src="@drawable/ic_sysbar_back_land"
218+
android:scaleType="center"
217219
systemui:keyCode="4"
218220
android:layout_weight="0"
219221
android:contentDescription="@string/accessibility_back"

packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import android.content.Context;
2424
import android.content.res.Resources;
2525
import android.graphics.Rect;
26+
import android.graphics.drawable.Drawable;
2627
import android.os.Handler;
2728
import android.os.Message;
2829
import android.os.ServiceManager;
@@ -71,6 +72,8 @@ public class NavigationBarView extends LinearLayout {
7172
int mDisabledFlags = 0;
7273
int mNavigationIconHints = 0;
7374

75+
private Drawable mBackIcon, mBackLandIcon, mBackAltIcon, mBackAltLandIcon;
76+
7477
private DelegateViewHelper mDelegateHelper;
7578

7679
// workaround for LayoutTransitions leaving the nav buttons in a weird state (bug 5549288)
@@ -146,6 +149,11 @@ public NavigationBarView(Context context, AttributeSet attrs) {
146149
mVertical = false;
147150
mShowMenu = false;
148151
mDelegateHelper = new DelegateViewHelper(this);
152+
153+
mBackIcon = res.getDrawable(R.drawable.ic_sysbar_back);
154+
mBackLandIcon = res.getDrawable(R.drawable.ic_sysbar_back_land);
155+
mBackAltIcon = res.getDrawable(R.drawable.ic_sysbar_back_ime);
156+
mBackAltLandIcon = res.getDrawable(R.drawable.ic_sysbar_back_ime);
149157
}
150158

151159
View.OnTouchListener mLightsOutListener = new View.OnTouchListener() {
@@ -188,10 +196,10 @@ public void setNavigationIconHints(int hints, boolean force) {
188196
getRecentsButton().setAlpha(
189197
(0 != (hints & StatusBarManager.NAVIGATION_HINT_RECENT_NOP)) ? 0.5f : 1.0f);
190198

191-
((ImageView)getBackButton()).setImageResource(
199+
((ImageView)getBackButton()).setImageDrawable(
192200
(0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT))
193-
? R.drawable.ic_sysbar_back_ime
194-
: R.drawable.ic_sysbar_back);
201+
? (mVertical ? mBackAltLandIcon : mBackAltIcon)
202+
: (mVertical ? mBackLandIcon : mBackIcon));
195203
}
196204

197205
public void setDisabledFlags(int disabledFlags) {

0 commit comments

Comments
 (0)