Make it buildable in 2022 (#41)
* Bump up to android-28, gradle 7.2 * updated gradle 2.2.1 -> 7.3.3 * readjusted API Level versions to support Mocor5 devices (hopefully) * no longer using the deprecated notification.setLatestEventInfo() * updated permissions list for compatibility with Android 9+ Co-authored-by: Ratmir Karabut <rkarabut@gmail.com>
This commit is contained in:
parent
a352deca43
commit
0a81e6845f
7 changed files with 35 additions and 70 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -32,4 +32,5 @@ proguard/
|
|||
|
||||
#Other
|
||||
assets/dict.properties
|
||||
t9build.properties
|
||||
t9build.properties
|
||||
*.keystore
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
android:versionCode="4"
|
||||
android:versionName="git" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-configuration
|
||||
android:reqFiveWayNav="true"
|
||||
|
|
|
|||
74
build.gradle
74
build.gradle
|
|
@ -1,16 +1,21 @@
|
|||
import groovy.swing.SwingBuilder
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.5.0'
|
||||
classpath 'com.android.tools.build:gradle:7.2.1'
|
||||
}
|
||||
}
|
||||
apply plugin: 'android'
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: '*.jar')
|
||||
implementation "androidx.core:core:1.5.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
|
||||
def execThing ( String cmdStr ) {
|
||||
|
|
@ -74,8 +79,8 @@ def computeVersionNumber = { ->
|
|||
}
|
||||
|
||||
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/<type>
|
||||
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
|
||||
// This moves them out of them default location under src/<type>/... 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
|
||||
|
|
|
|||
1
gradle.properties
Normal file
1
gradle.properties
Normal file
|
|
@ -0,0 +1 @@
|
|||
android.useAndroidX=true
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@
|
|||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-10
|
||||
target=android-30
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue