Skip to content

Commit

Permalink
Version upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
Eboreg committed Oct 27, 2023
1 parent aebcd09 commit 6825c46
Show file tree
Hide file tree
Showing 11 changed files with 495 additions and 78 deletions.
418 changes: 418 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

75 changes: 38 additions & 37 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import java.util.Properties

val keystoreProperties = Properties()
val secretsProperties = Properties()
val targetSdk = 34

keystoreProperties.load(FileInputStream(rootProject.file("keystore.properties")))
secretsProperties.load(FileInputStream(rootProject.file("secrets.properties")))

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.devtools.ksp")
id("org.jetbrains.kotlin.kapt")
id("com.google.dagger.hilt.android")
id("com.google.devtools.ksp")
id("kotlin-parcelize")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.kapt")
}

kotlin {
Expand All @@ -32,14 +33,14 @@ android {
}
}
namespace = "us.huseli.retain"
compileSdk = 33
compileSdk = targetSdk

defaultConfig {
// val dropboxAppKey = secretsProperties["dropboxAppKey"] as String

applicationId = "us.huseli.retain"
minSdk = 26
targetSdk = 33
targetSdk = targetSdk
versionCode = 1
versionName = "1.0.0-beta.1"
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -87,7 +88,7 @@ android {

composeOptions {
// https://developer.android.com/jetpack/androidx/releases/compose-kotlin
kotlinCompilerExtensionVersion = "1.4.4"
kotlinCompilerExtensionVersion = "1.5.3"
}

packaging {
Expand All @@ -97,22 +98,27 @@ android {
}
}

val lifecycleVersion = "2.6.2"
val composeVersion = "1.5.4"
val daggerVersion = "2.48.1"
val roomVersion = "2.6.0"

dependencies {
implementation("com.google.devtools.ksp:symbol-processing-api:1.8.10-1.0.9")
implementation("androidx.core:core-ktx:1.10.1")
implementation("com.google.devtools.ksp:symbol-processing-api:1.9.10-1.0.13")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.core:core-splashscreen:1.0.1")
implementation("androidx.recyclerview:recyclerview:1.3.1")
implementation("androidx.preference:preference-ktx:1.2.0")
implementation("androidx.activity:activity-compose:1.7.2")
implementation("androidx.navigation:navigation-compose:2.6.0")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("androidx.preference:preference-ktx:1.2.1")
implementation("androidx.activity:activity-compose:1.8.0")
implementation("androidx.navigation:navigation-compose:2.7.4")
// For PickVisualMedia contract:
implementation("androidx.activity:activity-ktx:1.7.2")
implementation("androidx.activity:activity-ktx:1.8.0")

// Lifecycle:
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.6.1")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-runtime-compose:$lifecycleVersion")

// Nextcloud:
implementation("commons-httpclient:commons-httpclient:3.1@jar")
Expand All @@ -121,34 +127,33 @@ dependencies {
}

// Compose:
implementation("androidx.compose.ui:ui:1.4.3")
implementation("androidx.compose.ui:ui-graphics:1.4.3")
implementation("androidx.compose.ui:ui-tooling-preview:1.4.3")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.4.3")
debugImplementation("androidx.compose.ui:ui-tooling:1.4.3")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.4.3")
implementation("androidx.compose.ui:ui:$composeVersion")
implementation("androidx.compose.ui:ui-graphics:$composeVersion")
implementation("androidx.compose.ui:ui-tooling-preview:$composeVersion")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$composeVersion")
debugImplementation("androidx.compose.ui:ui-tooling:$composeVersion")
debugImplementation("androidx.compose.ui:ui-test-manifest:$composeVersion")

// Material:
implementation("androidx.compose.material:material:1.4.3")
implementation("androidx.compose.material3:material3:1.1.1")
implementation("androidx.compose.material:material-icons-extended:1.4.3")
implementation("androidx.compose.material:material:$composeVersion")
implementation("androidx.compose.material3:material3:1.1.2")
implementation("androidx.compose.material:material-icons-extended:$composeVersion")

// Room:
implementation("androidx.room:room-runtime:2.5.2")
ksp("androidx.room:room-compiler:2.5.2")
implementation("androidx.room:room-ktx:2.5.2")
implementation("androidx.room:room-runtime:$roomVersion")
ksp("androidx.room:room-compiler:$roomVersion")
implementation("androidx.room:room-ktx:$roomVersion")

// Hilt:
implementation("com.google.dagger:hilt-android:2.46.1")
implementation("com.google.dagger:hilt-android:$daggerVersion")
implementation("androidx.hilt:hilt-navigation-compose:1.0.0")
kapt("com.google.dagger:hilt-compiler:2.46.1")
kapt("com.google.dagger:hilt-compiler:$daggerVersion")

// Gson:
implementation("com.google.code.gson:gson:2.10.1")

// Reorder:
implementation("org.burnoutcrew.composereorderable:reorderable:0.9.6")
// implementation("com.github.Eboreg:ComposeReorderable:main-b0729bddae-1")

// To change status bar colour etc:
implementation("com.google.accompanist:accompanist-systemuicontroller:0.27.0")
Expand All @@ -163,9 +168,5 @@ dependencies {
implementation("com.dropbox.core:dropbox-core-sdk:5.4.5")

// Theme:
implementation("com.github.Eboreg:RetainTheme:1.1.3")

// testImplementation("junit:junit:4.13.2")
// androidTestImplementation("androidx.test.ext:junit:1.1.5")
// androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
implementation("com.github.Eboreg:RetainTheme:2.1.0")
}
1 change: 1 addition & 0 deletions app/src/main/java/us/huseli/retain/RetainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import javax.inject.Inject
class RetainActivity : ComponentActivity() {
@Inject
lateinit var logger: Logger

@Inject
lateinit var dropboxEngine: DropboxEngine

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import androidx.compose.material.icons.sharp.PriorityHigh
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import us.huseli.retaintheme.ui.theme.RetainColorDark
import us.huseli.retaintheme.ui.theme.RetainColorLight
import us.huseli.retaintheme.ui.theme.RetainBasicColorsDark
import us.huseli.retaintheme.ui.theme.RetainBasicColorsLight

@Composable
fun FailIcon(modifier: Modifier = Modifier, circled: Boolean = false) {
val colors = if (isSystemInDarkTheme()) RetainColorDark else RetainColorLight
val colors = if (isSystemInDarkTheme()) RetainBasicColorsDark else RetainBasicColorsLight

Icon(
modifier = modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import androidx.compose.material.icons.sharp.CheckCircle
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import us.huseli.retaintheme.ui.theme.RetainColorDark
import us.huseli.retaintheme.ui.theme.RetainColorLight
import us.huseli.retaintheme.ui.theme.RetainBasicColorsDark
import us.huseli.retaintheme.ui.theme.RetainBasicColorsLight

@Composable
fun SuccessIcon(modifier: Modifier = Modifier, circled: Boolean = false) {
val colors = if (isSystemInDarkTheme()) RetainColorDark else RetainColorLight
val colors = if (isSystemInDarkTheme()) RetainBasicColorsDark else RetainBasicColorsLight

Icon(
modifier = modifier,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/us/huseli/retain/data/Database.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ abstract class Database : RoomDatabase() {
abstract fun noteDao(): NoteDao
abstract fun checklistItemDao(): ChecklistItemDao
abstract fun imageDao(): ImageDao

@EntryPoint
@InstallIn(SingletonComponent::class)
interface DatabaseEntryPoint {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ open class ChecklistItem(
override fun toString() =
"<ChecklistItem: id=$id, text=$text, position=$position, noteId=$noteId>"

override fun equals(other: Any?) =
other is ChecklistItem &&
override fun equals(other: Any?) = other is ChecklistItem &&
other.id == id &&
other.text == text &&
other.noteId == noteId &&
Expand Down
26 changes: 12 additions & 14 deletions app/src/main/java/us/huseli/retain/data/entities/Image.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,19 @@ data class Image(
added: Instant,
size: Int,
position: Int
) :
this(
filename = filename,
mimeType = mimeType,
width = width,
height = height,
noteId = noteId,
added = added,
size = size,
position = position,
imageBitmap = MutableStateFlow<ImageBitmap?>(null)
)
) : this(
filename = filename,
mimeType = mimeType,
width = width,
height = height,
noteId = noteId,
added = added,
size = size,
position = position,
imageBitmap = MutableStateFlow<ImageBitmap?>(null)
)

override fun equals(other: Any?) =
other is Image &&
override fun equals(other: Any?) = other is Image &&
other.filename == filename &&
other.mimeType == mimeType &&
other.width == width &&
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/us/huseli/retain/data/entities/Note.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ data class Note(

override fun compareTo(other: Note) = (updated.epochSecond - other.updated.epochSecond).toInt()

override fun equals(other: Any?) =
other is Note &&
override fun equals(other: Any?) = other is Note &&
other.id == id &&
other.title == title &&
other.text == text &&
Expand Down
21 changes: 10 additions & 11 deletions app/src/main/java/us/huseli/retain/ui/theme/RetainColor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import android.content.res.Configuration
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import us.huseli.retaintheme.ui.theme.RetainColorDark
import us.huseli.retaintheme.ui.theme.RetainColorLight
import us.huseli.retaintheme.ui.theme.RetainColorScheme
import us.huseli.retaintheme.ui.theme.RetainBasicColors
import us.huseli.retaintheme.ui.theme.RetainBasicColorsDark
import us.huseli.retaintheme.ui.theme.RetainBasicColorsLight
import kotlin.math.max

val noteColors: (RetainColorScheme) -> Map<String, Color> = { colorScheme ->
val noteColors: (RetainBasicColors) -> Map<String, Color> = { colorScheme ->
mapOf(
"DEFAULT" to colorScheme.Background,
"DEFAULT" to Color.Transparent,
"RED" to colorScheme.Red,
"ORANGE" to colorScheme.Orange,
"YELLOW" to colorScheme.Yellow,
Expand All @@ -28,11 +28,12 @@ val noteColors: (RetainColorScheme) -> Map<String, Color> = { colorScheme ->
}

@Composable
fun getNoteColors(): Map<String, Color> = noteColors(if (isSystemInDarkTheme()) RetainColorDark else RetainColorLight)
fun getNoteColors(): Map<String, Color> =
noteColors(if (isSystemInDarkTheme()) RetainBasicColorsDark else RetainBasicColorsLight)

fun getNoteColor(key: String, dark: Boolean): Color {
val colorScheme = if (dark) RetainColorDark else RetainColorLight
return noteColors(colorScheme).getOrDefault(key, colorScheme.Background)
val colorScheme = if (dark) RetainBasicColorsDark else RetainBasicColorsLight
return noteColors(colorScheme).getOrDefault(key, Color.Transparent)
}

fun getNoteColor(context: Context, key: String) = getNoteColor(
Expand All @@ -44,9 +45,7 @@ fun getNoteColor(context: Context, key: String) = getNoteColor(
fun getNoteColor(key: String): Color = getNoteColor(key, isSystemInDarkTheme())

fun getAppBarColor(key: String, dark: Boolean): Color {
val colorScheme = if (dark) RetainColorDark else RetainColorLight

return if (key == "DEFAULT") colorScheme.Surface
return if (key == "DEFAULT") Color.Transparent
else getNoteColor(key, dark).let {
it.copy(
red = max(it.red - 0.05f, 0f),
Expand Down
13 changes: 7 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
plugins {
id("com.android.application") version "8.0.0" apply false
id("com.android.library") version "8.0.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.10" apply false
id("org.jetbrains.kotlin.kapt") version "1.8.10" apply false
id("com.google.devtools.ksp") version "1.8.10-1.0.9" apply false
id("com.google.dagger.hilt.android") version "2.46" apply false
id("com.android.application") version "8.1.2" apply false
id("com.android.library") version "8.1.2" apply false
id("com.google.dagger.hilt.android") version "2.48" apply false
// id("com.google.devtools.ksp") version "1.8.10-1.0.9" apply false
id("com.google.devtools.ksp") version "1.9.10-1.0.13" apply false
id("org.jetbrains.kotlin.android") version "1.9.10" apply false
id("org.jetbrains.kotlin.kapt") version "1.9.10" apply false
}

0 comments on commit 6825c46

Please sign in to comment.