From adac0a91130ebcf898a125597b65ef2c9a2eab6b Mon Sep 17 00:00:00 2001 From: Piranavan Selvanandan Date: Sun, 18 Oct 2015 12:10:54 -0700 Subject: [PATCH 1/4] SDK 19 Compatibility port Move back to SDK 19 to support CM11 (KitKat 4.4) --- app/build.gradle | 9 +++++---- .../com/morristaedt/mirror/modules/BirthdayModule.java | 2 +- .../java/com/morristaedt/mirror/modules/MoodModule.java | 5 ++++- app/src/main/res/layout/activity_configuration.xml | 3 --- app/src/main/res/values/styles.xml | 3 ++- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4bc772c..05a5f30 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 22 + compileSdkVersion 19 buildToolsVersion "23.0.1" - defaultConfig { applicationId "com.morristaedt.mirror" minSdkVersion 14 - targetSdkVersion 22 + targetSdkVersion 19 versionCode 1 versionName "1.0" } @@ -17,6 +16,8 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + productFlavors { + } } repositories { @@ -25,7 +26,7 @@ repositories { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.0.0' + compile 'com.android.support:appcompat-v7:19.+' compile 'com.squareup.retrofit:retrofit:1.9.0' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.github.ahorn:android-rss:cf40b89' diff --git a/app/src/main/java/com/morristaedt/mirror/modules/BirthdayModule.java b/app/src/main/java/com/morristaedt/mirror/modules/BirthdayModule.java index 0c367e1..3bea83b 100644 --- a/app/src/main/java/com/morristaedt/mirror/modules/BirthdayModule.java +++ b/app/src/main/java/com/morristaedt/mirror/modules/BirthdayModule.java @@ -13,7 +13,7 @@ public class BirthdayModule { private static HashMap mBirthdayMap; static { - mBirthdayMap = new HashMap<>(); + mBirthdayMap = new HashMap(); mBirthdayMap.put("01/17", "Hannah"); mBirthdayMap.put("05/8", "Andy"); } diff --git a/app/src/main/java/com/morristaedt/mirror/modules/MoodModule.java b/app/src/main/java/com/morristaedt/mirror/modules/MoodModule.java index 9b203c2..8b1fdb0 100644 --- a/app/src/main/java/com/morristaedt/mirror/modules/MoodModule.java +++ b/app/src/main/java/com/morristaedt/mirror/modules/MoodModule.java @@ -95,7 +95,10 @@ public void receiveDetections(final Detector.Detections detections) { .build(); mCameraSource.start(); - } catch (IOException | RuntimeException e) { + } catch (IOException e) { + Log.e(TAG, "Something went horribly wrong, with your face.", e); + } + catch ( RuntimeException e) { Log.e(TAG, "Something went horribly wrong, with your face.", e); } } diff --git a/app/src/main/res/layout/activity_configuration.xml b/app/src/main/res/layout/activity_configuration.xml index 8b98c27..5c4a379 100644 --- a/app/src/main/res/layout/activity_configuration.xml +++ b/app/src/main/res/layout/activity_configuration.xml @@ -139,7 +139,6 @@ @dimen/configuration_description_size - +--> From fb4ae8c41bb4c13670cd6b0190e924033b2404e0 Mon Sep 17 00:00:00 2001 From: Piranavan Selvanandan Date: Sun, 18 Oct 2015 13:02:47 -0700 Subject: [PATCH 2/4] Add Celsius or Farenheit Degree Suffix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add ā€œCā€ or ā€œFā€ to temperature line. --- .../java/com/morristaedt/mirror/modules/ForecastModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/morristaedt/mirror/modules/ForecastModule.java b/app/src/main/java/com/morristaedt/mirror/modules/ForecastModule.java index b47faa4..8bc84ea 100644 --- a/app/src/main/java/com/morristaedt/mirror/modules/ForecastModule.java +++ b/app/src/main/java/com/morristaedt/mirror/modules/ForecastModule.java @@ -50,7 +50,7 @@ protected ForecastResponse doInBackground(Void... params) { protected void onPostExecute(ForecastResponse forecastResponse) { if (forecastResponse != null) { if (forecastResponse.currently != null) { - listener.onWeatherToday(forecastResponse.currently.getDisplayTemperature() + " " + forecastResponse.currently.summary); + listener.onWeatherToday(forecastResponse.currently.getDisplayTemperature() + (units=="si"?"C":"F") +" " + forecastResponse.currently.summary); } if (WeekUtil.isWeekday() && !WeekUtil.afterFive() && forecastResponse.hourly != null && forecastResponse.hourly.data != null) { From 10fa7f6218a4cc4d25364466dd29993d71eea867 Mon Sep 17 00:00:00 2001 From: Piranavan Selvanandan Date: Sun, 18 Oct 2015 15:12:35 -0700 Subject: [PATCH 3/4] Using the constants for UNITS_SI comparison Cleaner than the previous comparison. --- .../java/com/morristaedt/mirror/modules/ForecastModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/morristaedt/mirror/modules/ForecastModule.java b/app/src/main/java/com/morristaedt/mirror/modules/ForecastModule.java index 8bc84ea..d8e7058 100644 --- a/app/src/main/java/com/morristaedt/mirror/modules/ForecastModule.java +++ b/app/src/main/java/com/morristaedt/mirror/modules/ForecastModule.java @@ -50,7 +50,7 @@ protected ForecastResponse doInBackground(Void... params) { protected void onPostExecute(ForecastResponse forecastResponse) { if (forecastResponse != null) { if (forecastResponse.currently != null) { - listener.onWeatherToday(forecastResponse.currently.getDisplayTemperature() + (units=="si"?"C":"F") +" " + forecastResponse.currently.summary); + listener.onWeatherToday(forecastResponse.currently.getDisplayTemperature() + (units.equals(ForecastRequest.UNITS_SI)?"C":"F") +" " + forecastResponse.currently.summary); } if (WeekUtil.isWeekday() && !WeekUtil.afterFive() && forecastResponse.hourly != null && forecastResponse.hourly.data != null) { From 6fa5e5b892462dcba4d64aac18c4c45c4036143f Mon Sep 17 00:00:00 2001 From: Piranavan Selvanandan Date: Sun, 18 Oct 2015 15:35:25 -0700 Subject: [PATCH 4/4] Fixing up keys.xml creation The root node is missing in the documentation. Also fixing a small typo. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c45263f..6f4737d 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,10 @@ How to Run ---- 1. Clone project 2. Get a [forecast.io api key](https://developer.forecast.io/) -3. Add a keys.xml file under res/values with \your_key\ +3. Add a keys.xml file under res/values with \\your_key\\ 4. Import project to Android Studio and run -When its mirror time, I also recommend turning on the device Developer Option: "Stay Awake - Screen will never sleep while charging" +When it is mirror time, I also recommend turning on the device Developer Option: "Stay Awake - Screen will never sleep while charging" Making a Mirror ====