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: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "org.jetbrains.dokka"
android {
compileSdkVersion 29
compileSdkVersion 30
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0.10"
@ -29,12 +29,12 @@ android {
}
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 '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.espresso:espresso-core:3.3.0'
}
@ -42,13 +42,3 @@ dependencies {
repositories {
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'
android {
compileSdkVersion 29
compileSdkVersion 30
defaultConfig {
applicationId "oupson.apngcreator"
minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0.10"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -35,14 +35,14 @@ android {
dependencies {
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.legacy:legacy-support-v4:1.0.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.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 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()
@ -54,7 +55,7 @@ class CreatorActivity : AppCompatActivity() {
private var firstFrameInAnim = true
private var optimise = true
private var nextImageId : Long= 0
private var nextImageId: Long = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -129,13 +130,20 @@ class CreatorActivity : AppCompatActivity() {
return true
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
return when (item?.itemId) {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.menu_create_apng -> {
if (items.size > 0) {
val builder = NotificationCompat.Builder(this, CREATION_CHANNEL_ID).apply {
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)
priority = NotificationCompat.PRIORITY_LOW
}
@ -149,7 +157,11 @@ class CreatorActivity : AppCompatActivity() {
}
}
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()
if (BuildConfig.DEBUG)
@ -182,7 +194,14 @@ class CreatorActivity : AppCompatActivity() {
if (items.size > 0) {
val builder = NotificationCompat.Builder(this, CREATION_CHANNEL_ID).apply {
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)
priority = NotificationCompat.PRIORITY_LOW
}
@ -195,7 +214,11 @@ class CreatorActivity : AppCompatActivity() {
}
}
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()
withContext(Dispatchers.Main) {
@ -285,11 +308,15 @@ class CreatorActivity : AppCompatActivity() {
optimise = item.isChecked
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 maxHeight = 0
var notificationManagerCompat: NotificationManagerCompat?
@ -334,8 +361,15 @@ class CreatorActivity : AppCompatActivity() {
if (builder != null) {
withContext(Dispatchers.Main) {
notificationManagerCompat = NotificationManagerCompat.from(this@CreatorActivity)
builder.setProgress(files.size, i+1, false)
.setContentText(this@CreatorActivity.resources.getQuantityString(R.plurals.create_notification_description, i +1, i + 1, files.size))
builder.setProgress(files.size, i + 1, false)
.setContentText(
this@CreatorActivity.resources.getQuantityString(
R.plurals.create_notification_description,
i + 1,
i + 1,
files.size
)
)
notificationManagerCompat?.notify(1, builder.build())
}
}
@ -375,9 +409,8 @@ class CreatorActivity : AppCompatActivity() {
}
}
runCatching { // TODO
encoder.writeEnd()
}
encoder.writeEnd()
if (builder != null) {
withContext(Dispatchers.Main) {
@ -414,14 +447,25 @@ class CreatorActivity : AppCompatActivity() {
val builder = NotificationCompat.Builder(this, CREATION_CHANNEL_ID).apply {
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)
priority = NotificationCompat.PRIORITY_LOW
}
GlobalScope.launch(Dispatchers.IO) {
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()
withContext(Dispatchers.Main) {

View File

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

View File

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

View File

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

View File

@ -139,7 +139,7 @@ class KotlinFragment : Fragment() {
if (animation == null) {
ApngDecoder.decodeApngAsyncInto(
this.context!!,
requireContext(),
imageUrls[selected],
apngImageView!!,
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.
buildscript {
ext.kotlin_version = '1.4.30'
ext.anko_version = '0.10.8'
ext.dokka_version = '1.4.0'
ext.kotlin_version = '1.5.10'
ext.dokka_version = '1.4.3'
repositories {
google()
jcenter()
mavenCentral()
}
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"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
}

View File

@ -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-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip