Skip to content

Commit

Permalink
add gmaps go support
Browse files Browse the repository at this point in the history
  • Loading branch information
skyforcetw committed Aug 25, 2021
1 parent 961fc6b commit ffcb8ee
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,15 @@ private void processNotification(StatusBarNotification sbn) {
String packageName = sbn.getPackageName();
switch (packageName) {
case GOOGLE_MAPS_PACKAGE_NAME:
mNotifySource = 0;
parseGmapsNotification(notification);
break;

case GOOGLE_MAPS_GO_PACKAGE_NAME:
parseGmapsGoNotificationByReflection(notification);
// parseGmapsGoNotificationByReflection(notification);
mNotifySource = 1;
mParseMethod = 0;
boolean parseResult = parseGmapsNotificationByExtras(notification);
break;
/*case OSMAND_PACKAGE_NAME:
parseOsmandNotification(notification);
Expand Down Expand Up @@ -312,7 +316,10 @@ private void parseOsmandNotification(Notification notification) {

parseOsmandNotificationByExtras(notification);
}

private int mParseMethod = -1;
private int mNotifySource = -1;

private void parseGmapsNotification(Notification notification) {
long currentTime = System.currentTimeMillis();
mNotifyPeriodTime = currentTime - mLastNotifyTimeMillis;
Expand All @@ -337,7 +344,7 @@ private void parseGmapsNotification(Notification notification) {
mPostman.addBooleanExtra(getString(R.string.is_in_navigation), false);
mPostman.sendIntent2MainActivity();

String notifyMessage = "Notify parsing failed. " +(noViewsSituation?"(non-SDK interface restrictions)":"");
String notifyMessage = "Notify parsing failed. " + (noViewsSituation ? "(non-SDK interface restrictions)" : "");
mPostman.addStringExtra(getString(R.string.notify_msg), notifyMessage);
} else {
mPostman.addBooleanExtra(getString(R.string.notify_parse_failed), false);
Expand Down Expand Up @@ -592,7 +599,7 @@ else if (methodName.equals("setText")) {
parcel.recycle();
indexOfActions++;
}
if(validActionCount != 0) {
if (validActionCount != 0) {
logParseMessage();
}
//can update to garmin hud
Expand Down Expand Up @@ -683,7 +690,7 @@ private boolean parseGmapsNotificationByJavaReflection(Notification notification
textOnGmapsNotifyByJavaReflection = t;
break;
case 6:
textOnGmapsNotifyByJavaReflection += " "+t;
textOnGmapsNotifyByJavaReflection += " " + t;
break;
case 9:
//time, distance, arrived time
Expand Down Expand Up @@ -748,10 +755,10 @@ private boolean parseGmapsNotificationByJavaReflection(Notification notification
}
}

if(validActionCount != 0) {
if (validActionCount != 0) {
logParseMessage();
mIsNavigating = true;
}else {
} else {
mIsNavigating = false;
}
//can update to garmin hud
Expand All @@ -769,13 +776,15 @@ private boolean parseGmapsNotificationByJavaReflection(Notification notification

private void logParseMessage() {
String arrowString = mArrowTypeV2 ? mFoundArrowV2.toString() : mFoundArrow.toString();
String notifySourceString = mNotifySource == 0 ? "gmaps" : mNotifySource == 1 ? "gmaps go" : "unknow";
String notifyMessage = arrowString + "(" + (mArrowTypeV2 ? "v2:" : "v1:") + sArrowMinSad + ") " +
mDistanceNum + "/" + mDistanceUnit + " " +
(null == mRemainingHours ? 0 : mRemainingHours) + ":" + mRemainingMinutes + " " +
mRemainingDistance + mRemainingDistanceUnits + " " +
mArrivalHours + ":" + mArrivalMinutes +
" busy: " + (mBusyTraffic ? "1" : "0") +
" parseMethod: ("+ mParseMethod + ")" +
" parseMethod: (" + mParseMethod + ")" +
" source: (" + notifySourceString + ")" +
" (period: " + mNotifyPeriodTime + ")";
logi(notifyMessage);

Expand Down
4 changes: 2 additions & 2 deletions GoogleMaps_HUD/gmaps_hud/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Tue Aug 24 17:46:57 CST 2021
#Wed Aug 25 14:22:13 CST 2021
VERSION_NAME=0.8.8
VERSION_CODE=2316
VERSION_CODE=2326

0 comments on commit ffcb8ee

Please sign in to comment.