Loading packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +25 −12 Original line number Diff line number Diff line Loading @@ -237,23 +237,12 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mStatusArea = mView.findViewById(R.id.keyguard_status_area); if (mSmartspaceController.isEnabled()) { mSmartspaceView = mSmartspaceController.buildAndConnectView(mView); View ksv = mView.findViewById(R.id.keyguard_slice_view); int ksvIndex = mStatusArea.indexOfChild(ksv); ksv.setVisibility(View.GONE); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT); mStatusArea.addView(mSmartspaceView, ksvIndex, lp); int startPadding = getContext().getResources() .getDimensionPixelSize(R.dimen.below_clock_padding_start); int endPadding = getContext().getResources() .getDimensionPixelSize(R.dimen.below_clock_padding_end); mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0); addSmartspaceView(ksvIndex); updateClockLayout(); mKeyguardUnlockAnimationController.setLockscreenSmartspace(mSmartspaceView); } mSecureSettings.registerContentObserverForUser( Loading Loading @@ -287,6 +276,30 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mKeyguardUnlockAnimationListener); } void onLocaleListChanged() { if (mSmartspaceController.isEnabled()) { int index = mStatusArea.indexOfChild(mSmartspaceView); if (index >= 0) { mStatusArea.removeView(mSmartspaceView); addSmartspaceView(index); } } } private void addSmartspaceView(int index) { mSmartspaceView = mSmartspaceController.buildAndConnectView(mView); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT); mStatusArea.addView(mSmartspaceView, index, lp); int startPadding = getContext().getResources().getDimensionPixelSize( R.dimen.below_clock_padding_start); int endPadding = getContext().getResources().getDimensionPixelSize( R.dimen.below_clock_padding_end); mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0); mKeyguardUnlockAnimationController.setLockscreenSmartspace(mSmartspaceView); } /** * Apply dp changes on font/scale change */ Loading packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +1 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV @Override public void onLocaleListChanged() { refreshTime(); mKeyguardClockSwitchController.onLocaleListChanged(); } @Override Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +10 −1 Original line number Diff line number Diff line Loading @@ -229,12 +229,21 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase { @Test public void testSmartspaceEnabledRemovesKeyguardStatusArea() { when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.buildAndConnectView(any())).thenReturn(mFakeSmartspaceView); mController.init(); assertEquals(View.GONE, mSliceView.getVisibility()); } @Test public void onLocaleListChangedRebuildsSmartspaceView() { when(mSmartspaceController.isEnabled()).thenReturn(true); mController.init(); mController.onLocaleListChanged(); // Should be called once on initial setup, then once again for locale change verify(mSmartspaceController, times(2)).buildAndConnectView(mView); } @Test public void testSmartspaceDisabledShowsKeyguardStatusArea() { when(mSmartspaceController.isEnabled()).thenReturn(false); Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.ScreenOffAnimationController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.KeyguardStateController; import org.junit.Before; Loading Loading @@ -117,4 +118,16 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase { verify(mKeyguardStatusView).setChildrenTranslationYExcludingMediaView(translationY); } @Test public void onLocaleListChangedNotifiesClockSwitchController() { ArgumentCaptor<ConfigurationListener> configurationListenerArgumentCaptor = ArgumentCaptor.forClass(ConfigurationListener.class); mController.onViewAttached(); verify(mConfigurationController).addCallback(configurationListenerArgumentCaptor.capture()); configurationListenerArgumentCaptor.getValue().onLocaleListChanged(); verify(mKeyguardClockSwitchController).onLocaleListChanged(); } } Loading
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +25 −12 Original line number Diff line number Diff line Loading @@ -237,23 +237,12 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mStatusArea = mView.findViewById(R.id.keyguard_status_area); if (mSmartspaceController.isEnabled()) { mSmartspaceView = mSmartspaceController.buildAndConnectView(mView); View ksv = mView.findViewById(R.id.keyguard_slice_view); int ksvIndex = mStatusArea.indexOfChild(ksv); ksv.setVisibility(View.GONE); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT); mStatusArea.addView(mSmartspaceView, ksvIndex, lp); int startPadding = getContext().getResources() .getDimensionPixelSize(R.dimen.below_clock_padding_start); int endPadding = getContext().getResources() .getDimensionPixelSize(R.dimen.below_clock_padding_end); mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0); addSmartspaceView(ksvIndex); updateClockLayout(); mKeyguardUnlockAnimationController.setLockscreenSmartspace(mSmartspaceView); } mSecureSettings.registerContentObserverForUser( Loading Loading @@ -287,6 +276,30 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS mKeyguardUnlockAnimationListener); } void onLocaleListChanged() { if (mSmartspaceController.isEnabled()) { int index = mStatusArea.indexOfChild(mSmartspaceView); if (index >= 0) { mStatusArea.removeView(mSmartspaceView); addSmartspaceView(index); } } } private void addSmartspaceView(int index) { mSmartspaceView = mSmartspaceController.buildAndConnectView(mView); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( MATCH_PARENT, WRAP_CONTENT); mStatusArea.addView(mSmartspaceView, index, lp); int startPadding = getContext().getResources().getDimensionPixelSize( R.dimen.below_clock_padding_start); int endPadding = getContext().getResources().getDimensionPixelSize( R.dimen.below_clock_padding_end); mSmartspaceView.setPaddingRelative(startPadding, 0, endPadding, 0); mKeyguardUnlockAnimationController.setLockscreenSmartspace(mSmartspaceView); } /** * Apply dp changes on font/scale change */ Loading
packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +1 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV @Override public void onLocaleListChanged() { refreshTime(); mKeyguardClockSwitchController.onLocaleListChanged(); } @Override Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +10 −1 Original line number Diff line number Diff line Loading @@ -229,12 +229,21 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase { @Test public void testSmartspaceEnabledRemovesKeyguardStatusArea() { when(mSmartspaceController.isEnabled()).thenReturn(true); when(mSmartspaceController.buildAndConnectView(any())).thenReturn(mFakeSmartspaceView); mController.init(); assertEquals(View.GONE, mSliceView.getVisibility()); } @Test public void onLocaleListChangedRebuildsSmartspaceView() { when(mSmartspaceController.isEnabled()).thenReturn(true); mController.init(); mController.onLocaleListChanged(); // Should be called once on initial setup, then once again for locale change verify(mSmartspaceController, times(2)).buildAndConnectView(mView); } @Test public void testSmartspaceDisabledShowsKeyguardStatusArea() { when(mSmartspaceController.isEnabled()).thenReturn(false); Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.ScreenOffAnimationController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.KeyguardStateController; import org.junit.Before; Loading Loading @@ -117,4 +118,16 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase { verify(mKeyguardStatusView).setChildrenTranslationYExcludingMediaView(translationY); } @Test public void onLocaleListChangedNotifiesClockSwitchController() { ArgumentCaptor<ConfigurationListener> configurationListenerArgumentCaptor = ArgumentCaptor.forClass(ConfigurationListener.class); mController.onViewAttached(); verify(mConfigurationController).addCallback(configurationListenerArgumentCaptor.capture()); configurationListenerArgumentCaptor.getValue().onLocaleListChanged(); verify(mKeyguardClockSwitchController).onLocaleListChanged(); } }