Skip to content

Commit

Permalink
Start work on kotlin update
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Jul 27, 2024
1 parent 4d3bf7a commit 6509367
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 191 deletions.
137 changes: 0 additions & 137 deletions app/build.gradle

This file was deleted.

153 changes: 153 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.plugin.compose")
id("com.mikepenz.aboutlibraries.plugin")
}

android {
namespace = "org.andbootmgr.app"
compileSdk = 34
buildFeatures {
buildConfig = true
compose = true
}
packaging {
dex {
useLegacyPackaging = false
}
jniLibs {
useLegacyPackaging = false
}
resources {
excludes += "META-INF/*.version"
}
}
defaultConfig {
applicationId = "org.andbootmgr.app"
minSdk = 26
targetSdk = 32
versionCode = 3001
versionName = "0.3.0-m0"
vectorDrawables {
useSupportLibrary = true
}
}
signingConfigs {
register("release") {
if (project.hasProperty("ABM_RELEASE_KEY_ALIAS")) {
storeFile = file(project.properties["ABM_RELEASE_STORE_FILE"].toString())
storePassword = project.properties["ABM_RELEASE_STORE_PASSWORD"].toString()
keyAlias = project.properties["ABM_RELEASE_KEY_ALIAS"].toString()
keyPassword = project.properties["ABM_RELEASE_KEY_PASSWORD"].toString()
}
}
getByName("debug") {
if (project.hasProperty("ABM_DEBUG_KEY_ALIAS")) {
storeFile = file(project.properties["ABM_DEBUG_STORE_FILE"].toString())
storePassword = project.properties["ABM_DEBUG_STORE_PASSWORD"].toString()
keyAlias = project.properties["ABM_DEBUG_KEY_ALIAS"].toString()
keyPassword = project.properties["ABM_DEBUG_KEY_PASSWORD"].toString()
}
}
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
if (project.hasProperty("ABM_RELEASE_KEY_ALIAS")) {
signingConfig = signingConfigs["release"]
}
buildConfigField("boolean", "DEFAULT_NOOB_MODE", "false") // Noob mode default
}
debug {
if (project.hasProperty("ABM_DEBUG_KEY_ALIAS")) {
signingConfig = signingConfigs["debug"]
} else if (project.hasProperty("ABM_RELEASE_KEY_ALIAS")) {
signingConfig = signingConfigs["release"]
}
buildConfigField("boolean", "DEFAULT_NOOB_MODE", "false") // Noob mode default
}
}
java {
compileOptions {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
}

kotlin {
jvmToolchain(17)
compilerOptions {
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
composeOptions {
kotlinCompilerExtensionVersion = "1.1.1"
}
applicationVariants.forEach {
tasks["merge${it.name.replaceFirstChar(Char::titlecase)}Assets"].dependsOn(tasks["setAssetTs"])
}
}

tasks.register("setAssetTs", Task::class) {
doLast {
File("$rootDir/app/src/main/assets/cp/_ts").writeText((System.currentTimeMillis() / 1000L).toString())
}
}

dependencies {
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.legacy:legacy-support-v4:1.0.0")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.cardview:cardview:1.0.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.8.4")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4")
implementation("androidx.compose.ui:ui:1.6.8")
// Tooling support (Previews, etc.)
implementation("androidx.compose.ui:ui-tooling:1.6.8")
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation("androidx.compose.foundation:foundation:1.6.8")
// Material Design
implementation("androidx.compose.material:material:1.6.8")
implementation("androidx.compose.material3:material3:1.2.1")
// Material design icons
implementation("androidx.compose.material:material-icons-core:1.6.8")
implementation("androidx.compose.material:material-icons-extended:1.6.8")
// Integration with activities
implementation("androidx.activity:activity-compose:1.9.1")
// Integration with ViewModels
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4")
// Integration with observables
implementation("androidx.compose.runtime:runtime-livedata:1.6.8")
implementation("androidx.compose.runtime:runtime-rxjava2:1.6.8")

implementation("androidx.navigation:navigation-compose:2.7.7")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.4")
implementation("androidx.compose.ui:ui-tooling-preview:1.6.8")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.6.8")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.6.8")


val libsuVersion = "5.0.1"
implementation("com.github.topjohnwu.libsu:core:${libsuVersion}")
implementation("com.github.topjohnwu.libsu:service:${libsuVersion}")
implementation("com.github.topjohnwu.libsu:io:${libsuVersion}")
implementation("com.mikepenz:aboutlibraries:11.2.2")

implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.2")

}
7 changes: 1 addition & 6 deletions app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,6 @@ private fun Start(c: CreatePartDataHolder) {
}
val ctx = LocalContext.current

// Material3 colors for old RangeSlider
val i = SliderDefaults.colors()
val sc = androidx.compose.material.SliderDefaults.colors(activeTickColor = i.tickColor(enabled = true, active = true).value, disabledActiveTickColor = i.tickColor(enabled = false, active = true).value, disabledInactiveTickColor = i.tickColor(enabled = false, active = false).value, activeTrackColor = i.trackColor(enabled = true, active = true).value, disabledActiveTrackColor = i.trackColor(enabled = false, active = true).value, disabledInactiveTrackColor = i.trackColor(enabled = false, active = false).value, disabledThumbColor = i.thumbColor(enabled = false).value, inactiveTickColor = i.tickColor(enabled = true, active = false).value, inactiveTrackColor = i.trackColor(enabled = true, active = false).value, thumbColor = i.thumbColor(enabled = true).value)

val s = rememberScrollState()
var et by remember { mutableStateOf(false) }
var el by remember { mutableStateOf(false) }
Expand Down Expand Up @@ -257,8 +253,7 @@ private fun Start(c: CreatePartDataHolder) {
}, isError = eu, label = {
Text(stringResource(R.string.end_sector))
})
// Material3 RangeSlider is absolutely buggy trash
androidx.compose.material.RangeSlider(modifier = Modifier.fillMaxWidth(), colors = sc, values = lu, onValueChange = {
RangeSlider(modifier = Modifier.fillMaxWidth(), value = lu, onValueChange = {
l = it.start.toLong().toString()
u = it.endInclusive.toLong().toString()
el = !l.matches(Regex("\\d+"))
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/org/andbootmgr/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.FlowColumnScopeInstance.align
import androidx.compose.foundation.layout.FlowRowScopeInstance.alignBy
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
Expand All @@ -22,6 +24,7 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.HorizontalAlignmentLine
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -237,7 +240,7 @@ private fun AppContent(vm: MainActivityState, view: @Composable (PaddingValues)
ModalNavigationDrawer(drawerContent = {
Button(
modifier = Modifier
.align(Alignment.CenterHorizontally)
.align()
.padding(top = 16.dp),
onClick = { scope.launch {
vm.navController!!.navigate("start")
Expand All @@ -247,7 +250,7 @@ private fun AppContent(vm: MainActivityState, view: @Composable (PaddingValues)
)
Button(
modifier = Modifier
.align(Alignment.CenterHorizontally)
//.align(Alignment.CenterHorizontally)
.padding(top = 16.dp),
onClick = { if (vm.isOk) scope.launch {
vm.navController!!.navigate("settings")
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/org/andbootmgr/app/WizardActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class WizardActivity : ComponentActivity() {
}
}

@Deprecated("Deprecated in Java")
override fun onBackPressed() {
vm.onPrev.value(this)
}
Expand Down
40 changes: 0 additions & 40 deletions build.gradle

This file was deleted.

Loading

0 comments on commit 6509367

Please sign in to comment.