diff --git a/AnimatedImages/.gitignore b/AnimatedImages/.gitignore new file mode 100644 index 0000000..2b75303 --- /dev/null +++ b/AnimatedImages/.gitignore @@ -0,0 +1,13 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/AnimatedImages/.idea/codeStyles/Project.xml b/AnimatedImages/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..30aa626 --- /dev/null +++ b/AnimatedImages/.idea/codeStyles/Project.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AnimatedImages/.idea/gradle.xml b/AnimatedImages/.idea/gradle.xml new file mode 100644 index 0000000..2996d53 --- /dev/null +++ b/AnimatedImages/.idea/gradle.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/AnimatedImages/.idea/misc.xml b/AnimatedImages/.idea/misc.xml new file mode 100644 index 0000000..af0bbdd --- /dev/null +++ b/AnimatedImages/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/AnimatedImages/.idea/runConfigurations.xml b/AnimatedImages/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/AnimatedImages/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/AnimatedImages/.idea/vcs.xml b/AnimatedImages/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/AnimatedImages/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AnimatedImages/app/.gitignore b/AnimatedImages/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/AnimatedImages/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/AnimatedImages/app/build.gradle b/AnimatedImages/app/build.gradle new file mode 100644 index 0000000..2671174 --- /dev/null +++ b/AnimatedImages/app/build.gradle @@ -0,0 +1,28 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 28 + defaultConfig { + applicationId "com.rybarstudios.animatedimages" + minSdkVersion 28 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.android.support.constraint:constraint-layout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' +} diff --git a/AnimatedImages/app/proguard-rules.pro b/AnimatedImages/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/AnimatedImages/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/AnimatedImages/app/src/androidTest/java/com/rybarstudios/animatedimages/ExampleInstrumentedTest.java b/AnimatedImages/app/src/androidTest/java/com/rybarstudios/animatedimages/ExampleInstrumentedTest.java new file mode 100644 index 0000000..2803829 --- /dev/null +++ b/AnimatedImages/app/src/androidTest/java/com/rybarstudios/animatedimages/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.rybarstudios.animatedimages; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.rybarstudios.animatedimages", appContext.getPackageName()); + } +} diff --git a/AnimatedImages/app/src/main/AndroidManifest.xml b/AnimatedImages/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..5c17290 --- /dev/null +++ b/AnimatedImages/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AnimatedImages/app/src/main/java/com/rybarstudios/animatedimages/MainActivity.java b/AnimatedImages/app/src/main/java/com/rybarstudios/animatedimages/MainActivity.java new file mode 100644 index 0000000..a25d29c --- /dev/null +++ b/AnimatedImages/app/src/main/java/com/rybarstudios/animatedimages/MainActivity.java @@ -0,0 +1,62 @@ +package com.rybarstudios.animatedimages; + +import android.graphics.drawable.AnimatedImageDrawable; +import android.graphics.drawable.AnimationDrawable; +import android.graphics.drawable.Drawable; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ImageView; +import android.widget.Spinner; + +public class MainActivity extends AppCompatActivity { + + ImageView mImageView; + Spinner mSpinner; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + mImageView = findViewById(R.id.image_view); + mImageView.setImageDrawable(getDrawable(R.drawable.space)); + ((AnimatedImageDrawable)mImageView.getDrawable()).start(); + + + mSpinner = findViewById(R.id.image_selector); + mSpinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + String selectedText = mSpinner.getSelectedItem().toString(); + final String[] stringArray = getResources().getStringArray(R.array.resource_list); + + if (selectedText.equals(stringArray[0])) { + mImageView.setImageDrawable(getDrawable(R.drawable.space)); + } else if (selectedText.equals(stringArray[1])) { + mImageView.setImageDrawable(getDrawable(R.drawable.gatsby)); + } + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + + findViewById(R.id.start_button).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Drawable drawable = mImageView.getDrawable(); + if(drawable instanceof AnimatedImageDrawable) { + ((AnimatedImageDrawable) drawable).start(); + } else if (drawable instanceof AnimationDrawable) { + ((AnimationDrawable) drawable).start(); + } + } + }); + + } +} diff --git a/AnimatedImages/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/AnimatedImages/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..1f6bb29 --- /dev/null +++ b/AnimatedImages/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby.xml b/AnimatedImages/app/src/main/res/drawable/gatsby.xml new file mode 100644 index 0000000..ac63f59 --- /dev/null +++ b/AnimatedImages/app/src/main/res/drawable/gatsby.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_01.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_01.gif new file mode 100755 index 0000000..d5783b0 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_01.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_02.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_02.gif new file mode 100755 index 0000000..fe1d83d Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_02.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_03.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_03.gif new file mode 100755 index 0000000..de18b68 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_03.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_04.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_04.gif new file mode 100755 index 0000000..8a924d1 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_04.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_05.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_05.gif new file mode 100755 index 0000000..b25e601 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_05.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_06.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_06.gif new file mode 100755 index 0000000..113b6e0 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_06.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_07.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_07.gif new file mode 100755 index 0000000..e7bf82e Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_07.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_08.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_08.gif new file mode 100755 index 0000000..49d506a Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_08.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_09.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_09.gif new file mode 100755 index 0000000..d9c8988 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_09.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_10.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_10.gif new file mode 100755 index 0000000..8004559 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_10.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_11.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_11.gif new file mode 100755 index 0000000..9c428c4 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_11.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_12.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_12.gif new file mode 100755 index 0000000..023a1c4 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_12.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_13.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_13.gif new file mode 100755 index 0000000..f57ab95 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_13.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_14.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_14.gif new file mode 100755 index 0000000..db02579 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_14.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/gatsby_frame_15.gif b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_15.gif new file mode 100755 index 0000000..1622eaf Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/gatsby_frame_15.gif differ diff --git a/AnimatedImages/app/src/main/res/drawable/ic_launcher_background.xml b/AnimatedImages/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..0d025f9 --- /dev/null +++ b/AnimatedImages/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AnimatedImages/app/src/main/res/drawable/space.gif b/AnimatedImages/app/src/main/res/drawable/space.gif new file mode 100644 index 0000000..6929826 Binary files /dev/null and b/AnimatedImages/app/src/main/res/drawable/space.gif differ diff --git a/AnimatedImages/app/src/main/res/layout/activity_main.xml b/AnimatedImages/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..6c70159 --- /dev/null +++ b/AnimatedImages/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,43 @@ + + + + + + + +