Created
June 18, 2013 07:04
-
-
Save Teddy-Schmitz/5803234 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onDreamingStarted() { | |
super.onDreamingStarted(); | |
galaxy = (ImageView) findViewById(R.id.galaxyView); | |
mHandler.postDelayed(pictureChange, PICTURE_CHANGE_TIME); | |
int rndInt = rand.nextInt(PICTURE_RAND_NUM); | |
int imgId = imageResIds[rndInt]; | |
String imgName = Integer.toString(imgId); | |
galaxy.setImageDrawable(getResources().getDrawable(imgId)); | |
} | |
private Runnable pictureChange = new Runnable() { | |
@Override | |
public void run() { | |
int rndInt = rand.nextInt(PICTURE_RAND_NUM) + 1; | |
int imgId = imageResIds[rndInt]; | |
String imgName = Integer.toString(imgId); | |
Drawable[] ids = { galaxy.getDrawable(), getResources().getDrawable(imgId) }; | |
TransitionDrawable mTransition = new TransitionDrawable(ids); | |
mTransition.setCrossFadeEnabled(true); | |
mTransition.startTransition(5000); | |
galaxy.setImageDrawable(mTransition); | |
mHandler.postDelayed(this, PICTURE_CHANGE_TIME); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment