diff --git a/.gitignore b/.gitignore index 7717e098..7a8de7a4 100644 --- a/.gitignore +++ b/.gitignore @@ -64,18 +64,20 @@ captures/ # IntelliJ *.iml -.idea/workspace.xml -.idea/misc.xml -.idea/tasks.xml -.idea/gradle.xml -.idea/assetWizardSettings.xml -.idea/dictionaries -.idea/libraries +**/.idea/workspace.xml +**/.idea/misc.xml +**/.idea/tasks.xml +**/.idea/gradle.xml +**/.idea/assetWizardSettings.xml +**/.idea/dictionaries +**/.idea/libraries # Android Studio 3 in .gitignore file. -.idea/caches -.idea/modules.xml +**/.idea/caches +**/.idea/modules.xml # Comment next line if keeping position of elements in Navigation Editor is relevant for you -.idea/navEditor.xml +**/.idea/navEditor.xml +**/.idea/.gitignore +**/.idea/kotlinc.xml # Keystore files # Uncomment the following lines if you do not want to check your keystore files in. diff --git a/android_smart_glasses/main/app/build.gradle b/android_smart_glasses/main/app/build.gradle index 0691c7f2..236c7f0e 100644 --- a/android_smart_glasses/main/app/build.gradle +++ b/android_smart_glasses/main/app/build.gradle @@ -16,7 +16,7 @@ android { defaultConfig { applicationId "com.wearableintelligencesystem.androidsmartglasses" - minSdkVersion 22 + minSdkVersion 19 targetSdkVersion 22 versionCode 1 versionName "1.0" diff --git a/android_smart_glasses/main/app/src/main/AndroidManifest.xml b/android_smart_glasses/main/app/src/main/AndroidManifest.xml index 576ee640..f02ddc7a 100644 --- a/android_smart_glasses/main/app/src/main/AndroidManifest.xml +++ b/android_smart_glasses/main/app/src/main/AndroidManifest.xml @@ -16,7 +16,7 @@ - + - + + + + + - + android:label="CameraService" /> diff --git a/android_smart_glasses/main/app/src/main/java/com/wearableintelligencesystem/androidsmartglasses/MainActivity.java b/android_smart_glasses/main/app/src/main/java/com/wearableintelligencesystem/androidsmartglasses/MainActivity.java index 088e3373..b1d25b4b 100644 --- a/android_smart_glasses/main/app/src/main/java/com/wearableintelligencesystem/androidsmartglasses/MainActivity.java +++ b/android_smart_glasses/main/app/src/main/java/com/wearableintelligencesystem/androidsmartglasses/MainActivity.java @@ -226,8 +226,9 @@ private void updateWifiHud(){ return; } //wifiConnected = WifiUtils.checkWifiOnAndConnected(this); //check wifi status - don't need now that we have listener in service - Drawable wifiOnDrawable = this.getDrawable(R.drawable.ic_wifi_on); - Drawable wifiOffDrawable = this.getDrawable(R.drawable.ic_wifi_off); + Drawable wifiOnDrawable = this.getDrawableForAnyAPI(R.drawable.ic_wifi_on); + Drawable wifiOffDrawable = this.getDrawableForAnyAPI(R.drawable.ic_wifi_off); + if (wifiConnected) { mWifiStatusImageView.setImageDrawable(wifiOnDrawable); } else { @@ -240,8 +241,8 @@ private void updatePhoneHud(){ if (mPhoneStatusImageView == null){ return; } - Drawable phoneOnDrawable = this.getDrawable(R.drawable.ic_phone_connected); - Drawable phoneOffDrawable = this.getDrawable(R.drawable.ic_phone_disconnected); + Drawable phoneOnDrawable = this.getDrawableForAnyAPI(R.drawable.ic_phone_connected); + Drawable phoneOffDrawable = this.getDrawableForAnyAPI(R.drawable.ic_phone_disconnected); if (phoneConnected) { mPhoneStatusImageView.setImageDrawable(phoneOnDrawable); } else { @@ -255,10 +256,10 @@ private void updateBatteryHud(){ if (mBatteryStatusImageView == null){ return; } - Drawable batteryFullDrawable = this.getDrawable(R.drawable.ic_full_battery); - Drawable batteryFullChargingDrawable = this.getDrawable(R.drawable.ic_full_battery_charging); - Drawable batteryLowDrawable = this.getDrawable(R.drawable.ic_low_battery); - Drawable batteryLowChargingDrawable = this.getDrawable(R.drawable.ic_low_battery_charging); + Drawable batteryFullDrawable = this.getDrawableForAnyAPI(R.drawable.ic_full_battery); + Drawable batteryFullChargingDrawable = this.getDrawableForAnyAPI(R.drawable.ic_full_battery_charging); + Drawable batteryLowDrawable = this.getDrawableForAnyAPI(R.drawable.ic_low_battery); + Drawable batteryLowChargingDrawable = this.getDrawableForAnyAPI(R.drawable.ic_low_battery_charging); if (batteryFull) { if (batteryCharging) { mBatteryStatusImageView.setImageDrawable(batteryFullChargingDrawable); @@ -365,6 +366,14 @@ private void showWearableFaceRecognizer(){ // }, show_time); } + private Drawable getDrawableForAnyAPI(int id) { + if(android.os.Build.VERSION.SDK_INT >= 21) { + return this.getDrawable(id); + } else { + return this.getResources().getDrawable(id); + } + } + //generic way to set the current enumerated list of strings and display them, scrollably, on the main UI private void setupTextList() { //live life captions mode gui setup diff --git a/android_smart_glasses/main/app/src/main/res/xml/voice_trigger_start.xml b/android_smart_glasses/main/app/src/main/res/xml/voice_trigger_start.xml new file mode 100644 index 00000000..8915901f --- /dev/null +++ b/android_smart_glasses/main/app/src/main/res/xml/voice_trigger_start.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/android_smart_phone/main/app/src/main/java/com/wearableintelligencesystem/androidsmartphone/utils/NetworkUtils.java b/android_smart_phone/main/app/src/main/java/com/wearableintelligencesystem/androidsmartphone/utils/NetworkUtils.java index 79a5d816..f1813a1c 100644 --- a/android_smart_phone/main/app/src/main/java/com/wearableintelligencesystem/androidsmartphone/utils/NetworkUtils.java +++ b/android_smart_phone/main/app/src/main/java/com/wearableintelligencesystem/androidsmartphone/utils/NetworkUtils.java @@ -88,29 +88,7 @@ public static InetAddress getBroadcast(InetAddress inetAddr) { public static boolean isHotspotOn(Context context){ WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); - Method[] wmMethods = wifi.getClass().getDeclaredMethods(); - for (Method method: wmMethods) { - if (method.getName().equals("isWifiApEnabled")) { - - try { - if ((Boolean) method.invoke(wifi)) { -// isInetConnOn = true; -// iNetMode = 2; - return true; - } else { - return false; - } - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } - - } - } - return false; + return wifi.isWifiEnabled(); } public static InetAddress getIpAddress() {