Removing useless permissions
Deprecation of classes Removing warnings
This commit is contained in:
parent
4c9b2db7c7
commit
36ac99d97f
|
@ -1,5 +1,2 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest package="oupson.apng">
|
||||||
package="oupson.apng">
|
|
||||||
<!-- TODO REMOVE -->
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -17,6 +17,7 @@ class Loader {
|
||||||
* @throws IOException thrown when retrieving the file.
|
* @throws IOException thrown when retrieving the file.
|
||||||
* @throws Exception when returned code of the [HttpURLConnection] is not 200 (OK).
|
* @throws Exception when returned code of the [HttpURLConnection] is not 200 (OK).
|
||||||
*/
|
*/
|
||||||
|
@Suppress("BlockingMethodInNonBlockingContext") // RELATED TO ERROR.
|
||||||
@Throws(IOException::class, Exception::class)
|
@Throws(IOException::class, Exception::class)
|
||||||
suspend fun load(url: URL): ByteArray =
|
suspend fun load(url: URL): ByteArray =
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
|
|
|
@ -571,7 +571,7 @@ class ApngDecoder {
|
||||||
* @param config Configuration applied to the bitmap added to the animation. Please note that the frame is decoded in ARGB_8888 and converted after, for the buffer.
|
* @param config Configuration applied to the bitmap added to the animation. Please note that the frame is decoded in ARGB_8888 and converted after, for the buffer.
|
||||||
* @return [AnimationDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif.
|
* @return [AnimationDrawable] if successful and an [AnimatedImageDrawable] if the image decoded is not an APNG but a gif.
|
||||||
*/
|
*/
|
||||||
@Suppress("unused")
|
@Suppress("unused", "BlockingMethodInNonBlockingContext")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
suspend fun decodeApng(
|
suspend fun decodeApng(
|
||||||
context: Context,
|
context: Context,
|
||||||
|
|
|
@ -12,6 +12,7 @@ import kotlin.math.min
|
||||||
/**
|
/**
|
||||||
* Taken from http://catcode.com/pngencoder/com/keypoint/PngEncoder.java
|
* Taken from http://catcode.com/pngencoder/com/keypoint/PngEncoder.java
|
||||||
*/
|
*/
|
||||||
|
@Deprecated("It now integrated in ApngEncoder and will be removed after the 1.10 release")
|
||||||
class PngEncoder {
|
class PngEncoder {
|
||||||
companion object {
|
companion object {
|
||||||
/** Constants for filter (NONE) */
|
/** Constants for filter (NONE) */
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@SuppressWarnings("WeakerAccess")
|
@SuppressWarnings("WeakerAccess")
|
||||||
|
@Deprecated()
|
||||||
public class PnnQuantizer {
|
public class PnnQuantizer {
|
||||||
private final short SHORT_MAX = Short.MAX_VALUE;
|
private final short SHORT_MAX = Short.MAX_VALUE;
|
||||||
private final char BYTE_MAX = -Byte.MIN_VALUE + Byte.MAX_VALUE;
|
private final char BYTE_MAX = -Byte.MIN_VALUE + Byte.MAX_VALUE;
|
||||||
|
@ -31,7 +32,6 @@ public class PnnQuantizer {
|
||||||
@SuppressLint("UseSparseArrays")
|
@SuppressLint("UseSparseArrays")
|
||||||
private final HashMap<Integer, short[]> closestMap = new HashMap();
|
private final HashMap<Integer, short[]> closestMap = new HashMap();
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public PnnQuantizer(String fname) {
|
public PnnQuantizer(String fname) {
|
||||||
fromBitmap(fname);
|
fromBitmap(fname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
package oupson.apngcreator
|
|
||||||
|
|
||||||
import androidx.test.InstrumentationRegistry
|
|
||||||
import androidx.test.runner.AndroidJUnit4
|
|
||||||
import org.junit.Assert.assertEquals
|
|
||||||
import org.junit.Test
|
|
||||||
import org.junit.runner.RunWith
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instrumented test, which will execute on an Android device.
|
|
||||||
*
|
|
||||||
* See [testing documentation](http://d.android.com/tools/testing).
|
|
||||||
*/
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
|
||||||
class ExampleInstrumentedTest {
|
|
||||||
@Test
|
|
||||||
fun useAppContext() {
|
|
||||||
// Context of the app under test.
|
|
||||||
val appContext = InstrumentationRegistry.getTargetContext()
|
|
||||||
assertEquals("oupson.apngcreator", appContext.packageName)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,8 +3,8 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="oupson.apngcreator">
|
package="oupson.apngcreator">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:fullBackupContent="false"
|
android:fullBackupContent="false"
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
<category android:name="android.intent.category.BROWSABLE"/>
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
|
||||||
<data android:mimeType="image/png"/>
|
<data android:mimeType="image/*"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
|
|
@ -28,15 +28,25 @@ class ViewerActivity : AppCompatActivity() {
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
if (ContextCompat.checkSelfPermission(applicationContext, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
|
||||||
ActivityCompat.requestPermissions(this,
|
if (intent.data != null) {
|
||||||
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
|
if (intent.data!!.scheme == "file" && ContextCompat.checkSelfPermission(
|
||||||
2)
|
applicationContext,
|
||||||
|
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||||
|
)
|
||||||
|
!= PackageManager.PERMISSION_GRANTED
|
||||||
|
) {
|
||||||
|
ActivityCompat.requestPermissions(
|
||||||
|
this,
|
||||||
|
arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE),
|
||||||
|
2
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
load()
|
load()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun load() {
|
private fun load() {
|
||||||
val uri = intent.data ?: return
|
val uri = intent.data ?: return
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package oupson.apngcreator
|
|
||||||
|
|
||||||
import org.junit.Assert.assertEquals
|
|
||||||
import org.junit.Test
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
|
||||||
*
|
|
||||||
* See [testing documentation](http://d.android.com/tools/testing).
|
|
||||||
*/
|
|
||||||
class ExampleUnitTest {
|
|
||||||
@Test
|
|
||||||
fun addition_isCorrect() {
|
|
||||||
assertEquals(4, 2 + 2)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue