Remove enhanced smartspace flag

This commit is contained in:
Suphon Thanakornpakapong
2022-05-18 18:43:10 +07:00
parent f90a7c595c
commit f4bf92034b
4 changed files with 7 additions and 24 deletions

View File

@@ -258,12 +258,6 @@ class PreferenceManager2(private val context: Context) : PreferenceManager {
}
)
val enableEnhancedSmartspace = preference(
key = booleanPreferencesKey("enable_enhanced_smartspace"),
defaultValue = true,
onSet = { reloadHelper.recreate() }
)
val smartspaceAagWidget = preference(
key = booleanPreferencesKey("enable_smartspace_aag_widget"),
defaultValue = true

View File

@@ -1,7 +1,6 @@
package app.lawnchair.smartspace
import android.content.Context
import android.content.Intent
import android.graphics.Rect
import android.graphics.RectF
import android.util.AttributeSet
@@ -10,14 +9,12 @@ import android.view.MotionEvent
import android.view.View
import android.widget.FrameLayout
import app.lawnchair.launcher
import app.lawnchair.preferences2.PreferenceManager2
import app.lawnchair.ui.preferences.PreferenceActivity
import app.lawnchair.ui.preferences.Routes
import com.android.launcher3.CheckLongPressHelper
import com.android.launcher3.R
import com.android.launcher3.logging.StatsLogManager
import com.android.launcher3.views.OptionsPopupView
import com.patrykmichalik.preferencemanager.firstBlocking
class SmartspaceViewContainer @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, private val previewMode: Boolean = false
@@ -27,25 +24,18 @@ class SmartspaceViewContainer @JvmOverloads constructor(
private val smartspaceView: View
init {
val prefs = PreferenceManager2.getInstance(context)
val inflater = LayoutInflater.from(context)
smartspaceView = if (prefs.enableEnhancedSmartspace.firstBlocking()) {
val view = inflater.inflate(R.layout.smartspace_enhanced, this, false) as BcSmartspaceView
view.previewMode = previewMode
setOnLongClickListener {
openOptions()
true
}
view
} else {
inflater.inflate(R.layout.smartspace_legacy, this, false)
smartspaceView = inflater.inflate(R.layout.smartspace_enhanced, this, false) as BcSmartspaceView
smartspaceView.previewMode = previewMode
smartspaceView.setOnLongClickListener {
openOptions()
true
}
addView(smartspaceView)
}
private fun openOptions() {
if (previewMode) return
if (!PreferenceManager2.getInstance(context).enableEnhancedSmartspace.firstBlocking()) return
val launcher = context.launcher
val pos = Rect()

View File

@@ -76,7 +76,7 @@ fun DebugMenuPreferences() {
}
private val PreferenceManager2.debugFlags: List<Preference<Boolean, Boolean>>
get() = listOf(showComponentNames, enableEnhancedSmartspace)
get() = listOf(showComponentNames)
private val PreferenceManager2.textFlags: List<Preference<String, String>>
get() = listOf(additionalFonts)

View File

@@ -42,7 +42,6 @@ import com.android.launcher3.widget.model.WidgetsListBaseEntry;
import com.android.launcher3.widget.model.WidgetsListContentEntry;
import com.android.launcher3.widget.model.WidgetsListHeaderEntry;
import com.android.launcher3.widget.picker.WidgetsDiffReporter;
import com.patrykmichalik.preferencemanager.PreferenceExtensionsKt;
import java.util.ArrayList;
import java.util.Arrays;
@@ -284,7 +283,7 @@ public class WidgetsModel {
if (item.widgetInfo != null) {
if ((item.widgetInfo.getWidgetFeatures() & WIDGET_FEATURE_HIDE_FROM_PICKER) != 0) {
boolean isSelf = item.componentName.getPackageName().equals(BuildConfig.APPLICATION_ID);
if (!isSelf || !PreferenceExtensionsKt.firstBlocking(prefs.getEnableEnhancedSmartspace())) {
if (!isSelf) {
// Widget is hidden from picker
return false;
}