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

Commit 55410112 authored by Ale Nijamkin's avatar Ale Nijamkin Committed by Android (Google) Code Review
Browse files

Merge changes from topic "lock-screen-preview-in-wpp" into tm-qpr-dev

* changes:
  Long-press gesture for lock screen affordances.
  Lock screen preview.
parents 1970e1b9 f2add476
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.shared.quickaffordance.shared.model

object KeyguardQuickAffordancePreviewConstants {
    const val MESSAGE_ID_SLOT_SELECTED = 1337
    const val KEY_SLOT_ID = "slot_id"
    const val KEY_INITIALLY_SELECTED_SLOT_ID = "initially_selected_slot_id"
}
+49 −9
Original line number Diff line number Diff line
@@ -16,13 +16,53 @@
* limitations under the License.
*/
-->
<shape
<selector
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:shape="rectangle">
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">

  <item android:state_selected="true">
    <layer-list>
      <item
          android:left="3dp"
          android:top="3dp"
          android:right="3dp"
          android:bottom="3dp">
        <shape android:shape="oval">
          <solid android:color="?androidprv:attr/colorSurface"/>
          <size
              android:width="@dimen/keyguard_affordance_width"
              android:height="@dimen/keyguard_affordance_height"/>
  <corners android:radius="@dimen/keyguard_affordance_fixed_radius"/>
        </shape>
      </item>

      <item>
        <shape android:shape="oval">
          <stroke
              android:color="@color/control_primary_text"
              android:width="2dp"/>
          <size
              android:width="@dimen/keyguard_affordance_width"
              android:height="@dimen/keyguard_affordance_height"/>
        </shape>
      </item>
    </layer-list>
  </item>

  <item>
    <layer-list>
      <item
          android:left="3dp"
          android:top="3dp"
          android:right="3dp"
          android:bottom="3dp">
        <shape android:shape="oval">
          <solid android:color="?androidprv:attr/colorSurface"/>
          <size
              android:width="@dimen/keyguard_affordance_width"
              android:height="@dimen/keyguard_affordance_height"/>
        </shape>
      </item>
    </layer-list>
  </item>

</selector>
+2 −0
Original line number Diff line number Diff line
@@ -758,6 +758,8 @@
    <dimen name="keyguard_affordance_fixed_height">48dp</dimen>
    <dimen name="keyguard_affordance_fixed_width">48dp</dimen>
    <dimen name="keyguard_affordance_fixed_radius">24dp</dimen>
    <!-- Amount the button should shake when it's not long-pressed for long enough. -->
    <dimen name="keyguard_affordance_shake_amplitude">8dp</dimen>

    <dimen name="keyguard_affordance_horizontal_offset">32dp</dimen>
    <dimen name="keyguard_affordance_vertical_offset">32dp</dimen>
+6 −0
Original line number Diff line number Diff line
@@ -2740,6 +2740,12 @@
    -->
    <string name="keyguard_affordance_enablement_dialog_home_instruction_2">&#8226; At least one device is available</string>

    <!--
    Error message shown when a button should be pressed and held to activate it, usually shown when
    the user attempted to tap the button or held it for too short a time. [CHAR LIMIT=32].
    -->
    <string name="keyguard_affordance_press_too_short">Press and hold to activate</string>

    <!-- Text for education page of cancel button to hide the page. [CHAR_LIMIT=NONE] -->
    <string name="rear_display_bottom_sheet_cancel">Cancel</string>
    <!-- Text for the user to confirm they flipped the device around. [CHAR_LIMIT=NONE] -->
+18 −11
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;

@@ -43,6 +44,21 @@ public class KeyguardClockSwitch extends RelativeLayout {
    public static final int LARGE = 0;
    public static final int SMALL = 1;

    /** Returns a region for the large clock to position itself, based on the given parent. */
    public static Rect getLargeClockRegion(ViewGroup parent) {
        int largeClockTopMargin = parent.getResources()
                .getDimensionPixelSize(R.dimen.keyguard_large_clock_top_margin);
        int targetHeight = parent.getResources()
                .getDimensionPixelSize(R.dimen.large_clock_text_size) * 2;
        int top = parent.getHeight() / 2 - targetHeight / 2
                + largeClockTopMargin / 2;
        return new Rect(
                parent.getLeft(),
                top,
                parent.getRight(),
                top + targetHeight);
    }

    /**
     * Frame for small/large clocks
     */
@@ -129,17 +145,8 @@ public class KeyguardClockSwitch extends RelativeLayout {
            }

            if (mLargeClockFrame.isLaidOut()) {
                int largeClockTopMargin = getResources()
                        .getDimensionPixelSize(R.dimen.keyguard_large_clock_top_margin);
                int targetHeight = getResources()
                        .getDimensionPixelSize(R.dimen.large_clock_text_size) * 2;
                int top = mLargeClockFrame.getHeight() / 2 - targetHeight / 2
                        + largeClockTopMargin / 2;
                mClock.getLargeClock().getEvents().onTargetRegionChanged(new Rect(
                        mLargeClockFrame.getLeft(),
                        top,
                        mLargeClockFrame.getRight(),
                        top + targetHeight));
                mClock.getLargeClock().getEvents().onTargetRegionChanged(
                        getLargeClockRegion(mLargeClockFrame));
            }
        }
    }
Loading