<lambda>null1 package com.android.systemui.user.ui.dialog
2
3 import android.content.Context
4 import android.content.Intent
5 import android.provider.Settings
6 import android.view.LayoutInflater
7 import com.android.internal.logging.UiEventLogger
8 import com.android.systemui.animation.DialogTransitionAnimator
9 import com.android.systemui.plugins.ActivityStarter
10 import com.android.systemui.plugins.FalsingManager
11 import com.android.systemui.qs.QSUserSwitcherEvent
12 import com.android.systemui.qs.tiles.UserDetailView
13 import com.android.systemui.res.R
14 import com.android.systemui.statusbar.phone.SystemUIDialog
15
16 /**
17 * Extracted from the old UserSwitchDialogController. This is the dialog version of the full-screen
18 * user switcher. See config_enableFullscreenUserSwitcher
19 */
20 class UserSwitchDialog(
21 context: Context,
22 adapter: UserDetailView.Adapter,
23 uiEventLogger: UiEventLogger,
24 falsingManager: FalsingManager,
25 activityStarter: ActivityStarter,
26 dialogTransitionAnimator: DialogTransitionAnimator,
27 ) : SystemUIDialog(context) {
28 init {
29 setShowForAllUsers(true)
30 setCanceledOnTouchOutside(true)
31 setTitle(R.string.qs_user_switch_dialog_title)
32 setPositiveButton(R.string.quick_settings_done) { _, _ ->
33 uiEventLogger.log(QSUserSwitcherEvent.QS_USER_DETAIL_CLOSE)
34 }
35 setNeutralButton(
36 R.string.quick_settings_more_user_settings,
37 { _, _ ->
38 if (!falsingManager.isFalseTap(FalsingManager.LOW_PENALTY)) {
39 uiEventLogger.log(QSUserSwitcherEvent.QS_USER_MORE_SETTINGS)
40 val controller =
41 dialogTransitionAnimator.createActivityTransitionController(
42 getButton(BUTTON_NEUTRAL)
43 )
44
45 if (controller == null) {
46 dismiss()
47 }
48
49 activityStarter.postStartActivityDismissingKeyguard(
50 USER_SETTINGS_INTENT,
51 0,
52 controller
53 )
54 }
55 },
56 false /* dismissOnClick */
57 )
58 val gridFrame =
59 LayoutInflater.from(this.context).inflate(R.layout.qs_user_dialog_content, null)
60 setView(gridFrame)
61
62 adapter.linkToViewGroup(gridFrame.findViewById(R.id.grid))
63 adapter.injectDialogShower(DialogShowerImpl(this, dialogTransitionAnimator))
64 }
65
66 companion object {
67 private val USER_SETTINGS_INTENT = Intent(Settings.ACTION_USER_SETTINGS)
68 }
69 }
70