diff --git a/Week_01_Android_Studio/HelloMe/.idea/misc.xml b/Week_01_Android_Studio/HelloMe/.idea/misc.xml
index 3d21ecd..5d19981 100644
--- a/Week_01_Android_Studio/HelloMe/.idea/misc.xml
+++ b/Week_01_Android_Studio/HelloMe/.idea/misc.xml
@@ -37,7 +37,7 @@
-
+
diff --git a/Week_01_Android_Studio/README.md b/Week_01_Android_Studio/README.md
index 65ff5fe..d3bd4c3 100644
--- a/Week_01_Android_Studio/README.md
+++ b/Week_01_Android_Studio/README.md
@@ -300,7 +300,7 @@ Android studio has built-in version control system (VCS) support. In fact, there
2. Go back to Android Studio, click VCS ==> Enable Version Control Integration..., and select Git as the tool. Now the 'Version Control' tool window will turn from pale to bright colors.
-3. Locate your project title in the left-most position in the navigation bar, right-click on it and select Git ==> Add to add all files in your current project under control o Git. If you look at the 'Local Changes' tab in the 'Version Control' tool window, your 'Unversioned Files' will disappear and all files are under 'Default'.
+3. Locate your project title in the left-most position in the navigation bar, right-click on it and select Git ==> Add to add all files in your current project under control of Git. If you look at the 'Local Changes' tab in the 'Version Control' tool window, your 'Unversioned Files' will disappear and all files are under 'Default'.
![vcs_default](.md_images/vcs_default.png)
diff --git a/Week_02_The_Java_language/.md_images/android.jpg b/Week_02_The_Java_language/.md_images/android.jpg
new file mode 100644
index 0000000..fa56aa0
Binary files /dev/null and b/Week_02_The_Java_language/.md_images/android.jpg differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/bloodhound.png b/Week_02_The_Java_language/.md_images/bloodhound.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/bloodhound.png
rename to Week_02_The_Java_language/.md_images/bloodhound.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/drag.png b/Week_02_The_Java_language/.md_images/drag.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/drag.png
rename to Week_02_The_Java_language/.md_images/drag.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/float.png b/Week_02_The_Java_language/.md_images/float.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/float.png
rename to Week_02_The_Java_language/.md_images/float.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/linear.png b/Week_02_The_Java_language/.md_images/linear.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/linear.png
rename to Week_02_The_Java_language/.md_images/linear.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/mini.png b/Week_02_The_Java_language/.md_images/mini.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/mini.png
rename to Week_02_The_Java_language/.md_images/mini.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/mini_log.png b/Week_02_The_Java_language/.md_images/mini_log.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/mini_log.png
rename to Week_02_The_Java_language/.md_images/mini_log.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/new_class.png b/Week_02_The_Java_language/.md_images/new_class.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/new_class.png
rename to Week_02_The_Java_language/.md_images/new_class.png
diff --git a/Week_02_The_Java_language/.md_images/positioning.png b/Week_02_The_Java_language/.md_images/positioning.png
new file mode 100644
index 0000000..b2e9bc5
Binary files /dev/null and b/Week_02_The_Java_language/.md_images/positioning.png differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/raw_layout.png b/Week_02_The_Java_language/.md_images/raw_layout.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/raw_layout.png
rename to Week_02_The_Java_language/.md_images/raw_layout.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/rearrange.png b/Week_02_The_Java_language/.md_images/rearrange.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/rearrange.png
rename to Week_02_The_Java_language/.md_images/rearrange.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/templates.png b/Week_02_The_Java_language/.md_images/templates.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/templates.png
rename to Week_02_The_Java_language/.md_images/templates.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/vw.png b/Week_02_The_Java_language/.md_images/vw.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/vw.png
rename to Week_02_The_Java_language/.md_images/vw.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/.md_images/vw5.png b/Week_02_The_Java_language/.md_images/vw5.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/.md_images/vw5.png
rename to Week_02_The_Java_language/.md_images/vw5.png
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/.gitignore b/Week_02_The_Java_language/MyVehicle/.gitignore
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/.gitignore
rename to Week_02_The_Java_language/MyVehicle/.gitignore
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/compiler.xml b/Week_02_The_Java_language/MyVehicle/.idea/compiler.xml
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/compiler.xml
rename to Week_02_The_Java_language/MyVehicle/.idea/compiler.xml
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/copyright/profiles_settings.xml b/Week_02_The_Java_language/MyVehicle/.idea/copyright/profiles_settings.xml
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/copyright/profiles_settings.xml
rename to Week_02_The_Java_language/MyVehicle/.idea/copyright/profiles_settings.xml
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/gradle.xml b/Week_02_The_Java_language/MyVehicle/.idea/gradle.xml
similarity index 77%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/gradle.xml
rename to Week_02_The_Java_language/MyVehicle/.idea/gradle.xml
index 0e23f8e..7ac24c7 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/gradle.xml
+++ b/Week_02_The_Java_language/MyVehicle/.idea/gradle.xml
@@ -3,9 +3,8 @@
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/modules.xml b/Week_02_The_Java_language/MyVehicle/.idea/modules.xml
similarity index 68%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/modules.xml
rename to Week_02_The_Java_language/MyVehicle/.idea/modules.xml
index 7e769f6..bb40469 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/modules.xml
+++ b/Week_02_The_Java_language/MyVehicle/.idea/modules.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/runConfigurations.xml b/Week_02_The_Java_language/MyVehicle/.idea/runConfigurations.xml
similarity index 98%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/runConfigurations.xml
rename to Week_02_The_Java_language/MyVehicle/.idea/runConfigurations.xml
index 9b6e38d..7f68460 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/.idea/runConfigurations.xml
+++ b/Week_02_The_Java_language/MyVehicle/.idea/runConfigurations.xml
@@ -9,4 +9,4 @@
-
+
\ No newline at end of file
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/.gitignore b/Week_02_The_Java_language/MyVehicle/app/.gitignore
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/app/.gitignore
rename to Week_02_The_Java_language/MyVehicle/app/.gitignore
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/build.gradle b/Week_02_The_Java_language/MyVehicle/app/build.gradle
similarity index 78%
rename from old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/build.gradle
rename to Week_02_The_Java_language/MyVehicle/app/build.gradle
index 840d8ff..859e60b 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/build.gradle
+++ b/Week_02_The_Java_language/MyVehicle/app/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 24
- buildToolsVersion "24.0.3"
+ compileSdkVersion 26
+ buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.jianhuayang.myvehicle"
minSdkVersion 15
- targetSdkVersion 24
+ targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -24,6 +24,7 @@ dependencies {
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:24.2.1'
+ compile 'com.android.support:appcompat-v7:26.+'
+ compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/proguard-rules.pro b/Week_02_The_Java_language/MyVehicle/app/proguard-rules.pro
similarity index 71%
rename from old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/proguard-rules.pro
rename to Week_02_The_Java_language/MyVehicle/app/proguard-rules.pro
index cce7213..6d3585e 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/proguard-rules.pro
+++ b/Week_02_The_Java_language/MyVehicle/app/proguard-rules.pro
@@ -15,3 +15,11 @@
#-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/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/androidTest/java/com/example/jianhuayang/myvehicle/ExampleInstrumentedTest.java b/Week_02_The_Java_language/MyVehicle/app/src/androidTest/java/com/example/jianhuayang/myvehicle/ExampleInstrumentedTest.java
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/androidTest/java/com/example/jianhuayang/myvehicle/ExampleInstrumentedTest.java
rename to Week_02_The_Java_language/MyVehicle/app/src/androidTest/java/com/example/jianhuayang/myvehicle/ExampleInstrumentedTest.java
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/AndroidManifest.xml b/Week_02_The_Java_language/MyVehicle/app/src/main/AndroidManifest.xml
similarity index 81%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/AndroidManifest.xml
rename to Week_02_The_Java_language/MyVehicle/app/src/main/AndroidManifest.xml
index d8bf0da..b205bae 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/AndroidManifest.xml
+++ b/Week_02_The_Java_language/MyVehicle/app/src/main/AndroidManifest.xml
@@ -1,20 +1,21 @@
+ package="com.example.jianhuayang.myvehicle">
-
+
-
+
-
+
\ No newline at end of file
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/MainActivity.java b/Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/MainActivity.java
similarity index 97%
rename from old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/MainActivity.java
rename to Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/MainActivity.java
index 36c13e9..cab4041 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/MainActivity.java
+++ b/Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/MainActivity.java
@@ -1,7 +1,7 @@
package com.example.jianhuayang.myvehicle;
-import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
@@ -26,7 +26,7 @@ public class MainActivity extends AppCompatActivity {
String strYear = editTextYear.getText().toString();
Vehicle vehicle;
- if (strYear.equals("")) {
+ if (strYear.matches("")) {
vehicle = new Vehicle(make);
} else {
int intYear = Integer.parseInt(strYear);
@@ -36,4 +36,7 @@ public class MainActivity extends AppCompatActivity {
Log.d(TAG, "User clicked " + Vehicle.counter + " times.");
Log.d(TAG, "User message is \"" + vehicle + "\".");
}
+
+
+
}
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/Vehicle.java b/Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/Vehicle.java
similarity index 77%
rename from old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/Vehicle.java
rename to Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/Vehicle.java
index 2f04502..3895165 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/Vehicle.java
+++ b/Week_02_The_Java_language/MyVehicle/app/src/main/java/com/example/jianhuayang/myvehicle/Vehicle.java
@@ -1,12 +1,11 @@
package com.example.jianhuayang.myvehicle;
/**
- * Created by jianhuayang on 08/10/2016.
- * @author jianhuayang
- * @version 1.1
+ * Created by jianhuayang on 09/10/2017.
*/
public class Vehicle {
+
public static int counter = 0;
private String make;
private int year;
@@ -20,18 +19,18 @@ public class Vehicle {
}
/*
- * This constructor takes two parameters
- * */
+ * This constructor takes two parameters.
+ */
public Vehicle(String make, int year) {
this.make = make;
this.year = year;
this.message = "Your car is a " + make + " built in " + year + ".";
count();
+
}
/**
- * The constructor that takes only the make of the car
- * @param make the make of the car
+ * @param make the make of your car
*/
public Vehicle(String make) {
this();
@@ -49,7 +48,11 @@ public class Vehicle {
return message;
}
- private void count(){
+ private void count() {
this.counter++;
}
+
+
}
+
+
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/layout/activity_main.xml b/Week_02_The_Java_language/MyVehicle/app/src/main/res/layout/activity_main.xml
similarity index 82%
rename from old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/layout/activity_main.xml
rename to Week_02_The_Java_language/MyVehicle/app/src/main/res/layout/activity_main.xml
index 9fce028..ec97ece 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/layout/activity_main.xml
+++ b/Week_02_The_Java_language/MyVehicle/app/src/main/res/layout/activity_main.xml
@@ -1,13 +1,14 @@
-
+ android:textSize="24sp"/>
+ android:textAppearance="?android:attr/textAppearanceSmall"/>
+ android:inputType="textPersonName"/>
+ android:textAppearance="?android:attr/textAppearanceSmall"/>
+ android:inputType="number"/>
+ android:text="Run"/>
+
+
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-hdpi/ic_launcher.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/mipmap-hdpi/ic_launcher.png
rename to Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-hdpi/ic_launcher.png
diff --git a/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9a078e3
Binary files /dev/null and b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-mdpi/ic_launcher.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/mipmap-mdpi/ic_launcher.png
rename to Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-mdpi/ic_launcher.png
diff --git a/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..efc028a
Binary files /dev/null and b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xhdpi/ic_launcher.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/mipmap-xhdpi/ic_launcher.png
rename to Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xhdpi/ic_launcher.png
diff --git a/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..3af2608
Binary files /dev/null and b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
rename to Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
diff --git a/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9bec2e6
Binary files /dev/null and b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
rename to Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
diff --git a/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..34947cd
Binary files /dev/null and b/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values/colors.xml b/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/colors.xml
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values/colors.xml
rename to Week_02_The_Java_language/MyVehicle/app/src/main/res/values/colors.xml
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/strings.xml b/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/strings.xml
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/strings.xml
rename to Week_02_The_Java_language/MyVehicle/app/src/main/res/values/strings.xml
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values/styles.xml b/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/styles.xml
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values/styles.xml
rename to Week_02_The_Java_language/MyVehicle/app/src/main/res/values/styles.xml
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/test/java/com/example/jianhuayang/myvehicle/ExampleUnitTest.java b/Week_02_The_Java_language/MyVehicle/app/src/test/java/com/example/jianhuayang/myvehicle/ExampleUnitTest.java
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/test/java/com/example/jianhuayang/myvehicle/ExampleUnitTest.java
rename to Week_02_The_Java_language/MyVehicle/app/src/test/java/com/example/jianhuayang/myvehicle/ExampleUnitTest.java
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/build.gradle b/Week_02_The_Java_language/MyVehicle/build.gradle
similarity index 88%
rename from old(needs_updating)/Week_02_The_Java_language/MyVehicle/build.gradle
rename to Week_02_The_Java_language/MyVehicle/build.gradle
index a3330d4..c2eea8e 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/build.gradle
+++ b/Week_02_The_Java_language/MyVehicle/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/gradle.properties b/Week_02_The_Java_language/MyVehicle/gradle.properties
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/gradle.properties
rename to Week_02_The_Java_language/MyVehicle/gradle.properties
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/gradle/wrapper/gradle-wrapper.jar b/Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.jar
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/gradle/wrapper/gradle-wrapper.jar
rename to Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.jar
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/gradle/wrapper/gradle-wrapper.properties b/Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.properties
similarity index 79%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/gradle/wrapper/gradle-wrapper.properties
rename to Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.properties
index 04e285f..9a88328 100644
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/gradle/wrapper/gradle-wrapper.properties
+++ b/Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Dec 28 10:00:20 PST 2015
+#Sun Oct 08 23:53:34 BST 2017
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-3.3-all.zip
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/gradlew b/Week_02_The_Java_language/MyVehicle/gradlew
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/gradlew
rename to Week_02_The_Java_language/MyVehicle/gradlew
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/gradlew.bat b/Week_02_The_Java_language/MyVehicle/gradlew.bat
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/gradlew.bat
rename to Week_02_The_Java_language/MyVehicle/gradlew.bat
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/settings.gradle b/Week_02_The_Java_language/MyVehicle/settings.gradle
similarity index 100%
rename from old(needs_updating)/Week_02_The_Java_language/MyCar/settings.gradle
rename to Week_02_The_Java_language/MyVehicle/settings.gradle
diff --git a/old(needs_updating)/Week_02_The_Java_language/README.md b/Week_02_The_Java_language/README.md
similarity index 86%
rename from old(needs_updating)/Week_02_The_Java_language/README.md
rename to Week_02_The_Java_language/README.md
index 27a0392..2d3dd9d 100644
--- a/old(needs_updating)/Week_02_The_Java_language/README.md
+++ b/Week_02_The_Java_language/README.md
@@ -2,29 +2,65 @@
Hmm... Java... This is huge, where should we start?
-In their latest book [Android Programming: The Big Nerd Ranch Guide (2nd Edition)](http://www.amazon.co.uk/dp/0134171454/ref=sr_1_1?s=books&ie=UTF8&qid=1443519722&sr=1-1&keywords=android+big+nerd+ranch) the authors claimed that:
+In their latest book [Android Programming: The Big Nerd Ranch Guide (3rd Edition)](https://www.amazon.co.uk/Android-Programming-Ranch-Guide-Guides/dp/0134706056/ref=dp_ob_title_bk) the authors claimed that:
-> "... you need to be familiar with Java, including classes and objects, interfaces, listeners, packages, inner classes, anonymous inner classes, and generic classes. If these ideas do not ring a bell, you will be in the weeds by page 2 ..."
+> "... you need to be familiar with Java, including classes and objects, interfaces, listeners, packages, inner classes, anonymous inner classes, and generic classes. If these concepts do not ring a bell, you will be in the weeds by page 2 ..."
I couldn't agree more. So we'll start from there.
-![](https://www.bignerdranch.com/img/books/book-covers/android-cover.jpg)
+![Android Studio UI](.md_images/android.jpg)
## Lab 1 Language concepts
-In this first lab, you'll learn some basic language features and how Android Studio can be used to save your time.
+In this lab, you'll learn some basic language features and how Android Studio can be used to save your time.
### Design the interface
Follow steps below to create your app and initialize your layout file:
1. Create a new app and name it 'My Vehicle'.
-3. Open 'activity_main.xml'. In design view, drag and drop the following widgets onto the graphical layout below 'Hello World!'. These need to be in the order of:
+2. Open 'activity_main.xml' in text view, replace `android.support.constraint.ConstraintLayout` with `RelativeLayout` (don't forget the closing tag). Insert the following attributes into the opening tag of `RelativeLayout`, and remove the four `app:layout_constraint` attributes in `TextView`
+
+```xml
+ android:paddingBottom="16dp"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:paddingTop="16dp"
+```
+
+Your layout XML should now look like the following
+
+```xml
+
+
+
+
+
+```
+
+3. Now switch to design view. Drag and drop the following widgets onto the graphical layout below 'Hello World!'.
+
* TextView
* Plain Text
* TextView
- * Numer
+ * Number
* Button
+
+ Rearrange the widgets so it looks similar to the following:
![drag](.md_images/raw_layout.png)
@@ -37,7 +73,6 @@ Follow steps below to create your app and initialize your layout file:
5. Switch to the Text view, edit the layouts so it looks like the following:
```xml
-
```
- You have done something similar to this (hopefully!) in last week's labs - editing different Android tags and attributes. We'll now have a closer look. And we'll look at them again later on during the module.
+ You have done something similar to this (hopefully!) in last week's labs - editing different Android tags and attributes. We'll now have a closer look.
* Views in Android (UI elements) are defined in XML using tags similar to HTML. Some tags have two parts i.e. opening and closing parts, such as RelativeLayout, which are usually container layouts. Some tags have just opening tags, and closing tags are replaced by a forward slice.
* Attributes have an 'android:' prefix, and the values are enclosed in double quotes.
- * A common layout attribute is id. Note the '@+id/' part before most id texts, the plus sign means that the id is being added to the system. In other words, there're no existing views with the same id. Otherwise, the system will complain. Also, note the 'match_parent' value in the RelativeLayout tag. This value replaces the old 'fill_parent' value.
- * Other common attributes include layout_width and layout_height. Possible values for these two are 'wrap_content' and 'match_parent'. The names explain themselves.
+ * A common layout attribute is id. Note the '@+id/' part before most id texts, the plus sign means that the id is being added to the system. In other words, there're no existing views with the same id. Otherwise, the system will complain.
+ * Other common attributes include layout_width and layout_height. Possible values for these two are 'wrap_content' and 'match_parent'. The names explain themselves. Note that the 'match_parent' value replaces the old 'fill_parent' value, which you can still find in some online tutorials.
> If you see an online example using 'fill_parent', you know it has been there for a while.
- * RelativeLayout is one of the two most important layouts in Android. To align views in a RelativeLayout, you used attributes such as layout_height, layout_alignParentLeft, the layout below. For a comprehensive list of attributes that can be used to control the positioning, click [here](http://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html).
-
- > The reason that relative layout is important is that there're so many different screen sizes for Android. In a relative positioning system, once we know the origin point (top left corner) and the size of the view, we can determine its absolute position. By contrast, iOS use absolute positioning as there are only a limited number of screen sizes available.
+ * RelativeLayout is one of the two most important layouts in Android. To align views in a RelativeLayout, you used attributes such as layout_height, layout_alignParentLeft, and layout_below. For a comprehensive list of attributes that can be used to control the positioning, check out [Android reference page on RelativeLayout](https://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html). The reason that relative layout is important is that there're so many different screen sizes for Android. In a relative positioning system, once we know the origin point (top left corner) and the size of the view, we can determine its absolute position. By contrast, iOS use absolute positioning as there are only a limited number of screen sizes available.
- ![Android coordinates](http://i.stack.imgur.com/xgQ3b.png)
+
+ ![Android Studio UI](.md_images/positioning.png)
- * Padding and margins in Android are the same as in CSS. The units used here are dp (density-independent pixel) for everything except for fonts where sp (scale-independent pixel) is being used. For a thorough explanation of the difference between dp, sp, pixel, and scale-independence etc. click [here](http://developer.android.com/guide/practices/screens_support.html).
+ * Padding and margins in Android are the same as in CSS. The units used here are dp (density-independent pixel) for everything except for fonts where sp (scale-independent pixel) is being used. For a thorough explanation of the difference between dp, sp, pixel, and scale-independence etc. read [Android API guide on Supporting Multiple Screens](http://developer.android.com/guide/practices/screens_support.html).
+
+ > The new default layout that comes with Android Studio 2.3 is the [ConstraintLayout](https://developer.android.com/training/constraint-layout/index.html). However, this is not very well documented. We'll come back to this later.
### Build the class
@@ -142,7 +178,7 @@ Following steps below to build a new class:
There're several things you need to know in the above codes:
* If you come from Python background (as most of you do), you'll notice the type names such as String (capital S) and int. Unlike Python, Java is a strictly typed language, you need to declare variable types before using them.
- * Note access modifiers such as public and private. Public means everybody has access to that variable, and private is the complete opposite - nobody can. But if nobody has access rights, how can our Vehicle class use private variables? This is through getter and setter methods, as you'll find out later. There're also two other modifiers i.e. default and protected, do you know what those mean? Click [here](http://www.justfuckinggoogleit.com/).
+ * Note access modifiers such as public and private. Public means everybody has access to that variable, and private is the complete opposite - nobody can. But if nobody has access rights, how can our Vehicle class use private variables? This is through getter and setter methods, as you'll find out later. There're also two other modifiers i.e. default and protected, do you know what those mean?
* Also note the keyword static. This makes the counter variable a class variable that serves the whole class. By contrast, variables such as make is an instance variable (also called field). Instance variables are associated with an instance of the class i.e. objects.
* The part 'counter = 0' is an assignment expression that sets the counter to zero. All instance variables in Java have default values, and a default value for int is 0. So this step is not really necessary, but this is considered good coding practices. Local variables e.g. those appear in a for loop, have to be initialized before first use. This is the same as in Python.
* Note the concluding semicolons at the end of each line. This makes the assignment expression a declaration statement. In Python, we don't normally use semicolons, but this is mandatory in Java.
@@ -162,7 +198,7 @@ Following steps below to build a new class:
}
```
-5. Use the generator to generate two other constructors, so your code looks like this
+5. Use the generator to generate two other constructors, and edit as necessary so that they look like below
```java
public Vehicle(String make, int year) {
this.make = make;
@@ -182,7 +218,7 @@ Following steps below to build a new class:
* Name. This is needless to say. For constructors, though, this must be the same as class name.
* Parameter list. In our examples, this is a single parameter 'String make' or parameters separated by comma 'String make, int year'.
* A method's signature is the method's name and the parameter types. For example, the signature of the last constructor is Vehicle(String make).
- * In our simple example above, we overloaded the constructor methods. By **overloading** I meant methods with the same name but different input parameters.
+ * In our simple example above, we overloaded the constructor methods. **Overloading** methods mean methods with the same name but different input parameters.
Note the 'this' keyword in the second constructor 'this.make = make;'. In this case, this.make refers to the instance variable in the class, while make refers to the parameter of the method.
@@ -201,7 +237,7 @@ Following steps below to build a new class:
return message;
}
```
- Note the @Override part at the beginning of the line, this is called annotations. When Java compiler sees it, it double-checks that the subclass is overriding a method with the same signature in the superclass. By **overriding** I meant a method with the same signature. If this is not the case, the compiler will complain. There're quite a number of annotations in Java, but this Override is what you see the most in Android.
+ Note the @Override part at the beginning of the line, this is called annotations. When Java compiler sees it, it double-checks that the subclass is overriding a method with the same signature in the superclass. **Overriding** methods mean methods with the same signature. If this is not the case, the compiler will complain. There're quite a number of annotations in Java, but this Override is what you see the most in Android.
8. Insert the following within the class definition:
@@ -252,7 +288,7 @@ Following steps below to build a new class:
```java
/**
- * Created by jianhuayang on 08/10/16.
+ * Created by jianhuayang on 09/10/17.
* @author jianhuayang
* @version 1.1
*/
@@ -271,7 +307,9 @@ Following steps below to build a new class:
...
}
```
-11. Now you have everything you need, but it may not be in a nice readable order. What Android Studio offers here is a rearrangement function. Click Code ==> Rearrange Code to see if it makes any differences. The rules Android Studio uses can be configured using Preferences ==> Editor ==> Code Style ==> Java
+ After this you can generate Javadoc using Tools ==> Generate JavaDoc
+
+11. Now you have everything you need, but it may not be in a nice readable order. What Android Studio offers here is a rearrange function. Click Code ==> Rearrange Code to see if it makes any differences. The rules Android Studio uses can be configured using Preferences ==> Editor ==> Code Style ==> Java
![rearrange](.md_images/rearrange.png)
@@ -279,7 +317,7 @@ Following steps below to build a new class:
Follow steps below to create an onButtonClick method that responds to a user click.
-1. Open MainActivity.java, insert the following variables just after MainActivity class declaration i.e. immediately after `public class MainActivity extends AppCompatActivity {`
+1. Open MainActivity.java, insert the following variables definitions in the class
```java
private static final String TAG = "MyVehicleActivity";
@@ -306,19 +344,21 @@ Follow steps below to create an onButtonClick method that responds to a user cli
Log.d(TAG, "User message is \"" + vehicle + "\".");
}
```
-
- What this code does is that it collects the make and year the user has typed, and then it creates a vehicle object and pops up a message. In case the user doesn't supply a year of their car, it'll use the default settings. In the meanwhile, the app records the number of times the button has been clicked. And this info goes to the system log. Something you need to note in the codes above:
+ The same as in XML files, you can rearrange and/or reformat after insertion.
+
+ What this code does is that it collects the make and year the user has typed, and then it creates a vehicle object and pops up a message. In case the user doesn't supply a year of their car, it'll use the default settings. In the meanwhile, the app records the number of times the button has been clicked. And this info goes to the system log. A few more points you need to note:
- * (EditText) is an explicit type cast (type conversion). This is required as the return type of findViewById is View, which is the superclass of most UI elements in Android.
+ * `(EditText)` is an explicit type cast (type conversion). This is required as the return type of findViewById is View, which is the superclass of most UI elements in Android.
* The getText().toString() will return a String. A simple getText() won't work as the return type for the method is Editable.
- * Toast in Android is a small pop-up message. The signature for the method we used is `public static Toast makeText (Context context, CharSequence text, int duration)`. Click [here](http://developer.android.com/reference/android/widget/Toast.html) for details of this method.
+ * Toast in Android is a small pop-up message. The signature for the method we used is `public static Toast makeText (Context context, CharSequence text, int duration)`. Click [reference on Toast class](http://developer.android.com/reference/android/widget/Toast.html) for details of this method.
+
![toast](http://developer.android.com/images/toast.png)
- * You have seen Log.d before. There is another way of inserting Log.d into your class. Move you cursor to the position where you want to insert, press 'cmd' + 'j' together, a small drop-down menu will popup. This drop-down is different from normal Android Studio suggestions. You can now use your up/down key to select logm and then hit enter.
+
+
3. Insert the following attribute intuo the Button tag in 'activity_main.xml'
```java
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/build.gradle b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/build.gradle
deleted file mode 100644
index 24a7eca..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/build.gradle
+++ /dev/null
@@ -1,29 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 24
- buildToolsVersion "24.0.3"
- defaultConfig {
- applicationId "com.example.jianhuayang.mycar"
- minSdkVersion 15
- targetSdkVersion 24
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- 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:24.2.1'
- testCompile 'junit:junit:4.12'
-}
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/proguard-rules.pro b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/proguard-rules.pro
deleted file mode 100644
index cce7213..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/proguard-rules.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Users/jianhuayang/Library/Android/sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# 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 *;
-#}
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/androidTest/java/com/example/jianhuayang/mycar/ExampleInstrumentedTest.java b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/androidTest/java/com/example/jianhuayang/mycar/ExampleInstrumentedTest.java
deleted file mode 100644
index e4ab9ca..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/androidTest/java/com/example/jianhuayang/mycar/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.example.jianhuayang.mycar;
-
-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.*;
-
-/**
- * Instrumentation test, which will execute on an Android device.
- *
- * @see Testing documentation
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() throws Exception {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("com.example.jianhuayang.mycar", appContext.getPackageName());
- }
-}
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/java/com/example/jianhuayang/mycar/Car.java b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/java/com/example/jianhuayang/mycar/Car.java
deleted file mode 100644
index 4e7c252..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/java/com/example/jianhuayang/mycar/Car.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.example.jianhuayang.mycar;
-
-/**
- * Created by jianhuayang on 09/10/2016.
- */
-
-class Car extends Vehicle {
- private String color;
-
- public Car(String make, int year, String color) {
- super(make, year);
- this.color = color;
- setMessage(getMessage() + " I like your shining " + color + " color.");
- }
-}
-
-class Diesel extends Vehicle implements Vehicle.Controllable {
-
- private String type;
-
- public Diesel(String make, int year) {
- super(make, year);
- this.type = "Diesel";
- }
-
- @Override
- public void control() {
- setMessage(super.getMessage() + " Emission is under control.");
- }
-
- @Override
- public String getMessage() {
- control();
- return super.getMessage();
- }
-}
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/java/com/example/jianhuayang/mycar/MainActivity.java b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/java/com/example/jianhuayang/mycar/MainActivity.java
deleted file mode 100644
index 6f5c756..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/java/com/example/jianhuayang/mycar/MainActivity.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.example.jianhuayang.mycar;
-
-import android.support.v7.app.AppCompatActivity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.Toast;
-
-public class MainActivity extends AppCompatActivity {
- private static final String TAG = "MyCarActivity";
- private EditText editTextMake;
- private EditText editTextYear;
- private EditText editTextColor;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-
- public void onButtonClick(View view) {
- editTextMake = (EditText) findViewById(R.id.inputMake);
- editTextYear = (EditText) findViewById(R.id.inputYear);
- editTextColor = (EditText) findViewById(R.id.inputColor);
- String make = editTextMake.getText().toString();
- String strYear = editTextYear.getText().toString();
- int intYear = Integer.parseInt(strYear);
- String color = editTextColor.getText().toString();
-
- Vehicle vehicle;
- switch (view.getId()) {
- case R.id.buttonRunPetrol:
- vehicle = new Car(make, intYear, color);
- break;
- case R.id.buttonRunDiesel:
- vehicle = new Diesel(make, intYear);
- break;
- default:
- vehicle = new Vehicle();
- break;
- }
-
- if (Vehicle.counter == 5) {
- vehicle = new Vehicle() {
- @Override
- public String getMessage() {
- return "You have pressed 5 times, stop it!";
- }
- };
- }
-
- Toast.makeText(getApplicationContext(), vehicle.getMessage(), Toast.LENGTH_SHORT).show();
- Log.d(TAG, "User clicked " + Vehicle.counter + " times.");
- Log.d(TAG, "User message is \"" + vehicle + "\".");
- }
-}
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/java/com/example/jianhuayang/mycar/Vehicle.java b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/java/com/example/jianhuayang/mycar/Vehicle.java
deleted file mode 100644
index 3d8e970..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/java/com/example/jianhuayang/mycar/Vehicle.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.example.jianhuayang.mycar;
-
-/**
- * Created by jianhuayang on 08/10/2016.
- */
-
-public class Vehicle {
- public static int counter = 0;
- private String make;
- private int year;
- private String message;
-
- // the default constructor
- public Vehicle() {
- this.make = "Volvo";
- this.year = 2012;
- this.message = "This is the default message.";
- }
-
- /*
- * This constructor takes two parameters
- * */
- public Vehicle(String make, int year) {
- this.make = make;
- this.year = year;
- this.message = "Your car is a " + make + " built in " + year + ".";
- count();
- }
-
- /**
- * The constructor that takes only the make of the car
- * @param make the make of the car
- */
- public Vehicle(String make) {
- this();
- this.make = make;
- message = "You didn't type in year value.";
- count();
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- @Override
- public String toString() {
- return message;
- }
-
- private void count(){
- this.counter++;
- }
-
- interface Controllable {
- void control();
- }
-}
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/layout/activity_main.xml b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index 7197bfc..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values-w820dp/dimens.xml b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values-w820dp/dimens.xml
deleted file mode 100644
index 63fc816..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values-w820dp/dimens.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- 64dp
-
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values/dimens.xml b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values/dimens.xml
deleted file mode 100644
index 47c8224..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- 16dp
- 16dp
-
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values/strings.xml b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values/strings.xml
deleted file mode 100644
index f3b7efa..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- My Car
-
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/test/java/com/example/jianhuayang/mycar/ExampleUnitTest.java b/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/test/java/com/example/jianhuayang/mycar/ExampleUnitTest.java
deleted file mode 100644
index 588e3da..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/app/src/test/java/com/example/jianhuayang/mycar/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.example.jianhuayang.mycar;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyCar/build.gradle b/old(needs_updating)/Week_02_The_Java_language/MyCar/build.gradle
deleted file mode 100644
index a3330d4..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyCar/build.gradle
+++ /dev/null
@@ -1,23 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
-buildscript {
- repositories {
- jcenter()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
-}
-
-allprojects {
- repositories {
- jcenter()
- }
-}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/.gitignore b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/.gitignore
deleted file mode 100644
index 39fb081..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-*.iml
-.gradle
-/local.properties
-/.idea/workspace.xml
-/.idea/libraries
-.DS_Store
-/build
-/captures
-.externalNativeBuild
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/.gitignore b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/AndroidManifest.xml b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/AndroidManifest.xml
deleted file mode 100644
index 3c6c304..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-hdpi/ic_launcher.png b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index cde69bc..0000000
Binary files a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-mdpi/ic_launcher.png b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index c133a0c..0000000
Binary files a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index bfa42f0..0000000
Binary files a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 324e72c..0000000
Binary files a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index aee44e1..0000000
Binary files a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values-w820dp/dimens.xml b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values-w820dp/dimens.xml
deleted file mode 100644
index 63fc816..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values-w820dp/dimens.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- 64dp
-
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/colors.xml b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/colors.xml
deleted file mode 100644
index 3ab3e9c..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- #3F51B5
- #303F9F
- #FF4081
-
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/dimens.xml b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/dimens.xml
deleted file mode 100644
index 47c8224..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- 16dp
- 16dp
-
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/styles.xml b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/styles.xml
deleted file mode 100644
index 5885930..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradle.properties b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradle.properties
deleted file mode 100644
index aac7c9b..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradle.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx1536m
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.jar b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 13372ae..0000000
Binary files a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.properties b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 04e285f..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Mon Dec 28 10:00:20 PST 2015
-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
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradlew b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradlew
deleted file mode 100644
index 9d82f78..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradlew
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# 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
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# 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
-
-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" ] ; 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
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradlew.bat b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradlew.bat
deleted file mode 100644
index 8a0b282..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/settings.gradle b/old(needs_updating)/Week_02_The_Java_language/MyVehicle/settings.gradle
deleted file mode 100644
index e7b4def..0000000
--- a/old(needs_updating)/Week_02_The_Java_language/MyVehicle/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':app'