Experimental animation fix

This commit is contained in:
Yink 2017-03-09 02:58:12 +01:00
parent 6606b08ca5
commit 9a2ef7e4d1
1 changed files with 19 additions and 1 deletions

View File

@ -24,6 +24,15 @@ public class LaunchActivity extends AppCompatActivity {
Boolean isPressed = false;
SharedPreferences sharedPreferences;
MediaPlayer m;
int i = 0;
int id;
int duration = 20;
Runnable aniRunnable = new Runnable() {
public void run() {
imageViewLogo.setImageDrawable((getResources().getDrawable(id)));
animate(imageViewLogo);
}
};
private static boolean isAppInstalled(Context context, String packageName) {
try {
@ -34,6 +43,15 @@ public class LaunchActivity extends AppCompatActivity {
}
}
protected void animate(ImageView view) {
if (i < 39) {
i += 1;
String imgName = "logo" + Integer.toString(i);
id = getResources().getIdentifier(imgName, "drawable", getPackageName());
view.postDelayed(aniRunnable, duration);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -49,7 +67,7 @@ public class LaunchActivity extends AppCompatActivity {
/*logo = (AnimationDrawable) imageViewLogo.getDrawable();
logo.start();*/
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
animate(imageViewLogo);
if (!isAppInstalled(LaunchActivity.this, "com.google.android.googlequicksearchbox")) {
status.setText(R.string.google_app_error);
}