Skip to content

Commit

Permalink
Update stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
AkosPaha01 committed Jan 17, 2023
1 parent 344ac06 commit 2ef6d6c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 46 deletions.
9 changes: 5 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.android.application")
Expand All @@ -23,7 +24,7 @@ android {
applicationId = "de.dertyp7214.rboardthememanager"
minSdk = 23
targetSdk = 33
versionCode = 376000
versionCode = 376100
versionName = "3.7.6"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -59,7 +60,7 @@ android {
jvmTarget = JvmTarget.JVM_17.description
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = JvmTarget.JVM_17.description
}
Expand Down Expand Up @@ -103,7 +104,7 @@ dependencies {
implementation("com.google.android.material:material:1.8.0-rc01")
implementation("androidx.constraintlayout:constraintlayout:2.2.0-alpha05")
implementation("androidx.preference:preference-ktx:1.2.0")
implementation("androidx.activity:activity-ktx:1.7.0-alpha02")
implementation("androidx.activity:activity-ktx:1.7.0-alpha03")
implementation("androidx.fragment:fragment-ktx:1.6.0-alpha04")
implementation("com.jaredrummler:android-shell:1.0.0")
implementation("com.google.firebase:firebase-analytics:21.2.0")
Expand All @@ -122,6 +123,6 @@ dependencies {
implementation("com.github.murgupluoglu:flagkit-android:1.0.2")
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))

debugImplementation("androidx.compose.ui:ui-tooling:1.4.0-alpha03")
debugImplementation("androidx.compose.ui:ui-tooling:1.4.0-alpha04")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import com.skydoves.balloon.BalloonSizeSpec
import com.skydoves.balloon.createBalloon
import com.topjohnwu.superuser.io.SuFile
import de.dertyp7214.rboardcomponents.utils.asyncInto
import de.dertyp7214.rboardcomponents.utils.doAsync
import de.dertyp7214.rboardthememanager.BuildConfig
import de.dertyp7214.rboardthememanager.Config
import de.dertyp7214.rboardthememanager.Config.MODULE_META
Expand Down Expand Up @@ -699,8 +700,8 @@ class MainActivity : AppCompatActivity() {
}
Config.useMagisk = false
ThemeUtils::loadThemes asyncInto mainViewModel::setThemes
}, onMagisk = {
it.dismiss()
}, onMagisk = { dialogFragment ->
dialogFragment.dismiss()
preferenceManager.edit {
putBoolean("useMagisk", true)
putBoolean("usageSet", true)
Expand Down Expand Up @@ -743,52 +744,54 @@ class MainActivity : AppCompatActivity() {
notify(this, notificationId, builder.build())
}
var finished = false
val url =
doAsync({
if (URL(Config.GITHUB_REPO_PREFIX).isReachable()) updateUrl(versionName) else updateUrlGitlab
UpdateHelper(url, this).apply {
addOnProgressListener { progress, bytes, total ->
if (!finished) {
builder
.setContentText(
getString(
R.string.download_update_progress,
"${bytes.toHumanReadableBytes(this@MainActivity)}/${
total.toHumanReadableBytes(this@MainActivity)
}"
}) { url ->
UpdateHelper(url, this).apply {
addOnProgressListener { progress, bytes, total ->
if (!finished) {
builder
.setContentText(
getString(
R.string.download_update_progress,
"${bytes.toHumanReadableBytes(this@MainActivity)}/${
total.toHumanReadableBytes(this@MainActivity)
}"
)
)
)
.setProgress(maxProgress, progress.toInt(), false)
notify(manager, notificationId, builder.build())
}
}
setFinishListener { path, _ ->
finished = true
manager.cancel(notificationId)
if (enableBlur) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
content.setRenderEffect(
RenderEffect.createBlurEffect(
10F,
10F,
Shader.TileMode.REPEAT
)
)
.setProgress(maxProgress, progress.toInt(), false)
notify(manager, notificationId, builder.build())
}
}
PackageUtils.install(this@MainActivity, File(path), downloadResultLauncher) {
setFinishListener { path, _ ->
finished = true
manager.cancel(notificationId)
if (enableBlur) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
content.setRenderEffect(null)
content.setRenderEffect(
RenderEffect.createBlurEffect(
10F,
10F,
Shader.TileMode.REPEAT
)
)
}
PackageUtils.install(this@MainActivity, File(path), downloadResultLauncher) {
if (enableBlur) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
content.setRenderEffect(null)
}
Toast.makeText(this@MainActivity, R.string.error, Toast.LENGTH_LONG).show()
}
Toast.makeText(this@MainActivity, R.string.error, Toast.LENGTH_LONG).show()
}
}
setErrorListener {
finished = true
builder.setContentText(getString(R.string.download_error))
.setProgress(0, 0, false)
notify(manager, notificationId, builder.build())
it?.connectionException?.printStackTrace()
Log.d("ERROR", it?.serverErrorMessage ?: "NOO")
}
}.start()
setErrorListener {
finished = true
builder.setContentText(getString(R.string.download_error))
.setProgress(0, 0, false)
notify(manager, notificationId, builder.build())
it?.connectionException?.printStackTrace()
Log.d("ERROR", it?.serverErrorMessage ?: "NOO")
}
}.start()
}
}

override fun onDestroy() {
Expand Down

0 comments on commit 2ef6d6c

Please sign in to comment.