Update of dependencies

This commit is contained in:
Oupson 2021-06-22 13:03:14 +02:00
parent 7ca74af4d4
commit f7d76f26e7
9 changed files with 82 additions and 49 deletions

View File

@ -1,14 +1,14 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: "org.jetbrains.dokka"
android { android {
compileSdkVersion 29 compileSdkVersion 30
defaultConfig { defaultConfig {
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 29 targetSdkVersion 30
versionCode 1 versionCode 1
versionName "1.0.10" versionName "1.0.10"
@ -29,12 +29,12 @@ android {
} }
dependencies { dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.3.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.3.0' androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
} }
@ -42,13 +42,3 @@ dependencies {
repositories { repositories {
mavenCentral() mavenCentral()
} }
dokkaHtml.configure {
dokkaSourceSets {
named("main") {
includes.from("Module.md")
noAndroidSdkLink.set(false)
}
}
}

View File

@ -3,12 +3,12 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
android { android {
compileSdkVersion 29 compileSdkVersion 30
defaultConfig { defaultConfig {
applicationId "oupson.apngcreator" applicationId "oupson.apngcreator"
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 29 targetSdkVersion 30
versionCode 1 versionCode 1
versionName "1.0.10" versionName "1.0.10"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -35,14 +35,14 @@ android {
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.3.0' implementation 'com.google.android.material:material:1.3.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.3.0' androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

View File

@ -46,7 +46,8 @@ class CreatorActivity : AppCompatActivity() {
private const val WRITE_REQUEST_CODE = 2 private const val WRITE_REQUEST_CODE = 2
private const val TAG = "CreatorActivity" private const val TAG = "CreatorActivity"
private const val CREATION_CHANNEL_ID = "${BuildConfig.APPLICATION_ID}.notifications_channels.create" private const val CREATION_CHANNEL_ID =
"${BuildConfig.APPLICATION_ID}.notifications_channels.create"
} }
private var items: ArrayList<Triple<Uri, Int, Long>> = ArrayList() private var items: ArrayList<Triple<Uri, Int, Long>> = ArrayList()
@ -129,13 +130,20 @@ class CreatorActivity : AppCompatActivity() {
return true return true
} }
override fun onOptionsItemSelected(item: MenuItem?): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item?.itemId) { return when (item.itemId) {
R.id.menu_create_apng -> { R.id.menu_create_apng -> {
if (items.size > 0) { if (items.size > 0) {
val builder = NotificationCompat.Builder(this, CREATION_CHANNEL_ID).apply { val builder = NotificationCompat.Builder(this, CREATION_CHANNEL_ID).apply {
setContentTitle(getString(R.string.create_notification_title)) setContentTitle(getString(R.string.create_notification_title))
setContentText(this@CreatorActivity.resources.getQuantityString(R.plurals.create_notification_description, 0, 0, items.size)) setContentText(
this@CreatorActivity.resources.getQuantityString(
R.plurals.create_notification_description,
0,
0,
items.size
)
)
setSmallIcon(R.drawable.ic_create_white_24dp) setSmallIcon(R.drawable.ic_create_white_24dp)
priority = NotificationCompat.PRIORITY_LOW priority = NotificationCompat.PRIORITY_LOW
} }
@ -149,7 +157,11 @@ class CreatorActivity : AppCompatActivity() {
} }
} }
val out = FileOutputStream(f) val out = FileOutputStream(f)
saveToOutputStream(items.map { Pair(it.first, it.second) }, out, builder = builder) saveToOutputStream(
items.map { Pair(it.first, it.second) },
out,
builder = builder
)
out.close() out.close()
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG)
@ -182,7 +194,14 @@ class CreatorActivity : AppCompatActivity() {
if (items.size > 0) { if (items.size > 0) {
val builder = NotificationCompat.Builder(this, CREATION_CHANNEL_ID).apply { val builder = NotificationCompat.Builder(this, CREATION_CHANNEL_ID).apply {
setContentTitle(getString(R.string.create_notification_title)) setContentTitle(getString(R.string.create_notification_title))
setContentText(this@CreatorActivity.resources.getQuantityString(R.plurals.create_notification_description, 0, 0, items.size)) setContentText(
this@CreatorActivity.resources.getQuantityString(
R.plurals.create_notification_description,
0,
0,
items.size
)
)
setSmallIcon(R.drawable.ic_create_white_24dp) setSmallIcon(R.drawable.ic_create_white_24dp)
priority = NotificationCompat.PRIORITY_LOW priority = NotificationCompat.PRIORITY_LOW
} }
@ -195,7 +214,11 @@ class CreatorActivity : AppCompatActivity() {
} }
} }
val out = FileOutputStream(f) val out = FileOutputStream(f)
saveToOutputStream(items.map { Pair(it.first, it.second) }, out, builder = builder) saveToOutputStream(
items.map { Pair(it.first, it.second) },
out,
builder = builder
)
out.close() out.close()
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
@ -285,11 +308,15 @@ class CreatorActivity : AppCompatActivity() {
optimise = item.isChecked optimise = item.isChecked
true true
} }
else -> if (item != null) super.onOptionsItemSelected(item) else true else -> super.onOptionsItemSelected(item)
} }
} }
private suspend fun saveToOutputStream(files : Collection<Pair<Uri, Int>>, outputStream: OutputStream, builder : NotificationCompat.Builder? = null) { private suspend fun saveToOutputStream(
files: Collection<Pair<Uri, Int>>,
outputStream: OutputStream,
builder: NotificationCompat.Builder? = null
) {
var maxWidth = 0 var maxWidth = 0
var maxHeight = 0 var maxHeight = 0
var notificationManagerCompat: NotificationManagerCompat? var notificationManagerCompat: NotificationManagerCompat?
@ -335,7 +362,14 @@ class CreatorActivity : AppCompatActivity() {
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
notificationManagerCompat = NotificationManagerCompat.from(this@CreatorActivity) notificationManagerCompat = NotificationManagerCompat.from(this@CreatorActivity)
builder.setProgress(files.size, i + 1, false) builder.setProgress(files.size, i + 1, false)
.setContentText(this@CreatorActivity.resources.getQuantityString(R.plurals.create_notification_description, i +1, i + 1, files.size)) .setContentText(
this@CreatorActivity.resources.getQuantityString(
R.plurals.create_notification_description,
i + 1,
i + 1,
files.size
)
)
notificationManagerCompat?.notify(1, builder.build()) notificationManagerCompat?.notify(1, builder.build())
} }
} }
@ -375,9 +409,8 @@ class CreatorActivity : AppCompatActivity() {
} }
} }
runCatching { // TODO
encoder.writeEnd() encoder.writeEnd()
}
if (builder != null) { if (builder != null) {
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
@ -414,14 +447,25 @@ class CreatorActivity : AppCompatActivity() {
val builder = NotificationCompat.Builder(this, CREATION_CHANNEL_ID).apply { val builder = NotificationCompat.Builder(this, CREATION_CHANNEL_ID).apply {
setContentTitle(getString(R.string.create_notification_title)) setContentTitle(getString(R.string.create_notification_title))
setContentText(this@CreatorActivity.resources.getQuantityString(R.plurals.create_notification_description, 0, 0, items.size)) setContentText(
this@CreatorActivity.resources.getQuantityString(
R.plurals.create_notification_description,
0,
0,
items.size
)
)
setSmallIcon(R.drawable.ic_create_white_24dp) setSmallIcon(R.drawable.ic_create_white_24dp)
priority = NotificationCompat.PRIORITY_LOW priority = NotificationCompat.PRIORITY_LOW
} }
GlobalScope.launch(Dispatchers.IO) { GlobalScope.launch(Dispatchers.IO) {
val out = contentResolver.openOutputStream(data.data!!) ?: return@launch val out = contentResolver.openOutputStream(data.data!!) ?: return@launch
saveToOutputStream(items.map { Pair(it.first, it.second) }, out, builder = builder) saveToOutputStream(
items.map { Pair(it.first, it.second) },
out,
builder = builder
)
out.close() out.close()
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {

View File

@ -60,6 +60,7 @@ class ViewerActivity : AppCompatActivity() {
override fun onRequestPermissionsResult(requestCode: Int, override fun onRequestPermissionsResult(requestCode: Int,
permissions: Array<String>, grantResults: IntArray) { permissions: Array<String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
when (requestCode) { when (requestCode) {
2 -> { 2 -> {
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

View File

@ -30,7 +30,7 @@ class DelayInputDialog(
if (value != null) if (value != null)
mNumberEdit?.setText(value.toString()) mNumberEdit?.setText(value.toString())
return MaterialAlertDialogBuilder( return MaterialAlertDialogBuilder(
context!!, requireContext(),
R.style.RoundedCornersDialog R.style.RoundedCornersDialog
) )
.setTitle(R.string.delay) .setTitle(R.string.delay)

View File

@ -34,7 +34,7 @@ class ApngDecoderFragment : Fragment() {
if (context != null) { if (context != null) {
ApngDecoder.decodeApngAsyncInto( ApngDecoder.decodeApngAsyncInto(
this.context!!, this.requireContext(),
URL("https://metagif.files.wordpress.com/2015/01/bugbuckbunny.png"), URL("https://metagif.files.wordpress.com/2015/01/bugbuckbunny.png"),
imageView, imageView,
config = ApngDecoder.Config(bitmapConfig = Bitmap.Config.RGB_565, decodeCoverFrame = true), config = ApngDecoder.Config(bitmapConfig = Bitmap.Config.RGB_565, decodeCoverFrame = true),

View File

@ -139,7 +139,7 @@ class KotlinFragment : Fragment() {
if (animation == null) { if (animation == null) {
ApngDecoder.decodeApngAsyncInto( ApngDecoder.decodeApngAsyncInto(
this.context!!, requireContext(),
imageUrls[selected], imageUrls[selected],
apngImageView!!, apngImageView!!,
callback = object : ApngDecoder.Callback { callback = object : ApngDecoder.Callback {

View File

@ -1,26 +1,24 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.4.30' ext.kotlin_version = '1.5.10'
ext.anko_version = '0.10.8' ext.dokka_version = '1.4.3'
ext.dokka_version = '1.4.0'
repositories { repositories {
google() google()
jcenter() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.1.2' classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
} }
} }
allprojects { allprojects {
repositories { repositories {
google() google()
jcenter() mavenCentral()
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
} }
} }

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip