Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java +8 −0 Original line number Diff line number Diff line Loading @@ -62,4 +62,12 @@ public interface ClockPlugin extends Plugin { * Notifies that the time zone has changed. */ default void onTimeZoneChanged(TimeZone timeZone) {} /** * Indicates whether the keyguard status area (date) should be shown below * the clock. */ default boolean shouldShowStatusArea() { return true; } } packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml +24 −12 Original line number Diff line number Diff line Loading @@ -20,6 +20,12 @@ <!-- This is a view that shows clock information in Keyguard. --> <com.android.keyguard.KeyguardClockSwitch xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/keyguard_clock_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top"> <FrameLayout android:id="@+id/clock_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" Loading @@ -35,4 +41,10 @@ style="@style/widget_big" android:format12Hour="@string/keyguard_widget_12_hours_format" android:format24Hour="@string/keyguard_widget_24_hours_format" /> </FrameLayout> <include layout="@layout/keyguard_status_area" android:id="@+id/keyguard_status_area" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/clock_view" /> </com.android.keyguard.KeyguardClockSwitch> packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml +3 −13 Original line number Diff line number Diff line Loading @@ -33,21 +33,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <RelativeLayout <include layout="@layout/keyguard_clock_switch" android:id="@+id/keyguard_clock_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top"> <include layout="@layout/keyguard_clock_switch" android:id="@+id/clock_view" android:layout_width="match_parent" android:layout_height="wrap_content" /> <include layout="@layout/keyguard_status_area" android:id="@+id/keyguard_status_area" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/clock_view" /> </RelativeLayout> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" Loading packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +3 −13 Original line number Diff line number Diff line Loading @@ -50,21 +50,11 @@ android:textSize="13sp" android:text="@*android:string/global_action_logout" /> <RelativeLayout <include layout="@layout/keyguard_clock_switch" android:id="@+id/keyguard_clock_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top"> <include layout="@layout/keyguard_clock_switch" android:id="@+id/clock_view" android:layout_width="match_parent" android:layout_height="wrap_content" /> <include layout="@layout/keyguard_status_area" android:id="@+id/keyguard_status_area" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/clock_view" /> </RelativeLayout> <TextView android:id="@+id/owner_info" Loading packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +19 −3 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.RelativeLayout; import android.widget.TextClock; import androidx.annotation.VisibleForTesting; Loading @@ -22,7 +23,7 @@ import java.util.TimeZone; /** * Switch to show plugin clock when plugin is connected, otherwise it will show default clock. */ public class KeyguardClockSwitch extends FrameLayout { public class KeyguardClockSwitch extends RelativeLayout { /** * Optional/alternative clock injected via plugin. */ Loading @@ -31,6 +32,15 @@ public class KeyguardClockSwitch extends FrameLayout { * Default clock. */ private TextClock mClockView; /** * Frame for default and custom clock. */ private FrameLayout mClockFrame; /** * Status area (date and other stuff) shown below the clock. Plugin can decide whether * or not to show it below the alternate clock. */ private View mKeyguardStatusArea; private final PluginListener<ClockPlugin> mClockPluginListener = new PluginListener<ClockPlugin>() { Loading @@ -43,11 +53,14 @@ public class KeyguardClockSwitch extends FrameLayout { // selected clock face. In the future, the user should be able to // pick a clock face from the available plugins. mClockPlugin = plugin; addView(view, -1, mClockFrame.addView(view, -1, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); initPluginParams(); mClockView.setVisibility(View.GONE); if (!plugin.shouldShowStatusArea()) { mKeyguardStatusArea.setVisibility(View.GONE); } } } Loading @@ -56,6 +69,7 @@ public class KeyguardClockSwitch extends FrameLayout { if (Objects.equals(plugin, mClockPlugin)) { disconnectPlugin(); mClockView.setVisibility(View.VISIBLE); mKeyguardStatusArea.setVisibility(View.VISIBLE); } } }; Loading @@ -72,6 +86,8 @@ public class KeyguardClockSwitch extends FrameLayout { protected void onFinishInflate() { super.onFinishInflate(); mClockView = findViewById(R.id.default_clock_view); mClockFrame = findViewById(R.id.clock_view); mKeyguardStatusArea = findViewById(R.id.keyguard_status_area); } @Override Loading Loading @@ -185,7 +201,7 @@ public class KeyguardClockSwitch extends FrameLayout { if (mClockPlugin != null) { View view = mClockPlugin.getView(); if (view != null) { removeView(view); mClockFrame.removeView(view); } mClockPlugin = null; } Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java +8 −0 Original line number Diff line number Diff line Loading @@ -62,4 +62,12 @@ public interface ClockPlugin extends Plugin { * Notifies that the time zone has changed. */ default void onTimeZoneChanged(TimeZone timeZone) {} /** * Indicates whether the keyguard status area (date) should be shown below * the clock. */ default boolean shouldShowStatusArea() { return true; } }
packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml +24 −12 Original line number Diff line number Diff line Loading @@ -20,6 +20,12 @@ <!-- This is a view that shows clock information in Keyguard. --> <com.android.keyguard.KeyguardClockSwitch xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/keyguard_clock_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top"> <FrameLayout android:id="@+id/clock_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" Loading @@ -35,4 +41,10 @@ style="@style/widget_big" android:format12Hour="@string/keyguard_widget_12_hours_format" android:format24Hour="@string/keyguard_widget_24_hours_format" /> </FrameLayout> <include layout="@layout/keyguard_status_area" android:id="@+id/keyguard_status_area" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/clock_view" /> </com.android.keyguard.KeyguardClockSwitch>
packages/SystemUI/res-keyguard/layout/keyguard_presentation.xml +3 −13 Original line number Diff line number Diff line Loading @@ -33,21 +33,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <RelativeLayout <include layout="@layout/keyguard_clock_switch" android:id="@+id/keyguard_clock_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top"> <include layout="@layout/keyguard_clock_switch" android:id="@+id/clock_view" android:layout_width="match_parent" android:layout_height="wrap_content" /> <include layout="@layout/keyguard_status_area" android:id="@+id/keyguard_status_area" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/clock_view" /> </RelativeLayout> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" Loading
packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml +3 −13 Original line number Diff line number Diff line Loading @@ -50,21 +50,11 @@ android:textSize="13sp" android:text="@*android:string/global_action_logout" /> <RelativeLayout <include layout="@layout/keyguard_clock_switch" android:id="@+id/keyguard_clock_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top"> <include layout="@layout/keyguard_clock_switch" android:id="@+id/clock_view" android:layout_width="match_parent" android:layout_height="wrap_content" /> <include layout="@layout/keyguard_status_area" android:id="@+id/keyguard_status_area" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/clock_view" /> </RelativeLayout> <TextView android:id="@+id/owner_info" Loading
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +19 −3 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.RelativeLayout; import android.widget.TextClock; import androidx.annotation.VisibleForTesting; Loading @@ -22,7 +23,7 @@ import java.util.TimeZone; /** * Switch to show plugin clock when plugin is connected, otherwise it will show default clock. */ public class KeyguardClockSwitch extends FrameLayout { public class KeyguardClockSwitch extends RelativeLayout { /** * Optional/alternative clock injected via plugin. */ Loading @@ -31,6 +32,15 @@ public class KeyguardClockSwitch extends FrameLayout { * Default clock. */ private TextClock mClockView; /** * Frame for default and custom clock. */ private FrameLayout mClockFrame; /** * Status area (date and other stuff) shown below the clock. Plugin can decide whether * or not to show it below the alternate clock. */ private View mKeyguardStatusArea; private final PluginListener<ClockPlugin> mClockPluginListener = new PluginListener<ClockPlugin>() { Loading @@ -43,11 +53,14 @@ public class KeyguardClockSwitch extends FrameLayout { // selected clock face. In the future, the user should be able to // pick a clock face from the available plugins. mClockPlugin = plugin; addView(view, -1, mClockFrame.addView(view, -1, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); initPluginParams(); mClockView.setVisibility(View.GONE); if (!plugin.shouldShowStatusArea()) { mKeyguardStatusArea.setVisibility(View.GONE); } } } Loading @@ -56,6 +69,7 @@ public class KeyguardClockSwitch extends FrameLayout { if (Objects.equals(plugin, mClockPlugin)) { disconnectPlugin(); mClockView.setVisibility(View.VISIBLE); mKeyguardStatusArea.setVisibility(View.VISIBLE); } } }; Loading @@ -72,6 +86,8 @@ public class KeyguardClockSwitch extends FrameLayout { protected void onFinishInflate() { super.onFinishInflate(); mClockView = findViewById(R.id.default_clock_view); mClockFrame = findViewById(R.id.clock_view); mKeyguardStatusArea = findViewById(R.id.keyguard_status_area); } @Override Loading Loading @@ -185,7 +201,7 @@ public class KeyguardClockSwitch extends FrameLayout { if (mClockPlugin != null) { View view = mClockPlugin.getView(); if (view != null) { removeView(view); mClockFrame.removeView(view); } mClockPlugin = null; } Loading