Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump targetSdk version #17

Merged
merged 4 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- name: Build with Gradle
run: ./gradlew build${{ matrix.Variant }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
.externalNativeBuild
.cxx
/release.properties

keystore.properties
2 changes: 1 addition & 1 deletion .idea/compiler.xml
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions .idea/gradle.xml
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/misc.xml
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 78 additions & 33 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
import org.gradle.util.GUtil.loadProperties

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

val hiltVersion: String by rootProject.extra

android {
compileSdk = 31
compileSdk = 34

defaultConfig {
applicationId = "jp.co.c_lis.ccl.morelocale"
minSdk = 14
targetSdk = 30
versionCode = 14246
versionName = "2.4.6"
namespace = "jp.co.c_lis.ccl.morelocale"

minSdk = 19
maxSdk = 30
targetSdk = 34
multiDexEnabled = true

versionCode = 14247
versionName = "2.4.7"

buildConfigField(
"String",
Expand All @@ -30,27 +35,63 @@ android {
"\"locale.db\""
)

sourceSets {
// Adds exported schema location as test app assets.
getByName("androidTest").assets.srcDirs("$projectDir/schemas")
buildFeatures {
buildConfig = true
}

javaCompileOptions {
annotationProcessorOptions {
arguments["room.schemaLocation"] = "$projectDir/schemas"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}

ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

signingConfigs {
create("release") {
val releaseKeyStoreFile = File(rootDir, "keystore.properties")
if (!releaseKeyStoreFile.exists()) {
return@create
}

val releaseKeyStoreProps = loadProperties(releaseKeyStoreFile)

val keystorePath = releaseKeyStoreProps.getProperty("keystore_path", "")
val keystorePassword = releaseKeyStoreProps.getProperty("keystore_password", "")
val keystoreKeyAlias = releaseKeyStoreProps.getProperty("keystore_key_alias", "")
val keystoreKeyPassword = releaseKeyStoreProps.getProperty("keystore_key_password", "")

if (arrayOf(
keystorePath,
keystorePassword,
keystoreKeyAlias,
keystoreKeyPassword
).none { it.isNullOrEmpty() }
) {
storeFile = file(keystorePath)
storePassword = keystorePassword
keyAlias = keystoreKeyAlias
keyPassword = keystoreKeyPassword
}
}
}

buildTypes {
release {
isMinifyEnabled = false
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
}
}
testOptions {
Expand All @@ -62,9 +103,11 @@ android {
}

dependencies {
val lifecycleVersion = "2.4.0-rc01"
val fragmentVersion = "1.4.0-alpha10"
val roomVersion = "2.3.0"
val lifecycleVersion = "2.7.0-beta01"
val fragmentVersion = "1.7.0-alpha06"
val multidexVersion = "2.0.1"
val roomVersion = "2.6.0"
val hiltVersion = "2.48.1"

implementation(
fileTree(
Expand All @@ -76,30 +119,32 @@ dependencies {
)
)

implementation("androidx.core:core-ktx:1.7.0")
implementation("androidx.appcompat:appcompat:1.3.1")
implementation("com.google.android.material:material:1.4.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.1")
implementation("androidx.recyclerview:recyclerview:1.2.1")
implementation(project(":lib"))

implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.10.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.recyclerview:recyclerview:1.3.2")

implementation("androidx.fragment:fragment-ktx:$fragmentVersion")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion")

implementation("androidx.multidex:multidex:$multidexVersion")

implementation("androidx.room:room-runtime:$roomVersion")
kapt("androidx.room:room-compiler:$roomVersion")
ksp("androidx.room:room-compiler:$roomVersion")
androidTestImplementation("androidx.room:room-testing:$roomVersion")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")

implementation("com.jakewharton.timber:timber:5.0.1")

implementation("com.google.dagger:hilt-android:$hiltVersion")
kapt("com.google.dagger:hilt-android-compiler:$hiltVersion")

implementation(project(mapOf("path" to ":lib")))
ksp("com.google.dagger:hilt-android-compiler:$hiltVersion")

testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jp.co.c_lis.ccl.morelocale">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<uses-feature
android:name="android.hardware.faketouch"
android:required="false" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package jp.co.c_lis.ccl.morelocale

import android.app.Application
import android.content.Context
import androidx.multidex.MultiDexApplication
import androidx.room.Room
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber
import timber.log.Timber.DebugTree

@Suppress("unused")
@HiltAndroidApp
class MainApplication : Application() {
class MainApplication : MultiDexApplication() {

companion object {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import androidx.room.Ignore
import androidx.room.PrimaryKey
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import java.util.*
import java.util.Locale

@Entity
@Parcelize
@Entity
data class LocaleItem(
@PrimaryKey(autoGenerate = true)
val id: Int = 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package jp.co.c_lis.ccl.morelocale.service

import android.annotation.SuppressLint
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
Expand All @@ -11,6 +12,7 @@ import android.os.Build
import android.os.IBinder
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.app.PendingIntentCompat
import dagger.hilt.android.AndroidEntryPoint
import jp.co.c_lis.ccl.morelocale.BuildConfig
import jp.co.c_lis.ccl.morelocale.equals
Expand Down Expand Up @@ -243,6 +245,7 @@ class RestoreLocaleService : Service() {
notificationManager.createNotificationChannel(channel)
}

@SuppressLint("MissingPermission")
private fun showProgressNotification(context: Context) {
val notify = createProgressNotification(context)
NotificationManagerCompat.from(context)
Expand Down Expand Up @@ -275,6 +278,7 @@ class RestoreLocaleService : Service() {

}

@SuppressLint("MissingPermission")
private fun showCanceledNotification(context: Context) {
val notify = createCanceledNotification(context)
NotificationManagerCompat.from(context)
Expand All @@ -293,11 +297,13 @@ class RestoreLocaleService : Service() {
neverPendingIntent
)

val restorePendingIntent = PendingIntent.getService(
val restorePendingIntent = PendingIntentCompat.getService(
context,
REQUEST_CODE_RESTORE,
getRestoreIntent(context),
PendingIntent.FLAG_UPDATE_CURRENT)
PendingIntent.FLAG_UPDATE_CURRENT,
false,
)
val restoreAction = NotificationCompat.Action(
NO_ICON,
getText(R.string.restore),
Expand All @@ -316,18 +322,20 @@ class RestoreLocaleService : Service() {

}

@SuppressLint("MissingPermission")
private fun showPermissionErrorNotification(context: Context) {
val notify = createPermissionErrorNotification(context)
NotificationManagerCompat.from(context)
.notify(NOTIFICATION_ID_ERROR, notify)
}

private fun createPermissionErrorNotification(context: Context): Notification {
val pendingIntent = PendingIntent.getActivity(
val pendingIntent = PendingIntentCompat.getActivity(
context,
REQUEST_OPEN_FROM_PERMISSION_ERROR,
Intent(context, MainActivity::class.java),
PendingIntent.FLAG_CANCEL_CURRENT
PendingIntent.FLAG_CANCEL_CURRENT,
false,
)

return NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class EditLocaleFragment : Fragment(R.layout.fragment_edit_locale) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

mode = MODE.values()[requireArguments().getInt(KEY_MODE)]
mode = MODE.entries.toTypedArray()[requireArguments().getInt(KEY_MODE)]
}

override fun onAttach(context: Context) {
Expand Down
Loading
Loading