Skip to content

Commit

Permalink
minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
queuejw committed Aug 17, 2024
1 parent 19eb7e8 commit de75480
Show file tree
Hide file tree
Showing 40 changed files with 540 additions and 458 deletions.
2 changes: 1 addition & 1 deletion SpannedGridLayoutManager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ tasks.withType(Javadoc).configureEach {

dependencies {
implementation 'androidx.recyclerview:recyclerview:1.4.0-alpha02'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.10'
}
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId "ru.dimon6018.metrolauncher"
minSdk 21
targetSdk 35
versionCode 49
versionName "1.0 Pre-Alpha 5.1.1.1"
versionCode 50
versionName "1.0 Pre-Alpha 5.1.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled false
Expand Down Expand Up @@ -64,8 +64,8 @@ dependencies {
implementation project(path: ':liboverscroll')

implementation 'com.github.shadowalker77:wp7progressbar:1.1.0'
implementation 'io.coil-kt.coil3:coil:3.0.0-alpha09'
implementation 'io.coil-kt.coil3:coil-network-okhttp:3.0.0-alpha09'
implementation 'io.coil-kt.coil3:coil:3.0.0-alpha10'
implementation 'io.coil-kt.coil3:coil-network-okhttp:3.0.0-alpha10'

debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14'
// testImplementation 'junit:junit:4.13.2'
Expand Down
27 changes: 27 additions & 0 deletions app/src/main/java/ru/dimon6018/metrolauncher/Application.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package ru.dimon6018.metrolauncher

import android.annotation.SuppressLint
import android.app.Activity
import android.app.Application
import android.app.UiModeManager
import android.content.pm.ActivityInfo
import android.os.Build
import android.os.Bundle
import com.google.android.material.color.DynamicColors
//import ru.dimon6018.metrolauncher.content.data.ExperimentPrefs
import ru.dimon6018.metrolauncher.content.data.Prefs
import ru.dimon6018.metrolauncher.helpers.bsod.BsodDetector
import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.launcherAccentTheme

class Application : Application() {

Expand All @@ -24,6 +29,28 @@ class Application : Application() {
DynamicColors.applyToActivitiesIfAvailable(this)
}
super.onCreate()
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
@SuppressLint("SourceLockedOrientationActivity")
override fun onActivityPreCreated(activity: Activity, savedInstanceState: Bundle?) {
activity.setTheme(launcherAccentTheme())
when(PREFS!!.orientation) {
"p" -> {
activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
}
"l" -> {
activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
}
}
super.onActivityPreCreated(activity, savedInstanceState)
}
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {}
override fun onActivityStarted(activity: Activity) {}
override fun onActivityResumed(activity: Activity) {}
override fun onActivityPaused(activity: Activity) {}
override fun onActivityStopped(activity: Activity) {}
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
override fun onActivityDestroyed(activity: Activity) {}
})
}
fun setNightMode() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
Expand Down
18 changes: 2 additions & 16 deletions app/src/main/java/ru/dimon6018/metrolauncher/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.view.inputmethod.EditorInfo
import android.widget.AutoCompleteTextView
import android.widget.FrameLayout
Expand Down Expand Up @@ -59,7 +58,6 @@ import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.applyWindowInset
import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.getDefaultLocale
import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.isDevMode
import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.launcherAccentColor
import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.launcherAccentTheme
import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.launcherSurfaceColor
import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.registerPackageReceiver
import ru.dimon6018.metrolauncher.helpers.utils.Utils.Companion.sendCrash
Expand All @@ -83,7 +81,6 @@ class Main : AppCompatActivity() {
private lateinit var binding: MainScreenLaucnherBinding

override fun onCreate(savedInstanceState: Bundle?) {
setTheme(launcherAccentTheme())
setAppTheme()
handleDevMode()
super.onCreate(savedInstanceState)
Expand Down Expand Up @@ -129,10 +126,9 @@ class Main : AppCompatActivity() {
}

private fun setupUI() {
WindowCompat.setDecorFitsSystemWindows(window, true)
WindowCompat.setDecorFitsSystemWindows(window, false)
isLandscape = resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
applyWindowInsets(binding.coordinator)
configureWallpaper()
applyWindowInsets(binding.root)
registerPackageReceiver(this, packageReceiver)
otherTasks()
}
Expand All @@ -142,16 +138,6 @@ class Main : AppCompatActivity() {
PREFS!!.updateState = 3
}
}

private fun configureWallpaper() {
if (PREFS!!.isWallpaperUsed) {
window?.apply {
setBackgroundDrawable(ContextCompat.getDrawable(this@Main, R.drawable.start_transparent))
addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER)
}
}
}

private fun disableAnims() {
PREFS!!.apply {
isAAllAppsAnimEnabled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
private var appList: MutableList<App> = ArrayList()

fun addIconToCache(appPackage: String, bitmap: Bitmap?) {
if(icons.get(appPackage.hashCode()) == null) {
if(icons[appPackage.hashCode()] == null) {
icons.append(appPackage.hashCode(), bitmap)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ class NewAllApps: Fragment() {
val view = binding.root
Log.d("AllApps", "Init")
mainViewModel = ViewModelProvider(requireActivity())[MainViewModel::class.java]
if(!PREFS!!.isAllAppsBackgroundEnabled) {
binding.frame.background = if(PREFS!!.isLightThemeUsed) ContextCompat.getColor(requireContext(), android.R.color.background_light).toDrawable() else ContextCompat.getColor(requireContext(), android.R.color.background_dark).toDrawable()
} else {
binding.frame.background = ContextCompat.getColor(requireContext(), R.color.transparent).toDrawable()
}
binding.settingsBtn.setOnClickListener {
activity?.apply { startActivity(Intent(this, SettingsActivity::class.java)) }
}
Expand Down Expand Up @@ -708,20 +703,19 @@ class NewAllApps: Fragment() {
for (i in first..last) {
val itemView = binding.appList.findViewHolderForAdapterPosition(i)?.itemView
itemView?.let {
ObjectAnimator.ofFloat(it, "alpha", 0.5f, 1f).setDuration(500).start()
it.animate().alpha(1f).scaleY(1f).scaleX(1f).setDuration(500).start()
}
}
} else {
for (i in first..last) {
if (list[i] == app) continue
val itemView = binding.appList.findViewHolderForAdapterPosition(i)?.itemView
if (list[i] == app) continue
itemView?.let {
ObjectAnimator.ofFloat(it, "alpha", 1f, 0.5f).setDuration(500).start()
it.animate().alpha(0.5f).scaleY(0.95f).scaleX(0.95f).setDuration(500).start()
}
}
}
}

private fun startDismissAnim(item: App) {
if (appAdapter == null || !PREFS!!.isAAllAppsAnimEnabled) {
startAppDelay(item)
Expand Down
Loading

0 comments on commit de75480

Please sign in to comment.