Skip to content

Commit 2b41e93

Browse files
committed
Prepare to release beta
1 parent 5bb2701 commit 2b41e93

File tree

6 files changed

+13
-73
lines changed

6 files changed

+13
-73
lines changed

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

apng_library/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
minSdkVersion 21
99
targetSdkVersion 28
1010
versionCode 1
11-
versionName "1.0.9"
11+
versionName "1.0.9-beta"
1212

1313
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1414

apng_library/src/main/java/oupson/apng/imageUtils/BitmapDiffCalculator.kt

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import android.graphics.Bitmap
44
import android.graphics.Canvas
55
import android.graphics.Color
66
import android.graphics.Paint
7-
import androidx.annotation.ColorInt
87
import oupson.apng.utils.Utils
9-
import java.util.*
108

119
// TODO Work on this class
1210
class BitmapDiffCalculator(firstBitmap: Bitmap, secondBitmap : Bitmap) {
@@ -67,52 +65,4 @@ class BitmapDiffCalculator(firstBitmap: Bitmap, secondBitmap : Bitmap) {
6765
val btm = Bitmap.createBitmap(difBitmap, xOffset, yOffset, width - xOffset, height - yOffset)
6866
res = btm
6967
}
70-
71-
fun Bitmap.trim(@ColorInt color: Int = Color.TRANSPARENT): Bitmap {
72-
73-
var top = height
74-
var bottom = 0
75-
var right = width
76-
var left = 0
77-
78-
var colored = IntArray(width, { color })
79-
var buffer = IntArray(width)
80-
81-
for (y in bottom until top) {
82-
getPixels(buffer, 0, width, 0, y, width, 1)
83-
if (!Arrays.equals(colored, buffer)) {
84-
bottom = y
85-
break
86-
}
87-
}
88-
89-
for (y in top - 1 downTo bottom) {
90-
getPixels(buffer, 0, width, 0, y, width, 1)
91-
if (!Arrays.equals(colored, buffer)) {
92-
top = y
93-
break
94-
}
95-
}
96-
97-
val heightRemaining = top - bottom
98-
colored = IntArray(heightRemaining, { color })
99-
buffer = IntArray(heightRemaining)
100-
101-
for (x in left until right) {
102-
getPixels(buffer, 0, 1, x, bottom, 1, heightRemaining)
103-
if (!Arrays.equals(colored, buffer)) {
104-
left = x
105-
break
106-
}
107-
}
108-
109-
for (x in right - 1 downTo left) {
110-
getPixels(buffer, 0, 1, x, bottom, 1, heightRemaining)
111-
if (!Arrays.equals(colored, buffer)) {
112-
right = x
113-
break
114-
}
115-
}
116-
return Bitmap.createBitmap(this, left, bottom, right - left, top - bottom)
117-
}
11868
}

