Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java +23 −1 Original line number Original line Diff line number Diff line Loading @@ -28,7 +28,6 @@ import android.widget.LinearLayout; import android.widget.Space; import android.widget.Space; import com.android.systemui.R; import com.android.systemui.R; import com.android.systemui.SystemUIFactory; import com.android.systemui.statusbar.policy.KeyButtonView; import com.android.systemui.statusbar.policy.KeyButtonView; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService; Loading Loading @@ -71,6 +70,8 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi private View mLastRot0; private View mLastRot0; private View mLastRot90; private View mLastRot90; private boolean mAlternativeOrder; public NavigationBarInflaterView(Context context, AttributeSet attrs) { public NavigationBarInflaterView(Context context, AttributeSet attrs) { super(context, attrs); super(context, attrs); mDensity = context.getResources().getConfiguration().densityDpi; mDensity = context.getResources().getConfiguration().densityDpi; Loading Loading @@ -114,6 +115,7 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi false); false); mRot90.setId(R.id.rot90); mRot90.setId(R.id.rot90); addView(mRot90); addView(mRot90); updateAlternativeOrder(); if (getParent() instanceof NavigationBarView) { if (getParent() instanceof NavigationBarView) { ((NavigationBarView) getParent()).updateRotatedViews(); ((NavigationBarView) getParent()).updateRotatedViews(); } } Loading Loading @@ -152,6 +154,26 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi } } } } public void setAlternativeOrder(boolean alternativeOrder) { if (alternativeOrder != mAlternativeOrder) { mAlternativeOrder = alternativeOrder; updateAlternativeOrder(); } } private void updateAlternativeOrder() { updateAlternativeOrder(mRot0.findViewById(R.id.ends_group)); updateAlternativeOrder(mRot0.findViewById(R.id.center_group)); updateAlternativeOrder(mRot90.findViewById(R.id.ends_group)); updateAlternativeOrder(mRot90.findViewById(R.id.center_group)); } private void updateAlternativeOrder(View v) { if (v instanceof ReverseLinearLayout) { ((ReverseLinearLayout) v).setAlternativeOrder(mAlternativeOrder); } } private void initiallyFill(ButtonDispatcher buttonDispatcher) { private void initiallyFill(ButtonDispatcher buttonDispatcher) { addAll(buttonDispatcher, (ViewGroup) mRot0.findViewById(R.id.ends_group)); addAll(buttonDispatcher, (ViewGroup) mRot0.findViewById(R.id.ends_group)); addAll(buttonDispatcher, (ViewGroup) mRot0.findViewById(R.id.center_group)); addAll(buttonDispatcher, (ViewGroup) mRot0.findViewById(R.id.center_group)); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -99,6 +99,8 @@ public class NavigationBarView extends LinearLayout { private final SparseArray<ButtonDispatcher> mButtonDisatchers = new SparseArray<>(); private final SparseArray<ButtonDispatcher> mButtonDisatchers = new SparseArray<>(); private Configuration mConfiguration; private Configuration mConfiguration; private NavigationBarInflaterView mNavigationInflaterView; private class NavTransitionListener implements TransitionListener { private class NavTransitionListener implements TransitionListener { private boolean mBackTransitioning; private boolean mBackTransitioning; private boolean mHomeAppearing; private boolean mHomeAppearing; Loading Loading @@ -472,9 +474,10 @@ public class NavigationBarView extends LinearLayout { @Override @Override public void onFinishInflate() { public void onFinishInflate() { mNavigationInflaterView = (NavigationBarInflaterView) findViewById( R.id.navigation_inflater); updateRotatedViews(); updateRotatedViews(); ((NavigationBarInflaterView) findViewById(R.id.navigation_inflater)).setButtonDispatchers( mNavigationInflaterView.setButtonDispatchers(mButtonDisatchers); mButtonDisatchers); getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); Loading Loading @@ -530,6 +533,7 @@ public class NavigationBarView extends LinearLayout { } } mCurrentView = mRotatedViews[rot]; mCurrentView = mRotatedViews[rot]; mCurrentView.setVisibility(View.VISIBLE); mCurrentView.setVisibility(View.VISIBLE); mNavigationInflaterView.setAlternativeOrder(rot == Surface.ROTATION_90); for (int i = 0; i < mButtonDisatchers.size(); i++) { for (int i = 0; i < mButtonDisatchers.size(); i++) { mButtonDisatchers.valueAt(i).setCurrentView(mCurrentView); mButtonDisatchers.valueAt(i).setCurrentView(mCurrentView); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +19 −1 Original line number Original line Diff line number Diff line Loading @@ -52,6 +52,7 @@ import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable; import android.hardware.display.DisplayManager; import android.inputmethodservice.InputMethodService; import android.inputmethodservice.InputMethodService; import android.media.AudioAttributes; import android.media.AudioAttributes; import android.media.MediaMetadata; import android.media.MediaMetadata; Loading Loading @@ -200,7 +201,7 @@ import static com.android.systemui.statusbar.phone.BarTransitions.MODE_WARNING; public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public class PhoneStatusBar extends BaseStatusBar implements DemoMode, DragDownHelper.DragDownCallback, ActivityStarter, OnUnlockMethodChangedListener, DragDownHelper.DragDownCallback, ActivityStarter, OnUnlockMethodChangedListener, HeadsUpManager.OnHeadsUpChangedListener { HeadsUpManager.OnHeadsUpChangedListener, DisplayManager.DisplayListener { static final String TAG = "PhoneStatusBar"; static final String TAG = "PhoneStatusBar"; public static final boolean DEBUG = BaseStatusBar.DEBUG; public static final boolean DEBUG = BaseStatusBar.DEBUG; public static final boolean SPEW = false; public static final boolean SPEW = false; Loading Loading @@ -685,6 +686,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mUnlockMethodCache.addListener(this); mUnlockMethodCache.addListener(this); startKeyguard(); startKeyguard(); mContext.getSystemService(DisplayManager.class).registerDisplayListener(this, null); mDozeServiceHost = new DozeServiceHost(); mDozeServiceHost = new DozeServiceHost(); KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mDozeServiceHost); KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mDozeServiceHost); putComponent(DozeHost.class, mDozeServiceHost); putComponent(DozeHost.class, mDozeServiceHost); Loading Loading @@ -3511,6 +3514,21 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mNetworkController.onConfigurationChanged(); mNetworkController.onConfigurationChanged(); } } @Override public void onDisplayAdded(int displayId) { } @Override public void onDisplayRemoved(int displayId) { } @Override public void onDisplayChanged(int displayId) { if (displayId == Display.DEFAULT_DISPLAY) { repositionNavigationBar(); } } @Override @Override public void userSwitched(int newUserId) { public void userSwitched(int newUserId) { super.userSwitched(newUserId); super.userSwitched(newUserId); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ReverseLinearLayout.java +27 −18 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,11 @@ import java.util.ArrayList; */ */ public class ReverseLinearLayout extends LinearLayout { public class ReverseLinearLayout extends LinearLayout { private boolean mIsLayoutRtl; /** 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; public ReverseLinearLayout(Context context, @Nullable AttributeSet attrs) { public ReverseLinearLayout(Context context, @Nullable AttributeSet attrs) { super(context, attrs); super(context, attrs); Loading @@ -39,45 +43,50 @@ public class ReverseLinearLayout extends LinearLayout { @Override @Override protected void onFinishInflate() { protected void onFinishInflate() { super.onFinishInflate(); super.onFinishInflate(); mIsLayoutRtl = getResources().getConfiguration() updateOrder(); .getLayoutDirection() == LAYOUT_DIRECTION_RTL; } } @Override @Override public void addView(View child) { public void addView(View child) { reversParams(child.getLayoutParams()); reversParams(child.getLayoutParams()); if (mIsLayoutRtl) { if (mIsLayoutReverse) { super.addView(child); } else { super.addView(child, 0); super.addView(child, 0); } else { super.addView(child); } } } } @Override @Override public void addView(View child, ViewGroup.LayoutParams params) { public void addView(View child, ViewGroup.LayoutParams params) { reversParams(params); reversParams(params); if (mIsLayoutRtl) { if (mIsLayoutReverse) { super.addView(child, params); } else { super.addView(child, 0, params); super.addView(child, 0, params); } else { super.addView(child, params); } } } } @Override @Override protected void onConfigurationChanged(Configuration newConfig) { public void onRtlPropertiesChanged(int layoutDirection) { super.onConfigurationChanged(newConfig); super.onRtlPropertiesChanged(layoutDirection); updateRTLOrder(); updateOrder(); } public void setAlternativeOrder(boolean alternative) { mIsAlternativeOrder = alternative; updateOrder(); } } /** /** * In landscape, the LinearLayout is not auto mirrored since it is vertical. Therefore we * In landscape, the LinearLayout is not auto mirrored since it is vertical. Therefore we * have to do it manually * have to do it manually */ */ private void updateRTLOrder() { private void updateOrder() { boolean isLayoutRtl = getResources().getConfiguration() boolean isLayoutRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL; .getLayoutDirection() == LAYOUT_DIRECTION_RTL; boolean isLayoutReverse = isLayoutRtl ^ mIsAlternativeOrder; if (mIsLayoutRtl != isLayoutRtl) { // RTL changed, swap the order of all views. if (mIsLayoutReverse != isLayoutReverse) { // reversity changed, swap the order of all views. int childCount = getChildCount(); int childCount = getChildCount(); ArrayList<View> childList = new ArrayList<>(childCount); ArrayList<View> childList = new ArrayList<>(childCount); for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) { Loading @@ -87,7 +96,7 @@ public class ReverseLinearLayout extends LinearLayout { for (int i = childCount - 1; i >= 0; i--) { for (int i = childCount - 1; i >= 0; i--) { super.addView(childList.get(i)); super.addView(childList.get(i)); } } mIsLayoutRtl = isLayoutRtl; mIsLayoutReverse = isLayoutReverse; } } } } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java +23 −1 Original line number Original line Diff line number Diff line Loading @@ -28,7 +28,6 @@ import android.widget.LinearLayout; import android.widget.Space; import android.widget.Space; import com.android.systemui.R; import com.android.systemui.R; import com.android.systemui.SystemUIFactory; import com.android.systemui.statusbar.policy.KeyButtonView; import com.android.systemui.statusbar.policy.KeyButtonView; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService; Loading Loading @@ -71,6 +70,8 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi private View mLastRot0; private View mLastRot0; private View mLastRot90; private View mLastRot90; private boolean mAlternativeOrder; public NavigationBarInflaterView(Context context, AttributeSet attrs) { public NavigationBarInflaterView(Context context, AttributeSet attrs) { super(context, attrs); super(context, attrs); mDensity = context.getResources().getConfiguration().densityDpi; mDensity = context.getResources().getConfiguration().densityDpi; Loading Loading @@ -114,6 +115,7 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi false); false); mRot90.setId(R.id.rot90); mRot90.setId(R.id.rot90); addView(mRot90); addView(mRot90); updateAlternativeOrder(); if (getParent() instanceof NavigationBarView) { if (getParent() instanceof NavigationBarView) { ((NavigationBarView) getParent()).updateRotatedViews(); ((NavigationBarView) getParent()).updateRotatedViews(); } } Loading Loading @@ -152,6 +154,26 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi } } } } public void setAlternativeOrder(boolean alternativeOrder) { if (alternativeOrder != mAlternativeOrder) { mAlternativeOrder = alternativeOrder; updateAlternativeOrder(); } } private void updateAlternativeOrder() { updateAlternativeOrder(mRot0.findViewById(R.id.ends_group)); updateAlternativeOrder(mRot0.findViewById(R.id.center_group)); updateAlternativeOrder(mRot90.findViewById(R.id.ends_group)); updateAlternativeOrder(mRot90.findViewById(R.id.center_group)); } private void updateAlternativeOrder(View v) { if (v instanceof ReverseLinearLayout) { ((ReverseLinearLayout) v).setAlternativeOrder(mAlternativeOrder); } } private void initiallyFill(ButtonDispatcher buttonDispatcher) { private void initiallyFill(ButtonDispatcher buttonDispatcher) { addAll(buttonDispatcher, (ViewGroup) mRot0.findViewById(R.id.ends_group)); addAll(buttonDispatcher, (ViewGroup) mRot0.findViewById(R.id.ends_group)); addAll(buttonDispatcher, (ViewGroup) mRot0.findViewById(R.id.center_group)); addAll(buttonDispatcher, (ViewGroup) mRot0.findViewById(R.id.center_group)); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -99,6 +99,8 @@ public class NavigationBarView extends LinearLayout { private final SparseArray<ButtonDispatcher> mButtonDisatchers = new SparseArray<>(); private final SparseArray<ButtonDispatcher> mButtonDisatchers = new SparseArray<>(); private Configuration mConfiguration; private Configuration mConfiguration; private NavigationBarInflaterView mNavigationInflaterView; private class NavTransitionListener implements TransitionListener { private class NavTransitionListener implements TransitionListener { private boolean mBackTransitioning; private boolean mBackTransitioning; private boolean mHomeAppearing; private boolean mHomeAppearing; Loading Loading @@ -472,9 +474,10 @@ public class NavigationBarView extends LinearLayout { @Override @Override public void onFinishInflate() { public void onFinishInflate() { mNavigationInflaterView = (NavigationBarInflaterView) findViewById( R.id.navigation_inflater); updateRotatedViews(); updateRotatedViews(); ((NavigationBarInflaterView) findViewById(R.id.navigation_inflater)).setButtonDispatchers( mNavigationInflaterView.setButtonDispatchers(mButtonDisatchers); mButtonDisatchers); getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener); Loading Loading @@ -530,6 +533,7 @@ public class NavigationBarView extends LinearLayout { } } mCurrentView = mRotatedViews[rot]; mCurrentView = mRotatedViews[rot]; mCurrentView.setVisibility(View.VISIBLE); mCurrentView.setVisibility(View.VISIBLE); mNavigationInflaterView.setAlternativeOrder(rot == Surface.ROTATION_90); for (int i = 0; i < mButtonDisatchers.size(); i++) { for (int i = 0; i < mButtonDisatchers.size(); i++) { mButtonDisatchers.valueAt(i).setCurrentView(mCurrentView); mButtonDisatchers.valueAt(i).setCurrentView(mCurrentView); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +19 −1 Original line number Original line Diff line number Diff line Loading @@ -52,6 +52,7 @@ import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable; import android.hardware.display.DisplayManager; import android.inputmethodservice.InputMethodService; import android.inputmethodservice.InputMethodService; import android.media.AudioAttributes; import android.media.AudioAttributes; import android.media.MediaMetadata; import android.media.MediaMetadata; Loading Loading @@ -200,7 +201,7 @@ import static com.android.systemui.statusbar.phone.BarTransitions.MODE_WARNING; public class PhoneStatusBar extends BaseStatusBar implements DemoMode, public class PhoneStatusBar extends BaseStatusBar implements DemoMode, DragDownHelper.DragDownCallback, ActivityStarter, OnUnlockMethodChangedListener, DragDownHelper.DragDownCallback, ActivityStarter, OnUnlockMethodChangedListener, HeadsUpManager.OnHeadsUpChangedListener { HeadsUpManager.OnHeadsUpChangedListener, DisplayManager.DisplayListener { static final String TAG = "PhoneStatusBar"; static final String TAG = "PhoneStatusBar"; public static final boolean DEBUG = BaseStatusBar.DEBUG; public static final boolean DEBUG = BaseStatusBar.DEBUG; public static final boolean SPEW = false; public static final boolean SPEW = false; Loading Loading @@ -685,6 +686,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mUnlockMethodCache.addListener(this); mUnlockMethodCache.addListener(this); startKeyguard(); startKeyguard(); mContext.getSystemService(DisplayManager.class).registerDisplayListener(this, null); mDozeServiceHost = new DozeServiceHost(); mDozeServiceHost = new DozeServiceHost(); KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mDozeServiceHost); KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mDozeServiceHost); putComponent(DozeHost.class, mDozeServiceHost); putComponent(DozeHost.class, mDozeServiceHost); Loading Loading @@ -3511,6 +3514,21 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mNetworkController.onConfigurationChanged(); mNetworkController.onConfigurationChanged(); } } @Override public void onDisplayAdded(int displayId) { } @Override public void onDisplayRemoved(int displayId) { } @Override public void onDisplayChanged(int displayId) { if (displayId == Display.DEFAULT_DISPLAY) { repositionNavigationBar(); } } @Override @Override public void userSwitched(int newUserId) { public void userSwitched(int newUserId) { super.userSwitched(newUserId); super.userSwitched(newUserId); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ReverseLinearLayout.java +27 −18 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,11 @@ import java.util.ArrayList; */ */ public class ReverseLinearLayout extends LinearLayout { public class ReverseLinearLayout extends LinearLayout { private boolean mIsLayoutRtl; /** 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; public ReverseLinearLayout(Context context, @Nullable AttributeSet attrs) { public ReverseLinearLayout(Context context, @Nullable AttributeSet attrs) { super(context, attrs); super(context, attrs); Loading @@ -39,45 +43,50 @@ public class ReverseLinearLayout extends LinearLayout { @Override @Override protected void onFinishInflate() { protected void onFinishInflate() { super.onFinishInflate(); super.onFinishInflate(); mIsLayoutRtl = getResources().getConfiguration() updateOrder(); .getLayoutDirection() == LAYOUT_DIRECTION_RTL; } } @Override @Override public void addView(View child) { public void addView(View child) { reversParams(child.getLayoutParams()); reversParams(child.getLayoutParams()); if (mIsLayoutRtl) { if (mIsLayoutReverse) { super.addView(child); } else { super.addView(child, 0); super.addView(child, 0); } else { super.addView(child); } } } } @Override @Override public void addView(View child, ViewGroup.LayoutParams params) { public void addView(View child, ViewGroup.LayoutParams params) { reversParams(params); reversParams(params); if (mIsLayoutRtl) { if (mIsLayoutReverse) { super.addView(child, params); } else { super.addView(child, 0, params); super.addView(child, 0, params); } else { super.addView(child, params); } } } } @Override @Override protected void onConfigurationChanged(Configuration newConfig) { public void onRtlPropertiesChanged(int layoutDirection) { super.onConfigurationChanged(newConfig); super.onRtlPropertiesChanged(layoutDirection); updateRTLOrder(); updateOrder(); } public void setAlternativeOrder(boolean alternative) { mIsAlternativeOrder = alternative; updateOrder(); } } /** /** * In landscape, the LinearLayout is not auto mirrored since it is vertical. Therefore we * In landscape, the LinearLayout is not auto mirrored since it is vertical. Therefore we * have to do it manually * have to do it manually */ */ private void updateRTLOrder() { private void updateOrder() { boolean isLayoutRtl = getResources().getConfiguration() boolean isLayoutRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL; .getLayoutDirection() == LAYOUT_DIRECTION_RTL; boolean isLayoutReverse = isLayoutRtl ^ mIsAlternativeOrder; if (mIsLayoutRtl != isLayoutRtl) { // RTL changed, swap the order of all views. if (mIsLayoutReverse != isLayoutReverse) { // reversity changed, swap the order of all views. int childCount = getChildCount(); int childCount = getChildCount(); ArrayList<View> childList = new ArrayList<>(childCount); ArrayList<View> childList = new ArrayList<>(childCount); for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) { Loading @@ -87,7 +96,7 @@ public class ReverseLinearLayout extends LinearLayout { for (int i = childCount - 1; i >= 0; i--) { for (int i = childCount - 1; i >= 0; i--) { super.addView(childList.get(i)); super.addView(childList.get(i)); } } mIsLayoutRtl = isLayoutRtl; mIsLayoutReverse = isLayoutReverse; } } } } Loading