parent
2ee343a403
commit
d9a592902a
|
@ -96,7 +96,7 @@ class CreatorActivity : AppCompatActivity() {
|
|||
val f = File(filesDir, "images/apng.png").apply {
|
||||
if (!exists()) {
|
||||
parentFile?.mkdirs()
|
||||
println(createNewFile())
|
||||
createNewFile()
|
||||
}
|
||||
}
|
||||
val out = FileOutputStream(f)
|
||||
|
|
|
@ -203,6 +203,5 @@ class MainActivity : AppCompatActivity() {
|
|||
shapePath.lineTo(middle + (fabMargin + diamondSize - cradleVerticalOffset), 0f)
|
||||
shapePath.lineTo(length, 0f)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ class ApngDecoderFragment : Fragment() {
|
|||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
// Inflate the layout for this fragment
|
||||
val view = inflater.inflate(R.layout.fragment_apng_decoder, container, false)
|
||||
|
||||
val imageView : ImageView = view.findViewById(R.id.apngDecoderImageView) ?: return view
|
||||
|
@ -53,6 +52,4 @@ class ApngDecoderFragment : Fragment() {
|
|||
|
||||
return view
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class JavaFragment extends Fragment {
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.i(TAG, "onCreateView()");
|
||||
Log.v(TAG, "onCreateView()");
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_java, container, false);
|
||||
|
||||
|
@ -37,18 +37,8 @@ public class JavaFragment extends Fragment {
|
|||
Context context = this.getContext();
|
||||
|
||||
if (imageView != null && context != null) {
|
||||
/*
|
||||
ApngAnimator a = ApngAnimatorKt.loadApng(imageView, imageUrl);
|
||||
a.onLoaded((animator) -> {
|
||||
animator.setOnFrameChangeLister((index) -> {
|
||||
if (index == 0) {
|
||||
Log.i(TAG, "Loop");
|
||||
}
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
*/
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.v(TAG, "Loading " + imageUrl);
|
||||
ApngDecoder.decodeApngAsyncInto(context, imageUrl, imageView, 1f, new ApngDecoder.Callback() {
|
||||
@Override
|
||||
public void onSuccess(@NotNull Drawable drawable) {
|
||||
|
@ -58,12 +48,11 @@ public class JavaFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onError(@NotNull Exception error) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.e(TAG, "Error : " + error.toString());
|
||||
Log.e(TAG, "Error : " + error.toString());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,13 @@ import oupson.apngcreator.R
|
|||
|
||||
|
||||
class KotlinFragment : Fragment() {
|
||||
companion object {
|
||||
private const val TAG = "KotlinFragment"
|
||||
@JvmStatic
|
||||
fun newInstance() =
|
||||
KotlinFragment()
|
||||
}
|
||||
|
||||
private var apngImageView : ImageView? = null
|
||||
private var normalImageView : ImageView? = null
|
||||
|
||||
|
@ -43,8 +50,8 @@ class KotlinFragment : Fragment() {
|
|||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.i(TAG, "onCreateView()")
|
||||
// Inflate the layout for this fragment
|
||||
Log.v(TAG, "onCreateView()")
|
||||
|
||||
val view = inflater.inflate(R.layout.fragment_kotlin, container, false)
|
||||
|
||||
apngImageView = view.findViewById(R.id.ApngImageView)
|
||||
|
@ -61,7 +68,7 @@ class KotlinFragment : Fragment() {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.i(TAG, "onResume()")
|
||||
Log.v(TAG, "onResume()")
|
||||
|
||||
playButton?.setOnClickListener {
|
||||
animator?.play()
|
||||
|
@ -91,13 +98,12 @@ class KotlinFragment : Fragment() {
|
|||
animator = apngImageView?.loadApng(imageUrls[selected])?.apply {
|
||||
onLoaded {
|
||||
setOnFrameChangeLister {
|
||||
// Log.e("app-test", "onLoop")
|
||||
// Log.v("app-test", "onLoop")
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e : Exception) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.e(TAG, "Error : $e")
|
||||
Log.e(TAG, "Error : $e")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +113,7 @@ class KotlinFragment : Fragment() {
|
|||
override fun onPause() {
|
||||
super.onPause()
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.i(TAG, "onPause()")
|
||||
Log.v(TAG, "onPause()")
|
||||
|
||||
animator = null
|
||||
normalImageView?.setImageDrawable(null)
|
||||
|
@ -117,11 +123,4 @@ class KotlinFragment : Fragment() {
|
|||
pauseButton?.setOnClickListener(null)
|
||||
speedSeekBar?.setOnSeekBarChangeListener(null)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "KotlinFragment"
|
||||
@JvmStatic
|
||||
fun newInstance() =
|
||||
KotlinFragment()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue