commit 2f95fab7f3b9ab39fc87abafd90de01088980821 Author: Rudi Date: Sun Mar 20 21:00:00 2022 -0400 First Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2b75303 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..526b4c2 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..860da66 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9219066 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jason Tu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..4fd0374 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# GlassFrame +Base application for Google Glass apps (SDK version 19) + +SDK Version 19 (Android KitKat (4.4)) +targetSdkVersion = 29 + +master branch has Java version, kotlin branch has Kotlin version diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..60eb309 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,28 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion "Google Inc.:Glass Development Kit Preview:19" + buildToolsVersion "29.0.2" + defaultConfig { + applicationId "haus.nightmare.GlassTesla" + minSdkVersion 19 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'org.jetbrains:annotations-java5:15.0' + implementation group: 'commons-io', name: 'commons-io', version: '2.4' + implementation 'com.google.code.gson:gson:2.9.0' + implementation 'org.conscrypt:conscrypt-android:2.2.1' + implementation 'com.squareup.okhttp3:okhttp:3.12.13' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# 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/app/src/androidTest/java/haus/nightmare/GlassTesla/ApplicationTest.java b/app/src/androidTest/java/haus/nightmare/GlassTesla/ApplicationTest.java new file mode 100644 index 0000000..cc04251 --- /dev/null +++ b/app/src/androidTest/java/haus/nightmare/GlassTesla/ApplicationTest.java @@ -0,0 +1,13 @@ +package haus.nightmare.GlassTesla; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..2235adb --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/haus/nightmare/GlassTesla/ChargeState.java b/app/src/main/java/haus/nightmare/GlassTesla/ChargeState.java new file mode 100644 index 0000000..21fbeb5 --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/ChargeState.java @@ -0,0 +1,47 @@ +package haus.nightmare.GlassTesla; + +public class ChargeState { + public boolean battery_heater_on; + public int battery_level; + public double battery_range; + public int charge_current_request; + public int charge_current_request_max; + public boolean charge_enable_request; + public double charge_energy_added; + public int charge_limit_soc; + public int charge_limit_soc_max; + public int charge_limit_soc_min; + public int charge_limit_soc_std; + public double charge_miles_added_ideal; + public double charge_miles_added_rated; + public Object charge_port_cold_weather_mode; + public boolean charge_port_door_open; + public String charge_port_latch; + public double charge_rate; + public boolean charge_to_max_range; + public int charger_actual_current; + public int charger_phases; + public int charger_pilot_current; + public int charger_power; + public int charger_voltage; + public String charging_state; + public String conn_charge_cable; + public double est_battery_range; + public String fast_charger_brand; + public boolean fast_charger_present; + public String fast_charger_type; + public double ideal_battery_range; + public boolean managed_charging_active; + public Object managed_charging_start_time; + public boolean managed_charging_user_canceled; + public int max_range_charge_counter; + public int minutes_to_full_charge; + public boolean not_enough_power_to_heat; + public boolean scheduled_charging_pending; + public Object scheduled_charging_start_time; + public double time_to_full_charge; + public long timestamp; + public boolean trip_charging; + public int usable_battery_level; + public Object user_charge_enable_request; +} diff --git a/app/src/main/java/haus/nightmare/GlassTesla/ClimateState.java b/app/src/main/java/haus/nightmare/GlassTesla/ClimateState.java new file mode 100644 index 0000000..fa471c1 --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/ClimateState.java @@ -0,0 +1,28 @@ +package haus.nightmare.GlassTesla; + +public class ClimateState { + public boolean battery_heater; + public boolean battery_heater_no_power; + public String climate_keeper_mode; + public int defrost_mode; + public double driver_temp_setting; + public int fan_status; + public double inside_temp; + public boolean is_auto_conditioning_on; + public boolean is_climate_on; + public boolean is_front_defroster_on; + public boolean is_preconditioning; + public boolean is_rear_defroster_on; + public int left_temp_direction; + public double max_avail_temp; + public double min_avail_temp; + public double outside_temp; + public double passenger_temp_setting; + public boolean remote_heater_control_enabled; + public int right_temp_direction; + public int seat_heater_left; + public int seat_heater_right; + public boolean side_mirror_heaters; + public long timestamp; + public boolean wiper_blade_heater; +} diff --git a/app/src/main/java/haus/nightmare/GlassTesla/DriveState.java b/app/src/main/java/haus/nightmare/GlassTesla/DriveState.java new file mode 100644 index 0000000..63fcac4 --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/DriveState.java @@ -0,0 +1,20 @@ +package haus.nightmare.GlassTesla; + +// import com.fasterxml.jackson.databind.ObjectMapper; // version 2.11.1 +// import com.fasterxml.jackson.annotation.JsonProperty; // version 2.11.1 +/* ObjectMapper om = new ObjectMapper(); +Root root = om.readValue(myJsonString, Root.class); */ +public class DriveState { + public int gps_as_of; + public int heading; + public double latitude; + public double longitude; + public double native_latitude; + public int native_location_supported; + public double native_longitude; + public String native_type; + public int power; + public Object shift_state; + public Object speed; + public long timestamp; +} diff --git a/app/src/main/java/haus/nightmare/GlassTesla/GuiSettings.java b/app/src/main/java/haus/nightmare/GlassTesla/GuiSettings.java new file mode 100644 index 0000000..a04f89f --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/GuiSettings.java @@ -0,0 +1,11 @@ +package haus.nightmare.GlassTesla; + +public class GuiSettings { + public boolean gui_24_hour_time; + public String gui_charge_rate_units; + public String gui_distance_units; + public String gui_range_display; + public String gui_temperature_units; + public boolean show_range_units; + public long timestamp; +} diff --git a/app/src/main/java/haus/nightmare/GlassTesla/MainActivity.java b/app/src/main/java/haus/nightmare/GlassTesla/MainActivity.java new file mode 100644 index 0000000..7cfab1f --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/MainActivity.java @@ -0,0 +1,190 @@ +package haus.nightmare.GlassTesla; + +import com.google.android.glass.media.Sounds; +import com.google.android.glass.widget.CardBuilder; +import com.google.android.glass.widget.CardScrollAdapter; +import com.google.android.glass.widget.CardScrollView; +import com.google.gson.Gson; + +import android.app.Activity; +import android.content.Context; +import android.content.SharedPreferences; +import android.media.AudioManager; +import android.os.Bundle; +import android.os.StrictMode; +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; + +import org.conscrypt.Conscrypt; + +import java.net.URL; +import java.security.Security; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +import javax.net.ssl.SSLException; + +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + + +public class MainActivity extends Activity { + + private CardScrollView cardScroller; + + private View view; + private TeslaResponse vehicleData; + private SharedPreferences prefs; + @Override + protected void onCreate(Bundle bundle) { + super.onCreate(bundle); + StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); + StrictMode.setThreadPolicy(policy); + prefs = getPreferences(MODE_PRIVATE); + view = buildStatusView(); + view.setKeepScreenOn(true); + cardScroller = new CardScrollView(this); + cardScroller.setAdapter(new CardScrollAdapter() { + @Override + public int getCount() { + return 1; + } + + @Override + public Object getItem(int position) { + return view; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + return view; + } + + @Override + public int getPosition(Object item) { + if (view.equals(item)) { + return 0; + } + return AdapterView.INVALID_POSITION; + } + }); + + cardScroller.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE); + am.playSoundEffect(Sounds.TAP); + + } + }); + setContentView(cardScroller); + } + + @Override + protected void onResume() { + super.onResume(); + cardScroller.activate(); + } + + @Override + protected void onPause() { + cardScroller.deactivate(); + super.onPause(); + } + + private View buildStatusView() { + if (vehicleData == null) { + try { + getVehicleData(); + } catch(Exception e) { + Log.v("Tesla API Setup", "Unable to get Tesla data", e); + this.finishAffinity(); + System.exit(0); // Shouldn't be reached, but just in case let's kill it dead + } + } + + CardBuilder card = new CardBuilder(this, CardBuilder.Layout.TEXT); + String chargeDuration = ""; + int totalSecs = (int) (vehicleData.charge_state.time_to_full_charge * 3600); + int hours = totalSecs / 3600; + int minutes = (totalSecs % 3600) / 60; + if (hours > 0) { + chargeDuration += hours + "h"; + } + if (minutes > 0) { + chargeDuration += minutes + "m"; + } + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.HOUR_OF_DAY, hours); + cal.add(Calendar.MINUTE, minutes); + card.setText( + String.format(getString(R.string.StatusFormat), + vehicleData.charge_state.battery_level, + (int) vehicleData.charge_state.battery_range, + vehicleData.vehicle_state.sentry_mode ? "Enabled" : "Disabled", + vehicleData.charge_state.charging_state, + vehicleData.charge_state.charger_power, + chargeDuration, + new SimpleDateFormat("hh:mm").format(cal.getTime()) + ) + ); + card.setFootnote(String.format("%s last updated: %s", + vehicleData.display_name, + new SimpleDateFormat("hh:mm").format(vehicleData.charge_state.timestamp) + )); + + return card.getView(); + } + + // /api/1/vehicles/{id}/vehicle_data + public void getVehicleData() { + String vehicleId = prefs.getString("vehicle_id", ""); + String json = getResponseFromJsonURL("https://owner-api.teslamotors.com/api/1/vehicles/" + vehicleId +"/vehicle_data"); + Gson gson = new Gson(); + ResponseRoot root = gson.fromJson(json, ResponseRoot.class); + vehicleData = root.response; + } + public String getResponseFromJsonURL(String url) { + String token = prefs.getString("bearer_token", ""); + + String jsonResponse = null; + if (url.length() > 0) { + try { + Security.insertProviderAt(Conscrypt.newProvider(), 1); + + + + /************** For getting response from HTTP URL start ***************/ + URL object = new URL(url); + + OkHttpClient client = new OkHttpClient(); + Request request = new Request.Builder() + .url(object) + .addHeader("Authorization", "Bearer " + token) + .addHeader("User-Agent", "Tesla-GLASS") + .addHeader("Content-Type", "application/json") + .build(); + + Response response = client.newCall(request).execute(); + + int responseCode = response.code(); + + if (responseCode == 200) { + return response.body().string(); + + } + } catch (SSLException e) { + Log.e("DataSSL", "SSL Exception getting json:", e); + } catch (Exception e) { + e.printStackTrace(); + } + } + return jsonResponse; + } + +} + + diff --git a/app/src/main/java/haus/nightmare/GlassTesla/MediaState.java b/app/src/main/java/haus/nightmare/GlassTesla/MediaState.java new file mode 100644 index 0000000..fa03718 --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/MediaState.java @@ -0,0 +1,5 @@ +package haus.nightmare.GlassTesla; + +public class MediaState { + public boolean remote_control_enabled; +} diff --git a/app/src/main/java/haus/nightmare/GlassTesla/ResponseRoot.java b/app/src/main/java/haus/nightmare/GlassTesla/ResponseRoot.java new file mode 100644 index 0000000..c858130 --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/ResponseRoot.java @@ -0,0 +1,5 @@ +package haus.nightmare.GlassTesla; + +public class ResponseRoot { + public TeslaResponse response; +} diff --git a/app/src/main/java/haus/nightmare/GlassTesla/SoftwareUpdate.java b/app/src/main/java/haus/nightmare/GlassTesla/SoftwareUpdate.java new file mode 100644 index 0000000..73f08b7 --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/SoftwareUpdate.java @@ -0,0 +1,9 @@ +package haus.nightmare.GlassTesla; + +public class SoftwareUpdate { + public int download_perc; + public int expected_duration_sec; + public int install_perc; + public String status; + public String version; +} diff --git a/app/src/main/java/haus/nightmare/GlassTesla/SpeedLimitMode.java b/app/src/main/java/haus/nightmare/GlassTesla/SpeedLimitMode.java new file mode 100644 index 0000000..088f4c4 --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/SpeedLimitMode.java @@ -0,0 +1,9 @@ +package haus.nightmare.GlassTesla; + +public class SpeedLimitMode { + public boolean active; + public double current_limit_mph; + public int max_limit_mph; + public int min_limit_mph; + public boolean pin_code_set; +} diff --git a/app/src/main/java/haus/nightmare/GlassTesla/TeslaResponse.java b/app/src/main/java/haus/nightmare/GlassTesla/TeslaResponse.java new file mode 100644 index 0000000..0d5c66c --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/TeslaResponse.java @@ -0,0 +1,30 @@ +package haus.nightmare.GlassTesla; + +import java.util.ArrayList; + + +public class TeslaResponse{ + public long id; + public long user_id; + public long vehicle_id; + public String vin; + public String display_name; + public String option_codes; + public Object color; + public String access_type; + public ArrayList tokens; + public String state; + public boolean in_service; + public String id_s; + public boolean calendar_enabled; + public int api_version; + public Object backseat_token; + public Object backseat_token_updated_at; + public DriveState drive_state; + public ClimateState climate_state; + public ChargeState charge_state; + public GuiSettings gui_settings; + public VehicleState vehicle_state; + public VehicleConfig vehicle_config; +} + diff --git a/app/src/main/java/haus/nightmare/GlassTesla/VehicleConfig.java b/app/src/main/java/haus/nightmare/GlassTesla/VehicleConfig.java new file mode 100644 index 0000000..0956f73 --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/VehicleConfig.java @@ -0,0 +1,29 @@ +package haus.nightmare.GlassTesla; + +public class VehicleConfig { + public boolean can_accept_navigation_requests; + public boolean can_actuate_trunks; + public String car_special_type; + public String car_type; + public String charge_port_type; + public boolean default_charge_to_max; + public boolean ece_restrictions; + public boolean eu_vehicle; + public String exterior_color; + public boolean has_air_suspension; + public boolean has_ludicrous_mode; + public boolean motorized_charge_port; + public boolean plg; + public int rear_seat_heaters; + public int rear_seat_type; + public boolean rhd; + public String roof_color; + public int seat_type; + public String spoiler_type; + public int sun_roof_installed; + public String third_row_seats; + public long timestamp; + public String trim_badging; + public boolean use_range_badging; + public String wheel_type; +} diff --git a/app/src/main/java/haus/nightmare/GlassTesla/VehicleState.java b/app/src/main/java/haus/nightmare/GlassTesla/VehicleState.java new file mode 100644 index 0000000..c2a17e8 --- /dev/null +++ b/app/src/main/java/haus/nightmare/GlassTesla/VehicleState.java @@ -0,0 +1,44 @@ +package haus.nightmare.GlassTesla; + +public class VehicleState { + public int api_version; + public String autopark_state_v2; + public String autopark_style; + public boolean calendar_supported; + public String car_version; + public int center_display_state; + public int df; + public int dr; + public int fd_window; + public int fp_window; + public int ft; + public int homelink_device_count; + public boolean homelink_nearby; + public boolean is_user_present; + public String last_autopark_error; + public boolean locked; + public MediaState media_state; + public boolean notifications_supported; + public double odometer; + public boolean parsed_calendar_supported; + public int pf; + public int pr; + public int rd_window; + public boolean remote_start; + public boolean remote_start_enabled; + public boolean remote_start_supported; + public int rp_window; + public int rt; + public boolean sentry_mode; + public boolean sentry_mode_available; + public boolean smart_summon_available; + public SoftwareUpdate software_update; + public SpeedLimitMode speed_limit_mode; + public boolean summon_standby_mode_enabled; + public int sun_roof_percent_open; + public String sun_roof_state; + public long timestamp; + public boolean valet_mode; + public boolean valet_pin_needed; + public Object vehicle_name; +} diff --git a/app/src/main/res/drawable-hdpi/ic_glass_logo.png b/app/src/main/res/drawable-hdpi/ic_glass_logo.png new file mode 100644 index 0000000..2f17b96 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_glass_logo.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_stop.png b/app/src/main/res/drawable-hdpi/ic_stop.png new file mode 100644 index 0000000..f6acb41 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_stop.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..286809b Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png b/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png new file mode 100644 index 0000000..1ec01c4 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png b/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png new file mode 100644 index 0000000..d10d056 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..a3aa6c2 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png b/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png new file mode 100644 index 0000000..7213224 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png b/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png new file mode 100644 index 0000000..07c58ab Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..489539d Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png new file mode 100644 index 0000000..eb247cf Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png new file mode 100644 index 0000000..3dd0d73 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..cd7af10 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png new file mode 100644 index 0000000..6013683 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png new file mode 100644 index 0000000..5f83049 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..fce2ad5 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png new file mode 100644 index 0000000..c743b48 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png new file mode 100644 index 0000000..6681b89 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png differ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..5d7fa0b --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ + + GlassTesla + Glass Tesla + Hello, world! + glass tesla + Battery: %d%% (%d mi)\nSentry Mode: %s \n%s: %dkW \nTime to Full: %s (%s) + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..8cd593e --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/xml/voice_trigger.xml b/app/src/main/res/xml/voice_trigger.xml new file mode 100644 index 0000000..295079a --- /dev/null +++ b/app/src/main/res/xml/voice_trigger.xml @@ -0,0 +1,2 @@ + + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..1367437 --- /dev/null +++ b/build.gradle @@ -0,0 +1,28 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + google() + jcenter() + + } + dependencies { + classpath 'com.android.tools.build:gradle:3.4.2' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } + +} + +allprojects { + repositories { + google() + jcenter() + + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..199d16e --- /dev/null +++ b/gradle.properties @@ -0,0 +1,20 @@ +# 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 +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f6b961f Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..f16de31 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Aug 19 22:28:14 EDT 2019 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..cccdd3d --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# 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 + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# 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 +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +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" -a "$nonstop" = "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 + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..e95643d --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@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 + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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= + +@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 Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_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=%* + +: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/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app'