diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
new file mode 100644
index 000000000..bdcdf3122
Binary files /dev/null and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 000000000..30aa626c2
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 000000000..7ac24c777
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 000000000..cb9718101
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 000000000..41b994a12
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 000000000..7f68460d8
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 000000000..94a25f7f4
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_animated_vector_drawable_25_3_1_aar.xml b/app/.idea/libraries/Gradle__com_android_support_animated_vector_drawable_25_3_1_aar.xml
new file mode 100644
index 000000000..52d22b63d
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_animated_vector_drawable_25_3_1_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_appcompat_v7_25_3_1_aar.xml b/app/.idea/libraries/Gradle__com_android_support_appcompat_v7_25_3_1_aar.xml
new file mode 100644
index 000000000..9f2430522
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_appcompat_v7_25_3_1_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_support_annotations_25_3_1_jar.xml b/app/.idea/libraries/Gradle__com_android_support_support_annotations_25_3_1_jar.xml
new file mode 100644
index 000000000..dcf7af738
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_support_annotations_25_3_1_jar.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_support_compat_25_3_1_aar.xml b/app/.idea/libraries/Gradle__com_android_support_support_compat_25_3_1_aar.xml
new file mode 100644
index 000000000..e14fd0fbc
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_support_compat_25_3_1_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_support_core_ui_25_3_1_aar.xml b/app/.idea/libraries/Gradle__com_android_support_support_core_ui_25_3_1_aar.xml
new file mode 100644
index 000000000..e0ab691b9
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_support_core_ui_25_3_1_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_support_core_utils_25_3_1_aar.xml b/app/.idea/libraries/Gradle__com_android_support_support_core_utils_25_3_1_aar.xml
new file mode 100644
index 000000000..662c80998
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_support_core_utils_25_3_1_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_support_fragment_25_3_1_aar.xml b/app/.idea/libraries/Gradle__com_android_support_support_fragment_25_3_1_aar.xml
new file mode 100644
index 000000000..e4da45f40
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_support_fragment_25_3_1_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_support_media_compat_25_3_1_aar.xml b/app/.idea/libraries/Gradle__com_android_support_support_media_compat_25_3_1_aar.xml
new file mode 100644
index 000000000..545e22358
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_support_media_compat_25_3_1_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_support_v4_25_3_1_aar.xml b/app/.idea/libraries/Gradle__com_android_support_support_v4_25_3_1_aar.xml
new file mode 100644
index 000000000..76754eff8
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_support_v4_25_3_1_aar.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_support_vector_drawable_25_3_1_aar.xml b/app/.idea/libraries/Gradle__com_android_support_support_vector_drawable_25_3_1_aar.xml
new file mode 100644
index 000000000..97115a81d
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_support_vector_drawable_25_3_1_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_test_espresso_espresso_core_2_2_2_aar.xml b/app/.idea/libraries/Gradle__com_android_support_test_espresso_espresso_core_2_2_2_aar.xml
new file mode 100644
index 000000000..12f2e8fce
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_test_espresso_espresso_core_2_2_2_aar.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_test_espresso_espresso_idling_resource_2_2_2_aar.xml b/app/.idea/libraries/Gradle__com_android_support_test_espresso_espresso_idling_resource_2_2_2_aar.xml
new file mode 100644
index 000000000..53fb67954
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_test_espresso_espresso_idling_resource_2_2_2_aar.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_test_exposed_instrumentation_api_publish_0_5_aar.xml b/app/.idea/libraries/Gradle__com_android_support_test_exposed_instrumentation_api_publish_0_5_aar.xml
new file mode 100644
index 000000000..e8ded71b4
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_test_exposed_instrumentation_api_publish_0_5_aar.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_test_rules_0_5_aar.xml b/app/.idea/libraries/Gradle__com_android_support_test_rules_0_5_aar.xml
new file mode 100644
index 000000000..1e9bfbee1
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_test_rules_0_5_aar.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/libraries/Gradle__com_android_support_test_runner_0_5_aar.xml b/app/.idea/libraries/Gradle__com_android_support_test_runner_0_5_aar.xml
new file mode 100644
index 000000000..4a0744c43
--- /dev/null
+++ b/app/.idea/libraries/Gradle__com_android_support_test_runner_0_5_aar.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 2bfbc18e0..d3019ba63 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 25
- buildToolsVersion "25.0.2"
+ buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.android.android_me"
minSdkVersion 16
@@ -20,10 +20,11 @@ android {
}
dependencies {
+ implementation 'com.android.support:support-v4:25.3.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:25.3.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- compile 'com.android.support:appcompat-v7:25.1.0'
testCompile 'junit:junit:4.12'
}
diff --git a/app/gradle/wrapper/gradle-wrapper.jar b/app/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 000000000..f6b961fd5
Binary files /dev/null and b/app/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/app/gradle/wrapper/gradle-wrapper.properties b/app/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..00b75293f
--- /dev/null
+++ b/app/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Jun 01 09:59:33 IST 2020
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
diff --git a/app/gradlew b/app/gradlew
new file mode 100644
index 000000000..cccdd3d51
--- /dev/null
+++ b/app/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/app/local.properties b/app/local.properties
new file mode 100644
index 000000000..0acdce5d8
--- /dev/null
+++ b/app/local.properties
@@ -0,0 +1,8 @@
+## This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+#Mon Jun 01 09:59:31 IST 2020
+sdk.dir=C\:\\Users\\tjoseph\\AppData\\Local\\Android\\Sdk
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c9a63ea85..7bb589285 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -8,6 +8,16 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/example/android/android_me/ui/AndroidMeActivity.java b/app/src/main/java/com/example/android/android_me/ui/AndroidMeActivity.java
index 7e5d243b0..8ed2c117c 100644
--- a/app/src/main/java/com/example/android/android_me/ui/AndroidMeActivity.java
+++ b/app/src/main/java/com/example/android/android_me/ui/AndroidMeActivity.java
@@ -1,44 +1,80 @@
/*
-* Copyright (C) 2017 The Android Open Source Project
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.example.android.android_me.ui;
-import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import android.os.PersistableBundle;
+import android.support.v4.app.FragmentManager;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.widget.Toast;
import com.example.android.android_me.R;
+import com.example.android.android_me.data.AndroidImageAssets;
// This activity will display a custom Android image composed of three body parts: head, body, and legs
public class AndroidMeActivity extends AppCompatActivity {
// TODO (1) Create a layout file that displays one body part image named fragment_body_part.xml
- // This layout should contain a single ImageView
-
+ // This layout should contain a single ImageView
+ private static final String TAG = "AndroidMeActivity";
// TODO (2) Create a new class called BodyPartFragment to display an image of an Android-Me body part
- // In this class, you'll need to implement an empty constructor and the onCreateView method
- // TODO (3) Show the first image in the list of head images
- // Soon, you'll update this image display code to show any image you want
-
-
+ // In this class, you'll need to implement an empty constructor and the onCreateView method
+ // TODO (3) Show the first image in the list of head images
+ // Soon, you'll update this image display code to show any image you want
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_android_me);
- // TODO (5) Create a new BodyPartFragment instance and display it using the FragmentManager
+ Log.d(TAG, "OnCreate... "+getIntent());
+
+ /*Toast.makeText(this, "OnCreate.. head"+getIntent().getIntExtra("head", 0)
+ +"body: "+getIntent().getIntExtra("body", 0)
+ +"leg: "+getIntent().getIntExtra("leg", 0)
+ +"\n"+getIntent(), Toast.LENGTH_SHORT).show();*/
+
+ if(savedInstanceState == null) {
+ BodyPartFragment headFragment = new BodyPartFragment();
+ BodyPartFragment bodyFragment = new BodyPartFragment();
+ BodyPartFragment legsFragment = new BodyPartFragment();
+
+ headFragment.setImageList(AndroidImageAssets.getHeads());
+ headFragment.setImageIndex(getIntent().getIntExtra("head", 0));
+ FragmentManager fragmentManager = getSupportFragmentManager();
+
+ Log.d(TAG, "fragment? " + headFragment.isAdded());
+
+ fragmentManager.beginTransaction()
+ .add(R.id.fragment_container_head, headFragment)
+ .commit();
+
+ bodyFragment.setImageList(AndroidImageAssets.getBodies());
+ bodyFragment.setImageIndex(getIntent().getIntExtra("body", 0));
+ fragmentManager.beginTransaction()
+ .add(R.id.fragment_container_body, bodyFragment)
+ .commit();
+
+ legsFragment.setImageList(AndroidImageAssets.getLegs());
+ legsFragment.setImageIndex(getIntent().getIntExtra("leg", 0));
+ fragmentManager.beginTransaction()
+ .add(R.id.fragment_container_legs, legsFragment)
+ .commit();
+ }
}
}
diff --git a/app/src/main/java/com/example/android/android_me/ui/BodyPartFragment.java b/app/src/main/java/com/example/android/android_me/ui/BodyPartFragment.java
new file mode 100644
index 000000000..4bcf8aa84
--- /dev/null
+++ b/app/src/main/java/com/example/android/android_me/ui/BodyPartFragment.java
@@ -0,0 +1,83 @@
+package com.example.android.android_me.ui;
+
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+
+import com.example.android.android_me.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A simple {@link Fragment} subclass.
+ */
+public class BodyPartFragment extends Fragment {
+
+ public static final String TAG = "BodyPartFragment";
+
+ private static final String BUNDLE_TAG_IMG_PTR = "img_ptr";
+ private static final String BUNDLE_TAG_IMG_RES_IDs = "img_res_ids";
+
+ private List mImgResIds;
+ private int mImgPtr;
+
+ private boolean newly = true;
+
+ public BodyPartFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ if(newly){
+ newly = false;
+ }
+ View rootView = inflater.inflate(R.layout.fragment_body_part, container, false);
+ final ImageView img = (ImageView)rootView.findViewById(R.id.frame_layout_img);
+
+ Log.d(TAG, "onCreateView.. "+savedInstanceState);
+
+ if(savedInstanceState != null) {
+ mImgPtr = savedInstanceState.getInt(BUNDLE_TAG_IMG_PTR);
+ mImgResIds = savedInstanceState.getIntegerArrayList(BUNDLE_TAG_IMG_RES_IDs);
+ }
+
+ if (mImgResIds != null) {
+ img.setImageResource(mImgResIds.get(mImgPtr));
+ } else {
+ Log.d(TAG, "Image resources are not set! Pls check setImageList api");
+ }
+ img.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ mImgPtr = (mImgPtr+1)%mImgResIds.size();
+ img.setImageResource(mImgResIds.get(mImgPtr));
+ Log.d(TAG, "onClickListener.. "+mImgPtr);
+ }
+ });
+ return rootView;
+ }
+
+ public void setImageList(List imageIds){
+ mImgResIds = imageIds;
+ }
+
+ public void setImageIndex(int index){
+ mImgPtr = index;
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ Log.d(TAG, "onSaveInstanceState.. Ptr: "+mImgPtr);
+ outState.putInt(BUNDLE_TAG_IMG_PTR, mImgPtr);
+ outState.putIntegerArrayList(BUNDLE_TAG_IMG_RES_IDs, (ArrayList)mImgResIds);
+ //super.onSaveInstanceState(outState);
+ }
+}
diff --git a/app/src/main/java/com/example/android/android_me/ui/MasterListActivity.java b/app/src/main/java/com/example/android/android_me/ui/MasterListActivity.java
new file mode 100644
index 000000000..bc16d0438
--- /dev/null
+++ b/app/src/main/java/com/example/android/android_me/ui/MasterListActivity.java
@@ -0,0 +1,125 @@
+package com.example.android.android_me.ui;
+
+import android.app.FragmentTransaction;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.View;
+import android.widget.Toast;
+
+import com.example.android.android_me.R;
+import com.example.android.android_me.data.AndroidImageAssets;
+
+public class MasterListActivity extends AppCompatActivity implements MasterListFragment.IOnGridImageClickListener {
+
+ Context context = this;
+ boolean tabMode = false;
+ private static final String TAG = "MasterListActivity";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_master_list);
+
+ if (savedInstanceState == null) {
+ MasterListFragment frag = new MasterListFragment();
+ frag.createMasterListFragment(this, AndroidImageAssets.getAll());
+ tabMode = (null != findViewById(R.id.tablet_frame_grid_view_lay));
+ if (tabMode) {
+ getSupportFragmentManager().beginTransaction().add(R.id.tablet_frame_grid_view_lay, frag).commit();
+
+ BodyPartFragment headFragment = new BodyPartFragment();
+ BodyPartFragment bodyFragment = new BodyPartFragment();
+ BodyPartFragment legsFragment = new BodyPartFragment();
+
+ headFragment.setImageList(AndroidImageAssets.getHeads());
+ headFragment.setImageIndex(getIntent().getIntExtra("head", 0));
+ FragmentManager fragmentManager = getSupportFragmentManager();
+
+ Log.d(TAG, "fragment? " + headFragment.isAdded());
+
+ fragmentManager.beginTransaction()
+ .add(R.id.fragment_container_head, headFragment)
+ .commit();
+
+ bodyFragment.setImageList(AndroidImageAssets.getBodies());
+ bodyFragment.setImageIndex(getIntent().getIntExtra("body", 0));
+ fragmentManager.beginTransaction()
+ .add(R.id.fragment_container_body, bodyFragment)
+ .commit();
+
+ legsFragment.setImageList(AndroidImageAssets.getLegs());
+ legsFragment.setImageIndex(getIntent().getIntExtra("leg", 0));
+ fragmentManager.beginTransaction()
+ .add(R.id.fragment_container_legs, legsFragment)
+ .commit();
+ } else {
+
+ getSupportFragmentManager().beginTransaction().add(R.id.master_list_activity_layout, frag).commit();
+ }
+ }
+ }
+
+ private int headIndex = 0;
+ private int bodyIndex = 0;
+ private int legIndex = 0;
+
+ @Override
+ public void onImageSelected(int position) {
+ int group = position / 12;
+ int index = position % 12;
+ if (tabMode) {
+
+ }
+ switch (group) {
+ case 0:
+ headIndex = index;
+ if (tabMode) {
+ BodyPartFragment newFrag = new BodyPartFragment();
+ newFrag.setImageList(AndroidImageAssets.getHeads());
+ newFrag.setImageIndex(index);
+ getSupportFragmentManager().beginTransaction()
+ .replace(R.id.fragment_container_head, newFrag)
+ .commit();
+ }
+ break;
+ case 1:
+ bodyIndex = index;
+ if (tabMode) {
+ BodyPartFragment newFrag = new BodyPartFragment();
+ newFrag.setImageList(AndroidImageAssets.getBodies());
+ newFrag.setImageIndex(index);
+ getSupportFragmentManager().beginTransaction()
+ .replace(R.id.fragment_container_body, newFrag)
+ .commit();
+ }
+ break;
+ case 2:
+ legIndex = index;
+ if (tabMode) {
+ BodyPartFragment newFrag = new BodyPartFragment();
+ newFrag.setImageList(AndroidImageAssets.getLegs());
+ newFrag.setImageIndex(index);
+ getSupportFragmentManager().beginTransaction()
+ .replace(R.id.fragment_container_legs, newFrag)
+ .commit();
+ }
+ break;
+ default:
+ }
+// Toast.makeText(context, group+" "+index+" Grid item clicked {"+headIndex+","+bodyIndex+","+legIndex+"}", Toast.LENGTH_SHORT).show();
+ }
+
+ public void launchAndroidMe(View view) {
+ Intent intent = new Intent(context, AndroidMeActivity.class);
+ intent.putExtra("head", headIndex);
+ intent.putExtra("body", bodyIndex);
+ intent.putExtra("leg", legIndex);
+ startActivity(intent);
+// Toast.makeText(context, "Starting activity... {"+headIndex+","+bodyIndex+","+legIndex+"}", Toast.LENGTH_SHORT).show();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/android/android_me/ui/MasterListFragment.java b/app/src/main/java/com/example/android/android_me/ui/MasterListFragment.java
new file mode 100644
index 000000000..bec93b721
--- /dev/null
+++ b/app/src/main/java/com/example/android/android_me/ui/MasterListFragment.java
@@ -0,0 +1,103 @@
+package com.example.android.android_me.ui;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.GridView;
+
+import com.example.android.android_me.R;
+
+import java.util.List;
+
+/**
+ * A simple {@link Fragment} subclass.
+ * Use the {@link MasterListFragment#newInstance} factory method to
+ * create an instance of this fragment.
+ */
+public class MasterListFragment extends Fragment {
+
+ // TODO: Rename parameter arguments, choose names that match
+ // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+ private static final String ARG_PARAM1 = "param1";
+ private static final String ARG_PARAM2 = "param2";
+
+ // TODO: Rename and change types of parameters
+ private String mParam1;
+ private String mParam2;
+
+ MasterListAdapter masterListAdapter;
+ IOnGridImageClickListener mCallback;
+
+ interface IOnGridImageClickListener{
+ void onImageSelected(int position);
+ }
+
+ public MasterListFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ if(context instanceof IOnGridImageClickListener){
+ mCallback = (IOnGridImageClickListener)context;
+ }else{
+ throw new IllegalStateException("Activity has not implemented IOnGridImageClickListener intf.");
+ }
+ }
+
+ public void createMasterListFragment(Context ctx, List imgResIds){
+ masterListAdapter = new MasterListAdapter(ctx, imgResIds);
+ }
+
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment MasterListFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ public static MasterListFragment newInstance(String param1, String param2) {
+ MasterListFragment fragment = new MasterListFragment();
+ Bundle args = new Bundle();
+ args.putString(ARG_PARAM1, param1);
+ args.putString(ARG_PARAM2, param2);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ mParam1 = getArguments().getString(ARG_PARAM1);
+ mParam2 = getArguments().getString(ARG_PARAM2);
+ }
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View rootView = inflater.inflate(R.layout.fragment_master_list, container, false);
+ if(savedInstanceState == null) {
+ GridView gridView = (GridView) rootView.findViewById(R.id.fragmen_grid_view);
+ gridView.setAdapter(masterListAdapter);
+ gridView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ if(null != mCallback){
+ mCallback.onImageSelected(position);
+ }
+ }
+ });
+ }
+ return rootView;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout-sw600dp/activity_master_list.xml b/app/src/main/res/layout-sw600dp/activity_master_list.xml
new file mode 100644
index 000000000..2c722e5ec
--- /dev/null
+++ b/app/src/main/res/layout-sw600dp/activity_master_list.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_android_me.xml b/app/src/main/res/layout/activity_android_me.xml
index 71bd30adb..1c7482295 100644
--- a/app/src/main/res/layout/activity_android_me.xml
+++ b/app/src/main/res/layout/activity_android_me.xml
@@ -32,8 +32,22 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_master_list.xml b/app/src/main/res/layout/activity_master_list.xml
new file mode 100644
index 000000000..769ce783d
--- /dev/null
+++ b/app/src/main/res/layout/activity_master_list.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_body_part.xml b/app/src/main/res/layout/fragment_body_part.xml
new file mode 100644
index 000000000..9175c3fe0
--- /dev/null
+++ b/app/src/main/res/layout/fragment_body_part.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_master_list.xml b/app/src/main/res/layout/fragment_master_list.xml
new file mode 100644
index 000000000..c497cfbd7
--- /dev/null
+++ b/app/src/main/res/layout/fragment_master_list.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 630c78ca7..0db93737a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,3 +1,7 @@
Android_Me
+
+
+ Hello blank fragment
+ MasterListActivity
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 5885930df..545b9c6d2 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -8,4 +8,13 @@
- @color/colorAccent
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
index 74b2ab0dd..66652e64b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,10 +3,10 @@
buildscript {
repositories {
jcenter()
+ google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.3'
-
+ classpath 'com.android.tools.build:gradle:4.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
@@ -15,6 +15,7 @@ buildscript {
allprojects {
repositories {
jcenter()
+ google()
}
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 04e285f34..241e54359 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Dec 28 10:00:20 PST 2015
+#Sun May 31 17:00:22 IST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip