mirror of
https://github.com/apache/cordova-android.git
synced 2025-03-01 22:49:39 +08:00
refactor: java 7 migration aid - replace explicit type with <>
This commit is contained in:
parent
ad3aa4b134
commit
63834a362d
@ -97,7 +97,7 @@ public class AllowList {
|
|||||||
public static final String TAG = "CordovaAllowList";
|
public static final String TAG = "CordovaAllowList";
|
||||||
|
|
||||||
public AllowList() {
|
public AllowList() {
|
||||||
this.allowList = new ArrayList<URLPattern>();
|
this.allowList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Match patterns (from http://developer.chrome.com/extensions/match_patterns.html)
|
/* Match patterns (from http://developer.chrome.com/extensions/match_patterns.html)
|
||||||
|
@ -31,7 +31,7 @@ public class CallbackMap {
|
|||||||
private SparseArray<Pair<CordovaPlugin, Integer>> callbacks;
|
private SparseArray<Pair<CordovaPlugin, Integer>> callbacks;
|
||||||
|
|
||||||
public CallbackMap() {
|
public CallbackMap() {
|
||||||
this.callbacks = new SparseArray<Pair<CordovaPlugin, Integer>>();
|
this.callbacks = new SparseArray<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +45,7 @@ public class CallbackMap {
|
|||||||
*/
|
*/
|
||||||
public synchronized int registerCallback(CordovaPlugin receiver, int requestCode) {
|
public synchronized int registerCallback(CordovaPlugin receiver, int requestCode) {
|
||||||
int mappedId = this.currentCallbackId++;
|
int mappedId = this.currentCallbackId++;
|
||||||
callbacks.put(mappedId, new Pair<CordovaPlugin, Integer>(receiver, requestCode));
|
callbacks.put(mappedId, new Pair<>(receiver, requestCode));
|
||||||
return mappedId;
|
return mappedId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class ConfigXmlParser {
|
|||||||
private String launchUrl;
|
private String launchUrl;
|
||||||
private String contentSrc;
|
private String contentSrc;
|
||||||
private CordovaPreferences prefs = new CordovaPreferences();
|
private CordovaPreferences prefs = new CordovaPreferences();
|
||||||
private ArrayList<PluginEntry> pluginEntries = new ArrayList<PluginEntry>(20);
|
private ArrayList<PluginEntry> pluginEntries = new ArrayList<>(20);
|
||||||
|
|
||||||
public CordovaPreferences getPreferences() {
|
public CordovaPreferences getPreferences() {
|
||||||
return prefs;
|
return prefs;
|
||||||
|
@ -29,7 +29,7 @@ import android.app.Activity;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
public class CordovaPreferences {
|
public class CordovaPreferences {
|
||||||
private HashMap<String, String> prefs = new HashMap<String, String>(20);
|
private HashMap<String, String> prefs = new HashMap<>(20);
|
||||||
private Bundle preferencesBundleExtras;
|
private Bundle preferencesBundleExtras;
|
||||||
|
|
||||||
public void setPreferencesBundle(Bundle extras) {
|
public void setPreferencesBundle(Bundle extras) {
|
||||||
|
@ -72,7 +72,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
|
|||||||
private View mCustomView;
|
private View mCustomView;
|
||||||
private WebChromeClient.CustomViewCallback mCustomViewCallback;
|
private WebChromeClient.CustomViewCallback mCustomViewCallback;
|
||||||
|
|
||||||
private Set<Integer> boundKeyCodes = new HashSet<Integer>();
|
private Set<Integer> boundKeyCodes = new HashSet<>();
|
||||||
|
|
||||||
public static CordovaWebViewEngine createEngine(Context context, CordovaPreferences preferences) {
|
public static CordovaWebViewEngine createEngine(Context context, CordovaPreferences preferences) {
|
||||||
String className = preferences.getString("webview", SystemWebViewEngine.class.getCanonicalName());
|
String className = preferences.getString("webview", SystemWebViewEngine.class.getCanonicalName());
|
||||||
@ -91,7 +91,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
|
|||||||
|
|
||||||
// Convenience method for when creating programmatically (not from Config.xml).
|
// Convenience method for when creating programmatically (not from Config.xml).
|
||||||
public void init(CordovaInterface cordova) {
|
public void init(CordovaInterface cordova) {
|
||||||
init(cordova, new ArrayList<PluginEntry>(), new CordovaPreferences());
|
init(cordova, new ArrayList<>(), new CordovaPreferences());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("Assert")
|
@SuppressLint("Assert")
|
||||||
|
@ -167,7 +167,7 @@ public class CoreAndroid extends CordovaPlugin {
|
|||||||
boolean clearHistory = false;
|
boolean clearHistory = false;
|
||||||
|
|
||||||
// If there are properties, then set them on the Activity
|
// If there are properties, then set them on the Activity
|
||||||
HashMap<String, Object> params = new HashMap<String, Object>();
|
HashMap<String, Object> params = new HashMap<>();
|
||||||
if (props != null) {
|
if (props != null) {
|
||||||
JSONArray keys = props.names();
|
JSONArray keys = props.names();
|
||||||
for (int i = 0; i < keys.length(); i++) {
|
for (int i = 0; i < keys.length(); i++) {
|
||||||
|
@ -51,12 +51,12 @@ public class NativeToJsMessageQueue {
|
|||||||
/**
|
/**
|
||||||
* The list of JavaScript statements to be sent to JavaScript.
|
* The list of JavaScript statements to be sent to JavaScript.
|
||||||
*/
|
*/
|
||||||
private final LinkedList<JsMessage> queue = new LinkedList<JsMessage>();
|
private final LinkedList<JsMessage> queue = new LinkedList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The array of listeners that can be used to send messages to JS.
|
* The array of listeners that can be used to send messages to JS.
|
||||||
*/
|
*/
|
||||||
private ArrayList<BridgeMode> bridgeModes = new ArrayList<BridgeMode>();
|
private ArrayList<BridgeMode> bridgeModes = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When null, the bridge is disabled. This occurs during page transitions.
|
* When null, the bridge is disabled. This occurs during page transitions.
|
||||||
|
@ -52,8 +52,8 @@ public class PluginManager {
|
|||||||
private static final int SLOW_EXEC_WARNING_THRESHOLD = Debug.isDebuggerConnected() ? 60 : 16;
|
private static final int SLOW_EXEC_WARNING_THRESHOLD = Debug.isDebuggerConnected() ? 60 : 16;
|
||||||
|
|
||||||
// List of service entries
|
// List of service entries
|
||||||
private final Map<String, CordovaPlugin> pluginMap = Collections.synchronizedMap(new LinkedHashMap<String, CordovaPlugin>());
|
private final Map<String, CordovaPlugin> pluginMap = Collections.synchronizedMap(new LinkedHashMap<>());
|
||||||
private final Map<String, PluginEntry> entryMap = Collections.synchronizedMap(new LinkedHashMap<String, PluginEntry>());
|
private final Map<String, PluginEntry> entryMap = Collections.synchronizedMap(new LinkedHashMap<>());
|
||||||
|
|
||||||
private final CordovaInterface ctx;
|
private final CordovaInterface ctx;
|
||||||
private final CordovaWebView app;
|
private final CordovaWebView app;
|
||||||
@ -611,7 +611,7 @@ public class PluginManager {
|
|||||||
* @return list of PathHandlers in no particular order
|
* @return list of PathHandlers in no particular order
|
||||||
*/
|
*/
|
||||||
public ArrayList<CordovaPluginPathHandler> getPluginPathHandlers() {
|
public ArrayList<CordovaPluginPathHandler> getPluginPathHandlers() {
|
||||||
ArrayList<CordovaPluginPathHandler> handlers = new ArrayList<CordovaPluginPathHandler>();
|
ArrayList<CordovaPluginPathHandler> handlers = new ArrayList<>();
|
||||||
for (CordovaPlugin plugin : this.pluginMap.values()) {
|
for (CordovaPlugin plugin : this.pluginMap.values()) {
|
||||||
if (plugin != null && plugin.getPathHandler() != null) {
|
if (plugin != null && plugin.getPathHandler() != null) {
|
||||||
handlers.add(plugin.getPathHandler());
|
handlers.add(plugin.getPathHandler());
|
||||||
|
@ -66,7 +66,7 @@ public class ResumeCallback extends CallbackContext {
|
|||||||
// the PluginResult passed to this CallbackContext into JSON twice.
|
// the PluginResult passed to this CallbackContext into JSON twice.
|
||||||
// The results are combined into an event payload before the event is
|
// The results are combined into an event payload before the event is
|
||||||
// fired on the js side of things (see platform.js)
|
// fired on the js side of things (see platform.js)
|
||||||
List<PluginResult> result = new ArrayList<PluginResult>();
|
List<PluginResult> result = new ArrayList<>();
|
||||||
result.add(eventResult);
|
result.add(eventResult);
|
||||||
result.add(pluginResult);
|
result.add(pluginResult);
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ public class SystemWebChromeClient extends WebChromeClient {
|
|||||||
// Handle result
|
// Handle result
|
||||||
Uri[] result = null;
|
Uri[] result = null;
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
List<Uri> uris = new ArrayList<Uri>();
|
List<Uri> uris = new ArrayList<>();
|
||||||
|
|
||||||
if (intent != null && intent.getData() != null) { // single file
|
if (intent != null && intent.getData() != null) { // single file
|
||||||
LOG.v(LOG_TAG, "Adding file (single): " + intent.getData());
|
LOG.v(LOG_TAG, "Adding file (single): " + intent.getData());
|
||||||
|
@ -68,7 +68,7 @@ public class SystemWebViewClient extends WebViewClient {
|
|||||||
boolean isCurrentlyLoading;
|
boolean isCurrentlyLoading;
|
||||||
|
|
||||||
/** The authorization tokens. */
|
/** The authorization tokens. */
|
||||||
private Hashtable<String, AuthenticationToken> authenticationTokens = new Hashtable<String, AuthenticationToken>();
|
private Hashtable<String, AuthenticationToken> authenticationTokens = new Hashtable<>();
|
||||||
|
|
||||||
public SystemWebViewClient(SystemWebViewEngine parentEngine) {
|
public SystemWebViewClient(SystemWebViewEngine parentEngine) {
|
||||||
this.parentEngine = parentEngine;
|
this.parentEngine = parentEngine;
|
||||||
|
Loading…
Reference in New Issue
Block a user