add final modifiers to IITC_JSInterface
This commit is contained in:
parent
adc5d16297
commit
6b7525836d
@ -17,14 +17,15 @@ public class IITC_JSInterface {
|
|||||||
// context of main activity
|
// context of main activity
|
||||||
private final IITC_Mobile mIitc;
|
private final IITC_Mobile mIitc;
|
||||||
|
|
||||||
IITC_JSInterface(IITC_Mobile iitc) {
|
IITC_JSInterface(final IITC_Mobile iitc) {
|
||||||
mIitc = iitc;
|
mIitc = iitc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open dialog to send geo intent for navigation apps like gmaps or waze etc...
|
// open dialog to send geo intent for navigation apps like gmaps or waze etc...
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void intentPosLink(double lat, double lng, int zoom, String title, boolean isPortal) {
|
public void intentPosLink(
|
||||||
Intent intent = new Intent(mIitc, ShareActivity.class);
|
final double lat, final double lng, final int zoom, final String title, final boolean isPortal) {
|
||||||
|
final Intent intent = new Intent(mIitc, ShareActivity.class);
|
||||||
intent.putExtra("lat", lat);
|
intent.putExtra("lat", lat);
|
||||||
intent.putExtra("lng", lng);
|
intent.putExtra("lng", lng);
|
||||||
intent.putExtra("zoom", zoom);
|
intent.putExtra("zoom", zoom);
|
||||||
@ -35,8 +36,8 @@ public class IITC_JSInterface {
|
|||||||
|
|
||||||
// share a string to the IITC share activity. only uses the share tab.
|
// share a string to the IITC share activity. only uses the share tab.
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void shareString(String str) {
|
public void shareString(final String str) {
|
||||||
Intent intent = new Intent(mIitc, ShareActivity.class);
|
final Intent intent = new Intent(mIitc, ShareActivity.class);
|
||||||
intent.putExtra("shareString", str);
|
intent.putExtra("shareString", str);
|
||||||
intent.putExtra("onlyShare", true);
|
intent.putExtra("onlyShare", true);
|
||||||
mIitc.startActivity(intent);
|
mIitc.startActivity(intent);
|
||||||
@ -45,16 +46,15 @@ public class IITC_JSInterface {
|
|||||||
// disable javascript injection while spinner is enabled
|
// disable javascript injection while spinner is enabled
|
||||||
// prevent the spinner from closing automatically
|
// prevent the spinner from closing automatically
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void spinnerEnabled(boolean en) {
|
public void spinnerEnabled(final boolean en) {
|
||||||
mIitc.getWebView().disableJS(en);
|
mIitc.getWebView().disableJS(en);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy link to specific portal to android clipboard
|
// copy link to specific portal to android clipboard
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void copy(String s) {
|
public void copy(final String s) {
|
||||||
ClipboardManager clipboard = (ClipboardManager) mIitc
|
final ClipboardManager clipboard = (ClipboardManager) mIitc.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
.getSystemService(Context.CLIPBOARD_SERVICE);
|
final ClipData clip = ClipData.newPlainText("Copied Text ", s);
|
||||||
ClipData clip = ClipData.newPlainText("Copied Text ", s);
|
|
||||||
clipboard.setPrimaryClip(clip);
|
clipboard.setPrimaryClip(clip);
|
||||||
Toast.makeText(mIitc, "copied to clipboard", Toast.LENGTH_SHORT).show();
|
Toast.makeText(mIitc, "copied to clipboard", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
@ -63,10 +63,9 @@ public class IITC_JSInterface {
|
|||||||
public int getVersionCode() {
|
public int getVersionCode() {
|
||||||
int versionCode = 0;
|
int versionCode = 0;
|
||||||
try {
|
try {
|
||||||
PackageInfo pInfo = mIitc.getPackageManager()
|
final PackageInfo pInfo = mIitc.getPackageManager().getPackageInfo(mIitc.getPackageName(), 0);
|
||||||
.getPackageInfo(mIitc.getPackageName(), 0);
|
|
||||||
versionCode = pInfo.versionCode;
|
versionCode = pInfo.versionCode;
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (final PackageManager.NameNotFoundException e) {
|
||||||
Log.w(e);
|
Log.w(e);
|
||||||
}
|
}
|
||||||
return versionCode;
|
return versionCode;
|
||||||
@ -75,11 +74,11 @@ public class IITC_JSInterface {
|
|||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public String getVersionName() {
|
public String getVersionName() {
|
||||||
String buildVersion = "unknown";
|
String buildVersion = "unknown";
|
||||||
PackageManager pm = mIitc.getPackageManager();
|
final PackageManager pm = mIitc.getPackageManager();
|
||||||
try {
|
try {
|
||||||
PackageInfo info = pm.getPackageInfo(mIitc.getPackageName(), 0);
|
final PackageInfo info = pm.getPackageInfo(mIitc.getPackageName(), 0);
|
||||||
buildVersion = info.versionName;
|
buildVersion = info.versionName;
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (final PackageManager.NameNotFoundException e) {
|
||||||
Log.w(e);
|
Log.w(e);
|
||||||
}
|
}
|
||||||
return buildVersion;
|
return buildVersion;
|
||||||
@ -93,7 +92,7 @@ public class IITC_JSInterface {
|
|||||||
Pane pane;
|
Pane pane;
|
||||||
try {
|
try {
|
||||||
pane = mIitc.getNavigationHelper().getPane(id);
|
pane = mIitc.getNavigationHelper().getPane(id);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (final IllegalArgumentException e) {
|
||||||
pane = Pane.MAP;
|
pane = Pane.MAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,12 +102,12 @@ public class IITC_JSInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void dialogFocused(String id) {
|
public void dialogFocused(final String id) {
|
||||||
mIitc.setFocusedDialog(id);
|
mIitc.setFocusedDialog(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void dialogOpened(String id, boolean open) {
|
public void dialogOpened(final String id, final boolean open) {
|
||||||
mIitc.dialogOpened(id, open);
|
mIitc.dialogOpened(id, open);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,9 +189,9 @@ public class IITC_JSInterface {
|
|||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public boolean showZoom() {
|
public boolean showZoom() {
|
||||||
PackageManager pm = mIitc.getPackageManager();
|
final PackageManager pm = mIitc.getPackageManager();
|
||||||
boolean hasMultitouch = pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
|
final boolean hasMultitouch = pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
|
||||||
boolean forcedZoom = mIitc.getPrefs().getBoolean("pref_user_zoom", false);
|
final boolean forcedZoom = mIitc.getPrefs().getBoolean("pref_user_zoom", false);
|
||||||
return forcedZoom || !hasMultitouch;
|
return forcedZoom || !hasMultitouch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user