Skip to content

Commit 191bcce

Browse files
few nips and tucks
Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent f2f7589 commit 191bcce

7 files changed

Lines changed: 2136 additions & 1595 deletions

File tree

app/src/main/kotlin/com/fox2code/mmm/MainActivity.kt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import androidx.appcompat.widget.SearchView
2828
import androidx.cardview.widget.CardView
2929
import androidx.recyclerview.widget.LinearLayoutManager
3030
import androidx.recyclerview.widget.RecyclerView
31+
import androidx.room.Room
3132
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
3233
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener
3334
import com.fox2code.foxcompat.app.FoxActivity
@@ -54,6 +55,7 @@ import com.fox2code.mmm.utils.RuntimeUtils
5455
import com.fox2code.mmm.utils.SyncManager
5556
import com.fox2code.mmm.utils.io.net.Http.Companion.cleanDnsCache
5657
import com.fox2code.mmm.utils.io.net.Http.Companion.hasWebView
58+
import com.fox2code.mmm.utils.room.ReposListDatabase
5759
import com.google.android.material.bottomnavigation.BottomNavigationView
5860
import com.google.android.material.progressindicator.LinearProgressIndicator
5961
import org.matomo.sdk.extra.TrackHelper
@@ -108,6 +110,28 @@ class MainActivity : FoxActivity(), OnRefreshListener, SearchView.OnQueryTextLis
108110
// Show a toast to warn the user
109111
Toast.makeText(this, R.string.not_official_build, Toast.LENGTH_LONG).show()
110112
}
113+
// track enabled repos
114+
Thread {
115+
val db = Room.databaseBuilder(
116+
applicationContext,
117+
ReposListDatabase::class.java,
118+
"ReposList.db"
119+
).build()
120+
val repoDao = db.reposListDao()
121+
val repos = repoDao.getAll()
122+
val enabledRepos = StringBuilder()
123+
for (repo in repos) {
124+
if (repo.enabled) {
125+
enabledRepos.append(repo.url).append(", ")
126+
}
127+
}
128+
db.close()
129+
if (enabledRepos.isNotEmpty()) {
130+
enabledRepos.delete(enabledRepos.length - 2, enabledRepos.length)
131+
TrackHelper.track().event("Enabled Repos", enabledRepos.toString())
132+
.with(MainApplication.INSTANCE!!.tracker)
133+
}
134+
}.start()
111135
val ts = Timestamp(System.currentTimeMillis() - 30L * 24 * 60 * 60 * 1000)
112136
// check if this build has expired
113137
val buildTime = Timestamp(BuildConfig.BUILD_TIME)

app/src/main/kotlin/com/fox2code/mmm/repo/CustomRepoManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class CustomRepoManager internal constructor(
112112
// now the same as above but for room database
113113
val applicationContext = INSTANCE!!.applicationContext
114114
val db = Room.databaseBuilder(
115-
applicationContext, ReposListDatabase::class.java, "reposlist.db"
115+
applicationContext, ReposListDatabase::class.java, "ReposList.db"
116116
).build()
117117
val reposListDao = db.reposListDao()
118118
val reposList = ReposList(id, repo, true, donate, support, submitModule, 0, name, website)

app/src/main/kotlin/com/fox2code/mmm/repo/RepoData.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ open class RepoData(url: String, cacheRoot: File) : XRepo() {
297297
"ReposList.db",
298298
).allowMainThreadQueries().build()
299299
val reposList = db.reposListDao().getById(preferenceId!!)
300+
db.close()
300301
// should never happen but for safety
301302
if (reposList.enabled) {
302303
!isForceHide

app/src/main/kotlin/com/fox2code/mmm/settings/SettingsActivity.java

Lines changed: 0 additions & 1588 deletions
This file was deleted.

app/src/main/kotlin/com/fox2code/mmm/settings/SettingsActivity.kt

Lines changed: 2107 additions & 0 deletions
Large diffs are not rendered by default.

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,4 +441,5 @@
441441
<string name="eula_agree_v2_headline">EULA and Terms</string>
442442
<string name="error_creating_repos_database">Could not create repos db</string>
443443
<string name="error_creating_modulelistcache_database">Failed to create module cache db</string>
444+
<string name="blur_performance_warning_summary">Device is not compatible with blur</string>
444445
</resources>

gradle.properties

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#
2-
# Copyright (c) 2023 to present Androidacy and contributors. Names, logos, icons, and the Androidacy name are all trademarks of Androidacy and may not be used without license. See LICENSE for more information.
3-
#
4-
51
## For more details on how to configure your build environment visit
62
# http://www.gradle.org/docs/current/userguide/build_environment.html
73
#
@@ -14,13 +10,13 @@
1410
# This option should only be used with decoupled projects. More details, visit
1511
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1612
# org.gradle.parallel=true
17-
#Mon May 29 11:36:28 EDT 2023
13+
#Mon Jun 19 16:29:35 EDT 2023
1814
android.defaults.buildfeatures.buildconfig=true
1915
android.enableJetifier=false
2016
android.enableR8.fullMode=true
2117
android.useAndroidX=true
2218
org.gradle.caching=true
2319
org.gradle.configuration-cache=true
2420
org.gradle.configuration-cache.problems=warn
25-
org.gradle.jvmargs=-Xmx1536M -Dkotlin.daemon.jvm.options\="-Xmx1536M" -Dfile.encoding\=UTF-8 -XX\:+UseParallelGC -XX\:ReservedCodeCacheSize\=768m
21+
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -Dfile.encoding\=UTF-8 -XX\:+UseParallelGC -XX\:ReservedCodeCacheSize\=768m
2622
org.gradle.parallel=true

0 commit comments

Comments
 (0)