diff options
| author | 2020-06-09 15:20:52 +0000 | |
|---|---|---|
| committer | 2020-06-09 15:20:52 +0000 | |
| commit | 5031649f35f45716c5d88c29897b1c81b06702e7 (patch) | |
| tree | d981c4823bf9c7aa19f0bc8f91d8bfca92fd2b65 | |
| parent | b1215125800bfba2b6566028842e070cb4378922 (diff) | |
| parent | d3e1d699dbaae104fcd2490dbefa9cd78d8a60a0 (diff) | |
Merge "Controls UI - Remove reset" into rvc-dev
3 files changed, 1 insertions, 55 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsController.kt b/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsController.kt index 07319207d9ab..45ba1e6012fe 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsController.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsController.kt @@ -190,11 +190,6 @@ interface ControlsController : UserAwareController { fun countFavoritesForComponent(componentName: ComponentName): Int /** - * TEMPORARY for testing - */ - fun resetFavorites() - - /** * Interface for structure to pass data to [ControlsFavoritingActivity]. */ interface LoadData { diff --git a/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsControllerImpl.kt index 93f0c7f41ce3..ebdcdccead90 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/controller/ControlsControllerImpl.kt @@ -524,13 +524,6 @@ class ControlsControllerImpl @Inject constructor ( } } - override fun resetFavorites() { - executor.execute { - Favorites.clear() - persistenceWrapper.storeFavorites(Favorites.getAllStructures()) - } - } - override fun refreshStatus(componentName: ComponentName, control: Control) { if (!confirmAvailability()) { Log.d(TAG, "Controls not available") diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt index d31b6eb9d857..0f5aef7eeec1 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt @@ -19,16 +19,13 @@ package com.android.systemui.controls.ui import android.animation.Animator import android.animation.AnimatorListenerAdapter import android.animation.ObjectAnimator -import android.app.AlertDialog import android.content.ComponentName import android.content.Context -import android.content.DialogInterface import android.content.Intent import android.content.SharedPreferences import android.content.res.Configuration import android.graphics.drawable.Drawable import android.graphics.drawable.LayerDrawable -import android.os.Process import android.service.controls.Control import android.util.Log import android.util.TypedValue @@ -36,7 +33,6 @@ import android.view.ContextThemeWrapper import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.view.WindowManager import android.view.animation.AccelerateInterpolator import android.view.animation.DecelerateInterpolator import android.widget.AdapterView @@ -272,8 +268,7 @@ class ControlsUiControllerImpl @Inject constructor ( private fun createMenu() { val items = arrayOf( context.resources.getString(R.string.controls_menu_add), - context.resources.getString(R.string.controls_menu_edit), - "Reset" + context.resources.getString(R.string.controls_menu_edit) ) var adapter = ArrayAdapter<String>(context, R.layout.controls_more_item, items) @@ -298,10 +293,6 @@ class ControlsUiControllerImpl @Inject constructor ( 0 -> startFavoritingActivity(view.context, selectedStructure) // 1: Edit controls 1 -> startEditingActivity(view.context, selectedStructure) - // 2: TEMPORARY for reset controls - 2 -> showResetConfirmation() - else -> Log.w(ControlsUiController.TAG, - "Unsupported index ($pos) on 'more' menu selection") } dismiss() } @@ -312,39 +303,6 @@ class ControlsUiControllerImpl @Inject constructor ( }) } - private fun showResetConfirmation() { - val builder = AlertDialog.Builder( - context, - android.R.style.Theme_DeviceDefault_Dialog_Alert - ).apply { - setMessage("For testing purposes: Would you like to " + - "reset your favorited device controls?") - setPositiveButton( - android.R.string.ok, - DialogInterface.OnClickListener { dialog, _ -> - val userHandle = Process.myUserHandle() - val userContext = context.createContextAsUser(userHandle, 0) - val prefs = userContext.getSharedPreferences( - "controls_prefs", Context.MODE_PRIVATE) - prefs.edit().remove("SeedingCompleted").apply() - controlsController.get().resetFavorites() - dialog.dismiss() - context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) - }) - setNegativeButton( - android.R.string.cancel, - DialogInterface.OnClickListener { - dialog, _ -> dialog.cancel() - } - ) - } - builder.create().apply { - getWindow().apply { - setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY) - } - }.show() - } - private fun createDropDown(items: List<SelectionItem>) { items.forEach { RenderInfo.registerComponentIcon(it.componentName, it.icon) |