diff --git a/Omega/src/com/saggitt/omega/DeviceProfileOverrides.kt b/Omega/src/com/saggitt/omega/DeviceProfileOverrides.kt index 55e9d43d0f..d9ab291ab5 100644 --- a/Omega/src/com/saggitt/omega/DeviceProfileOverrides.kt +++ b/Omega/src/com/saggitt/omega/DeviceProfileOverrides.kt @@ -11,9 +11,9 @@ import com.android.launcher3.util.MainThreadInitializedObject import com.saggitt.omega.preferences.NeoPrefs class DeviceProfileOverrides(context: Context) { - private val prefs by lazy { Utilities.getOmegaPrefs(context) } + private val prefs by lazy { Utilities.getNeoPrefs(context) } - private val predefinedGrids = InvariantDeviceProfile.parseAllGridOptions(context) + private val predefinedGrids = InvariantDeviceProfile.parseAllDefinedGridOptions(context) .map { option -> val gridInfo = DBGridInfo( numHotseatIcons = option.numHotseatIcons, diff --git a/Omega/src/com/saggitt/omega/NeoLauncher.kt b/Omega/src/com/saggitt/omega/NeoLauncher.kt index 279730bbd3..cadbec5585 100644 --- a/Omega/src/com/saggitt/omega/NeoLauncher.kt +++ b/Omega/src/com/saggitt/omega/NeoLauncher.kt @@ -46,15 +46,12 @@ import androidx.core.app.ActivityOptionsCompat import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LifecycleRegistry -import androidx.lifecycle.setViewTreeLifecycleOwner import androidx.savedstate.SavedStateRegistry import androidx.savedstate.SavedStateRegistryController import androidx.savedstate.SavedStateRegistryOwner -import androidx.savedstate.setViewTreeSavedStateRegistryOwner import com.android.launcher3.AppFilter import com.android.launcher3.Launcher import com.android.launcher3.LauncherAppState -import com.android.launcher3.LauncherRootView import com.android.launcher3.R import com.android.launcher3.Utilities import com.android.launcher3.model.data.AppInfo @@ -82,18 +79,18 @@ import kotlinx.coroutines.launch import java.util.stream.Stream class NeoLauncher : Launcher(), LifecycleOwner, SavedStateRegistryOwner, - ActivityResultRegistryOwner, ThemeManager.ThemeableActivity { + ActivityResultRegistryOwner, ThemeManager.ThemeableActivity { override var currentTheme = 0 override var currentAccent = 0 private lateinit var themeOverride: ThemeOverride private val themeSet: ThemeOverride.ThemeSet get() = ThemeOverride.Settings() - val prefs: NeoPrefs by lazy { Utilities.getOmegaPrefs(this) } + val prefs: NeoPrefs by lazy { Utilities.getNeoPrefs(this) } val gestureController by lazy { GestureController(this) } val background by lazy { findViewById(R.id.omega_background)!! } val dummyView by lazy { findViewById(R.id.dummy_view)!! } - val optionsView by lazy { findViewById(R.id.options_view)!! } + val optionsView by lazy { findViewById>(R.id.options_view)!! } private val prefCallback = PreferencesChangeCallback(this) val hiddenApps = ArrayList() @@ -338,14 +335,6 @@ class NeoLauncher : Launcher(), LifecycleOwner, SavedStateRegistryOwner, } } - override fun setupViews() { - super.setupViews() - findViewById(R.id.launcher).also { - it.setViewTreeLifecycleOwner(this) - it.setViewTreeSavedStateRegistryOwner(this) - } - } - fun recreateIfNotScheduled() { if (sRestartFlags == 0) { recreate() @@ -354,7 +343,7 @@ class NeoLauncher : Launcher(), LifecycleOwner, SavedStateRegistryOwner, private fun restartIfPending() { when { - sRestartFlags and FLAG_RESTART != 0 -> neoApp.restart(false) + sRestartFlags and FLAG_RESTART != 0 -> neoApp.restart(false) sRestartFlags and FLAG_RECREATE != 0 -> { sRestartFlags = 0 recreate() diff --git a/Omega/src/com/saggitt/omega/OptionsState.kt b/Omega/src/com/saggitt/omega/OptionsState.kt index 387cbfd1d0..3a21ad81ae 100644 --- a/Omega/src/com/saggitt/omega/OptionsState.kt +++ b/Omega/src/com/saggitt/omega/OptionsState.kt @@ -62,8 +62,7 @@ class OptionsState(id: Int) : val scaledHeight = scale * ws.normalChildHeight val shrunkTop = (insets.top + grid.dropTargetBarSizePx).toFloat() val shrunkBottom = (ws.measuredHeight - insets.bottom - - grid.workspacePadding.bottom - - grid.workspaceSpringLoadedBottomSpace).toFloat() + - grid.workspacePadding.bottom).toFloat() val totalShrunkSpace = shrunkBottom - shrunkTop val desiredCellTop = shrunkTop + (totalShrunkSpace - scaledHeight) / 2 diff --git a/Omega/src/com/saggitt/omega/allapps/AllAppsPagesController.kt b/Omega/src/com/saggitt/omega/allapps/AllAppsPagesController.kt index d56a8c03ec..996bd61e6f 100644 --- a/Omega/src/com/saggitt/omega/allapps/AllAppsPagesController.kt +++ b/Omega/src/com/saggitt/omega/allapps/AllAppsPagesController.kt @@ -29,11 +29,11 @@ class AllAppsPagesController( return holders.toTypedArray() } - fun registerIconContainers(allAppsStore: AllAppsStore) { + fun registerIconContainers(allAppsStore: AllAppsStore) { //holders.forEach { allAppsStore.registerIconContainer(it.mRecyclerView) } } - fun unregisterIconContainers(allAppsStore: AllAppsStore) { + fun unregisterIconContainers(allAppsStore: AllAppsStore) { //holders.forEach { allAppsStore.unregisterIconContainer(it.mRecyclerView) } } diff --git a/Omega/src/com/saggitt/omega/allapps/AllAppsTabItem.kt b/Omega/src/com/saggitt/omega/allapps/AllAppsTabItem.kt index ebe2baa768..4c4ba72954 100644 --- a/Omega/src/com/saggitt/omega/allapps/AllAppsTabItem.kt +++ b/Omega/src/com/saggitt/omega/allapps/AllAppsTabItem.kt @@ -50,7 +50,7 @@ class AllAppsTabItem(context: Context, attrs: AttributeSet) : private var mIsRtl = false private val mArgbEvaluator: ArgbEvaluator = ArgbEvaluator() - val prefs: NeoPrefs = Utilities.getOmegaPrefs(context) + val prefs: NeoPrefs = Utilities.getNeoPrefs(context) val launcher: Launcher = Launcher.getLauncher(context) init { diff --git a/Omega/src/com/saggitt/omega/allapps/AllAppsTabsController.kt b/Omega/src/com/saggitt/omega/allapps/AllAppsTabsController.kt index 0cb2351c90..84d17dcec5 100644 --- a/Omega/src/com/saggitt/omega/allapps/AllAppsTabsController.kt +++ b/Omega/src/com/saggitt/omega/allapps/AllAppsTabsController.kt @@ -2,6 +2,7 @@ package com.saggitt.omega.allapps import android.view.View import android.view.ViewGroup +import com.android.launcher3.BaseDraggingActivity import com.android.launcher3.allapps.ActivityAllAppsContainerView import com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.MAIN import com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.WORK @@ -11,7 +12,7 @@ import com.saggitt.omega.util.forEachChildIndexed typealias AdapterHolders = List.AdapterHolder> -class AllAppsTabsController( +class AllAppsTabsController( val tabs: AllAppsTabs, private val container: ActivityAllAppsContainerView<*>, ) { @@ -46,11 +47,11 @@ class AllAppsTabsController( tabs.reloadTabs() } - fun registerIconContainers(allAppsStore: AllAppsStore) { + fun registerIconContainers(allAppsStore: AllAppsStore) { holders.forEach { allAppsStore.registerIconContainer(it.mRecyclerView) } } - fun unregisterIconContainers(allAppsStore: AllAppsStore) { + fun unregisterIconContainers(allAppsStore: AllAppsStore) { holders.forEach { allAppsStore.unregisterIconContainer(it.mRecyclerView) } } diff --git a/Omega/src/com/saggitt/omega/allapps/AllAppsTabsLayout.kt b/Omega/src/com/saggitt/omega/allapps/AllAppsTabsLayout.kt index 34937d392f..0eee4cfbef 100644 --- a/Omega/src/com/saggitt/omega/allapps/AllAppsTabsLayout.kt +++ b/Omega/src/com/saggitt/omega/allapps/AllAppsTabsLayout.kt @@ -37,7 +37,7 @@ import java.util.function.Consumer class AllAppsTabsLayout(context: Context, attrs: AttributeSet) : PersonalWorkSlidingTabStrip(context, attrs) { - val prefs: NeoPrefs = Utilities.getOmegaPrefs(context) + val prefs: NeoPrefs = Utilities.getNeoPrefs(context) val launcher: Launcher = Launcher.getLauncher(context) private val selectedPage: MutableState = mutableIntStateOf(0) diff --git a/Omega/src/com/saggitt/omega/allapps/CustomAppFilter.kt b/Omega/src/com/saggitt/omega/allapps/CustomAppFilter.kt index 6b5a490ebb..a364dca664 100644 --- a/Omega/src/com/saggitt/omega/allapps/CustomAppFilter.kt +++ b/Omega/src/com/saggitt/omega/allapps/CustomAppFilter.kt @@ -48,11 +48,11 @@ class CustomAppFilter(private val mContext: Context) : OmegaAppFilter(mContext) } private fun getHiddenApps(context: Context): MutableSet { - return HashSet(Utilities.getOmegaPrefs(context).drawerHiddenAppSet.getValue()) + return HashSet(Utilities.getNeoPrefs(context).drawerHiddenAppSet.getValue()) } fun setHiddenApps(context: Context, hiddenApps: Set?) { - Utilities.getOmegaPrefs(context).drawerHiddenAppSet.setValue(hiddenApps!!) + Utilities.getNeoPrefs(context).drawerHiddenAppSet.setValue(hiddenApps!!) } } } \ No newline at end of file diff --git a/Omega/src/com/saggitt/omega/allapps/search/ComposeSearchLayout.kt b/Omega/src/com/saggitt/omega/allapps/search/ComposeSearchLayout.kt index bc3fbe2134..52e94b3217 100644 --- a/Omega/src/com/saggitt/omega/allapps/search/ComposeSearchLayout.kt +++ b/Omega/src/com/saggitt/omega/allapps/search/ComposeSearchLayout.kt @@ -21,7 +21,6 @@ package com.saggitt.omega.allapps.search import android.content.Context import android.graphics.Rect import android.util.AttributeSet -import android.util.TypedValue import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Row @@ -61,12 +60,10 @@ import coil.compose.rememberAsyncImagePainter import com.android.launcher3.ExtendedEditText import com.android.launcher3.Insettable import com.android.launcher3.R -import com.android.launcher3.ResourceUtils import com.android.launcher3.allapps.ActivityAllAppsContainerView import com.android.launcher3.allapps.BaseAllAppsAdapter import com.android.launcher3.allapps.SearchUiManager import com.android.launcher3.allapps.search.AllAppsSearchBarController -import com.android.launcher3.graphics.IconShape import com.android.launcher3.search.SearchCallback import com.saggitt.omega.compose.icons.Phosphor import com.saggitt.omega.compose.icons.phosphor.Nut @@ -112,11 +109,7 @@ open class ComposeSearchLayout(context: Context, attrs: AttributeSet? = null) : var radius by remember { mutableFloatStateOf(0f) } val radiusPrefs = prefs.searchBarRadius.get().collectAsState(initial = 0f) - radius = if (radiusPrefs.value < 0) { - getCornerRadius() - } else { - radiusPrefs.value - } + radius = radiusPrefs.value.coerceAtLeast(8f) var textFieldValue by query @@ -229,12 +222,6 @@ open class ComposeSearchLayout(context: Context, attrs: AttributeSet? = null) : } } - private fun getCornerRadius(): Float { - val defaultRadius = ResourceUtils.pxFromDp(100f, resources.displayMetrics).toFloat() - val edgeRadius: TypedValue? = IconShape.getShape().getAttrValue(R.attr.qsbEdgeRadius) - return edgeRadius?.getDimension(context.resources.displayMetrics) ?: defaultRadius - } - private fun onQueryChanged(query: String) { if (query.isEmpty()) { searchAlgorithm.cancel(true) @@ -278,10 +265,6 @@ open class ComposeSearchLayout(context: Context, attrs: AttributeSet? = null) : override fun getEditText(): ExtendedEditText? = null - override fun hideSoftwareKeyboard() { - keyboardController?.hide() - } - override fun onSearchResult( query: String?, items: ArrayList?, diff --git a/Omega/src/com/saggitt/omega/blur/BlurScrimView.kt b/Omega/src/com/saggitt/omega/blur/BlurScrimView.kt index c0be8d65e5..67c46b5035 100644 --- a/Omega/src/com/saggitt/omega/blur/BlurScrimView.kt +++ b/Omega/src/com/saggitt/omega/blur/BlurScrimView.kt @@ -27,12 +27,12 @@ import android.graphics.drawable.Drawable import android.util.AttributeSet import android.view.animation.Interpolator import androidx.core.graphics.ColorUtils +import com.android.app.animation.Interpolators.ACCELERATE +import com.android.app.animation.Interpolators.ACCELERATE_2 +import com.android.app.animation.Interpolators.LINEAR import com.android.launcher3.LauncherState.BACKGROUND_APP import com.android.launcher3.R import com.android.launcher3.Utilities -import com.android.launcher3.anim.Interpolators.ACCEL -import com.android.launcher3.anim.Interpolators.ACCEL_2 -import com.android.launcher3.anim.Interpolators.LINEAR import com.android.launcher3.util.SystemUiController import com.android.launcher3.util.Themes import com.android.launcher3.views.ScrimView @@ -42,7 +42,7 @@ import com.saggitt.omega.util.runOnMainThread import kotlin.math.roundToInt class BlurScrimView(context: Context, attrs: AttributeSet?) : ScrimView(context, attrs), - BlurWallpaperProvider.Listener { + BlurWallpaperProvider.Listener { private val prefs = NeoPrefs.getInstance(context) private var drawerOpacity = prefs.drawerBackgroundOpacity.getValue() private var radius = prefs.profileBlurRadius.getValue() @@ -76,8 +76,8 @@ class BlurScrimView(context: Context, attrs: AttributeSet?) : ScrimView(context, private var mProgress = 1f private var mShelfColor = 0 private var fullBlurProgress = 0f - private var mBeforeMidProgressColorInterpolator: Interpolator = ACCEL - private var mAfterMidProgressColorInterpolator: Interpolator = ACCEL + private var mBeforeMidProgressColorInterpolator: Interpolator = ACCELERATE + private var mAfterMidProgressColorInterpolator: Interpolator = ACCELERATE // Mid point where the alpha changes private var mMidAlpha = 0 @@ -85,7 +85,7 @@ class BlurScrimView(context: Context, attrs: AttributeSet?) : ScrimView(context, override fun updateSysUiColors() { val threshold = STATUS_BAR_COLOR_FORCE_UPDATE_THRESHOLD val forceChange = visibility == VISIBLE && - alpha > threshold && Color.alpha(mBackgroundColor) / (255f * drawerOpacity) > threshold + alpha > threshold && Color.alpha(backgroundColor) / (255f * drawerOpacity) > threshold with(systemUiController) { if (forceChange) { updateUiState(SystemUiController.UI_STATE_SCRIM_VIEW, !isScrimDark) @@ -117,12 +117,12 @@ class BlurScrimView(context: Context, attrs: AttributeSet?) : ScrimView(context, private fun updateColors() { val alpha = when { - useFlatColor -> ((1 - mProgress) * 255).toInt() - mProgress >= fullBlurProgress -> (255 * ACCEL_2.getInterpolation( + useFlatColor -> ((1 - mProgress) * 255).toInt() + mProgress >= fullBlurProgress -> (255 * ACCELERATE_2.getInterpolation( 0f.coerceAtLeast(1 - mProgress) / (1 - fullBlurProgress) )).roundToInt() - else -> 255 + else -> 255 } blurDrawable?.alpha = alpha @@ -139,13 +139,13 @@ class BlurScrimView(context: Context, attrs: AttributeSet?) : ScrimView(context, private fun getColorForProgress(progress: Float): Int { val interpolatedProgress: Float = when { - progress >= 1 -> progress + progress >= 1 -> progress progress >= mMidProgress -> Utilities.mapToRange( progress, mMidProgress, 1f, mMidProgress, 1f, mBeforeMidProgressColorInterpolator ) - else -> Utilities.mapToRange( + else -> Utilities.mapToRange( progress, 0f, mMidProgress, 0f, mMidProgress, mAfterMidProgressColorInterpolator ) } diff --git a/Omega/src/com/saggitt/omega/compose/components/ComposeBottomSheet.kt b/Omega/src/com/saggitt/omega/compose/components/ComposeBottomSheet.kt index ea76c01c9b..e9c83bc50f 100644 --- a/Omega/src/com/saggitt/omega/compose/components/ComposeBottomSheet.kt +++ b/Omega/src/com/saggitt/omega/compose/components/ComposeBottomSheet.kt @@ -20,16 +20,16 @@ import androidx.compose.foundation.layout.padding import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.runtime.Composable -import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.dp +import com.android.app.animation.Interpolators import com.android.launcher3.Launcher import com.android.launcher3.R import com.android.launcher3.Utilities -import com.android.launcher3.anim.Interpolators import com.android.launcher3.anim.PendingAnimation import com.android.launcher3.util.SystemUiController import com.android.launcher3.util.Themes @@ -44,7 +44,7 @@ class ComposeBottomSheet(context: Context, attrs: AttributeSet? = null) : private val container = ComposeView(context) private val mLauncher = Launcher.getLauncher(context) private var imeShift = 0f - private var _hintCloseProgress = mutableStateOf(0f) + private var _hintCloseProgress = mutableFloatStateOf(0f) private val hintCloseProgress get() = _hintCloseProgress.value var hintCloseDistance = 0f private set @@ -68,7 +68,7 @@ class ComposeBottomSheet(context: Context, attrs: AttributeSet? = null) : bottom = 50.dp, start = 0.dp, end = 0.dp - ) + ), ) { container.setContent { OmegaAppTheme { @@ -89,17 +89,17 @@ class ComposeBottomSheet(context: Context, attrs: AttributeSet? = null) : } private fun animateOpen(animate: Boolean) { - if (mIsOpen || mOpenCloseAnimator.isRunning) { + if (mIsOpen || mOpenCloseAnimation.animationPlayer.isRunning) { return } mIsOpen = true setupNavBarColor() - mOpenCloseAnimator.setValues( + mOpenCloseAnimation.animationPlayer.setValues( PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED) ) - mOpenCloseAnimator.interpolator = Interpolators.FAST_OUT_SLOW_IN - if (!animate) mOpenCloseAnimator.duration = 0 - mOpenCloseAnimator.start() + mOpenCloseAnimation.animationPlayer.interpolator = Interpolators.FAST_OUT_SLOW_IN + if (!animate) mOpenCloseAnimation.animationPlayer.duration = 0 + mOpenCloseAnimation.animationPlayer.start() } private fun setupNavBarColor() { @@ -126,7 +126,7 @@ class ComposeBottomSheet(context: Context, attrs: AttributeSet? = null) : override fun addHintCloseAnim( distanceToMove: Float, interpolator: Interpolator, - target: PendingAnimation + target: PendingAnimation, ) { super.addHintCloseAnim(distanceToMove, interpolator, target) hintCloseDistance = distanceToMove @@ -134,7 +134,7 @@ class ComposeBottomSheet(context: Context, attrs: AttributeSet? = null) : } private fun updateContentShift() { - if (!Utilities.getOmegaPrefs(context).showDebugInfo.getValue()) { + if (!Utilities.getNeoPrefs(context).showDebugInfo.getValue()) { mContent.translationY = mTranslationShift * mContent.height + imeShift } } @@ -147,7 +147,7 @@ class ComposeBottomSheet(context: Context, attrs: AttributeSet? = null) : @Composable private fun ContentWrapper( contentPaddings: PaddingValues = PaddingValues(all = 0.dp), - content: @Composable ComposeBottomSheet.() -> Unit + content: @Composable ComposeBottomSheet.() -> Unit, ) { val imePaddings = WindowInsets.ime .only(WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom) @@ -189,7 +189,7 @@ class ComposeBottomSheet(context: Context, attrs: AttributeSet? = null) : fun show( context: Context, animate: Boolean = true, - content: @Composable ComposeBottomSheet.() -> Unit + content: @Composable ComposeBottomSheet.() -> Unit, ) { val bottomSheet = ComposeBottomSheet(context) bottomSheet.setContent(content) diff --git a/Omega/src/com/saggitt/omega/compose/components/preferences/GridSizePrefDialogUI.kt b/Omega/src/com/saggitt/omega/compose/components/preferences/GridSizePrefDialogUI.kt index ec66da6d05..dcebf28a65 100644 --- a/Omega/src/com/saggitt/omega/compose/components/preferences/GridSizePrefDialogUI.kt +++ b/Omega/src/com/saggitt/omega/compose/components/preferences/GridSizePrefDialogUI.kt @@ -68,7 +68,7 @@ fun GridSizePrefDialogUI( openDialogCustom: MutableState, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) var numColumns by remember { mutableIntStateOf(pref.numColumnsPref.getValue()) } var numRows by remember { mutableIntStateOf(if (pref is GridSize2D) pref.numRowsPref.getValue() else 0) } diff --git a/Omega/src/com/saggitt/omega/compose/components/preferences/IntentLauncherDialogUI.kt b/Omega/src/com/saggitt/omega/compose/components/preferences/IntentLauncherDialogUI.kt index 670d853701..82410be743 100644 --- a/Omega/src/com/saggitt/omega/compose/components/preferences/IntentLauncherDialogUI.kt +++ b/Omega/src/com/saggitt/omega/compose/components/preferences/IntentLauncherDialogUI.kt @@ -31,7 +31,7 @@ fun IntentLauncherDialogUI( openDialogCustom: MutableState, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) var radius = 16.dp if (prefs.profileWindowCornerRadius.getValue() > -1) { diff --git a/Omega/src/com/saggitt/omega/compose/components/preferences/SelectionPrefDialogUI.kt b/Omega/src/com/saggitt/omega/compose/components/preferences/SelectionPrefDialogUI.kt index 565d690c77..c2673aceb7 100644 --- a/Omega/src/com/saggitt/omega/compose/components/preferences/SelectionPrefDialogUI.kt +++ b/Omega/src/com/saggitt/omega/compose/components/preferences/SelectionPrefDialogUI.kt @@ -72,7 +72,7 @@ fun IntSelectionPrefDialogUI( openDialogCustom: MutableState, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) val entryPairs = pref.entries.toList() val coroutineScope = rememberCoroutineScope() var selected by remember { mutableIntStateOf(-1) } @@ -160,7 +160,7 @@ fun LongSelectionPrefDialogUI( openDialogCustom: MutableState, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) val entryPairs = pref.entries().toList() val coroutineScope = rememberCoroutineScope() var selected by remember { mutableLongStateOf(-1L) } @@ -241,7 +241,7 @@ fun StringSelectionPrefDialogUI( openDialogCustom: MutableState, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) var selected by remember { mutableStateOf(pref.getValue()) } val entryPairs = pref.entries.toList() @@ -317,7 +317,7 @@ fun StringMultiSelectionPrefDialogUI( openDialogCustom: MutableState, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) var selected by remember { mutableStateOf(pref.getValue()) } val entryPairs = pref.entries.toList() @@ -396,7 +396,7 @@ fun ResetCustomIconsDialog( openDialogCustom: MutableState, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) var radius = 16.dp if (prefs.profileWindowCornerRadius.getValue() > -1) { diff --git a/Omega/src/com/saggitt/omega/compose/components/preferences/StringTextPrefDialogUI.kt b/Omega/src/com/saggitt/omega/compose/components/preferences/StringTextPrefDialogUI.kt index 220e884043..3dd0efafae 100644 --- a/Omega/src/com/saggitt/omega/compose/components/preferences/StringTextPrefDialogUI.kt +++ b/Omega/src/com/saggitt/omega/compose/components/preferences/StringTextPrefDialogUI.kt @@ -51,7 +51,7 @@ fun StringTextPrefDialogUI( openDialogCustom: MutableState, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) var itemText by remember { mutableStateOf(pref.getValue()) } var radius = 16.dp diff --git a/Omega/src/com/saggitt/omega/compose/pages/GestureSelectorPage.kt b/Omega/src/com/saggitt/omega/compose/pages/GestureSelectorPage.kt index b07479fc9d..f51b48fbf7 100644 --- a/Omega/src/com/saggitt/omega/compose/pages/GestureSelectorPage.kt +++ b/Omega/src/com/saggitt/omega/compose/pages/GestureSelectorPage.kt @@ -417,6 +417,6 @@ fun ShortcutsScreen( @Preview fun GestureSelectorPreview() { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) GestureSelectorPage(prefs.gestureDoubleTap) } \ No newline at end of file diff --git a/Omega/src/com/saggitt/omega/compose/pages/HiddenAppsPage.kt b/Omega/src/com/saggitt/omega/compose/pages/HiddenAppsPage.kt index a33325edbd..6cbd5bcbed 100644 --- a/Omega/src/com/saggitt/omega/compose/pages/HiddenAppsPage.kt +++ b/Omega/src/com/saggitt/omega/compose/pages/HiddenAppsPage.kt @@ -33,7 +33,7 @@ import com.saggitt.omega.util.comparing @Composable fun HiddenAppsPage() { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) val hiddenApps by remember { mutableStateOf(prefs.drawerHiddenAppSet.getValue()) } val title = if (hiddenApps.isEmpty()) stringResource(id = R.string.title__drawer_hide_apps) else stringResource(id = R.string.hide_app_selected, hiddenApps.size) diff --git a/Omega/src/com/saggitt/omega/compose/pages/IconShapePage.kt b/Omega/src/com/saggitt/omega/compose/pages/IconShapePage.kt index 86028eb4eb..f1805b70a3 100644 --- a/Omega/src/com/saggitt/omega/compose/pages/IconShapePage.kt +++ b/Omega/src/com/saggitt/omega/compose/pages/IconShapePage.kt @@ -53,7 +53,7 @@ import com.saggitt.omega.icons.ShapeModel @Composable fun IconShapePage() { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) val currentShape = remember { mutableStateOf(prefs.profileIconShape.getValue()) } ViewWithActionBar(title = stringResource(id = R.string.title_theme_customize_icons)) { paddingValues -> val systemShape = IconShapeManager.getSystemIconShape(context) diff --git a/Omega/src/com/saggitt/omega/compose/pages/ProtectedAppsPage.kt b/Omega/src/com/saggitt/omega/compose/pages/ProtectedAppsPage.kt index 6fd90b11ff..28776548ca 100644 --- a/Omega/src/com/saggitt/omega/compose/pages/ProtectedAppsPage.kt +++ b/Omega/src/com/saggitt/omega/compose/pages/ProtectedAppsPage.kt @@ -34,7 +34,7 @@ import com.saggitt.omega.util.prefs @Composable fun ProtectedAppsPage() { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) val navController = LocalNavController.current if (prefs.drawerEnableProtectedApps.getValue() && Utilities.ATLEAST_R) { Config.showLockScreen( diff --git a/Omega/src/com/saggitt/omega/compose/pages/preferences/DevPrefsPage.kt b/Omega/src/com/saggitt/omega/compose/pages/preferences/DevPrefsPage.kt index 43cb947c8c..158f038a2a 100644 --- a/Omega/src/com/saggitt/omega/compose/pages/preferences/DevPrefsPage.kt +++ b/Omega/src/com/saggitt/omega/compose/pages/preferences/DevPrefsPage.kt @@ -39,7 +39,7 @@ import com.saggitt.omega.compose.components.preferences.PreferenceGroup @Composable fun DevPrefsPage() { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) val openDialog = remember { mutableStateOf(false) } var dialogPref by remember { mutableStateOf(null) } val onPrefDialog = { pref: Any -> diff --git a/Omega/src/com/saggitt/omega/compose/pages/preferences/EditDashPage.kt b/Omega/src/com/saggitt/omega/compose/pages/preferences/EditDashPage.kt index 603143eb0b..6dd30946c9 100644 --- a/Omega/src/com/saggitt/omega/compose/pages/preferences/EditDashPage.kt +++ b/Omega/src/com/saggitt/omega/compose/pages/preferences/EditDashPage.kt @@ -61,7 +61,7 @@ import org.burnoutcrew.reorderable.reorderable @Composable fun EditDashPage() { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) val iconList = iconIds val allItems = dashProviderOptions diff --git a/Omega/src/com/saggitt/omega/compose/pages/preferences/MainPrefsPage.kt b/Omega/src/com/saggitt/omega/compose/pages/preferences/MainPrefsPage.kt index fb6f8439a3..e531920904 100644 --- a/Omega/src/com/saggitt/omega/compose/pages/preferences/MainPrefsPage.kt +++ b/Omega/src/com/saggitt/omega/compose/pages/preferences/MainPrefsPage.kt @@ -53,7 +53,7 @@ import com.saggitt.omega.compose.pages.iconPickerGraph @Composable fun MainPrefsPage() { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) val uiPrefs = listOf( PageItem.PrefsProfile, PageItem.PrefsDesktop, diff --git a/Omega/src/com/saggitt/omega/folder/FolderListDialog.kt b/Omega/src/com/saggitt/omega/folder/FolderListDialog.kt index 63be95404b..57078f59e3 100644 --- a/Omega/src/com/saggitt/omega/folder/FolderListDialog.kt +++ b/Omega/src/com/saggitt/omega/folder/FolderListDialog.kt @@ -81,7 +81,7 @@ fun FolderListDialogUI( onClose: (GestureHandler) -> Unit, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) var radius = 16.dp if (prefs.profileWindowCornerRadius.getValue() > -1) { diff --git a/Omega/src/com/saggitt/omega/gestures/GestureController.kt b/Omega/src/com/saggitt/omega/gestures/GestureController.kt index 1b34da2851..70e5ffbee0 100644 --- a/Omega/src/com/saggitt/omega/gestures/GestureController.kt +++ b/Omega/src/com/saggitt/omega/gestures/GestureController.kt @@ -44,14 +44,17 @@ import org.json.JSONObject class GestureController(val launcher: NeoLauncher) : TouchController { - private val blankGestureHandler = BlankGestureHandler(launcher, null) + val blankGestureHandler = BlankGestureHandler(launcher, null) private val doubleTapGesture by lazy { DoubleTapGesture(this) } private val pressHomeGesture by lazy { PressHomeGesture(this) } private val pressBackGesture by lazy { PressBackGesture(this) } private val longPressGesture by lazy { LongPressGesture(this) } + + //private val assistantGesture by lazy { LaunchAssistantGesture(this) } val verticalSwipeGesture by lazy { VerticalSwipeGesture(this) } var touchDownPoint = PointF() + private var swipeUpOverride: Pair? = null override fun onControllerInterceptTouchEvent(ev: MotionEvent): Boolean { @@ -78,6 +81,10 @@ class GestureController(val launcher: NeoLauncher) : TouchController { pressBackGesture.isEnabled && pressBackGesture.onEvent() } + /*fun onLaunchAssistant() { + assistantGesture.isEnabled && assistantGesture.onEvent() + }*/ + fun setSwipeUpOverride(handler: GestureHandler, downTime: Long) { if (swipeUpOverride?.second != downTime) { swipeUpOverride = Pair(handler, downTime) @@ -109,7 +116,7 @@ class GestureController(val launcher: NeoLauncher) : TouchController { fun createGestureHandler( context: Context, jsonString: String?, - fallback: GestureHandler + fallback: GestureHandler, ): GestureHandler { if (!jsonString.isNullOrEmpty()) { val config: JSONObject? = try { @@ -167,5 +174,4 @@ class GestureController(val launcher: NeoLauncher) : TouchController { } }.filter { it.isAvailableForSwipeUp(isSwipeUp) } } - } diff --git a/Omega/src/com/saggitt/omega/gestures/VerticalSwipeGestureController.kt b/Omega/src/com/saggitt/omega/gestures/VerticalSwipeGestureController.kt index dfc8e80b3a..64b3b4a358 100644 --- a/Omega/src/com/saggitt/omega/gestures/VerticalSwipeGestureController.kt +++ b/Omega/src/com/saggitt/omega/gestures/VerticalSwipeGestureController.kt @@ -44,13 +44,7 @@ class VerticalSwipeGestureController(private val launcher: Launcher) : TouchCont private val controller by lazy { launcher.nLauncher.gestureController } private val gesture by lazy { controller.verticalSwipeGesture } - private val detector by lazy { - SwipeDetector( - launcher, - this, - SwipeDetector.VERTICAL - ) - } + private val detector by lazy { SwipeDetector(launcher, this, SwipeDetector.VERTICAL) } private var noIntercept = false private var swipeUpOverride: GestureHandler? = null diff --git a/Omega/src/com/saggitt/omega/gestures/handlers/LauncherGestureHandler.kt b/Omega/src/com/saggitt/omega/gestures/handlers/LauncherGestureHandler.kt index 1ac4d6a109..465175e463 100644 --- a/Omega/src/com/saggitt/omega/gestures/handlers/LauncherGestureHandler.kt +++ b/Omega/src/com/saggitt/omega/gestures/handlers/LauncherGestureHandler.kt @@ -36,6 +36,7 @@ import com.android.launcher3.R import com.android.launcher3.Utilities import com.android.launcher3.anim.AnimatorListeners import com.android.launcher3.util.ComponentKey +import com.android.launcher3.widget.WidgetsBottomSheet import com.android.launcher3.widget.picker.WidgetsFullSheet import com.saggitt.omega.dash.DashSheet import com.saggitt.omega.gestures.GestureController diff --git a/Omega/src/com/saggitt/omega/groups/category/DrawerFolderInfo.kt b/Omega/src/com/saggitt/omega/groups/category/DrawerFolderInfo.kt index aafd128cc1..26060b957d 100644 --- a/Omega/src/com/saggitt/omega/groups/category/DrawerFolderInfo.kt +++ b/Omega/src/com/saggitt/omega/groups/category/DrawerFolderInfo.kt @@ -19,6 +19,7 @@ package com.saggitt.omega.groups.category import com.android.launcher3.AbstractFloatingView +import com.android.launcher3.BaseDraggingActivity import com.android.launcher3.Launcher import com.android.launcher3.allapps.AllAppsStore import com.android.launcher3.model.ModelWriter @@ -31,7 +32,7 @@ import com.saggitt.omega.util.prefs class DrawerFolderInfo(private val drawerFolder: DrawerFolders.Folder) : FolderInfo() { private var changed = false - lateinit var appsStore: AllAppsStore + lateinit var appsStore: AllAppsStore override fun setTitle(title: CharSequence?, modelWriter: ModelWriter?) { super.setTitle(title, modelWriter) diff --git a/Omega/src/com/saggitt/omega/groups/category/DrawerFolders.kt b/Omega/src/com/saggitt/omega/groups/category/DrawerFolders.kt index 21b488758f..4d370b7542 100644 --- a/Omega/src/com/saggitt/omega/groups/category/DrawerFolders.kt +++ b/Omega/src/com/saggitt/omega/groups/category/DrawerFolders.kt @@ -135,7 +135,7 @@ class DrawerFolders(val manager: AppGroupsManager) : ) = super .toFolderInfo(getAppInfo, modelWriter).apply { this@CustomFolder.contents.value?.mapNotNullTo(contents) { key -> - getAppInfo(key)?.makeWorkspaceItem() + getAppInfo(key)?.makeWorkspaceItem(context) }?.sortWith(comparator) } } diff --git a/Omega/src/com/saggitt/omega/groups/ui/AppTabDialog.kt b/Omega/src/com/saggitt/omega/groups/ui/AppTabDialog.kt index 7e4cac812a..9bc64082e6 100644 --- a/Omega/src/com/saggitt/omega/groups/ui/AppTabDialog.kt +++ b/Omega/src/com/saggitt/omega/groups/ui/AppTabDialog.kt @@ -79,7 +79,7 @@ fun AppTabDialogUI( openDialogCustom: MutableState, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) var radius = 16.dp if (prefs.profileWindowCornerRadius.getValue() > -1) { diff --git a/Omega/src/com/saggitt/omega/groups/ui/EditGroupBottomSheet.kt b/Omega/src/com/saggitt/omega/groups/ui/EditGroupBottomSheet.kt index 044ede39ca..bd3f9f2493 100644 --- a/Omega/src/com/saggitt/omega/groups/ui/EditGroupBottomSheet.kt +++ b/Omega/src/com/saggitt/omega/groups/ui/EditGroupBottomSheet.kt @@ -82,7 +82,7 @@ fun EditGroupBottomSheet( onClose: (Int) -> Unit, ) { val context = LocalContext.current - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) val flowerpotManager = Flowerpot.Manager.getInstance(context) val config = group.customizations val keyboardController = LocalSoftwareKeyboardController.current diff --git a/Omega/src/com/saggitt/omega/icons/CustomIconProvider.kt b/Omega/src/com/saggitt/omega/icons/CustomIconProvider.kt index 6921bcc608..618ccbf339 100644 --- a/Omega/src/com/saggitt/omega/icons/CustomIconProvider.kt +++ b/Omega/src/com/saggitt/omega/icons/CustomIconProvider.kt @@ -44,7 +44,7 @@ import androidx.core.content.getSystemService import androidx.core.content.res.ResourcesCompat import com.android.launcher3.R import com.android.launcher3.Utilities -import com.android.launcher3.icons.IconProvider +import com.android.launcher3.icons.LauncherIconProvider import com.android.launcher3.icons.ThemedIconDrawable import com.android.launcher3.util.ComponentKey import com.android.launcher3.util.SafeCloseable @@ -66,9 +66,9 @@ import java.util.function.Supplier class CustomIconProvider @JvmOverloads constructor( private val context: Context, supportsIconTheme: Boolean = false, -) : IconProvider(context) { +) : LauncherIconProvider(context) { - private val prefs = Utilities.getOmegaPrefs(context) + private val prefs = Utilities.getNeoPrefs(context) private val iconPackPref = prefs.profileIconPack private val iconPackProvider = IconPackProvider.INSTANCE.get(context) private val overrideRepo = IconOverrideRepository.INSTANCE.get(context) @@ -93,7 +93,7 @@ class CustomIconProvider @JvmOverloads constructor( setIconThemeSupported(supportsIconTheme) } - private fun setIconThemeSupported(isSupported: Boolean) { + override fun setIconThemeSupported(isSupported: Boolean) { _themeMap = if (isSupported) null else DISABLED_MAP } @@ -330,7 +330,7 @@ class CustomIconProvider @JvmOverloads constructor( } private var iconState = systemIconState - private val prefs = Utilities.getOmegaPrefs(context) + private val prefs = Utilities.getNeoPrefs(context) private val iconPackPref = prefs.profileIconPack init { diff --git a/Omega/src/com/saggitt/omega/icons/IconCornerShape.kt b/Omega/src/com/saggitt/omega/icons/IconCornerShape.kt index 2a57b6037a..88fec1668f 100644 --- a/Omega/src/com/saggitt/omega/icons/IconCornerShape.kt +++ b/Omega/src/com/saggitt/omega/icons/IconCornerShape.kt @@ -21,7 +21,7 @@ package com.saggitt.omega.icons import android.graphics.Path import android.graphics.PointF import com.android.launcher3.Utilities -import com.android.launcher3.anim.Interpolators.LINEAR +import com.android.app.animation.Interpolators.LINEAR abstract class IconCornerShape { diff --git a/Omega/src/com/saggitt/omega/preferences/Constants.kt b/Omega/src/com/saggitt/omega/preferences/Constants.kt index bce31417a0..b6dce9f631 100644 --- a/Omega/src/com/saggitt/omega/preferences/Constants.kt +++ b/Omega/src/com/saggitt/omega/preferences/Constants.kt @@ -82,7 +82,7 @@ val iconIds = mapOf( PREFS_DRAWER_POPUP_EDIT to R.drawable.ic_edit_no_shadow, // Dash Providers EditDash::class.java.name to R.drawable.ic_edit_dash, - ChangeWallpaper::class.java.name to R.drawable.ic_wallpaper, + ChangeWallpaper::class.java.name to R.drawable.ic_palette, OmegaSettings::class.java.name to R.drawable.ic_omega_settings, ManageVolume::class.java.name to R.drawable.ic_volume, DeviceSettings::class.java.name to R.drawable.ic_setting, diff --git a/Omega/src/com/saggitt/omega/preferences/NeoPrefs.kt b/Omega/src/com/saggitt/omega/preferences/NeoPrefs.kt index 26139b2e7d..7a5a7624dc 100644 --- a/Omega/src/com/saggitt/omega/preferences/NeoPrefs.kt +++ b/Omega/src/com/saggitt/omega/preferences/NeoPrefs.kt @@ -61,6 +61,7 @@ import com.saggitt.omega.smartspace.provider.NowPlayingProvider import com.saggitt.omega.smartspace.weather.GoogleWeatherProvider import com.saggitt.omega.smartspace.weather.OWMWeatherProvider import com.saggitt.omega.util.Config +import com.saggitt.omega.util.Config.Companion.THEME_ICON_THEMED import com.saggitt.omega.util.firstBlocking import com.saggitt.omega.util.getFeedProviders import com.saggitt.omega.util.languageOptions @@ -139,6 +140,12 @@ class NeoPrefs private constructor(val context: Context) { .getIconPackList() .associateBy(IconPackInfo::packageName, IconPackInfo::name), onChange = { + Utilities.getPrefs(context).edit() + .putBoolean( + Themes.KEY_THEMED_ICONS, + it == THEME_ICON_THEMED + ) + .apply() reloadGrid() } ) diff --git a/Omega/src/com/saggitt/omega/search/NeoAppSearchAlgorithm.kt b/Omega/src/com/saggitt/omega/search/NeoAppSearchAlgorithm.kt index dcd73ffcb7..a4dbb67564 100644 --- a/Omega/src/com/saggitt/omega/search/NeoAppSearchAlgorithm.kt +++ b/Omega/src/com/saggitt/omega/search/NeoAppSearchAlgorithm.kt @@ -91,13 +91,13 @@ class NeoAppSearchAlgorithm(val context: Context) : DefaultAppSearchAlgorithm(co return if (prefs.searchFuzzy.getValue()) { getFuzzySearchResult(apps, query) } else { - getTitleMatchResult(apps, query) + getTitleMatchResultKT(apps, query) } } private fun getFuzzySearchResult( apps: MutableList, - query: String + query: String, ): ArrayList { val result = ArrayList() val mApps = apps @@ -124,7 +124,8 @@ class NeoAppSearchAlgorithm(val context: Context) : DefaultAppSearchAlgorithm(co return result } - override fun getTitleMatchResult( + + private fun getTitleMatchResultKT( apps: MutableList, query: String?, ): ArrayList { @@ -160,7 +161,7 @@ class NeoAppSearchAlgorithm(val context: Context) : DefaultAppSearchAlgorithm(co } private fun getSuggestions(query: String): List { - if (!Utilities.getOmegaPrefs(context).searchGlobal.getValue()) { + if (!Utilities.getNeoPrefs(context).searchGlobal.getValue()) { return emptyList() } val provider = SearchProviderController diff --git a/Omega/src/com/saggitt/omega/smartspace/SmartSpaceHostView.kt b/Omega/src/com/saggitt/omega/smartspace/SmartSpaceHostView.kt index 75549d5871..1e8ea847d1 100644 --- a/Omega/src/com/saggitt/omega/smartspace/SmartSpaceHostView.kt +++ b/Omega/src/com/saggitt/omega/smartspace/SmartSpaceHostView.kt @@ -56,7 +56,7 @@ open class SmartSpaceHostView(context: Context) : QsbWidgetHostView(context), On R.drawable.ic_smartspace_preferences, NexusLauncherEnum.SMARTSPACE_TAP_OR_LONGPRESS ) { v: View -> openSettings(v) } - OptionsPopupView.show(mLauncher, centerPos, listOf(item), true) + OptionsPopupView.show(mLauncher, centerPos, listOf(item), true) return true } diff --git a/Omega/src/com/saggitt/omega/smartspace/SmartspaceViewContainer.kt b/Omega/src/com/saggitt/omega/smartspace/SmartspaceViewContainer.kt index 0021d5f0a8..4ac15733df 100644 --- a/Omega/src/com/saggitt/omega/smartspace/SmartspaceViewContainer.kt +++ b/Omega/src/com/saggitt/omega/smartspace/SmartspaceViewContainer.kt @@ -12,6 +12,7 @@ import com.android.launcher3.CheckLongPressHelper import com.android.launcher3.Launcher import com.android.launcher3.R import com.android.launcher3.logging.StatsLogManager +import com.android.launcher3.views.ActivityContext import com.android.launcher3.views.OptionsPopupView import com.google.android.systemui.smartspace.BcSmartspaceView import com.saggitt.omega.compose.navigation.Routes @@ -42,7 +43,7 @@ class SmartspaceViewContainer @JvmOverloads constructor( val launcher = Launcher.getLauncher(context) val pos = Rect() launcher.dragLayer.getDescendantRectRelativeToSelf(smartspaceView, pos) - OptionsPopupView.show(launcher, RectF(pos), listOf(getCustomizeOption()), true) + OptionsPopupView.show(launcher, RectF(pos), listOf(getCustomizeOption()), true) } private fun getCustomizeOption() = OptionsPopupView.OptionItem( diff --git a/Omega/src/com/saggitt/omega/smartspace/ThemedSmartSpaceHostView.kt b/Omega/src/com/saggitt/omega/smartspace/ThemedSmartSpaceHostView.kt index 405162f453..8a89657938 100644 --- a/Omega/src/com/saggitt/omega/smartspace/ThemedSmartSpaceHostView.kt +++ b/Omega/src/com/saggitt/omega/smartspace/ThemedSmartSpaceHostView.kt @@ -11,8 +11,8 @@ import android.widget.ImageView import android.widget.RemoteViews import android.widget.TextView import com.android.launcher3.R -import com.android.launcher3.ResourceUtils import com.android.launcher3.icons.ShadowGenerator +import com.android.launcher3.util.ResourceHelper.Companion.pxFromDp import com.android.launcher3.util.Themes import com.android.launcher3.views.DoubleShadowBubbleTextView import com.saggitt.omega.util.recursiveChildren @@ -22,7 +22,7 @@ class ThemedSmartSpaceHostView(context: Context) : SmartSpaceHostView(context) { private val isWorkspaceDarkText = Themes.getAttrBoolean(context, R.attr.isWorkspaceDarkText) private val workspaceTextColor = Themes.getAttrColor(context, R.attr.workspaceTextColor) private val shadowGenerator = - ShadowGenerator(ResourceUtils.pxFromDp(48f, context.resources.displayMetrics)) + ShadowGenerator(pxFromDp(48f, context.resources.displayMetrics)) private val templateTextView = LayoutInflater.from(context) .inflate(R.layout.smartspace_text_template, this, false) as DoubleShadowBubbleTextView @@ -40,7 +40,7 @@ class ThemedSmartSpaceHostView(context: Context) : SmartSpaceHostView(context) { val images = mutableListOf() for (child in parent.recursiveChildren) { when (child) { - is TextView -> overrideTextView(child) + is TextView -> overrideTextView(child) is ImageView -> images.add(child) } } diff --git a/Omega/src/com/saggitt/omega/theme/ThemeOverride.kt b/Omega/src/com/saggitt/omega/theme/ThemeOverride.kt index 7253392ad5..642221d91e 100644 --- a/Omega/src/com/saggitt/omega/theme/ThemeOverride.kt +++ b/Omega/src/com/saggitt/omega/theme/ThemeOverride.kt @@ -52,9 +52,9 @@ class ThemeOverride(private val themeSet: ThemeSet, val listener: ThemeOverrideL } class Launcher : ThemeSet { - override val lightTheme = R.style.AppTheme_Light - override val darkTheme = R.style.AppTheme_Dark - override val blackTheme = R.style.AppTheme_Black + override val lightTheme = R.style.NeoTheme_Light + override val darkTheme = R.style.NeoTheme_Dark + override val blackTheme = R.style.NeoTheme_Black } class Settings : ThemeSet { diff --git a/Omega/src/com/saggitt/omega/util/Config.kt b/Omega/src/com/saggitt/omega/util/Config.kt index 31130ffddb..152be7cfad 100644 --- a/Omega/src/com/saggitt/omega/util/Config.kt +++ b/Omega/src/com/saggitt/omega/util/Config.kt @@ -187,7 +187,7 @@ class Config(val context: Context) { } fun gesturePrefs(context: Context): List { - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) return listOf( prefs.gestureDoubleTap, prefs.gestureLongPress, @@ -261,7 +261,7 @@ class Config(val context: Context) { fun isAppProtected(context: Context, componentKey: ComponentKey): Boolean { var result = false val protectedApps = ArrayList( - Utilities.getOmegaPrefs(context).drawerProtectedAppsSet.getValue() + Utilities.getNeoPrefs(context).drawerProtectedAppsSet.getValue() .map { Utilities.makeComponentKey(context, it) }) if (protectedApps.contains(componentKey)) { diff --git a/Omega/src/com/saggitt/omega/util/OmegaUtils.kt b/Omega/src/com/saggitt/omega/util/OmegaUtils.kt index dbde240006..7165a9a90b 100644 --- a/Omega/src/com/saggitt/omega/util/OmegaUtils.kt +++ b/Omega/src/com/saggitt/omega/util/OmegaUtils.kt @@ -217,7 +217,7 @@ operator fun PreferenceGroup.get(index: Int): Preference = getPreference(index) fun openPopupMenu(view: View, rect: RectF?, vararg items: OptionsPopupView.OptionItem) { val launcher = Launcher.getLauncher(view.context) - OptionsPopupView.show( + OptionsPopupView.show( launcher, rect ?: RectF(launcher.getViewBounds(view)), items.toList(), diff --git a/Omega/src/com/saggitt/omega/util/PackageUtils.kt b/Omega/src/com/saggitt/omega/util/PackageUtils.kt index 1c2a1dbc60..f7e6263353 100644 --- a/Omega/src/com/saggitt/omega/util/PackageUtils.kt +++ b/Omega/src/com/saggitt/omega/util/PackageUtils.kt @@ -1,10 +1,6 @@ package com.saggitt.omega.util -import android.content.ComponentName -import android.content.Context -import android.content.Intent import android.content.pm.PackageManager -import com.android.launcher3.R import com.android.launcher3.Utilities fun PackageManager.isAppEnabled(packageName: String?, flags: Int): Boolean { @@ -29,13 +25,13 @@ fun PackageManager.getPackageVersionCode(packageName: String) = val info = getPackageInfo(packageName, 0) when { Utilities.ATLEAST_P -> info.longVersionCode - else -> info.versionCode.toLong() + else -> info.versionCode.toLong() } } catch (e: PackageManager.NameNotFoundException) { -1L } -fun PackageManager.getThemedIconPacksInstalled(context: Context): List = +/*fun PackageManager.getThemedIconPacksInstalled(context: Context): List = try { queryIntentActivityOptions( ComponentName(context.applicationInfo.packageName, context.applicationInfo.className), @@ -45,4 +41,4 @@ fun PackageManager.getThemedIconPacksInstalled(context: Context): List = ).map { it.activityInfo.packageName } } catch (_: PackageManager.NameNotFoundException) { emptyList() - } \ No newline at end of file + }*/ \ No newline at end of file diff --git a/Omega/src/com/saggitt/omega/util/ThemeExtensions.kt b/Omega/src/com/saggitt/omega/util/ThemeExtensions.kt index 37f0d5f5f6..72b1a286ac 100644 --- a/Omega/src/com/saggitt/omega/util/ThemeExtensions.kt +++ b/Omega/src/com/saggitt/omega/util/ThemeExtensions.kt @@ -27,7 +27,7 @@ import com.android.launcher3.R import com.android.launcher3.Utilities fun AlertDialog.applyAccent() { - val color = Utilities.getOmegaPrefs(context).profileAccentColor.getColor() + val color = Utilities.getNeoPrefs(context).profileAccentColor.getColor() val buttons = listOf( getButton(DialogInterface.BUTTON_NEGATIVE), getButton(DialogInterface.BUTTON_NEUTRAL), @@ -44,7 +44,7 @@ val Int.luminance get() = ColorUtils.calculateLuminance(this) val Int.isDark get() = luminance < 0.5f fun getWindowCornerRadius(context: Context): Float { - val prefs = Utilities.getOmegaPrefs(context) + val prefs = Utilities.getNeoPrefs(context) if (prefs.profileWindowCornerRadius.getValue() > -1) { return prefs.profileWindowCornerRadius.getValue() } diff --git a/Omega/src/com/saggitt/omega/views/BaseBottomSheet.kt b/Omega/src/com/saggitt/omega/views/BaseBottomSheet.kt index 82c1f792c2..bf98e958f1 100644 --- a/Omega/src/com/saggitt/omega/views/BaseBottomSheet.kt +++ b/Omega/src/com/saggitt/omega/views/BaseBottomSheet.kt @@ -28,7 +28,7 @@ import android.view.animation.Interpolator import com.android.launcher3.Insettable import com.android.launcher3.Launcher import com.android.launcher3.R -import com.android.launcher3.anim.Interpolators +import com.android.app.animation.Interpolators import com.android.launcher3.anim.PendingAnimation import com.android.launcher3.util.SystemUiController import com.android.launcher3.util.Themes @@ -74,19 +74,19 @@ open class BaseBottomSheet @JvmOverloads constructor( } private fun animateOpen(animate: Boolean) { - if (mIsOpen || mOpenCloseAnimator.isRunning) { + if (mIsOpen || mOpenCloseAnimation.animationPlayer.isRunning) { return } mIsOpen = true setupNavBarColor() - mOpenCloseAnimator.setValues( + mOpenCloseAnimation.animationPlayer.setValues( PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED) ) - mOpenCloseAnimator.interpolator = Interpolators.FAST_OUT_SLOW_IN + mOpenCloseAnimation.animationPlayer.interpolator = Interpolators.FAST_OUT_SLOW_IN if (!animate) { - mOpenCloseAnimator.duration = 0 + mOpenCloseAnimation.animationPlayer.duration = 0 } - mOpenCloseAnimator.start() + mOpenCloseAnimation.animationPlayer.start() } override fun handleClose(animate: Boolean) { diff --git a/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatState.kt b/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatState.kt index ddc41b2f47..f17b5d77f5 100644 --- a/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatState.kt +++ b/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatState.kt @@ -3,7 +3,7 @@ package com.saulhdev.neolauncher.hotseat import android.content.Context import com.android.launcher3.Launcher import com.android.launcher3.LauncherState -import com.android.launcher3.anim.Interpolators +import com.android.app.animation.Interpolators import com.android.launcher3.views.ActivityContext class ExpandableHotseatState(id: Int) : @@ -11,7 +11,7 @@ class ExpandableHotseatState(id: Int) : var mIsHotseatOpened = false val PAGE_ALPHA_PROVIDER: PageAlphaProvider = - object : PageAlphaProvider(Interpolators.DEACCEL_2) { + object : PageAlphaProvider(Interpolators.DECELERATE_2) { override fun getPageAlpha(i2: Int): Float { return 1f } diff --git a/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatSwipeController.kt b/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatSwipeController.kt index f333b7024d..a85669e47a 100644 --- a/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatSwipeController.kt +++ b/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatSwipeController.kt @@ -35,7 +35,7 @@ class ExpandableHotseatSwipeController(val launcher: Launcher) : mCurrentAnimation = mLauncher.mStateManager.createAnimationToNewWorkspace( mToState, (2.0f * shiftRange).toLong(), - StateAnimationConfig.ANIM_HOTSEAT_SCALE + 0 //StateAnimationConfig.ANIM_HOTSEAT_SCALE ) var verticalProgress = mToState.getVerticalProgress(mLauncher) * shiftRange - mFromState.getVerticalProgress( diff --git a/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatTransitionController.kt b/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatTransitionController.kt index c2fc5e0cfe..edba919c30 100644 --- a/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatTransitionController.kt +++ b/Omega/src/com/saulhdev/neolauncher/hotseat/ExpandableHotseatTransitionController.kt @@ -2,13 +2,13 @@ package com.saulhdev.neolauncher.hotseat import android.view.View import android.view.animation.Interpolator +import com.android.app.animation.Interpolators import com.android.launcher3.DeviceProfile import com.android.launcher3.Hotseat import com.android.launcher3.Launcher import com.android.launcher3.LauncherState import com.android.launcher3.R import com.android.launcher3.ShortcutAndWidgetContainer -import com.android.launcher3.anim.Interpolators import com.android.launcher3.anim.PropertySetter import com.android.launcher3.compat.AccessibilityManagerCompat import com.android.launcher3.statemanager.StateManager @@ -121,7 +121,7 @@ class ExpandableHotseatTransitionController(launcher: Launcher) : Interpolators.LINEAR ) val shortcutsAndWidgets: ShortcutAndWidgetContainer = - mHotseat!!.getShortcutsAndWidgets() + mHotseat!!.shortcutsAndWidgets val childCount = shortcutsAndWidgets.childCount val dragInfo = mLauncher.workspace.dragInfo var i2 = 0 @@ -148,12 +148,12 @@ class ExpandableHotseatTransitionController(launcher: Launcher) : f = 1.0f } propertySetter.setViewAlpha(settingsIcon, f, interpolator) - propertySetter.setInt( + /*propertySetter.setInt( mScrimView, ScrimView.DRAG_HANDLE_ALPHA, if (visibleElements and 32 != 0) 255 else 0, Interpolators.LINEAR - ) + )*/ }