diff --git a/.idea/misc.xml b/.idea/misc.xml index 92209e6..856a07f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,6 +3,9 @@ + + + diff --git a/README b/README index d15763f..cb58d8c 100644 --- a/README +++ b/README @@ -15,15 +15,13 @@ Current Features: * Auto night mode(dark color scheme) using the light sensor * Sensor discovery * Runs in the background -* Optional data logging in csv format to /sdcard/itpms +* Optional data logging in csv format to /sdcard/mtpms * English language, please contact me if you would like to help with a translation Howto Use: 1) Power on the iTPMSystem -2) Pair your device to the iTPMSystem unit, test with the Vendor supplied app and close it. - If it doesn't work then this app probably won't either. -3) Launch iTPMSystem, you should see message that you are connected. - You now need to wait for the sensors to start sending data through the iTPMSystem. +2) Pair your device to the iTPMSystem unit, test with the Vendor supplied app and close it. If it doesn't work then this app probably won't either. +3) Launch iTPMSystem, you should see message that you are connected. You now need to wait for the sensors to start sending data through the iTPMSystem. 4) Once discovered map them to their wheel locations in the preferences. 5) Enjoy @@ -32,4 +30,10 @@ Android SQLiteAssetHelper https://github.com/jgilfelt/android-sqlite-asset-helper SVG TPMS Icon sourced from: -http://commons.m.wikimedia.org/wiki/File:TPMS_warning_icon.svg \ No newline at end of file +http://commons.m.wikimedia.org/wiki/File:TPMS_warning_icon.svg + +Donate +If you find any of this usefull and want to show appreciation see below: + +PayPal: keith.conger@gmail.com +Bitcoin: 1Pg54vVnaLxNsziA6cy9CTefoEG5iAm9Uh \ No newline at end of file diff --git a/app/app.iml b/app/app.iml index c3cacf4..8ac2de1 100644 --- a/app/app.iml +++ b/app/app.iml @@ -79,6 +79,7 @@ + diff --git a/app/src/main/java/org/thecongers/mtpms/MainActivity.java b/app/src/main/java/org/thecongers/mtpms/MainActivity.java index 2ddf3f6..ad64371 100644 --- a/app/src/main/java/org/thecongers/mtpms/MainActivity.java +++ b/app/src/main/java/org/thecongers/mtpms/MainActivity.java @@ -262,11 +262,8 @@ public void handleMessage(android.os.Message msg) { logger.write("front", String.valueOf(psi), String.valueOf(tempC), String.valueOf(voltage)); } final LinearLayout layoutFront = (LinearLayout) findViewById(R.id.layoutFront); - int notificationID = 0; if (psi <= fLowPressure) { frontStatus = 1; - // Send notification - Notify(TAG, getResources().getString(R.string.alert_lowFrontPressure), notificationID); // Set background to red if (itsDark){ layoutFront.setBackground(redBackgroundDark); @@ -275,8 +272,6 @@ public void handleMessage(android.os.Message msg) { } } else if (psi >= fHighPressure) { frontStatus = 2; - // Send notification - Notify(TAG, getResources().getString(R.string.alert_highFrontPressure), notificationID); // Set background to red if (itsDark){ layoutFront.setBackground(redBackgroundDark); @@ -285,9 +280,6 @@ public void handleMessage(android.os.Message msg) { } } else { frontStatus = 0; - if (notificationManager != null) { - notificationManager.cancel(notificationID); - } // Reset background if (itsDark){ layoutFront.setBackground(backgroundDark); @@ -310,11 +302,8 @@ public void handleMessage(android.os.Message msg) { logger.write("rear", String.valueOf(psi), String.valueOf(tempC), String.valueOf(voltage)); } final LinearLayout layoutRear = (LinearLayout) findViewById(R.id.layoutRear); - int notificationID = 1; if (psi <= rLowPressure) { rearStatus = 1; - // Send notification - Notify(TAG, getResources().getString(R.string.alert_lowRearPressure), notificationID); // Set background to red if (itsDark){ layoutRear.setBackground(redBackgroundDark); @@ -322,9 +311,6 @@ public void handleMessage(android.os.Message msg) { layoutRear.setBackground(redBackground); } } else if (psi >= rHighPressure) { - rearStatus = 2; - // Send notification - Notify(TAG, getResources().getString(R.string.alert_highRearPressure), notificationID); // Set background to red if (itsDark){ layoutRear.setBackground(redBackgroundDark); @@ -333,9 +319,6 @@ public void handleMessage(android.os.Message msg) { } } else { rearStatus = 0; - if (notificationManager != null) { - notificationManager.cancel(notificationID); - } // Reset background if (itsDark){ layoutRear.setBackground(backgroundDark); @@ -347,25 +330,36 @@ public void handleMessage(android.os.Message msg) { txtRearTemperature.setText(String.valueOf(formattedTemperature) + " " + temperatureUnit); txtRearVoltage.setText(String.format("%.2f", voltage) + " V"); } - // Update txtOutput box + // Update txtOutput box and send notification if ((frontStatus == 0) && (rearStatus == 0)){ txtOutput.setText(""); + if (notificationManager != null ){ + notificationManager.cancel(0); + } } else if ((frontStatus == 1) && (rearStatus == 0)){ txtOutput.setText(getResources().getString(R.string.alert_lowFrontPressure)); + Notify(getResources().getString(R.string.alert_lowFrontPressure)); } else if ((frontStatus == 2) && (rearStatus == 0)){ txtOutput.setText(getResources().getString(R.string.alert_highFrontPressure)); + Notify(getResources().getString(R.string.alert_highFrontPressure)); } else if ((rearStatus == 1) && (frontStatus == 0)){ txtOutput.setText(getResources().getString(R.string.alert_lowRearPressure)); + Notify(getResources().getString(R.string.alert_lowRearPressure)); } else if ((rearStatus == 2) && (frontStatus == 0)){ txtOutput.setText(getResources().getString(R.string.alert_highRearPressure)); + Notify(getResources().getString(R.string.alert_highRearPressure)); } else if ((frontStatus == 1) && (rearStatus == 1)){ txtOutput.setText(getResources().getString(R.string.alert_lowFrontLowRearPressure)); + Notify(getResources().getString(R.string.alert_lowFrontLowRearPressure)); } else if ((frontStatus == 2) && (rearStatus == 2)){ txtOutput.setText(getResources().getString(R.string.alert_highFrontHighRearPressure)); + Notify(getResources().getString(R.string.alert_highFrontHighRearPressure)); } else if ((frontStatus == 1) && (rearStatus == 2)){ txtOutput.setText(getResources().getString(R.string.alert_lowFrontHighRearPressure)); + Notify(getResources().getString(R.string.alert_lowFrontHighRearPressure)); } else if ((frontStatus == 2) && (rearStatus == 1)){ txtOutput.setText(getResources().getString(R.string.alert_highFrontLowRearPressure)); + Notify(getResources().getString(R.string.alert_highFrontLowRearPressure)); } if (!itsDark) { txtOutput.setBackground(txtOutBackground); @@ -738,7 +732,7 @@ public void run() { } //Send Notification - private void Notify(String notificationTitle, String notificationMessage, int notificationID) + private void Notify(String notificationMessage) { notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); @@ -753,7 +747,7 @@ private void Notify(String notificationTitle, String notificationMessage, int no Uri soundURI = Uri.parse(alertURI); // Build notification NotificationCompat.Builder builder = new NotificationCompat.Builder(this); - builder.setContentTitle(notificationTitle) + builder.setContentTitle(getResources().getString(R.string.app_shortName)) .setContentText(notificationMessage) .setSmallIcon(R.drawable.notification_icon) .setAutoCancel(false) @@ -777,7 +771,7 @@ private void Notify(String notificationTitle, String notificationMessage, int no notification.flags |= Notification.FLAG_INSISTENT; // Send notification - notificationManager.notify(notificationID, notification); + notificationManager.notify(0, notification); } // Listens for light sensor events diff --git a/playstore-graphics/Feature-Graphic.png b/playstore-graphics/Feature-Graphic.png new file mode 100644 index 0000000..9ec1251 Binary files /dev/null and b/playstore-graphics/Feature-Graphic.png differ diff --git a/playstore-graphics/Nexus6-Alert-SS.png b/playstore-graphics/Nexus6-Alert-SS.png new file mode 100644 index 0000000..840fb0b Binary files /dev/null and b/playstore-graphics/Nexus6-Alert-SS.png differ diff --git a/playstore-graphics/Nexus6-Landscape-Alert-SS.png b/playstore-graphics/Nexus6-Landscape-Alert-SS.png new file mode 100644 index 0000000..6df1c50 Binary files /dev/null and b/playstore-graphics/Nexus6-Landscape-Alert-SS.png differ diff --git a/playstore-graphics/Nexus6-Landscape-Night-SS.png b/playstore-graphics/Nexus6-Landscape-Night-SS.png new file mode 100644 index 0000000..e70cb1b Binary files /dev/null and b/playstore-graphics/Nexus6-Landscape-Night-SS.png differ diff --git a/playstore-graphics/Nexus6-Landscape-SS.png b/playstore-graphics/Nexus6-Landscape-SS.png new file mode 100644 index 0000000..27c5294 Binary files /dev/null and b/playstore-graphics/Nexus6-Landscape-SS.png differ diff --git a/web_hi_res_512.png b/playstore-graphics/web_hi_res_512.png similarity index 100% rename from web_hi_res_512.png rename to playstore-graphics/web_hi_res_512.png