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

Commit 233592bb authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Application restrictions UI

Refactored User Settings UI to have two types of users.
Display a list of apps to select.
Edit user restrictions.
Handle saving and updating RestrictionEntry items via
User Manager.

Change-Id: I3ad5aa71d5ef66dffd39e17ba0556f075ac10a0f
parent 9f5b4919
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@
            android:taskAffinity=""
            android:theme="@android:style/Theme.Holo"
            android:hardwareAccelerated="true"
            android:requiredForAllUsers="true"
            android:supportsRtl="true">

        <!-- Settings -->
@@ -85,6 +86,16 @@
            </intent-filter>
        </activity>

        <!-- User Restrictions activity -->

        <activity android:name=".users.UserRestrictionsActivity"
                android:label="@string/user_restrictions_title">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity android:name=".SubSettings"
                android:taskAffinity="com.android.settings"
                android:parentActivityName="Settings">
@@ -734,6 +745,16 @@
            </intent-filter>
        </activity-alias>

        <activity android:name=".users.AppRestrictionsFragment$Activity"
                android:label="@string/application_info_label"
                android:exported="true"
                android:taskAffinity="">
            <intent-filter>
                <action android:name="com.android.settings.APP_RESTRICTIONS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- Provide direct entry into manage apps showing running services. -->
        <activity android:name="Settings$RunningServicesActivity"
                android:label="@string/runningservices_settings_title"
@@ -1516,6 +1537,22 @@
                android:resource="@id/display_settings" />
        </activity>

        <activity android:name="Settings$UserSettingsActivity"
                android:uiOptions="splitActionBarWhenNarrow"
                android:label="@string/user_settings_title"
                android:taskAffinity=""
                android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.settings.USER_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                android:value="com.android.settings.users.UserSettings" />
            <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
                android:resource="@id/user_settings" />
        </activity>

        <receiver android:name=".widget.SettingsAppWidgetProvider"
                android:label="@string/gadget_title"
                android:exported="true"
@@ -1546,5 +1583,11 @@
            </intent-filter>
        </receiver>

        <receiver android:name=".users.RestrictionsReceiver">
            <intent-filter>
                <action android:name="android.intent.action.GET_RESTRICTION_ENTRIES"/>
            </intent-filter>
        </receiver>

    </application>
</manifest>
+107 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 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.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:gravity="center_vertical"
    android:paddingStart="@*android:dimen/preference_item_padding_side"
    android:paddingEnd="?android:attr/scrollbarSize">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:id="@+id/app_restrictions_pref"
        android:focusable="true"
        android:clickable="true"
        android:gravity="center_vertical"
        android:background="?android:attr/selectableItemBackground" >
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center"
            android:minWidth="@*android:dimen/preference_icon_minWidth"
            android:orientation="horizontal">
            <ImageView
                android:id="@+android:id/icon"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:layout_gravity="center"
                android:minWidth="48dp"
                android:scaleType="centerInside"
                android:layout_marginEnd="@*android:dimen/preference_item_padding_inner"
                 />
        </LinearLayout>
        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="6dip"
            android:layout_marginTop="6dip"
            android:layout_marginBottom="6dip"
            android:layout_weight="1">
            <TextView
                android:id="@+android:id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:ellipsize="marquee"
                android:fadingEdge="horizontal"/>
            <TextView
                android:id="@android:id/summary"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@android:id/title"
                android:layout_alignStart="@android:id/title"
                android:paddingBottom="3dip"
                android:visibility="gone"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textSize="13sp"
                android:textColor="?android:attr/textColorSecondary"
                android:focusable="false"
                android:maxLines="4" />
        </RelativeLayout>
    </LinearLayout>
    <ImageView
        android:id="@+id/app_restrictions_settings"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:paddingStart="12dip"
        android:paddingEnd="12dp"
        android:src="@drawable/ic_sysbar_quicksettings"
        android:contentDescription="@string/apps_with_restrictions_settings_button"
        android:layout_gravity="center"
        android:clickable="true"
        android:focusable="true"
        android:background="?android:attr/selectableItemBackground" />
    <View
        android:id="@+id/settings_divider"
        android:layout_width="1dip"
        android:layout_height="match_parent"
        android:layout_marginTop="5dip"
        android:layout_marginBottom="5dip"
        android:background="@android:drawable/divider_horizontal_dark" />

    <LinearLayout
        android:id="@android:id/widget_frame"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:paddingRight="?android:attr/scrollbarSize"
        android:gravity="center_vertical"
        android:orientation="vertical" />
</LinearLayout>
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 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.
-->

<!-- Layout for a text label in the user limits screen. -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/user_rename" />
+12 −2
Original line number Diff line number Diff line
@@ -20,6 +20,16 @@
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:orientation="horizontal">
    <ImageView
        android:id="@+id/manage_user"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:paddingStart="12dip"
        android:paddingEnd="12dip"
        android:src="@drawable/ic_sysbar_quicksettings"
        android:contentDescription="@string/user_delete_user_description"
        android:layout_gravity="center"
        android:background="?android:attr/selectableItemBackground" />
    <View
        android:layout_width="2dip"
        android:layout_height="match_parent"
@@ -30,8 +40,8 @@
        android:id="@+id/trash_user"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:paddingStart="15dip"
        android:paddingEnd="?android:attr/scrollbarSize"
        android:paddingStart="12dip"
        android:paddingEnd="12dip"
        android:src="@drawable/ic_menu_delete_holo_dark"
        android:contentDescription="@string/user_delete_user_description"
        android:layout_gravity="center"
+55 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2013, 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.
*/
-->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:layout_marginStart="32dp"
    android:layout_marginEnd="32dp"
    android:orientation="vertical">

    <fragment android:name="com.android.settings.users.AppRestrictionsFragment"
            android:id="@+id/user_limits_fragment"
            android:layout_weight="1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            />
    <RelativeLayout
            android:id="@+id/button_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0" >
       <Button
                android:id="@+id/back_button"
                android:layout_width="150dip"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_margin="5dip"
                android:text="@string/wizard_back"
                android:visibility="invisible"/>

       <Button
               android:id="@+id/next_button"
               android:layout_width="150dip"
               android:layout_height="wrap_content"
               android:layout_margin="5dip"
               android:layout_alignParentEnd="true"
               android:text="@string/wizard_finish" />
    </RelativeLayout>
</LinearLayout>
Loading