diff --git a/GoA_Assignment/.DS_Store b/GoA_Assignment/.DS_Store new file mode 100644 index 0000000..1b04c53 Binary files /dev/null and b/GoA_Assignment/.DS_Store differ diff --git a/GoA_Assignment/ImagesApp/.gitignore b/GoA_Assignment/ImagesApp/.gitignore new file mode 100644 index 0000000..603b140 --- /dev/null +++ b/GoA_Assignment/ImagesApp/.gitignore @@ -0,0 +1,14 @@ +*.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 +.cxx diff --git a/GoA_Assignment/ImagesApp/.idea/.name b/GoA_Assignment/ImagesApp/.idea/.name new file mode 100644 index 0000000..a03531e --- /dev/null +++ b/GoA_Assignment/ImagesApp/.idea/.name @@ -0,0 +1 @@ +Images App \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/.idea/codeStyles/Project.xml b/GoA_Assignment/ImagesApp/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/GoA_Assignment/ImagesApp/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/.idea/gradle.xml b/GoA_Assignment/ImagesApp/.idea/gradle.xml new file mode 100644 index 0000000..ac6b0ae --- /dev/null +++ b/GoA_Assignment/ImagesApp/.idea/gradle.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/.idea/jarRepositories.xml b/GoA_Assignment/ImagesApp/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/GoA_Assignment/ImagesApp/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/.idea/misc.xml b/GoA_Assignment/ImagesApp/.idea/misc.xml new file mode 100644 index 0000000..37a7509 --- /dev/null +++ b/GoA_Assignment/ImagesApp/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/.idea/render.experimental.xml b/GoA_Assignment/ImagesApp/.idea/render.experimental.xml new file mode 100644 index 0000000..8ec256a --- /dev/null +++ b/GoA_Assignment/ImagesApp/.idea/render.experimental.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/.idea/runConfigurations.xml b/GoA_Assignment/ImagesApp/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/GoA_Assignment/ImagesApp/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/app/.gitignore b/GoA_Assignment/ImagesApp/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/GoA_Assignment/ImagesApp/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/app/build.gradle b/GoA_Assignment/ImagesApp/app/build.gradle new file mode 100644 index 0000000..b31509a --- /dev/null +++ b/GoA_Assignment/ImagesApp/app/build.gradle @@ -0,0 +1,34 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.3" + + defaultConfig { + applicationId "com.example.imagesapp" + minSdkVersion 16 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + implementation 'com.google.android:flexbox:2.0.1' + +} \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/app/proguard-rules.pro b/GoA_Assignment/ImagesApp/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/GoA_Assignment/ImagesApp/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 \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/app/src/androidTest/java/com/example/imagesapp/ExampleInstrumentedTest.java b/GoA_Assignment/ImagesApp/app/src/androidTest/java/com/example/imagesapp/ExampleInstrumentedTest.java new file mode 100644 index 0000000..c9e51be --- /dev/null +++ b/GoA_Assignment/ImagesApp/app/src/androidTest/java/com/example/imagesapp/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.imagesapp; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext(); + assertEquals("com.example.imagesapp", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/app/src/main/AndroidManifest.xml b/GoA_Assignment/ImagesApp/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..990b924 --- /dev/null +++ b/GoA_Assignment/ImagesApp/app/src/main/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/app/src/main/java/com/example/imagesapp/ItemActivity.java b/GoA_Assignment/ImagesApp/app/src/main/java/com/example/imagesapp/ItemActivity.java new file mode 100644 index 0000000..eb53fe7 --- /dev/null +++ b/GoA_Assignment/ImagesApp/app/src/main/java/com/example/imagesapp/ItemActivity.java @@ -0,0 +1,43 @@ +package com.example.imagesapp; + +import androidx.appcompat.app.AppCompatActivity; + +import android.widget.ImageButton; +import android.widget.ImageView; +import android.content.Intent; +import android.widget.Button; +import android.view.View; + +import android.os.Bundle; + +//This code opens the correct image the user clicked on +public class ItemActivity extends AppCompatActivity { + ImageView mPuppy; + Button mButton; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_item); + + final int mPuppyImg[] = {R.drawable.puppy1, R.drawable.puppy2, R.drawable.puppy3, + R.drawable.puppy6, R.drawable.puppy4}; + + mPuppy = (ImageView) findViewById(R.id.puppy); + + Intent mIntent = getIntent(); + //Based on the integer recieved, it uses the "mPuppyImg" array to set the right image + int mPuppyType = mIntent.getIntExtra("puppyType", 0); + mPuppy.setImageResource(mPuppyImg[mPuppyType]); + + //The button closes the enlarged image screen and returns to the list of images + mButton = (Button) findViewById(R.id.button); + mButton.setOnClickListener(new View.OnClickListener() { + + public void onClick(View v) { + Intent mIntent = new Intent(ItemActivity.this, MainActivity.class); + startActivity(mIntent); + } + }); + } +} \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/app/src/main/java/com/example/imagesapp/MainActivity.java b/GoA_Assignment/ImagesApp/app/src/main/java/com/example/imagesapp/MainActivity.java new file mode 100644 index 0000000..b149926 --- /dev/null +++ b/GoA_Assignment/ImagesApp/app/src/main/java/com/example/imagesapp/MainActivity.java @@ -0,0 +1,62 @@ +package com.example.imagesapp; + +import androidx.appcompat.app.AppCompatActivity; +import android.view.View; +import android.content.Intent; +import android.widget.ImageButton; + +import android.os.Bundle; + +//This code allows the user to select any image shown on the screen +public class MainActivity extends AppCompatActivity implements View.OnClickListener{ + ImageButton mPuppy1; + ImageButton mPuppy2; + ImageButton mPuppy3; + ImageButton mPuppy4; + ImageButton mPuppy5; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + //Initializes each imageButton object shown on screen + mPuppy1 = (ImageButton) findViewById(R.id.puppy1); + mPuppy2 = (ImageButton) findViewById(R.id.puppy2); + mPuppy3 = (ImageButton) findViewById(R.id.puppy3); + mPuppy4 = (ImageButton) findViewById(R.id.puppy4); + mPuppy5 = (ImageButton) findViewById(R.id.puppy5); + + //Allows the user to click on every image + mPuppy1.setOnClickListener(this); + mPuppy2.setOnClickListener(this); + mPuppy3.setOnClickListener(this); + mPuppy4.setOnClickListener(this); + mPuppy5.setOnClickListener(this); + } + + /* Method allows the user to + * select an image and then + * it starts a new activity + * that shows the enlarged + * version of the selected image + */ + public void onClick(View v) { + ImageButton mImgButton[] = {mPuppy1, mPuppy2, mPuppy3, mPuppy4, mPuppy5}; + String image[] = {"puppy1", "puppy2", "puppy3", "puppy4", "puppy5"}; + + Intent mIntent = new Intent(MainActivity.this, ItemActivity.class); + //Once an image is clicked, the code loops through the "mImgButton" arrray + //to find the desired image and start the other activity + for(int i = 0; i < mImgButton.length; i++) { + + if (v.getId() == mImgButton[i].getId()) { + //Sends a specific integer to the new activity to open the right image + mIntent.putExtra("puppyType", i); + startActivity(mIntent); + break; + } + + } + } +} \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/GoA_Assignment/ImagesApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/GoA_Assignment/ImagesApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/GoA_Assignment/ImagesApp/app/src/main/res/drawable/ic_launcher_background.xml b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy1.jpg b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy1.jpg new file mode 100644 index 0000000..5d28215 Binary files /dev/null and b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy1.jpg differ diff --git a/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy2.jpeg b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy2.jpeg new file mode 100644 index 0000000..aed5841 Binary files /dev/null and b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy2.jpeg differ diff --git a/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy3.jpg b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy3.jpg new file mode 100644 index 0000000..dcb4565 Binary files /dev/null and b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy3.jpg differ diff --git a/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy4.jpg b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy4.jpg new file mode 100644 index 0000000..631bbbf Binary files /dev/null and b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy4.jpg differ diff --git a/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy5.jpg b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy5.jpg new file mode 100644 index 0000000..1085b60 Binary files /dev/null and b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy5.jpg differ diff --git a/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy6.jpg b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy6.jpg new file mode 100644 index 0000000..ff855e7 Binary files /dev/null and b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy6.jpg differ diff --git a/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy7.jpg b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy7.jpg new file mode 100644 index 0000000..42c2b34 Binary files /dev/null and b/GoA_Assignment/ImagesApp/app/src/main/res/drawable/puppy7.jpg differ diff --git a/GoA_Assignment/ImagesApp/app/src/main/res/layout/activity_item.xml b/GoA_Assignment/ImagesApp/app/src/main/res/layout/activity_item.xml new file mode 100644 index 0000000..d6ff108 --- /dev/null +++ b/GoA_Assignment/ImagesApp/app/src/main/res/layout/activity_item.xml @@ -0,0 +1,33 @@ + + + + + +