Skip to content

Commit

Permalink
very small update 5
Browse files Browse the repository at this point in the history
  • Loading branch information
queuejw committed Jun 7, 2024
1 parent d3b2a83 commit 4331843
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 66 deletions.
1 change: 1 addition & 0 deletions .idea/misc.xml

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

2 changes: 1 addition & 1 deletion SpannedGridLayoutManager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ tasks.withType(Javadoc).configureEach {

dependencies {
implementation 'androidx.recyclerview:recyclerview:1.4.0-alpha01'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.0-RC2'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.0'
}
18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId "ru.dimon6018.metrolauncher"
minSdk 23
targetSdk 34
versionCode 40
versionName "1.0 Pre-Alpha 4.9.1"
versionCode 41
versionName "1.0 Pre-Alpha 4.9.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled false
Expand All @@ -43,19 +43,20 @@ android {
}
dependencies {

implementation 'androidx.appcompat:appcompat:1.7.0-rc01'
ksp "androidx.room:room-compiler:2.6.1"

implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.annotation:annotation:1.8.0'
implementation 'com.google.android.material:material:1.13.0-alpha02'
implementation 'com.google.android.material:material:1.13.0-alpha03'
implementation 'androidx.recyclerview:recyclerview:1.4.0-alpha01'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.fragment:fragment-ktx:1.7.1'
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.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.8.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.1"
implementation "androidx.work:work-runtime-ktx:2.9.0"
ksp "androidx.room:room-compiler:2.6.1"

implementation project(path: ':SpannedGridLayoutManager')
implementation project(path: ':liboverscroll')
Expand All @@ -64,8 +65,7 @@ dependencies {
implementation 'io.coil-kt.coil3:coil:3.0.0-alpha06'
implementation 'io.coil-kt.coil3:coil-network-okhttp:3.0.0-alpha06'

//Crash with ViewModel 2.8.0 https://github.com/square/leakcanary/issues/2677
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
Expand Down
26 changes: 15 additions & 11 deletions app/src/main/java/ru/dimon6018/metrolauncher/content/NewAllApps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import com.google.android.material.card.MaterialCardView
import com.google.android.material.textfield.TextInputLayout
import com.google.android.material.textview.MaterialTextView
import ir.alirezabdn.wp7progress.WP7ProgressBar
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
Expand Down Expand Up @@ -110,6 +111,9 @@ class NewAllApps: Fragment() {

private var shouldShowTip = false

private val defaultDispatcher: CoroutineDispatcher = Dispatchers.Default
private val mainDispatcher: CoroutineDispatcher = Dispatchers.Main

override fun onAttach(context: Context) {
super.onAttach(context)
contextFragment = context
Expand Down Expand Up @@ -156,7 +160,7 @@ class NewAllApps: Fragment() {
}
searchBtn!!.setOnClickListener { searchFunction() }
setRecyclerPadding(resources.getDimensionPixelSize(R.dimen.recyclerViewPadding))
lifecycleScope.launch(Dispatchers.Default) {
lifecycleScope.launch(defaultDispatcher) {
if(contextFragment == null) {
contextFragment = context
}
Expand All @@ -171,7 +175,7 @@ class NewAllApps: Fragment() {
val lm = LinearLayoutManager(contextFragment)
setAlphabetRecyclerView()
shouldShowTip = PREFS!!.pref.getBoolean("tip2Enabled", true)
withContext(Dispatchers.Main) {
withContext(mainDispatcher) {
searchBtnBack!!.setOnClickListener {
if(isListLoaded) {
disableSearch()
Expand Down Expand Up @@ -293,13 +297,13 @@ class NewAllApps: Fragment() {
super.onDestroyView()
unregisterBroadcast()
}
private fun setAlphabetRecyclerView() {
private suspend fun setAlphabetRecyclerView() {
if(contextFragment == null) {
contextFragment = context
}
adapterAlphabet = AlphabetAdapter(getAlphabetList())
val lm = GridLayoutManager(contextFragment!!, 4)
activity?.runOnUiThread {
withContext(mainDispatcher) {
alphabetLayout?.setOnClickListener {
hideAlphabet()
}
Expand Down Expand Up @@ -400,7 +404,7 @@ class NewAllApps: Fragment() {
setRecyclerPadding(resources.getDimensionPixelSize(R.dimen.recyclerViewPadding))
progressBar!!.showProgressBar()
recyclerView?.alpha = 0.5f
lifecycleScope.launch(Dispatchers.IO) {
lifecycleScope.launch(defaultDispatcher) {
appList = getHeaderListLatter(setUpApps(pm, contextFragment!!))
withContext(Dispatchers.Main) {
appAdapter?.setData(appList!!, true)
Expand All @@ -422,7 +426,7 @@ class NewAllApps: Fragment() {
search!!.visibility = View.VISIBLE
search!!.isFocusable = true
searchBtnBack!!.visibility = View.VISIBLE
lifecycleScope.launch(Dispatchers.IO) {
lifecycleScope.launch(defaultDispatcher) {
removeHeaders()
activity?.runOnUiThread {
setRecyclerPadding(0)
Expand Down Expand Up @@ -470,7 +474,7 @@ class NewAllApps: Fragment() {
return
}
progressBar!!.showProgressBar()
lifecycleScope.launch(Dispatchers.IO) {
lifecycleScope.launch(defaultDispatcher) {
var temp = appList!!.size
while (temp != 0) {
temp -= 1
Expand All @@ -479,7 +483,7 @@ class NewAllApps: Fragment() {
appList!!.remove(item)
}
}
withContext(Dispatchers.Main) {
withContext(mainDispatcher) {
appAdapter?.setData(appList!!, true)
progressBar!!.hideProgressBar()
}
Expand Down Expand Up @@ -580,15 +584,15 @@ class NewAllApps: Fragment() {
val uninstall = popupView.findViewById<MaterialCardView>(R.id.uninstallApp)
val info = popupView.findViewById<MaterialCardView>(R.id.infoApp)
var isAppAlreadyPinned = false
lifecycleScope.launch(Dispatchers.IO) {
lifecycleScope.launch(defaultDispatcher) {
val dbList = dbCall.getJustApps()
dbList.forEach {
if (it.appPackage == appPackage) {
isAppAlreadyPinned = true
return@forEach
}
}
withContext(Dispatchers.Main) {
withContext(mainDispatcher) {
if(isAppAlreadyPinned) {
pin.isEnabled = false
pin.alpha = 0.5f
Expand Down Expand Up @@ -628,7 +632,7 @@ class NewAllApps: Fragment() {
}
}
private fun insertNewApp(text: String, packag: String) {
lifecycleScope.launch(Dispatchers.IO) {
lifecycleScope.launch(defaultDispatcher) {
val dBlist = dbCall.getJustApps()
dBlist.forEach {
if(it.appPackage == packag) {
Expand Down
Loading

0 comments on commit 4331843

Please sign in to comment.