Merge changes I2769bc3f,I20171f31 into tm-dev
* changes: Use configuration for display rotation instead of display Refill all the dispatcher views when updating rotation
This commit is contained in:
@@ -168,6 +168,7 @@ public class NavigationBarInflaterView extends FrameLayout
|
|||||||
|
|
||||||
public void setButtonDispatchers(SparseArray<ButtonDispatcher> buttonDispatchers) {
|
public void setButtonDispatchers(SparseArray<ButtonDispatcher> buttonDispatchers) {
|
||||||
mButtonDispatchers = buttonDispatchers;
|
mButtonDispatchers = buttonDispatchers;
|
||||||
|
clearDispatcherViews();
|
||||||
for (int i = 0; i < buttonDispatchers.size(); i++) {
|
for (int i = 0; i < buttonDispatchers.size(); i++) {
|
||||||
initiallyFill(buttonDispatchers.valueAt(i));
|
initiallyFill(buttonDispatchers.valueAt(i));
|
||||||
}
|
}
|
||||||
@@ -454,12 +455,16 @@ public class NavigationBarInflaterView extends FrameLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearViews() {
|
private void clearDispatcherViews() {
|
||||||
if (mButtonDispatchers != null) {
|
if (mButtonDispatchers != null) {
|
||||||
for (int i = 0; i < mButtonDispatchers.size(); i++) {
|
for (int i = 0; i < mButtonDispatchers.size(); i++) {
|
||||||
mButtonDispatchers.valueAt(i).clear();
|
mButtonDispatchers.valueAt(i).clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearViews() {
|
||||||
|
clearDispatcherViews();
|
||||||
clearAllChildren(mHorizontal.findViewById(R.id.nav_buttons));
|
clearAllChildren(mHorizontal.findViewById(R.id.nav_buttons));
|
||||||
clearAllChildren(mVertical.findViewById(R.id.nav_buttons));
|
clearAllChildren(mVertical.findViewById(R.id.nav_buttons));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
R.drawable.ic_sysbar_rotate_button_ccw_start_90,
|
R.drawable.ic_sysbar_rotate_button_ccw_start_90,
|
||||||
R.drawable.ic_sysbar_rotate_button_cw_start_0,
|
R.drawable.ic_sysbar_rotate_button_cw_start_0,
|
||||||
R.drawable.ic_sysbar_rotate_button_cw_start_90,
|
R.drawable.ic_sysbar_rotate_button_cw_start_90,
|
||||||
() -> getDisplay().getRotation());
|
() -> mCurrentRotation);
|
||||||
|
|
||||||
mConfiguration = new Configuration();
|
mConfiguration = new Configuration();
|
||||||
mTmpLastConfiguration = new Configuration();
|
mTmpLastConfiguration = new Configuration();
|
||||||
@@ -538,6 +538,7 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
mRotationButtonController.setRotationButton(mRotationContextButton,
|
mRotationButtonController.setRotationButton(mRotationContextButton,
|
||||||
mRotationButtonListener);
|
mRotationButtonListener);
|
||||||
}
|
}
|
||||||
|
mNavigationInflaterView.setButtonDispatchers(mButtonDispatchers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyButtonDrawable getBackDrawable() {
|
public KeyButtonDrawable getBackDrawable() {
|
||||||
@@ -978,15 +979,27 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
return mCurrentRotation != rotation;
|
return mCurrentRotation != rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateCurrentRotation() {
|
||||||
|
final int rotation = mConfiguration.windowConfiguration.getDisplayRotation();
|
||||||
|
if (mCurrentRotation == rotation) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mCurrentRotation = rotation;
|
||||||
|
mNavigationInflaterView.setAlternativeOrder(mCurrentRotation == Surface.ROTATION_90);
|
||||||
|
mDeadZone.onConfigurationChanged(mCurrentRotation);
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "updateCurrentRotation(): rot=" + mCurrentRotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateCurrentView() {
|
private void updateCurrentView() {
|
||||||
resetViews();
|
resetViews();
|
||||||
mCurrentView = mIsVertical ? mVertical : mHorizontal;
|
mCurrentView = mIsVertical ? mVertical : mHorizontal;
|
||||||
mCurrentView.setVisibility(View.VISIBLE);
|
mCurrentView.setVisibility(View.VISIBLE);
|
||||||
mNavigationInflaterView.setVertical(mIsVertical);
|
mNavigationInflaterView.setVertical(mIsVertical);
|
||||||
mCurrentRotation = getContextDisplay().getRotation();
|
|
||||||
mNavigationInflaterView.setAlternativeOrder(mCurrentRotation == Surface.ROTATION_90);
|
|
||||||
mNavigationInflaterView.updateButtonDispatchersCurrentView();
|
mNavigationInflaterView.updateButtonDispatchersCurrentView();
|
||||||
updateLayoutTransitionsEnabled();
|
updateLayoutTransitionsEnabled();
|
||||||
|
updateCurrentRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetViews() {
|
private void resetViews() {
|
||||||
@@ -1019,17 +1032,11 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
|
|
||||||
public void reorient() {
|
public void reorient() {
|
||||||
updateCurrentView();
|
updateCurrentView();
|
||||||
|
|
||||||
((NavigationBarFrame) getRootView()).setDeadZone(mDeadZone);
|
((NavigationBarFrame) getRootView()).setDeadZone(mDeadZone);
|
||||||
mDeadZone.onConfigurationChanged(mCurrentRotation);
|
|
||||||
|
|
||||||
// force the low profile & disabled states into compliance
|
// force the low profile & disabled states into compliance
|
||||||
mBarTransitions.init();
|
mBarTransitions.init();
|
||||||
|
|
||||||
if (DEBUG) {
|
|
||||||
Log.d(TAG, "reorient(): rot=" + mCurrentRotation);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve layout direction if not resolved since components changing layout direction such
|
// Resolve layout direction if not resolved since components changing layout direction such
|
||||||
// as changing languages will recreate this view and the direction will be resolved later
|
// as changing languages will recreate this view and the direction will be resolved later
|
||||||
if (!isLayoutDirectionResolved()) {
|
if (!isLayoutDirectionResolved()) {
|
||||||
@@ -1100,6 +1107,7 @@ public class NavigationBarView extends FrameLayout {
|
|||||||
boolean uiCarModeChanged = updateCarMode();
|
boolean uiCarModeChanged = updateCarMode();
|
||||||
updateIcons(mTmpLastConfiguration);
|
updateIcons(mTmpLastConfiguration);
|
||||||
updateRecentsIcon();
|
updateRecentsIcon();
|
||||||
|
updateCurrentRotation();
|
||||||
mEdgeBackGestureHandler.onConfigurationChanged(mConfiguration);
|
mEdgeBackGestureHandler.onConfigurationChanged(mConfiguration);
|
||||||
if (uiCarModeChanged || mTmpLastConfiguration.densityDpi != mConfiguration.densityDpi
|
if (uiCarModeChanged || mTmpLastConfiguration.densityDpi != mConfiguration.densityDpi
|
||||||
|| mTmpLastConfiguration.getLayoutDirection() != mConfiguration.getLayoutDirection()) {
|
|| mTmpLastConfiguration.getLayoutDirection() != mConfiguration.getLayoutDirection()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user