Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Glass and Pixel 3XL Support #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion android_smart_glasses/main/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {

defaultConfig {
applicationId "com.wearableintelligencesystem.androidsmartglasses"
minSdkVersion 22
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
Expand Down
15 changes: 11 additions & 4 deletions android_smart_glasses/main/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>

<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />

<application
android:allowBackup="true"
Expand All @@ -25,17 +25,24 @@
android:roundIcon="@mipmap/wis_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.WearableAiDisplayMoverio">
<activity android:name="com.wearableintelligencesystem.androidsmartglasses.MainActivity">
<activity
android:name="com.wearableintelligencesystem.androidsmartglasses.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="@xml/voice_trigger_start" />
</activity>

<service
android:name="com.wearableintelligencesystem.androidsmartglasses.WearableAiService"
android:label="CameraService" >
</service>
android:label="CameraService" />
<service android:name="com.wearableintelligencesystem.androidsmartglasses.sensors.MuseService" android:enabled="true"/>

<service android:name="com.wearableintelligencesystem.androidsmartglasses.archive.AudioService" android:enabled="true" android:exported="true"></service>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/app_name" />
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down