diff --git a/Week_07_Testing/NavigationDrawerTest/.idea/modules.xml b/Week_07_Testing/NavigationDrawerTest/.idea/modules.xml index ee75487..9ed6641 100644 --- a/Week_07_Testing/NavigationDrawerTest/.idea/modules.xml +++ b/Week_07_Testing/NavigationDrawerTest/.idea/modules.xml @@ -2,8 +2,8 @@ - + - + \ No newline at end of file diff --git a/Week_09_Services_and_wearables/.md_images/not1.png b/Week_09_Services_and_wearables/.md_images/not1.png deleted file mode 100644 index 82bee1c..0000000 Binary files a/Week_09_Services_and_wearables/.md_images/not1.png and /dev/null differ diff --git a/Week_09_Services_and_wearables/.md_images/open_on_phone.png b/Week_09_Services_and_wearables/.md_images/open_on_phone.png deleted file mode 100644 index 9079aca..0000000 Binary files a/Week_09_Services_and_wearables/.md_images/open_on_phone.png and /dev/null differ diff --git a/Week_09_Services_and_wearables/.md_images/sdk_google.png b/Week_09_Services_and_wearables/.md_images/sdk_google.png deleted file mode 100644 index 3907afb..0000000 Binary files a/Week_09_Services_and_wearables/.md_images/sdk_google.png and /dev/null differ diff --git a/Week_09_Services_and_wearables/.md_images/try.png b/Week_09_Services_and_wearables/.md_images/try.png deleted file mode 100644 index a3a2e25..0000000 Binary files a/Week_09_Services_and_wearables/.md_images/try.png and /dev/null differ diff --git a/Week_09_Services_and_wearables/.md_images/watch_start.png b/Week_09_Services_and_wearables/.md_images/watch_start.png index 1642f94..4a62e9b 100644 Binary files a/Week_09_Services_and_wearables/.md_images/watch_start.png and b/Week_09_Services_and_wearables/.md_images/watch_start.png differ diff --git a/Week_09_Services_and_wearables/MyWearables copy/.gitignore b/Week_09_Services_and_wearables/MyWearables copy/.gitignore deleted file mode 100644 index 39fb081..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures -.externalNativeBuild diff --git a/Week_09_Services_and_wearables/MyWearables copy/.idea/compiler.xml b/Week_09_Services_and_wearables/MyWearables copy/.idea/compiler.xml deleted file mode 100644 index 32b8ce7..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/Week_09_Services_and_wearables/MyWearables copy/.idea/copyright/profiles_settings.xml b/Week_09_Services_and_wearables/MyWearables copy/.idea/copyright/profiles_settings.xml deleted file mode 100644 index 7d61b5c..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/Week_09_Services_and_wearables/MyWearables copy/.idea/gradle.xml b/Week_09_Services_and_wearables/MyWearables copy/.idea/gradle.xml deleted file mode 100644 index c3b1da4..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/.idea/gradle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - diff --git a/Week_09_Services_and_wearables/MyWearables copy/.idea/misc.xml b/Week_09_Services_and_wearables/MyWearables copy/.idea/misc.xml deleted file mode 100644 index 184803f..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/.idea/misc.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/Week_09_Services_and_wearables/MyWearables copy/.idea/modules.xml b/Week_09_Services_and_wearables/MyWearables copy/.idea/modules.xml deleted file mode 100644 index b94c244..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/Week_09_Services_and_wearables/MyWearables copy/.idea/runConfigurations.xml b/Week_09_Services_and_wearables/MyWearables copy/.idea/runConfigurations.xml deleted file mode 100644 index 9b6e38d..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/Week_09_Services_and_wearables/MyWearables copy/app/.gitignore b/Week_09_Services_and_wearables/MyWearables copy/app/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/Week_09_Services_and_wearables/MyWearables copy/app/build.gradle b/Week_09_Services_and_wearables/MyWearables copy/app/build.gradle deleted file mode 100644 index 4c2cbe4..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/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.mywearables" - 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/Week_09_Services_and_wearables/MyWearables copy/app/proguard-rules.pro b/Week_09_Services_and_wearables/MyWearables copy/app/proguard-rules.pro deleted file mode 100644 index cce7213..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/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/Week_09_Services_and_wearables/MyWearables copy/app/src/androidTest/java/com/example/jianhuayang/mywearables/ExampleInstrumentedTest.java b/Week_09_Services_and_wearables/MyWearables copy/app/src/androidTest/java/com/example/jianhuayang/mywearables/ExampleInstrumentedTest.java deleted file mode 100644 index 67c500d..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/app/src/androidTest/java/com/example/jianhuayang/mywearables/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.jianhuayang.mywearables; - -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.mywearables", appContext.getPackageName()); - } -} diff --git a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/AndroidManifest.xml b/Week_09_Services_and_wearables/MyWearables copy/app/src/main/AndroidManifest.xml deleted file mode 100644 index fb4843c..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/CountingReceiver.java b/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/CountingReceiver.java deleted file mode 100644 index 3951ffc..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/CountingReceiver.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.example.jianhuayang.mywearables; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -/** - * Created by jianhuayang on 25/11/2016. - */ - -public class CountingReceiver extends BroadcastReceiver { - public CountingReceiver() { - } - - @Override - public void onReceive(Context context, Intent intent) { - Log.d(MainActivity.DEBUG_KEY, "on receive"); - String timeElapsed = intent.getStringExtra(CountingService.REPORT_KEY); - Log.d(MainActivity.DEBUG_KEY, "time elapsed: " + timeElapsed); - - Intent intentNew = new Intent(context, DisplayActivity.class); - intentNew.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intentNew.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - intentNew.putExtra(CountingService.REPORT_KEY, timeElapsed); - context.startActivity(intentNew); - } - -} diff --git a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/CountingService.java b/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/CountingService.java deleted file mode 100644 index 39ae1a1..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/CountingService.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.example.jianhuayang.mywearables; - -import android.app.IntentService; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.TaskStackBuilder; -import android.util.Log; - -/** - * Created by jianhuayang on 25/11/2016. - */ - -public class CountingService extends IntentService { - - public static final String REPORT_KEY = "REPORT_KEY"; - public static final String INTENT_KEY = "com.example.jianhuayang.mywearables.BROADCAST"; - - public CountingService() { - super("BackgroundCounting"); - } - - @Override - protected void onHandleIntent(Intent intent) { - - int count = 0; - while (count < 10) { - synchronized (this) { - try { - wait(1000); - count++; - Log.d(MainActivity.DEBUG_KEY, Integer.toString(count)); - -// send info using intent -// Intent intentNew = new Intent(getBaseContext(), DisplayActivity.class); -// intentNew.putExtra(REPORT_KEY, Integer.toString(count)); -// intentNew.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); -// intentNew.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); -// getBaseContext().startActivity(intentNew); - -// Intent localIntent = new Intent(); -// localIntent.setAction(INTENT_KEY); -// localIntent.putExtra(REPORT_KEY, Integer.toString(count)); -// sendBroadcast(localIntent); -// Log.d(MainActivity.DEBUG_KEY, "broadcasted"); - - NotificationCompat.Builder builder = - new NotificationCompat.Builder(this) - .setSmallIcon(R.mipmap.ic_launcher) - .setContentTitle("My Wearables") - .setContentText("Time elapsed: " + Integer.toString(count) + " seconds."); - Intent resultIntent = new Intent(this, DisplayActivity.class); - resultIntent.putExtra(REPORT_KEY, Integer.toString(count)); - - TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(this); - taskStackBuilder.addParentStack(DisplayActivity.class); - taskStackBuilder.addNextIntent(resultIntent); - PendingIntent resultPendingIntent = - taskStackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); - builder.setContentIntent(resultPendingIntent); - NotificationManager notificationManager = - (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - notificationManager.notify(123123, builder.build()); - } catch (Exception e) { - } - } - } - Log.d(MainActivity.DEBUG_KEY, "service finished"); - - } -} diff --git a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/DisplayActivity.java b/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/DisplayActivity.java deleted file mode 100644 index 0258027..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/DisplayActivity.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.example.jianhuayang.mywearables; - -import android.content.Intent; -import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.widget.TextView; - -public class DisplayActivity extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_display); - if (getIntent() != null) { - Intent intent = getIntent(); - TextView textView = (TextView) findViewById(R.id.display); - textView.setText("Time elapsed (seconds):\n" + intent.getStringExtra(CountingService.REPORT_KEY)); - } - } -} diff --git a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/MainActivity.java b/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/MainActivity.java deleted file mode 100644 index be541c5..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/java/com/example/jianhuayang/mywearables/MainActivity.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.example.jianhuayang.mywearables; - -import android.content.Intent; -import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.util.Log; -import android.view.View; - -public class MainActivity extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - } - - public static final String DEBUG_KEY = "DEBUG_KEY"; - public void onStartClick(View v) { - startService(new Intent(this, CountingService.class)); - Log.d(DEBUG_KEY, "service started"); - } -} diff --git a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/res/layout/activity_display.xml b/Week_09_Services_and_wearables/MyWearables copy/app/src/main/res/layout/activity_display.xml deleted file mode 100644 index 9d1e4d1..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/res/layout/activity_display.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - diff --git a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/res/layout/activity_main.xml b/Week_09_Services_and_wearables/MyWearables copy/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index 5518d18..0000000 --- a/Week_09_Services_and_wearables/MyWearables copy/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - -