diff --git a/.gitignore b/.gitignore index aff35e08..bafadc6b 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,5 @@ proguard/ #Other assets/dict.properties -t9build.properties \ No newline at end of file +t9build.properties +*.keystore \ No newline at end of file diff --git a/AndroidManifest.xml b/AndroidManifest.xml index e85e8a13..e90420b4 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -4,7 +4,7 @@ android:versionCode="4" android:versionName="git" > - + } android { - compileSdkVersion 8 - buildToolsVersion "19.1" + compileSdkVersion 30 + buildToolsVersion "32.0.0" sourceSets { main { @@ -88,9 +93,6 @@ android { assets.srcDirs = ['assets'] } - // Move the tests to tests/java, tests/res, etc... - instrumentTest.setRoot('tests') - // Move the build types to build-types/ // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src//... which would @@ -99,10 +101,11 @@ android { // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') - } defaultConfig { + minSdkVersion 19 + targetSdk 30 versionCode computeVersionNumber() versionName computeVersionName() } @@ -111,23 +114,15 @@ android { signingConfigs { release { storeFile file(System.getenv("KEYSTORE")) - storePassword '' + storePassword System.getenv("KEYSTORE_PASS") keyAlias System.getenv("KEYALIAS") - keyPassword '' + keyPassword System.getenv("KEYALIAS_PASS") } } buildTypes { release { signingConfig android.signingConfigs.release - // http://stackoverflow.com/a/24650026 - applicationVariants.all { variant -> - variant.outputs.each { output -> - output.outputFile = new File(output.outputFile.parent, - output.outputFile.name.replace("-release", "-" + android.defaultConfig.versionName) - ) - } - } } } } @@ -149,44 +144,3 @@ task getDictSizes { preBuild.dependsOn getDictSizes preBuild.mustRunAfter getDictSizes - -// https://www.timroes.de/2014/01/19/using-password-prompts-with-gradle-build-files/ -def getPass(String msg) { - def pass = '' - if(System.console() == null) { - new SwingBuilder().edt { - dialog(modal: true, // Otherwise the build will continue running before you closed the dialog - title: 'Enter password', // Dialog title - alwaysOnTop: true, // pretty much what the name says - resizable: false, // Don't allow the user to resize the dialog - locationRelativeTo: null, // Place dialog in center of the screen - pack: true, // We need to pack the dialog (so it will take the size of it's children) - show: true // Let's show it - ) { - vbox { // Put everything below each other - label(text: msg) - input = passwordField() - button(defaultButton: true, text: 'OK', actionPerformed: { - pass = new String(input.password); // Set pass variable to value of input field - dispose(); // Close dialog - }) - } // vbox end - } // dialog end - } // edt end - } else { - pass = System.console().readPassword("\nPlease enter key passphrase: ") - pass = new String(pass) - } - - if(pass.size() <= 0) { - throw new InvalidUserDataException("You must enter a password to proceed.") - } - return pass -} - -gradle.taskGraph.whenReady { taskGraph -> - if(taskGraph.hasTask(':assembleRelease')) { - android.signingConfigs.release.storePassword = getPass("Please enter Key Store passphrase:") - android.signingConfigs.release.keyPassword = getPass("Please enter Key passphrase:") - } // end if has task -} // end whenReady diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..2d8d1e4d --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index eb28e8f5..2335d02f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip diff --git a/project.properties b/project.properties index b7c2081d..08dc7b34 100644 --- a/project.properties +++ b/project.properties @@ -11,4 +11,4 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-10 +target=android-30 diff --git a/src/org/nyanya/android/traditionalt9/DBUpdateService.java b/src/org/nyanya/android/traditionalt9/DBUpdateService.java index 93236b05..a27515a0 100644 --- a/src/org/nyanya/android/traditionalt9/DBUpdateService.java +++ b/src/org/nyanya/android/traditionalt9/DBUpdateService.java @@ -2,6 +2,7 @@ package org.nyanya.android.traditionalt9; import android.app.IntentService; import android.app.Notification; +import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; @@ -49,17 +50,25 @@ public class DBUpdateService extends IntentService { return; } Log.d("T9DBUpdate.onHandle", "Update pass check."); + // do real things - Notification notification = new Notification(R.drawable.ime_en_lang_lower, getText(R.string.updating_database_title), - System.currentTimeMillis()); Intent notificationIntent = new Intent(this, DBUpdateService.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); - notification.setLatestEventInfo(this, getText(R.string.updating_database_title), - getText(R.string.updating_database), pendingIntent); + + NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + + Notification.Builder nBuilder = new Notification.Builder(this); + Notification notification = nBuilder + .setContentIntent(pendingIntent) + .setContentTitle(getText(R.string.updating_database_title)) + .setContentText(getText(R.string.updating_database)) + .setSmallIcon(R.drawable.ime_en_lang_lower) + .getNotification(); + + notificationManager.notify(UPDATING_NOTIFICATION_ID, notification); + startForeground(UPDATING_NOTIFICATION_ID, notification); - - //put this in a thread mHandler.post(new DisplayToast(this, getText(R.string.updating_database)));