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

Commit 0cc7fbdb authored by Jason Monk's avatar Jason Monk Committed by Android (Google) Code Review
Browse files

Merge "Settings Drawer: Support multi-user changes"

parents c99f909b af001092
Loading
Loading
Loading
Loading

res/layout/user_preference.xml

deleted100644 → 0
+0 −47
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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:id="@android:id/widget_frame"
        android:layout_width="match_parent"
        android:layout_height="@dimen/user_spinner_item_height"
        android:paddingStart="@dimen/user_spinner_padding_sides"
        android:paddingEnd="@dimen/user_spinner_padding_sides"
        android:orientation="horizontal" >

    <ImageView
            android:id="@+android:id/icon"
            android:layout_width="@dimen/user_icon_view_height"
            android:layout_height="@dimen/user_icon_view_height"
            android:layout_gravity="center"
            android:scaleType="fitCenter"
            android:paddingBottom="@dimen/user_spinner_padding"
            android:paddingTop="@dimen/user_spinner_padding" />

    <TextView
            android:id="@+android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:layout_gravity="center"
            android:labelFor="@+android:id/icon"
            android:ellipsize="marquee"
            android:fadingEdge="horizontal"
            android:paddingStart="@dimen/user_spinner_padding"
            android:paddingEnd="@dimen/user_spinner_padding"
            style="@style/TextAppearance.Medium" />

</LinearLayout>
+0 −5
Original line number Diff line number Diff line
@@ -193,11 +193,6 @@

    <!-- Height of a user icon view -->
    <dimen name="user_icon_view_height">56dp</dimen>
    <!-- User spinner -->
    <dimen name="user_spinner_height">72dp</dimen>
    <dimen name="user_spinner_padding">4dp</dimen>
    <dimen name="user_spinner_padding_sides">20dp</dimen>
    <dimen name="user_spinner_item_height">56dp</dimen>

    <!-- CheckBoxPreference -->
    <dimen name="checkbox_widget_min_width">58dip</dimen>
+0 −10
Original line number Diff line number Diff line
@@ -1959,10 +1959,6 @@
    <!-- Account settings header. [CHAR LIMIT=30] -->
    <string name="account_settings">Accounts</string>
    <!-- Header for items under the personal user [CHAR LIMIT=30] -->
    <string name="category_personal">Personal</string>
    <!-- Header for items under the work user [CHAR LIMIT=30] -->
    <string name="category_work">Work</string>
    <!-- Content description for work profile accounts group [CHAR LIMIT=NONE] -->
    <string name="accessibility_category_work">Work profile accounts - <xliff:g id="managed_by" example="Managed by Corporate application">%s</xliff:g></string>
    <!-- Content description for personal profile accounts group [CHAR LIMIT=NONE] -->
@@ -6335,9 +6331,6 @@
    <!-- [CHAR LIMIT=60] Unlock setting for screen pinning -->
    <string name="screen_pinning_unlock_none">Lock device when unpinning</string>
    <!-- TODO: Remove it once the same entry in SettingsLib is translated. -->
    <!-- Title for a work profile. [CHAR LIMIT=25] -->
    <string name="managed_user_title">Work profile</string>
    <!-- Opening string on the dialog that prompts the user to confirm that they really want to delete their existing work profile. The administration app icon and name appear after the final colon. [CHAR LIMIT=NONE] -->
    <string name="opening_paragraph_delete_profile_unknown_company">This work profile is managed by:</string>
    <!-- Summary for work profile accounts group. [CHAR LIMIT=25] -->
@@ -6540,9 +6533,6 @@
   <!-- Warning toast shown when data usage screen can't find specified app -->
   <string name="unknown_app">Unknown app</string>
   <!-- Title for profile selection dialog [CHAR LIMIT=30] -->
   <string name="choose_profile">Choose Profile</string>
   <!-- Label for list that shows all permissions -->
   <string name="app_permissions">App permissions</string>
   <!-- Summary of permissions currently granted to apps [CHAR LIMIT=45] -->
+0 −68
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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.settings;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.FragmentManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;

import com.android.settingslib.drawer.DashboardTile;

public class ProfileSelectDialog extends DialogFragment implements OnClickListener {

    private static final String ARG_SELECTED_TILE = "selectedTile";

    private DashboardTile mSelectedTile;

    public static void show(FragmentManager manager, DashboardTile tile) {
        ProfileSelectDialog dialog = new ProfileSelectDialog();
        Bundle args = new Bundle();
        args.putParcelable(ARG_SELECTED_TILE, tile);
        dialog.setArguments(args);
        dialog.show(manager, "select_profile");
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mSelectedTile = getArguments().getParcelable(ARG_SELECTED_TILE);
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Context context = getActivity();
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        UserAdapter adapter = Utils.createUserAdapter(UserManager.get(context), context,
                mSelectedTile.userHandle);
        builder.setTitle(R.string.choose_profile)
                .setAdapter(adapter, this);

        return builder.create();
    }

    @Override
    public void onClick(DialogInterface dialog, int which) {
        UserHandle user = mSelectedTile.userHandle.get(which);
        getActivity().startActivityAsUser(mSelectedTile.intent, user);
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -1133,6 +1133,13 @@ public class SettingsActivity extends SettingsDrawerActivity
        }
    }

    @Override
    public void onProfileTileOpen() {
        if (!mIsShowingDashboard) {
            finish();
        }
    }

    private void switchToSearchResultsFragmentIfNeeded() {
        if (mSearchResultsFragment != null) {
            return;
Loading