apng_library/src/main/java/oupson/apng/utils/Utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Utils {
2020
try {
2121
val acTL = byteArrayOf(0x61, 0x63, 0x54, 0x4c)
2222
@Suppress("LocalVariableName") val IDAT = byteArrayOf(0x49, 0x44, 0x41, 0x54)
23-
for (i in 0 until byteArray.size) {
23+
for (i in 8 until byteArray.size) {
2424
val it = byteArray.copyOfRange(i, i + 4)
2525
// if byteArray contain acTL
2626
if (it.contentEquals(acTL)) {

app-test/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
<data android:mimeType="image/png" />
3535
</intent-filter>
3636
</activity>
37-
<activity android:name=".CreatorActivity"></activity>
37+
<activity android:name=".CreatorActivity"
38+
android:exported="true"/>
3839
</application>
3940

4041
</manifest>

app-test/src/main/java/oupson/apngcreator/MainActivity.kt

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import android.graphics.Color
44
import android.graphics.drawable.GradientDrawable
55
import android.os.Bundle
66
import android.text.Html
7-
import android.util.Log
87
import android.view.View
98
import android.widget.Toolbar
109
import androidx.appcompat.app.AppCompatActivity
@@ -22,16 +21,12 @@ import org.jetbrains.anko.sdk27.coroutines.onSeekBarChangeListener
2221
import oupson.apng.ApngAnimator
2322
import oupson.apng.loadApng
2423

25-
2624
class MainActivity : AppCompatActivity() {
27-
28-
29-
30-
lateinit var animator: ApngAnimator
31-
lateinit var tool : Toolbar
25+
private lateinit var animator: ApngAnimator
26+
private lateinit var tool : Toolbar
3227
// val imageUrl = "http://oupson.oupsman.fr/apng/bigApng.png"
33-
// val imageUrl = "https://metagif.files.wordpress.com/2015/01/bugbuckbunny.png"
34-
val imageUrl = "http://orig06.deviantart.net/7812/f/2012/233/7/5/twilight_rapidash_shaded_and_animated_by_tamalesyatole-d5bz7hd.png"
28+
private val imageUrl = "https://metagif.files.wordpress.com/2015/01/bugbuckbunny.png"
29+
// val imageUrl = "http://orig06.deviantart.net/7812/f/2012/233/7/5/twilight_rapidash_shaded_and_animated_by_tamalesyatole-d5bz7hd.png"
3530
// val imageUrl = "https://raw.githubusercontent.com/tinify/iMessage-Panda-sticker/master/StickerPackExtension/Stickers.xcstickers/Sticker%20Pack.stickerpack/panda.sticker/panda.png"
3631
override fun onCreate(savedInstanceState: Bundle?) {
3732
super.onCreate(savedInstanceState)
@@ -48,18 +43,14 @@ class MainActivity : AppCompatActivity() {
4843
backgroundColor = Color.BLACK
4944
tool = toolbar {
5045
id = View.generateViewId()
51-
title = Html.fromHtml("<font color='#ffffff'>MainActivity</font>")
46+
title = Html.fromHtml("<font color='#ffffff'>MainActivity</font>", Html.FROM_HTML_MODE_LEGACY)
5247
inflateMenu(R.menu.main_menu)
5348
onMenuItemClick { item ->
54-
Log.e("lll", "Click")
5549
when (item!!.itemId) {
5650
R.id.action_open_create_activity -> {
57-
Log.e("lll", "Click")
5851
startActivity<CreatorActivity>()
5952
finish()
60-
true
6153
}
62-
else -> false
6354
}
6455
}
6556
}.lparams {
@@ -76,7 +67,6 @@ class MainActivity : AppCompatActivity() {
7667
height = wrapContent
7768
}
7869

79-
8070
constraintLayout {
8171
val pauseButton = button("pause") {
8272
id = View.generateViewId()
@@ -103,11 +93,10 @@ class MainActivity : AppCompatActivity() {
10393
max = 200
10494
progress = 10
10595
onSeekBarChangeListener {
106-
onProgressChanged { seekBar, progressValue, fromUser -> }
107-
onStartTrackingTouch { seekBar -> }
96+
onProgressChanged { _, _, _ -> }
97+
onStartTrackingTouch { }
10898
onStopTrackingTouch { seekBar ->
109-
Log.e("TAG", (seekBar!!.progress.toFloat() / 100f).toString())
110-
animator.speed = (seekBar!!.progress.toFloat() / 100f)
99+
animator.speed = (seekBar?.progress?.toFloat() ?: 100f / 100f)
111100
}
112101
}
113102
}.lparams(
@@ -123,7 +112,7 @@ class MainActivity : AppCompatActivity() {
123112
)
124113
val imageView = imageView {
125114
id = View.generateViewId()
126-
animator = this.loadApng(R.raw.bugbuckbunny).apply {
115+
animator = this.loadApng(imageUrl).apply {
127116
onLoaded {
128117
setOnAnimationLoopListener {
129118
// Log.e("app-test", "onLoop")

0 commit comments

Comments
 (0)