Smartspace - Align large clock

The large clock was not properly set below the new smartspace when the
plugin was activiated. Fix that.

Fixes: 185226009
Test: atest KeyguardClockSwitchControllerTest
Change-Id: Ib9c1f837128524b8a896ed12eee7b70cc145ec28
This commit is contained in:
Matt Pietal
2021-04-13 11:20:48 -04:00
parent 1d55f8ecbe
commit 7994f8159a
2 changed files with 11 additions and 0 deletions

View File

@@ -188,6 +188,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
mSmartspaceView.registerDataProvider(plugin);
View asView = (View) mSmartspaceView;
// Place plugin view below normal clock...
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
MATCH_PARENT, WRAP_CONTENT);
lp.addRule(RelativeLayout.BELOW, R.id.lockscreen_clock_view);
@@ -197,6 +198,11 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
.getDimensionPixelSize(R.dimen.below_clock_padding_start);
asView.setPadding(padding, 0, padding, 0);
// ... but above the large clock
lp = new RelativeLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT);
lp.addRule(RelativeLayout.BELOW, asView.getId());
mLargeClockFrame.setLayoutParams(lp);
View nic = mView.findViewById(
com.android.systemui.R.id.left_aligned_notification_icon_container);
lp = (RelativeLayout.LayoutParams) nic.getLayoutParams();
@@ -219,6 +225,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
nic.getLayoutParams();
lp.addRule(RelativeLayout.BELOW, R.id.keyguard_status_area);
nic.setLayoutParams(lp);
mLargeClockFrame.setLayoutParams(lp);
mSmartspaceView = null;
}

View File

@@ -31,6 +31,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import com.android.internal.colorextraction.ColorExtractor;
@@ -98,6 +99,8 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
@Mock
private AnimatableClockView mLargeClockView;
@Mock
private FrameLayout mLargeClockFrame;
@Mock
BatteryController mBatteryController;
private KeyguardClockSwitchController mController;
@@ -112,6 +115,7 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
when(mView.findViewById(R.id.animatable_clock_view)).thenReturn(mClockView);
when(mView.findViewById(R.id.animatable_clock_view_large)).thenReturn(mLargeClockView);
when(mView.findViewById(R.id.lockscreen_clock_view_large)).thenReturn(mLargeClockFrame);
when(mClockView.getContext()).thenReturn(getContext());
when(mLargeClockView.getContext()).thenReturn(getContext());