Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
make sharing next step work on 191209
Browse files Browse the repository at this point in the history
  • Loading branch information
g4rb4g3 committed Jul 5, 2020
1 parent 98412d4 commit 9ff3c28
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
minSdkVersion 17
targetSdkVersion 17
versionCode 1
versionName "3.1.7"
versionName "3.1.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters 'armeabi-v7a'
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/g4rb4g3/at/abrptransmitter/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ public class Constants {

public static final String ABRPTRANSMITTER_RELEASE_URL = "https://api.github.com/repos/g4rb4g3/abrptransmitter/releases";
public static final String ABRPTRANSMITTER_APK_NAME = "app-debug.apk";

public static final String SYSTEM_PROPERTY_LGE_FW_VERSIOIN = "ro.lge.fw_version";
}
17 changes: 16 additions & 1 deletion app/src/main/java/g4rb4g3/at/abrptransmitter/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
Expand Down Expand Up @@ -37,8 +39,21 @@ public static List<String> getIPAddresses() {
}
return Collections.unmodifiableList(ips);
}

public static String getTimestamp() {
return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date());
}

public static String getSystemProperty(String propertyName) {
String value = "";
try {
Process getPropProcess = Runtime.getRuntime().exec("getprop " + propertyName);
BufferedReader osRes = new BufferedReader(new InputStreamReader(getPropProcess.getInputStream()));
value = osRes.readLine();
osRes.close();
} catch (Exception e) {
sLog.error("error getting system property " + propertyName, e);
}
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import androidx.fragment.app.Fragment;
import g4rb4g3.at.abrptransmitter.R;
import g4rb4g3.at.abrptransmitter.TLSSocketFactory;
import g4rb4g3.at.abrptransmitter.Utils;
import g4rb4g3.at.abrptransmitter.service.AbrpTransmitterService;

import static com.lge.ivi.view.IviKeyEvent.KEYCODE_TUNE_DOWN;
Expand All @@ -63,6 +64,7 @@
import static g4rb4g3.at.abrptransmitter.Constants.PREFERENCES_APPLY_CSS;
import static g4rb4g3.at.abrptransmitter.Constants.PREFERENCES_NAME;
import static g4rb4g3.at.abrptransmitter.Constants.PREFERENCES_TOKEN;
import static g4rb4g3.at.abrptransmitter.Constants.SYSTEM_PROPERTY_LGE_FW_VERSIOIN;

/**
* A simple {@link Fragment} subclass.
Expand Down Expand Up @@ -113,6 +115,8 @@ public void onServiceDisconnected(ComponentName name) {
}
};

private String mLgeFirmwareVersion;

public AbrpGeckViewFragment() {
// Required empty public constructor
}
Expand All @@ -133,6 +137,7 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mSharedPreferences = getContext().getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE);
mLgeFirmwareVersion = Utils.getSystemProperty(SYSTEM_PROPERTY_LGE_FW_VERSIOIN);

GeckoRuntimeSettings.Builder builder = new GeckoRuntimeSettings.Builder();
mGeckoRuntime = GeckoRuntime.create(getContext(), builder.build());
Expand Down Expand Up @@ -178,16 +183,23 @@ public GeckoResult<AllowOrDeny> onLoadRequest(@NonNull GeckoSession session, @No
name = "";
}

Intent intent = new Intent();
intent.setAction("com.hkmc.intent.action.ACTION_ROUTE_SEARCH");
intent.putExtra("com.hkmc.navi.EXTRA_LATITUDE", lat);
intent.putExtra("com.hkmc.navi.EXTRA_LONGITUDE", lon);
intent.putExtra("com.hkmc.navi.EXTRA_KEYWORD", name);
getContext().sendBroadcast(intent);

intent = new Intent();
intent.setComponent(new ComponentName("com.mnsoft.navi", "com.mnsoft.navi.NaviApp"));
startActivity(intent);
Intent intent1 = new Intent();
intent1.setComponent(new ComponentName("com.mnsoft.navi", "com.mnsoft.navi.NaviApp"));
startActivity(intent1);

final String finalName = name;
new Handler().postDelayed(() -> {
Intent intent = new Intent();
if("XX.EUR.SOP.00.191209".equals(mLgeFirmwareVersion)) {
intent.setAction("com.hkmc.intent.action.ACTION_SHOW_MAP");
} else {
intent.setAction("com.hkmc.intent.action.ACTION_ROUTE_SEARCH");
}
intent.putExtra("com.hkmc.navi.EXTRA_LATITUDE", lat);
intent.putExtra("com.hkmc.navi.EXTRA_LONGITUDE", lon);
intent.putExtra("com.hkmc.navi.EXTRA_KEYWORD", finalName);
getContext().sendBroadcast(intent);
}, 1000);
} else if (request.uri.startsWith(ABETTERROUTEPLANNER_AUTH_REDIRECT_URI)) {
if (request.uri.contains(ABETTERROUTEPLANNER_AUTH_AUTH_CODE)) {
String authCode = request.uri.substring(request.uri.indexOf(ABETTERROUTEPLANNER_AUTH_AUTH_CODE) + ABETTERROUTEPLANNER_AUTH_AUTH_CODE.length() + 1);
Expand Down

0 comments on commit 9ff3c28

Please sign in to comment.