Поддержка анимации переходов для фоновых изображений

This commit is contained in:
Victor 2015-05-03 22:10:57 +03:00
parent 9ac6c371ef
commit 656af4ae39
2 changed files with 6 additions and 6 deletions

View File

@ -4,7 +4,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/black" > android:background="@android:color/black" >
<ImageView <com.annimon.everlastingsummer.AnimatableImageView
android:id="@+id/background" android:id="@+id/background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -56,7 +56,7 @@ public final class ViewActivity extends Activity implements TouchGesture.OnTouch
private String scriptPath; private String scriptPath;
private String backgroundName, backgroundType; private String backgroundName, backgroundType;
private ImageView background; private AnimatableImageView background;
private FrameLayout container; private FrameLayout container;
private TextView textview; private TextView textview;
private MediaPlayer musicPlayer, soundPlayer; private MediaPlayer musicPlayer, soundPlayer;
@ -84,7 +84,7 @@ public final class ViewActivity extends Activity implements TouchGesture.OnTouch
setContentView(R.layout.main); setContentView(R.layout.main);
instance = this; instance = this;
background = (ImageView) findViewById(R.id.background); background = (AnimatableImageView) findViewById(R.id.background);
container = (FrameLayout) findViewById(R.id.container); container = (FrameLayout) findViewById(R.id.container);
textview = (TextView) findViewById(R.id.text); textview = (TextView) findViewById(R.id.text);
@ -285,11 +285,11 @@ public final class ViewActivity extends Activity implements TouchGesture.OnTouch
backgroundName = name; backgroundName = name;
text(""); text("");
spritesClear(); spritesClear();
if (name.equalsIgnoreCase("black")) background.setImageResource(android.R.color.black); if (name.equalsIgnoreCase("black")) background.setImageResource(android.R.color.black, effect);
else if (name.equalsIgnoreCase("white")) background.setImageResource(android.R.color.white); else if (name.equalsIgnoreCase("white")) background.setImageResource(android.R.color.white, effect);
else { else {
try { try {
background.setImageBitmap(IOUtil.readBitmap(PathResolver.background(type, name))); background.setImageBitmap(IOUtil.readBitmap(PathResolver.background(type, name)), effect);
} catch (Exception ioe) { } catch (Exception ioe) {
if (Logger.DEBUG) Logger.log("background: " + type + ", " + name, ioe); if (Logger.DEBUG) Logger.log("background: " + type + ", " + name, ioe);
background.setImageResource(android.R.color.black); background.setImageResource(android.R.color.black);