Skip to content

Commit

Permalink
d
Browse files Browse the repository at this point in the history
  • Loading branch information
queuejw committed Oct 26, 2024
1 parent f408f93 commit 205fa08
Show file tree
Hide file tree
Showing 23 changed files with 184 additions and 354 deletions.
2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions SpannedGridLayoutManager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ tasks.withType(Javadoc).configureEach {
}

dependencies {
implementation 'androidx.recyclerview:recyclerview:1.4.0-beta01'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.20'
implementation 'androidx.recyclerview:recyclerview:1.4.0-rc01'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21'
}
14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ dependencies {
ksp "androidx.room:room-compiler:2.6.1"

implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.annotation:annotation:1.8.2'
implementation 'com.google.android.material:material:1.13.0-alpha05'
implementation 'androidx.recyclerview:recyclerview:1.4.0-beta01'
implementation 'androidx.annotation:annotation:1.9.0'
implementation 'com.google.android.material:material:1.13.0-alpha07'
implementation 'androidx.recyclerview:recyclerview:1.4.0-rc01'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.fragment:fragment-ktx:1.8.3'
implementation 'androidx.fragment:fragment-ktx:1.8.4'
implementation "androidx.dynamicanimation:dynamicanimation:1.1.0-alpha03"
implementation "androidx.room:room-runtime:2.6.1"
implementation "androidx.room:room-ktx:2.6.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.8.5"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.5"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.8.6"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.6"
implementation "androidx.work:work-runtime-ktx:2.9.1"
implementation "androidx.core:core-splashscreen:1.1.0-rc01"

implementation project(path: ':SpannedGridLayoutManager')
implementation project(path: ':liboverscroll')

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

debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14'
// testImplementation 'junit:junit:4.13.2'
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/java/ru/dimon6018/metrolauncher/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.app.Activity
import android.app.Application
import android.content.pm.ActivityInfo
import android.os.Bundle
import androidx.appcompat.app.AppCompatDelegate
import com.google.android.material.color.DynamicColors
import ru.dimon6018.metrolauncher.content.data.Prefs
import ru.dimon6018.metrolauncher.helpers.bsod.BsodDetector
Expand All @@ -30,7 +29,6 @@ class Application : Application() {
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
@SuppressLint("SourceLockedOrientationActivity")
override fun onActivityPreCreated(activity: Activity, savedInstanceState: Bundle?) {
setNightMode()
activity.setTheme(launcherAccentTheme())
when(PREFS.orientation) {
"p" -> {
Expand All @@ -51,13 +49,6 @@ class Application : Application() {
override fun onActivityDestroyed(activity: Activity) {}
})
}
private fun setNightMode() {
when(PREFS.appTheme) {
0 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
1 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
2 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}
}
companion object {
lateinit var PREFS: Prefs
//var EXP_PREFS: ExperimentPrefs? = null
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/java/ru/dimon6018/metrolauncher/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import android.widget.AutoCompleteTextView
import android.widget.ImageView
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.toBitmap
import androidx.core.view.WindowCompat
Expand Down Expand Up @@ -83,6 +84,11 @@ class Main : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
isDarkMode = resources.getBoolean(R.bool.isDark) && PREFS.appTheme != 2
when(PREFS.appTheme) {
0 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
1 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
2 -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}
handleDevMode()
super.onCreate(savedInstanceState)

Expand Down Expand Up @@ -375,9 +381,7 @@ class Main : AppCompatActivity() {
setOnClickListener { binding.pager.setCurrentItem(0, true) }
}
binding.navigationSearchBtn.setOnClickListener {
if (PREFS.isAllAppsEnabled) {
binding.pager.setCurrentItem(1, true)
}
if (PREFS.isAllAppsEnabled) binding.pager.setCurrentItem(1, true)
}
}

Expand Down Expand Up @@ -409,7 +413,6 @@ class Main : AppCompatActivity() {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
filterSearchText(s.toString(), mainViewModel.getAppList())
}

override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun afterTextChanged(s: Editable) {}
})
Expand All @@ -428,7 +431,6 @@ class Main : AppCompatActivity() {
fun hideSearch() {
hideSearchResults()
}

private fun hideSearchResults() {
lifecycleScope.launch {
searching = false
Expand Down
8 changes: 2 additions & 6 deletions app/src/main/java/ru/dimon6018/metrolauncher/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
private var appList: MutableList<App> = ArrayList()

fun addIconToCache(appPackage: String, bitmap: Bitmap?) {
if(icons[appPackage.hashCode()] == null) {
icons.append(appPackage.hashCode(), bitmap)
}
if(icons[appPackage.hashCode()] == null) icons.append(appPackage.hashCode(), bitmap)
}
fun removeIconFromCache(appPackage: String) {
icons.remove(appPackage.hashCode())
Expand All @@ -26,9 +24,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
return icons[appPackage.hashCode()]
}
fun addAppToList(app: App) {
if(!appList.contains(app)) {
appList.add(app)
}
if(!appList.contains(app)) appList.add(app)
}
fun removeAppFromList(app: App) {
appList.remove(app)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ class NewAllApps: Fragment() {
}
}
private fun filterText(searchText: String) {
val filteredList: ArrayList<App> = ArrayList()
val filteredList: MutableList<App> = ArrayList()
val locale = getDefaultLocale()
mainViewModel.getAppList().forEach {
if (it.appLabel!!.lowercase(locale).contains(searchText.lowercase(locale))) {
Expand Down Expand Up @@ -702,17 +702,13 @@ class NewAllApps: Fragment() {
if (restoreAll) {
for (i in first..last) {
val itemView = binding.appList.findViewHolderForAdapterPosition(i)?.itemView
itemView?.let {
it.animate().alpha(1f).scaleY(1f).scaleX(1f).setDuration(500).start()
}
itemView?.animate()?.alpha(1f)?.scaleY(1f)?.scaleX(1f)?.setDuration(500)?.start()
}
} else {
for (i in first..last) {
val itemView = binding.appList.findViewHolderForAdapterPosition(i)?.itemView
if (list[i] == app) continue
itemView?.let {
it.animate().alpha(0.5f).scaleY(0.95f).scaleX(0.95f).setDuration(500).start()
}
itemView?.animate()?.alpha(0.5f)?.scaleY(0.95f)?.scaleX(0.95f)?.setDuration(500)?.start()
}
}
}
Expand Down
Loading

0 comments on commit 205fa08

Please sign in to comment.