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

Commit f1f0f8be authored by Fan Zhang's avatar Fan Zhang
Browse files

Convert CreateShortcut to DashboardFragment

Created a new xml and CreateShortcutPreferenceController to deal with
querying package manager and display list on UI.

Bug: 74806595
Test: robotests
Change-Id: I0945245c3856d12b7751d26fca324d2dbf31b230
parent 1693bc9d
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -148,12 +148,15 @@
                android:taskAffinity="com.android.settings"
                android:parentActivityName="Settings" />

        <activity android:name=".shortcut.CreateShortcut"
        <activity android:name=".Settings$CreateShortcutActivity"
                  android:label="@string/settings_shortcut">
            <intent-filter>
                <action android:name="android.intent.action.CREATE_SHORTCUT" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data
                android:name="com.android.settings.FRAGMENT_CLASS"
                android:value="com.android.settings.shortcut.CreateShortcut" />
        </activity>

        <!-- Wireless Controls -->
+0 −2
Original line number Diff line number Diff line
@@ -689,8 +689,6 @@
    <string name="settings_label_launcher">Settings</string>
    <!-- Label for option to select a settings panel as a shortcut -->
    <string name="settings_shortcut">Settings shortcut</string>
    <!-- Shown in create shortcut activity when there is no shortcut that can be created. [CHAR_LIMIT=None] -->
    <string name="activity_list_empty">No matching activities found.</string>
    <!-- Wireless controls settings screen, setting check box label -->
    <string name="airplane_mode">Airplane mode</string>
    <!-- Main Settings screen settings title for things like airplane mode, tethering, NFC, VPN.  This will take you to another screen with those settings.  [CHAR LIMIT=30] -->
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2016 The Android Open Source Project
  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.
@@ -15,22 +15,9 @@
  limitations under the License.
  -->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="match_parent"
             android:layout_height="match_parent">

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <TextView
        android:id="@android:id/empty"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="@string/activity_list_empty"
        android:visibility="gone"
        android:textAppearance="?android:attr/textAppearanceMedium"/>

</FrameLayout>
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/settings_shortcut"
    android:key="create_shortcut_screen"
    settings:controller="com.android.settings.shortcut.CreateShortcutPreferenceController" />
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ public class Settings extends SettingsActivity {
    */
    public static class AssistGestureSettingsActivity extends SettingsActivity { /* empty */}
    public static class BluetoothSettingsActivity extends SettingsActivity { /* empty */ }
    public static class CreateShortcutActivity extends SettingsActivity { /* empty */ }
    public static class SimSettingsActivity extends SettingsActivity { /* empty */ }
    public static class TetherSettingsActivity extends SettingsActivity { /* empty */ }
    public static class WifiTetherSettingsActivity extends SettingsActivity { /* empty */ }
+3 −2
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;

import com.android.settings.shortcut.CreateShortcut;
import com.android.settings.Settings.CreateShortcutActivity;

import java.util.ArrayList;
import java.util.List;
@@ -101,7 +101,8 @@ public class SettingsInitialize extends BroadcastReceiver {
        pm.setComponentEnabledSetting(settingsComponentName,
                PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
        // Disable shortcut picker.
        ComponentName shortcutComponentName = new ComponentName(context, CreateShortcut.class);
        ComponentName shortcutComponentName = new ComponentName(
                context, CreateShortcutActivity.class);
        pm.setComponentEnabledSetting(shortcutComponentName,
                PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
    }
Loading