Revert "Fix navigation bar order in seascape"
This reverts commit 27315acfbbf9921e760647e2e96e74ec7de6015a.
Change-Id: I680f44eaca7813633d7c251ff0bb9c62f94d1fc5
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
index b7faf15..dd46b08 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java
@@ -28,6 +28,7 @@
import android.widget.Space;
import com.android.systemui.R;
+import com.android.systemui.SystemUIFactory;
import com.android.systemui.statusbar.policy.KeyButtonView;
import com.android.systemui.tuner.TunerService;
@@ -70,8 +71,6 @@
private View mLastRot0;
private View mLastRot90;
- private boolean mAlternativeOrder;
-
public NavigationBarInflaterView(Context context, AttributeSet attrs) {
super(context, attrs);
mDensity = context.getResources().getConfiguration().densityDpi;
@@ -115,7 +114,6 @@
false);
mRot90.setId(R.id.rot90);
addView(mRot90);
- updateAlternativeOrder();
if (getParent() instanceof NavigationBarView) {
((NavigationBarView) getParent()).updateRotatedViews();
}
@@ -154,20 +152,6 @@
}
}
- public void setAlternativeOrder(boolean alternativeOrder) {
- if (alternativeOrder != mAlternativeOrder) {
- mAlternativeOrder = alternativeOrder;
- updateAlternativeOrder();
- }
- }
-
- private void updateAlternativeOrder() {
- ((ReverseLinearLayout) mRot90.findViewById(R.id.ends_group)).setAlternativeOrder(
- mAlternativeOrder);
- ((ReverseLinearLayout) mRot90.findViewById(R.id.center_group)).setAlternativeOrder(
- mAlternativeOrder);
- }
-
private void initiallyFill(ButtonDispatcher buttonDispatcher) {
addAll(buttonDispatcher, (ViewGroup) mRot0.findViewById(R.id.ends_group));
addAll(buttonDispatcher, (ViewGroup) mRot0.findViewById(R.id.center_group));
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 23aeae8..53fe6ce3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -99,8 +99,6 @@
private final SparseArray<ButtonDispatcher> mButtonDisatchers = new SparseArray<>();
private Configuration mConfiguration;
- private NavigationBarInflaterView mNavigationInflaterView;
-
private class NavTransitionListener implements TransitionListener {
private boolean mBackTransitioning;
private boolean mHomeAppearing;
@@ -474,10 +472,9 @@
@Override
public void onFinishInflate() {
- mNavigationInflaterView = (NavigationBarInflaterView) findViewById(
- R.id.navigation_inflater);
updateRotatedViews();
- mNavigationInflaterView.setButtonDispatchers(mButtonDisatchers);
+ ((NavigationBarInflaterView) findViewById(R.id.navigation_inflater)).setButtonDispatchers(
+ mButtonDisatchers);
getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
@@ -533,7 +530,6 @@
}
mCurrentView = mRotatedViews[rot];
mCurrentView.setVisibility(View.VISIBLE);
- mNavigationInflaterView.setAlternativeOrder(rot == Surface.ROTATION_90);
for (int i = 0; i < mButtonDisatchers.size(); i++) {
mButtonDisatchers.valueAt(i).setCurrentView(mCurrentView);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ReverseLinearLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ReverseLinearLayout.java
index f45967a..3682aa1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ReverseLinearLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ReverseLinearLayout.java
@@ -30,11 +30,7 @@
*/
public class ReverseLinearLayout extends LinearLayout {
- /** If true, the layout is reversed vs. a regular linear layout */
- private boolean mIsLayoutReverse;
-
- /** If true, the layout is opposite to it's natural reversity from the layout direction */
- private boolean mIsAlternativeOrder;
+ private boolean mIsLayoutRtl;
public ReverseLinearLayout(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
@@ -43,50 +39,45 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- updateOrder();
+ mIsLayoutRtl = getResources().getConfiguration()
+ .getLayoutDirection() == LAYOUT_DIRECTION_RTL;
}
@Override
public void addView(View child) {
reversParams(child.getLayoutParams());
- if (mIsLayoutReverse) {
- super.addView(child, 0);
- } else {
+ if (mIsLayoutRtl) {
super.addView(child);
+ } else {
+ super.addView(child, 0);
}
}
@Override
public void addView(View child, ViewGroup.LayoutParams params) {
reversParams(params);
- if (mIsLayoutReverse) {
- super.addView(child, 0, params);
- } else {
+ if (mIsLayoutRtl) {
super.addView(child, params);
+ } else {
+ super.addView(child, 0, params);
}
}
@Override
- public void onRtlPropertiesChanged(int layoutDirection) {
- super.onRtlPropertiesChanged(layoutDirection);
- updateOrder();
- }
-
- public void setAlternativeOrder(boolean alternative) {
- mIsAlternativeOrder = alternative;
- updateOrder();
+ protected void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ updateRTLOrder();
}
/**
* In landscape, the LinearLayout is not auto mirrored since it is vertical. Therefore we
* have to do it manually
*/
- private void updateOrder() {
- boolean isLayoutRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
- boolean isLayoutReverse = isLayoutRtl ^ mIsAlternativeOrder;
-
- if (mIsLayoutReverse != isLayoutReverse) {
- // reversity changed, swap the order of all views.
+ private void updateRTLOrder() {
+ boolean isLayoutRtl = getResources().getConfiguration()
+ .getLayoutDirection() == LAYOUT_DIRECTION_RTL;
+ if (mIsLayoutRtl != isLayoutRtl) {
+ // RTL changed, swap the order of all views.
int childCount = getChildCount();
ArrayList<View> childList = new ArrayList<>(childCount);
for (int i = 0; i < childCount; i++) {
@@ -96,7 +87,7 @@
for (int i = childCount - 1; i >= 0; i--) {
super.addView(childList.get(i));
}
- mIsLayoutReverse = isLayoutReverse;
+ mIsLayoutRtl = isLayoutRtl;
}
}