Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60e22451 authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge changes from topic "clock_plugin"

* changes:
  Add clock plugin function
  Add clock plugin interface
parents 28023e2e 29007e6d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -51,6 +51,10 @@ Expected interface: [NotificationSwipeActionHelper](/packages/SystemUI/plugin/sr

Use: Control over swipes/input for notification views, can be used to control what happens when you swipe/long-press

### Action: com.android.systemui.action.PLUGIN_CLOCK
Expected interface: [ClockPlugin](/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockPlugin.java)

Use: Allows replacement of the keyguard main clock.

# Global plugin dependencies
These classes can be accessed by any plugin using PluginDependency as long as they @Requires them.
+47 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package com.android.systemui.plugins;

import com.android.systemui.plugins.annotations.ProvidesInterface;

import android.graphics.Paint.Style;
import android.view.View;

/**
 * This plugin is used to replace main clock in keyguard.
 */
@ProvidesInterface(action = ClockPlugin.ACTION, version = ClockPlugin.VERSION)
public interface ClockPlugin extends Plugin {

    String ACTION = "com.android.systemui.action.PLUGIN_CLOCK";
    int VERSION = 1;

    /**
     * Get clock view.
     * @return clock view from plugin.
     */
    View getView();

    /**
     * Set clock paint style.
     * @param style The new style to set in the paint.
     */
    void setStyle(Style style);

    /**
     * Set clock text color.
     * @param color A color value.
     */
    void setTextColor(int color);
}
+38 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2018, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License")
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->

<!-- This is a view that shows clock information in Keyguard. -->
<com.android.keyguard.KeyguardClockSwitch
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_alignParentTop="true">
    <TextClock
        android:id="@+id/default_clock_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:letterSpacing="0.03"
        android:textColor="?attr/wallpaperTextColor"
        android:singleLine="true"
        style="@style/widget_big_thin"
        android:format12Hour="@string/keyguard_widget_12_hours_format"
        android:format24Hour="@string/keyguard_widget_24_hours_format" />
</com.android.keyguard.KeyguardClockSwitch>
+4 −13
Original line number Diff line number Diff line
@@ -38,19 +38,10 @@
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|top">
                <TextClock
                <include layout="@layout/keyguard_clock_switch"
                         android:id="@+id/clock_view"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:layout_centerHorizontal="true"
                    android:layout_alignParentTop="true"
                    android:letterSpacing="0.03"
                    android:textColor="?attr/wallpaperTextColor"
                    android:singleLine="true"
                    style="@style/widget_big_thin"
                    android:format12Hour="@string/keyguard_widget_12_hours_format"
                    android:format24Hour="@string/keyguard_widget_24_hours_format" />
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content" />
                <View
                    android:id="@+id/clock_separator"
                    android:layout_width="@dimen/widget_separator_width"
+4 −13
Original line number Diff line number Diff line
@@ -55,19 +55,10 @@
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|top">
            <TextClock
            <include layout="@layout/keyguard_clock_switch"
                 android:id="@+id/clock_view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_centerHorizontal="true"
                android:layout_alignParentTop="true"
                android:letterSpacing="0.03"
                android:textColor="?attr/wallpaperTextColor"
                android:singleLine="true"
                style="@style/widget_big_thin"
                android:format12Hour="@string/keyguard_widget_12_hours_format"
                android:format24Hour="@string/keyguard_widget_24_hours_format" />
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content" />
            <View
                android:id="@+id/clock_separator"
                android:layout_width="@dimen/widget_separator_width"
Loading