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

Commit f2df8963 authored by Miranda Kephart's avatar Miranda Kephart
Browse files

Add clipboard overlay prototype

Adds a floating window/overlay (similar to screenshots) when
something is copied to the clipboard. Opens Markup or a lightweight
test editing activity (as appropriate) when edit is tapped.

Bug: 195554988
Test: manual (tested copying text/images, and interactions with
screenshots)

Change-Id: I02aff237a1245ed2fed130d5e43112472d320a9c
parent 2952c722
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -523,6 +523,12 @@ public final class SystemUiDeviceConfigFlags {
     */
    public static final String TASK_MANAGER_ENABLED = "task_manager_enabled";


    /**
     * (boolean) Whether the clipboard overlay is enabled.
     */
    public static final String CLIPBOARD_OVERLAY_ENABLED = "clipboard_overlay_enabled";

    private SystemUiDeviceConfigFlags() {
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -299,6 +299,9 @@

    <uses-permission android:name="android.permission.BIND_APPWIDGET" />

    <!-- For clipboard overlay -->
    <uses-permission android:name="android.permission.READ_CLIPBOARD_IN_BACKGROUND" />

    <protected-broadcast android:name="com.android.settingslib.action.REGISTER_SLICE_RECEIVER" />
    <protected-broadcast android:name="com.android.settingslib.action.UNREGISTER_SLICE_RECEIVER" />
    <protected-broadcast android:name="com.android.settings.flashlight.action.FLASHLIGHT_CHANGED" />
@@ -348,6 +351,7 @@
        <!-- started from PhoneWindowManager
             TODO: Should have an android:permission attribute -->
        <service android:name=".screenshot.TakeScreenshotService"
            android:permission="com.android.systemui.permission.SELF"
            android:process=":screenshot"
            android:exported="false" />

@@ -760,6 +764,12 @@
            </intent-filter>
        </activity>

        <activity android:name=".clipboardoverlay.EditTextActivity"
                  android:theme="@style/EditTextActivity"
                  android:exported="false"
                  android:excludeFromRecents="true"
                  />

        <activity android:name=".controls.management.ControlsProviderSelectorActivity"
                  android:label="@string/controls_providers_title"
                  android:theme="@style/Theme.ControlsManagement"
+27 −0
Original line number Diff line number Diff line
<!--
  Copyright (C) 2020 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
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24"
        android:tint="?attr/colorControlNormal">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M4,6h18L22,4L4,4c-1.1,0 -2,0.9 -2,2v11L0,17v3h14v-3L4,17L4,6zM23,8h-6c-0.55,0 -1,0.45 -1,1v10c0,0.55 0.45,1 1,1h6c0.55,0 1,-0.45 1,-1L24,9c0,-0.55 -0.45,-1 -1,-1zM22,17h-4v-7h4v7z"/>
</vector>
+60 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2021 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.
  -->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:app="http://schemas.android.com/apk/res-auto"
             android:id="@+id/preview_border"
             android:elevation="9dp"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/screenshot_offset_x"
             android:layout_marginBottom="@dimen/screenshot_offset_y"
             android:layout_gravity="bottom|start"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintBottom_toBottomOf="parent"
             android:clipToPadding="false"
             android:clipChildren="false"
             android:padding="4dp"
             android:background="@drawable/screenshot_border"
             >
    <FrameLayout
        android:elevation="0dp"
        android:background="@drawable/screenshot_preview_background"
        android:clipChildren="true"
        android:clipToOutline="true"
        android:clipToPadding="true"
        android:layout_width="@dimen/screenshot_x_scale"
        android:layout_height="wrap_content">
        <TextView android:id="@+id/text_preview"
                  android:textFontWeight="500"
                  android:padding="8dp"
                  android:gravity="center|start"
                  android:ellipsize="end"
                  android:autoSizeTextType="uniform"
                  android:autoSizeMinTextSize="10sp"
                  android:autoSizeMaxTextSize="200sp"
                  android:textColor="?android:attr/textColorPrimary"
                  android:layout_width="@dimen/screenshot_x_scale"
                  android:layout_height="@dimen/screenshot_x_scale"/>
        <ImageView
            android:id="@+id/image_preview"
            android:scaleType="fitCenter"
            android:adjustViewBounds="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>
    </FrameLayout>
</FrameLayout>
+60 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        android:id="@+id/copy_button"
        style="@android:style/Widget.DeviceDefault.Button.Colored"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:text="@string/clipboard_edit_text_copy"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/attribution"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        app:layout_constraintStart_toStartOf="@+id/copy_button"
        app:layout_constraintTop_toBottomOf="@+id/copy_button" />

    <ImageButton
        android:id="@+id/share"
        style="@android:style/Widget.Material.Button.Borderless"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:layout_marginEnd="8dp"
        android:padding="12dp"
        android:scaleType="fitCenter"
        android:contentDescription="@*android:string/share"
        android:tooltipText="@*android:string/share"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@+id/copy_button"
        android:src="@drawable/ic_screenshot_share" />

    <ScrollView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginTop="8dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintStart_toStartOf="@+id/copy_button"
        app:layout_constraintTop_toBottomOf="@+id/attribution">

        <EditText
            android:id="@+id/edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="start|top"
            android:textSize="24sp" />
    </ScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
Loading