diff --git a/.idea/deviceManager.xml b/.idea/deviceManager.xml
new file mode 100644
index 0000000..91f9558
--- /dev/null
+++ b/.idea/deviceManager.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index cd2b502..700dcf7 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -7,6 +7,6 @@
-
+
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index ab803bc..7d0bf68 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -1,3 +1,5 @@
+import org.jetbrains.kotlin.gradle.dsl.JvmTarget
+
plugins {
id("com.android.application")
kotlin("android")
@@ -14,10 +16,10 @@ android {
defaultConfig {
applicationId = "de.dertyp7214.rboardpatcher"
- minSdk = 23
+ minSdk = 26
targetSdk = 36
- versionCode = 3406
- versionName = "3.4"
+ versionCode = 3500
+ versionName = "3.5"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
@@ -37,16 +39,18 @@ android {
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
- sourceCompatibility = JavaVersion.current()
- targetCompatibility = JavaVersion.current()
}
- kotlinOptions {
- jvmTarget = JavaVersion.current().toString()
- freeCompilerArgs += listOf(
- "-P",
- "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"
- )
+ kotlin {
+ compilerOptions {
+ freeCompilerArgs = freeCompilerArgs.get() + listOf(
+ "-P",
+ "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true",
+ "-Xsuppress-version-warnings"
+ )
+ jvmToolchain(23)
+ jvmTarget.set(JvmTarget.JVM_23)
+ }
}
packaging {
diff --git a/app/src/main/java/de/dertyp7214/rboardpatcher/adapter/MainOptionAdapter.kt b/app/src/main/java/de/dertyp7214/rboardpatcher/adapter/MainOptionAdapter.kt
index b269935..6c7b071 100644
--- a/app/src/main/java/de/dertyp7214/rboardpatcher/adapter/MainOptionAdapter.kt
+++ b/app/src/main/java/de/dertyp7214/rboardpatcher/adapter/MainOptionAdapter.kt
@@ -8,6 +8,7 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.card.MaterialCardView
+import de.dertyp7214.rboardcomponents.core.dpToPxRounded
import de.dertyp7214.rboardpatcher.R
import de.dertyp7214.rboardpatcher.screens.types.MainOption
@@ -30,6 +31,22 @@ class MainOptionAdapter(
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = list[position]
+ when (position) {
+ 0 -> {
+ if (list.size == 1){
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_rounded)
+ }
+ else{
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_top)
+ }
+ }
+ list.lastIndex -> {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_bottom)
+ }
+ else -> {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background)
+ }
+ }
holder.icon.setImageResource(item.icon)
holder.title.text = item.title
diff --git a/app/src/main/java/de/dertyp7214/rboardpatcher/adapter/PatchAdapter.kt b/app/src/main/java/de/dertyp7214/rboardpatcher/adapter/PatchAdapter.kt
index 8edb10e..02bbf94 100644
--- a/app/src/main/java/de/dertyp7214/rboardpatcher/adapter/PatchAdapter.kt
+++ b/app/src/main/java/de/dertyp7214/rboardpatcher/adapter/PatchAdapter.kt
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
+import android.os.Build
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -11,6 +12,7 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.card.MaterialCardView
+import de.dertyp7214.rboardcomponents.core.dpToPxRounded
import de.dertyp7214.rboardpatcher.R
import de.dertyp7214.rboardpatcher.api.types.PatchMeta
import de.dertyp7214.rboardpatcher.core.getAttr
@@ -100,7 +102,36 @@ class PatchAdapter(
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val patchMeta = list[position]
-
+ when (position) {
+ 0 -> {
+ if (list.size == 1){
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_rounded)
+ val param = holder.root.layoutParams as ViewGroup.MarginLayoutParams
+ param.setMargins(16.dpToPxRounded(context), 4.dpToPxRounded(context), 16.dpToPxRounded(context), 0.dpToPxRounded(context))
+ holder.root.layoutParams = param
+
+ }
+ else{
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_top)
+ val param = holder.root.layoutParams as ViewGroup.MarginLayoutParams
+ param.setMargins(16.dpToPxRounded(context), 4.dpToPxRounded(context), 16.dpToPxRounded(context), 0.dpToPxRounded(context))
+ holder.root.layoutParams = param
+
+ }
+ }
+ list.lastIndex -> {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_bottom)
+ val param = holder.root.layoutParams as ViewGroup.MarginLayoutParams
+ param.setMargins(16.dpToPxRounded(context), 0.dpToPxRounded(context), 16.dpToPxRounded(context), 4.dpToPxRounded(context))
+ holder.root.layoutParams = param
+ }
+ else -> {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background)
+ val param = holder.root.layoutParams as ViewGroup.MarginLayoutParams
+ param.setMargins(16.dpToPxRounded(context), 0.dpToPxRounded(context), 16.dpToPxRounded(context), 0.dpToPxRounded(context))
+ holder.root.layoutParams = param
+ }
+ }
if (selected[patchMeta]) holder.root.setCardBackgroundColor(selectedColor)
else holder.root.setCardBackgroundColor(Color.TRANSPARENT)
@@ -122,8 +153,43 @@ class PatchAdapter(
if (isEnabled) {
selected[patchMeta] = !selected[patchMeta]
- if (selected[patchMeta]) holder.root.setCardBackgroundColor(selectedColor)
- else holder.root.setCardBackgroundColor(Color.TRANSPARENT)
+ if (selected[patchMeta]) {
+ when (position) {
+ 0 -> {
+ if (list.size == 1) {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_rounded_colored)
+ } else {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_top_colored)
+ }
+ }
+
+ list.lastIndex -> {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_bottom_colored)
+ }
+
+ else -> {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_colored)
+ }
+ }
+ }
+ else
+ when (position) {
+ 0 -> {
+ if (list.size == 1) {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_rounded)
+ } else {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_top)
+ }
+ }
+
+ list.lastIndex -> {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background_bottom)
+ }
+
+ else -> {
+ holder.root.setBackgroundResource(R.drawable.color_surface_overlay_background)
+ }
+ }
}
}
}
diff --git a/app/src/main/java/de/dertyp7214/rboardpatcher/core/String.kt b/app/src/main/java/de/dertyp7214/rboardpatcher/core/String.kt
index 13d12f2..0d36aa1 100644
--- a/app/src/main/java/de/dertyp7214/rboardpatcher/core/String.kt
+++ b/app/src/main/java/de/dertyp7214/rboardpatcher/core/String.kt
@@ -12,12 +12,7 @@ import java.util.Locale
fun String.downloadFile(path: File): File {
if (path.exists()) path.deleteRecursively()
path.parentFile?.let { if (!it.exists()) it.mkdirs() }
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- Files.copy(URL(this).openStream(), path.toPath(), StandardCopyOption.REPLACE_EXISTING)
- } else {
- URL(this).openStream()
- .use { Files.copy(it, path.toPath()) }
- }
+ Files.copy(URL(this).openStream(), path.toPath(), StandardCopyOption.REPLACE_EXISTING)
return path
}
diff --git a/app/src/main/java/de/dertyp7214/rboardpatcher/screens/LoadThemeActivity.kt b/app/src/main/java/de/dertyp7214/rboardpatcher/screens/LoadThemeActivity.kt
index 425ace4..578a226 100644
--- a/app/src/main/java/de/dertyp7214/rboardpatcher/screens/LoadThemeActivity.kt
+++ b/app/src/main/java/de/dertyp7214/rboardpatcher/screens/LoadThemeActivity.kt
@@ -70,7 +70,7 @@ class LoadThemeActivity : AppCompatActivity() {
recyclerView.adapter = adapter
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.setHasFixedSize(true)
- recyclerView.addItemDecoration(MarginItemDecoration(2.dp(this), all = true))
+ recyclerView.addItemDecoration(MarginItemDecoration(2.dp(this)))
when {
scheme != "content" && data != null && data.scheme == "file" -> {
diff --git a/app/src/main/java/de/dertyp7214/rboardpatcher/screens/PatchActivity.kt b/app/src/main/java/de/dertyp7214/rboardpatcher/screens/PatchActivity.kt
index f173de2..6e0b352 100644
--- a/app/src/main/java/de/dertyp7214/rboardpatcher/screens/PatchActivity.kt
+++ b/app/src/main/java/de/dertyp7214/rboardpatcher/screens/PatchActivity.kt
@@ -33,6 +33,7 @@ import com.google.android.material.progressindicator.CircularProgressIndicator
import com.google.android.material.progressindicator.LinearProgressIndicator
import com.google.gson.Gson
import de.dertyp7214.rboardcomponents.components.SearchBar
+import de.dertyp7214.rboardcomponents.core.dpToPxRounded
import de.dertyp7214.rboardpatcher.Application
import de.dertyp7214.rboardpatcher.R
import de.dertyp7214.rboardpatcher.adapter.PatchAdapter
@@ -42,6 +43,7 @@ import de.dertyp7214.rboardpatcher.api.types.KeyValue
import de.dertyp7214.rboardpatcher.api.types.PatchMeta
import de.dertyp7214.rboardpatcher.components.BaseActivity
import de.dertyp7214.rboardpatcher.components.ChipContainer
+import de.dertyp7214.rboardpatcher.components.MarginItemDecoration
import de.dertyp7214.rboardpatcher.core.Observe
import de.dertyp7214.rboardpatcher.core.app
import de.dertyp7214.rboardpatcher.core.decodeBitmap
@@ -332,6 +334,7 @@ class PatchActivity : BaseActivity() {
recyclerView.adapter = adapter
recyclerView.setHasFixedSize(true)
recyclerView.layoutManager = LinearLayoutManager(this)
+ recyclerView.addItemDecoration(MarginItemDecoration(2.dpToPxRounded(this)))
doAsync({
val patches: List = GitHub.GboardThemes.Patches["patches.json"]
@@ -424,11 +427,7 @@ class PatchActivity : BaseActivity() {
progress = { progress, stage ->
CoroutineScope(Dispatchers.Main).launch {
patchTheme.text = "Applying: $stage"
- if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {
progressBar.setProgress(progress.roundToInt(), true)
- } else {
- progressBar.progress = progress.roundToInt()
- }
}
}) {
patchTheme.isEnabled = true
diff --git a/app/src/main/java/de/dertyp7214/rboardpatcher/screens/PickThemeActivity.kt b/app/src/main/java/de/dertyp7214/rboardpatcher/screens/PickThemeActivity.kt
index bc91b0f..1ec4112 100644
--- a/app/src/main/java/de/dertyp7214/rboardpatcher/screens/PickThemeActivity.kt
+++ b/app/src/main/java/de/dertyp7214/rboardpatcher/screens/PickThemeActivity.kt
@@ -96,7 +96,7 @@ class PickThemeActivity : AppCompatActivity() {
recyclerView.adapter = adapter
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.setHasFixedSize(true)
- recyclerView.addItemDecoration(MarginItemDecoration(2.dp(this), all = true))
+ recyclerView.addItemDecoration(MarginItemDecoration(2.dp(this)))
Application.rboardService?.apply {
doAsync({
diff --git a/app/src/main/java/de/dertyp7214/rboardpatcher/screens/types/MainOption.kt b/app/src/main/java/de/dertyp7214/rboardpatcher/screens/types/MainOption.kt
index f7e7e23..d20dd07 100644
--- a/app/src/main/java/de/dertyp7214/rboardpatcher/screens/types/MainOption.kt
+++ b/app/src/main/java/de/dertyp7214/rboardpatcher/screens/types/MainOption.kt
@@ -3,7 +3,7 @@ package de.dertyp7214.rboardpatcher.screens.types
import androidx.annotation.DrawableRes
data class MainOption(
- @DrawableRes val icon: Int,
+ @param:DrawableRes val icon: Int,
val title: String,
val action: () -> Unit
)
\ No newline at end of file
diff --git a/app/src/main/res/drawable/color_surface_overlay_background.xml b/app/src/main/res/drawable/color_surface_overlay_background.xml
new file mode 100644
index 0000000..8e24333
--- /dev/null
+++ b/app/src/main/res/drawable/color_surface_overlay_background.xml
@@ -0,0 +1,15 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/color_surface_overlay_background_bottom.xml b/app/src/main/res/drawable/color_surface_overlay_background_bottom.xml
new file mode 100644
index 0000000..5678912
--- /dev/null
+++ b/app/src/main/res/drawable/color_surface_overlay_background_bottom.xml
@@ -0,0 +1,17 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/color_surface_overlay_background_bottom_colored.xml b/app/src/main/res/drawable/color_surface_overlay_background_bottom_colored.xml
new file mode 100644
index 0000000..100a9bd
--- /dev/null
+++ b/app/src/main/res/drawable/color_surface_overlay_background_bottom_colored.xml
@@ -0,0 +1,17 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/color_surface_overlay_background_colored.xml b/app/src/main/res/drawable/color_surface_overlay_background_colored.xml
new file mode 100644
index 0000000..ae23400
--- /dev/null
+++ b/app/src/main/res/drawable/color_surface_overlay_background_colored.xml
@@ -0,0 +1,15 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/color_surface_overlay_background_rounded.xml b/app/src/main/res/drawable/color_surface_overlay_background_rounded.xml
new file mode 100644
index 0000000..35ca2c2
--- /dev/null
+++ b/app/src/main/res/drawable/color_surface_overlay_background_rounded.xml
@@ -0,0 +1,15 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/color_surface_overlay_background_rounded_colored.xml b/app/src/main/res/drawable/color_surface_overlay_background_rounded_colored.xml
new file mode 100644
index 0000000..eb87a22
--- /dev/null
+++ b/app/src/main/res/drawable/color_surface_overlay_background_rounded_colored.xml
@@ -0,0 +1,15 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/color_surface_overlay_background_top.xml b/app/src/main/res/drawable/color_surface_overlay_background_top.xml
new file mode 100644
index 0000000..66a48eb
--- /dev/null
+++ b/app/src/main/res/drawable/color_surface_overlay_background_top.xml
@@ -0,0 +1,19 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/color_surface_overlay_background_top_colored.xml b/app/src/main/res/drawable/color_surface_overlay_background_top_colored.xml
new file mode 100644
index 0000000..78f8f1c
--- /dev/null
+++ b/app/src/main/res/drawable/color_surface_overlay_background_top_colored.xml
@@ -0,0 +1,19 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 9b01fcd..3e6634a 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -170,7 +170,7 @@
android:layout_marginBottom="32dp"
android:translationZ="0dp"
app:cardBackgroundColor="?android:attr/colorBackground"
- app:cardCornerRadius="@dimen/roundCorners"
+ app:cardCornerRadius="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
diff --git a/app/src/main/res/layout/activity_patch.xml b/app/src/main/res/layout/activity_patch.xml
index dd5a492..0240d5e 100644
--- a/app/src/main/res/layout/activity_patch.xml
+++ b/app/src/main/res/layout/activity_patch.xml
@@ -18,6 +18,8 @@
-
+ android:fitsSystemWindows="true"
+ android:orientation="vertical">
-
+
-
+
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/custom_image_patch_layout.xml b/app/src/main/res/layout/custom_image_patch_layout.xml
index e4c2fcf..5cacd8d 100644
--- a/app/src/main/res/layout/custom_image_patch_layout.xml
+++ b/app/src/main/res/layout/custom_image_patch_layout.xml
@@ -76,6 +76,7 @@
-
-
+ android:layout_height="73dp"
+ android:layout_marginHorizontal="16dp"
+ app:cardElevation="0dp"
+ app:strokeWidth="0dp">
+
+
-
+
-
+
-
+
+
-
-
+
+
+
-
+
-
-
\ No newline at end of file
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/share_popup.xml b/app/src/main/res/layout/share_popup.xml
index c1b381e..3feb24c 100644
--- a/app/src/main/res/layout/share_popup.xml
+++ b/app/src/main/res/layout/share_popup.xml
@@ -53,16 +53,17 @@
-
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index a3e4608..2a35d53 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -1,7 +1,7 @@
-