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

Commit d553f4f9 authored by Adrian Roos's avatar Adrian Roos
Browse files

Add setting to allow RemoteInput on keyguard

Bug: 26440855
Change-Id: I57e02876c615f558eee279f2dc7edca8b28fc495
parent b6717805
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2016 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"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    <CheckBox
            android:id="@+id/lockscreen_remote_input"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="20dp"
            android:paddingStart="20dp"
            android:paddingEnd="?android:attr/dialogPreferredPadding"
            android:minHeight="?android:attr/listPreferredItemHeightSmall"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="?android:attr/textColorAlertDialogListItem"
            android:gravity="center_vertical"
            android:text="@string/lockscreen_remote_input"
        />
</FrameLayout>
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -15,7 +15,8 @@
     limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.android.settings.CheckableLinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
@@ -41,4 +42,4 @@
            android:baselineAlignBottom="true"
            android:scaleType="centerInside"
            android:visibility="gone" />
</LinearLayout>
 No newline at end of file
</com.android.settings.CheckableLinearLayout>
 No newline at end of file
+4 −1
Original line number Diff line number Diff line
@@ -5912,7 +5912,7 @@
    <string name="notification_pulse_title">Pulse notification light</string>
    <!-- Configure Notifications: Title for the option controlling notifications on the lockscreen. [CHAR LIMIT=30] -->
    <string name="lock_screen_notifications_title">When device is locked</string>
    <string name="lock_screen_notifications_title">On the lock screen</string>
    <!-- Configure Notifications: Value for lockscreen notifications:  all information will be
         shown in notifications shown on a secure lock screen
@@ -7221,6 +7221,9 @@
    <!-- [CHAR_LIMIT=NONE] Label for when app is ignoring battery optimizations -->
    <string name="not_battery_optimizing">Not using battery optimization</string>
    <!-- Text for the setting on whether you can type text into notifications without unlocking the device. -->
    <string name="lockscreen_remote_input">If device is locked, prevent typing replies or other text in notifications</string>
    <string-array name="bytes_picker_sizes" translatable="false">
        <item>@*android:string/megabyteShort</item>
        <item>@*android:string/gigabyteShort</item>
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
            android:title="@string/notification_pulse_title" />

    <!-- When device is locked -->
    <com.android.settingslib.RestrictedDropDownPreference
    <com.android.settings.notification.NotificationLockscreenPreference
            android:key="lock_screen_notifications"
            android:title="@string/lock_screen_notifications_title"
            android:summary="%s" />
+36 −7
Original line number Diff line number Diff line
@@ -17,12 +17,14 @@
package com.android.settings;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v14.preference.ListPreferenceDialogFragment;
import android.support.v7.preference.ListPreference;
import android.util.AttributeSet;
import android.view.View;

public class CustomListPreference extends ListPreference {

@@ -42,6 +44,13 @@ public class CustomListPreference extends ListPreference {
    protected void onDialogClosed(boolean positiveResult) {
    }

    protected void onDialogCreated(Dialog dialog) {
    }

    protected boolean isAutoClosePreference() {
        return true;
    }

    public static class CustomListPreferenceDialogFragment extends ListPreferenceDialogFragment {

        private int mClickedDialogEntryIndex;
@@ -64,6 +73,23 @@ public class CustomListPreference extends ListPreference {
            mClickedDialogEntryIndex = getCustomizablePreference()
                    .findIndexOfValue(getCustomizablePreference().getValue());
            getCustomizablePreference().onPrepareDialogBuilder(builder, getOnItemClickListener());
            if (!getCustomizablePreference().isAutoClosePreference()) {
                builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        CustomListPreferenceDialogFragment.this.onClick(dialog,
                                DialogInterface.BUTTON_POSITIVE);
                        dialog.dismiss();
                    }
                });
            }
        }

        @Override
        public Dialog onCreateDialog(Bundle savedInstanceState) {
            Dialog dialog = super.onCreateDialog(savedInstanceState);
            getCustomizablePreference().onDialogCreated(dialog);
            return dialog;
        }

        protected DialogInterface.OnClickListener getOnItemClickListener() {
@@ -71,6 +97,8 @@ public class CustomListPreference extends ListPreference {
                public void onClick(DialogInterface dialog, int which) {
                    setClickedDialogEntryIndex(which);


                    if (getCustomizablePreference().isAutoClosePreference()) {
                        /*
                         * Clicking on an item simulates the positive button
                         * click, and dismisses the dialog.
@@ -79,6 +107,7 @@ public class CustomListPreference extends ListPreference {
                                DialogInterface.BUTTON_POSITIVE);
                        dialog.dismiss();
                    }
                }
            };
        }

Loading