refactor: cleanup typos

This commit is contained in:
エリス 2024-12-29 14:42:07 +09:00
parent 8338a9c7ae
commit 19da06ec29
No known key found for this signature in database
GPG Key ID: 2E5FF17FB26AF7F2
14 changed files with 55 additions and 55 deletions

View File

@ -150,7 +150,7 @@ def doGetConfigPreference(name, defaultValue) {
}
def doApplyCordovaConfigCustomization() {
// Apply user overide properties that comes from the "--gradleArg=-P" parameters
// Apply user override properties that comes from the "--gradleArg=-P" parameters
if (project.hasProperty('cdvMinSdkVersion')) {
cordovaConfig.MIN_SDK_VERSION = Integer.parseInt('' + cdvMinSdkVersion)
}

View File

@ -54,7 +54,7 @@ public class CallbackMap {
* obtained from registerCallback()
*
* @param mappedId The request code obtained from registerCallback()
* @return The CordovaPlugin and orignal request code that correspond to the
* @return The CordovaPlugin and original request code that correspond to the
* given mappedCode
*/
public synchronized Pair<CordovaPlugin, Integer> getAndRemoveCallback(int mappedId) {

View File

@ -23,7 +23,7 @@ import java.util.List;
import android.app.Activity;
@Deprecated // Use AllowList, CordovaPrefences, etc. directly.
@Deprecated // Use AllowList, CordovaPreferences, etc. directly.
public class Config {
private static final String TAG = "Config";
@ -54,7 +54,7 @@ public class Config {
}
public static String getErrorUrl() {
return parser.getPreferences().getString("errorurl", null);
return parser.getPreferences().getString("ErrorUrl", null);
}
public static List<PluginEntry> getPluginEntries() {

View File

@ -78,7 +78,7 @@ import androidx.core.splashscreen.SplashScreen;
public class CordovaActivity extends AppCompatActivity {
public static final String TAG = "CordovaActivity";
// The webview for our app
// The WebView for our app
protected CordovaWebView appView;
private static final int ACTIVITY_STARTING = 0;
@ -112,7 +112,7 @@ public class CordovaActivity extends AppCompatActivity {
// need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
loadConfig();
String logLevel = preferences.getString("loglevel", "ERROR");
String logLevel = preferences.getString("LogLevel", "ERROR");
LOG.setLogLevel(logLevel);
LOG.i(TAG, "Apache Cordova native platform version " + CordovaWebView.CORDOVA_VERSION + " is starting");
@ -206,7 +206,7 @@ public class CordovaActivity extends AppCompatActivity {
/**
* Construct the default web view object.
* <p/>
* Override this to customize the webview that is used.
* Override this to customize the WebView that is used.
*/
protected CordovaWebView makeWebView() {
return new CordovaWebViewImpl(makeWebViewEngine());
@ -227,7 +227,7 @@ public class CordovaActivity extends AppCompatActivity {
}
/**
* Load the url into the webview.
* Load the url into the WebView.
*/
public void loadUrl(String url) {
if (appView == null) {
@ -250,7 +250,7 @@ public class CordovaActivity extends AppCompatActivity {
if (this.appView != null) {
// CB-9382 If there is an activity that started for result and main activity is waiting for callback
// result, we shoudn't stop WebView Javascript timers, as activity for result might be using them
// result, we shouldn't stop WebView Javascript timers, as activity for result might be using them
boolean keepRunning = this.keepRunning || this.cordovaInterface.activityResultCallback != null;
this.appView.handlePause(keepRunning);
}

View File

@ -244,7 +244,7 @@ public class CordovaPlugin {
/**
* Hook for blocking navigation by the Cordova WebView. This applies both to top-level and
* iframe navigations.
* iframe navigation.
*
* This will be called when the WebView's needs to know whether to navigate
* to a new page. Return false to block the navigation: if any plugin
@ -282,7 +282,7 @@ public class CordovaPlugin {
/**
* Allows plugins to handle a link being clicked. Return true here to cancel the navigation.
*
* @param url The URL that is trying to be loaded in the Cordova webview.
* @param url The URL that is trying to be loaded in the Cordova WebView.
* @return true to prevent the URL from loading. Default is false.
*/
public boolean onOverrideUrlLoading(String url) {
@ -439,11 +439,11 @@ public class CordovaPlugin {
}
/**
* Called when the WebView's render process has exited. Can be used to collect information regarding the crash for crashlytics or optionally attempt to gracefully handle/recover the crashed webview by recreating it.
* Called when the WebView's render process has exited. Can be used to collect information regarding the crash for crashlytics or optionally attempt to gracefully handle/recover the crashed WebView by recreating it.
*
* See <a href="https://developer.android.com/reference/android/webkit/WebViewClient#onRenderProcessGone(android.webkit.WebView,%20android.webkit.RenderProcessGoneDetail)">WebViewClient#onRenderProcessGone</a>
*
* Note: A plugin must not attempt to recover a webview that it does not own/manage.
* Note: A plugin must not attempt to recover a WebView that it does not own/manage.
*
* @return true if the host application handled the situation that process has exited,
* otherwise, application will crash if render process crashed, or be killed

View File

@ -25,7 +25,7 @@ import android.view.View;
import android.webkit.WebChromeClient.CustomViewCallback;
/**
* Main interface for interacting with a Cordova webview - implemented by CordovaWebViewImpl.
* Main interface for interacting with a Cordova WebView - implemented by CordovaWebViewImpl.
* This is an interface so that it can be easily mocked in tests.
* Methods may be added to this interface without a major version bump, as plugins & embedders
* are not expected to implement it.
@ -92,12 +92,12 @@ public interface CordovaWebView {
void sendJavascript(String statememt);
/**
* Load the specified URL in the Cordova webview or a new browser instance.
* Load the specified URL in the Cordova WebView or a new browser instance.
*
* NOTE: If openExternal is false, only allow listed URLs can be loaded.
*
* @param url The url to load.
* @param openExternal Load url in browser instead of Cordova webview.
* @param openExternal Load url in browser instead of Cordova WebView.
* @param clearHistory Clear the history stack, so new page becomes top of history
* @param params Parameters for new app
*/

View File

@ -59,7 +59,7 @@ public interface CordovaWebViewEngine {
/** Clean up all resources associated with the WebView. */
void destroy();
/** Add the evaulate Javascript method **/
/** Add the evaluate Javascript method **/
void evaluateJavascript(String js, ValueCallback<String> callback);
/**

View File

@ -43,7 +43,7 @@ import java.util.Map;
import java.util.Set;
/**
* Main class for interacting with a Cordova webview. Manages plugins, events, and a CordovaWebViewEngine.
* Main class for interacting with a Cordova WebView. Manages plugins, events, and a CordovaWebViewEngine.
* Class uses two-phase initialization. You must call init() before calling any other methods.
*/
public class CordovaWebViewImpl implements CordovaWebView {
@ -75,13 +75,13 @@ public class CordovaWebViewImpl implements CordovaWebView {
private final Set<Integer> boundKeyCodes = new HashSet<>();
public static CordovaWebViewEngine createEngine(Context context, CordovaPreferences preferences) {
String className = preferences.getString("webview", SystemWebViewEngine.class.getCanonicalName());
String className = preferences.getString("WebView", SystemWebViewEngine.class.getCanonicalName());
try {
Class<?> webViewClass = Class.forName(className);
Constructor<?> constructor = webViewClass.getConstructor(Context.class, CordovaPreferences.class);
return (CordovaWebViewEngine) constructor.newInstance(context, preferences);
} catch (Exception e) {
throw new RuntimeException("Failed to create webview. ", e);
throw new RuntimeException("Failed to create WebView. ", e);
}
}
@ -152,7 +152,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
stopLoading();
LOG.e(TAG, "CordovaWebView: TIMEOUT ERROR!");
// Handle other errors by passing them to the webview in JS
// Handle other errors by passing them to the WebView in JS
JSONObject data = new JSONObject();
try {
data.put("errorCode", -6);
@ -213,7 +213,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
engine.clearHistory();
}
// If loading into our webview
// If loading into our WebView
if (!openExternal) {
// Make sure url is in allow list
if (pluginManager.shouldAllowNavigation(url)) {
@ -222,7 +222,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
loadUrlIntoView(url, true);
return;
} else {
LOG.w(TAG, "showWebPage: Refusing to load URL into webview since it is not in the <allow-navigation> allow list. URL=" + url);
LOG.w(TAG, "showWebPage: Refusing to load URL into WebView since it is not in the <allow-navigation> allow list. URL=" + url);
return;
}
}
@ -481,7 +481,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
// If app doesn't want to run in background
if (!keepRunning) {
// Pause JavaScript timers. This affects all webviews within the app!
// Pause JavaScript timers. This affects all WebViews within the app!
engine.setPaused(true);
}
}
@ -491,7 +491,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
return;
}
// Resume JavaScript timers. This affects all webviews within the app!
// Resume JavaScript timers. This affects all WebViews within the app!
engine.setPaused(false);
this.pluginManager.onResume(keepRunning);
@ -531,7 +531,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
// We should use a blank data: url instead so it's more obvious
this.loadUrl("about:blank");
// TODO: Should not destroy webview until after about:blank is done loading.
// TODO: Should not destroy WebView until after about:blank is done loading.
engine.destroy();
hideCustomView();
}

View File

@ -67,7 +67,7 @@ public class CoreAndroid extends CordovaPlugin {
* Executes the request and returns PluginResult.
*
* @param action The action to execute.
* @param args JSONArry of arguments for the plugin.
* @param args JSONArray of arguments for the plugin.
* @param callbackContext The callback context from which we were invoked.
*
* @return A PluginResult object with a status and message.
@ -82,9 +82,9 @@ public class CoreAndroid extends CordovaPlugin {
this.clearCache();
}
else if (action.equals("show")) {
// This gets called from JavaScript onCordovaReady to show the webview.
// This gets called from JavaScript onCordovaReady to show the WebView.
// I recommend we change the name of the Message as spinner/stop is not
// indicative of what this actually does (shows the webview).
// indicative of what this actually does (shows the WebView).
cordova.getActivity().runOnUiThread(() -> webView.getPluginManager().postMessage("spinner", "stop"));
}
else if (action.equals("loadUrl")) {
@ -143,7 +143,7 @@ public class CoreAndroid extends CordovaPlugin {
}
/**
* Load the url into the webview.
* Load the url into the WebView.
*
* @param url
* @param props Properties that can be passed in to the Cordova activity (i.e. loadingDialog, wait, ...)
@ -273,7 +273,7 @@ public class CoreAndroid extends CordovaPlugin {
private void initTelephonyReceiver() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
//final CordovaInterface mycordova = this.cordova;
//final CordovaInterface myCordova = this.cordova;
this.telephonyReceiver = new BroadcastReceiver() {
@Override

View File

@ -491,9 +491,9 @@ public class NativeToJsMessageQueue {
case PluginResult.MESSAGE_TYPE_MULTIPART:
int size = pluginResult.getMultipartMessagesSize();
for (int i=0; i<size; i++) {
PluginResult subresult = pluginResult.getMultipartMessage(i);
JsMessage submessage = new JsMessage(subresult, jsPayloadOrCallbackId);
submessage.buildJsMessage(sb);
PluginResult subResult = pluginResult.getMultipartMessage(i);
JsMessage subMessage = new JsMessage(subResult, jsPayloadOrCallbackId);
subMessage.buildJsMessage(sb);
if (i < (size-1)) {
sb.append(",");
}

View File

@ -86,7 +86,7 @@ public class PluginManager {
}
/**
* Init when loading a new HTML page into webview.
* Init when loading a new HTML page into WebView.
*/
public void init() {
LOG.d(TAG, "init()");
@ -388,7 +388,7 @@ public class PluginManager {
}
/**
* Called when the webview is going to request an external resource.
* Called when the WebView is going to request an external resource.
*
* This delegates to the installed plugins, and returns true/false for the
* first plugin to provide a non-null result. If no plugins respond, then
@ -420,7 +420,7 @@ public class PluginManager {
return true;
}
if (url.startsWith("file://")) {
//This directory on WebKit/Blink based webviews contains SQLite databases!
//This directory on WebKit/Blink based WebViews contains SQLite databases!
//DON'T CHANGE THIS UNLESS YOU KNOW WHAT YOU'RE DOING!
return !url.contains("/app_webview/");
}
@ -428,7 +428,7 @@ public class PluginManager {
}
/**
* Called when the webview is going to change the URL of the loaded content.
* Called when the WebView is going to change the URL of the loaded content.
*
* This delegates to the installed plugins, and returns true/false for the
* first plugin to provide a non-null result. If no plugins respond, then
@ -457,7 +457,7 @@ public class PluginManager {
/**
* Called when the webview is requesting the exec() bridge be enabled.
* Called when the WebView is requesting the exec() bridge be enabled.
*/
public boolean shouldAllowBridgeAccess(String url) {
synchronized (this.entryMap) {
@ -477,7 +477,7 @@ public class PluginManager {
}
/**
* Called when the webview is going not going to navigate, but may launch
* Called when the WebView is going not going to navigate, but may launch
* an Intent for an URL.
*
* This delegates to the installed plugins, and returns true/false for the
@ -506,7 +506,7 @@ public class PluginManager {
}
/**
* Called when the URL of the webview changes.
* Called when the URL of the WebView changes.
*
* @param url The URL that is being changed to.
* @return Return false to allow the URL to load, return true to prevent the URL from loading.

View File

@ -59,7 +59,7 @@ import org.apache.cordova.LOG;
*/
public class SystemWebChromeClient extends WebChromeClient {
private static final int FILECHOOSER_RESULTCODE = 5173;
private static final int FILE_CHOOSER_RESULT_CODE = 5173;
private static final String LOG_TAG = "SystemWebChromeClient";
private final long MAX_QUOTA = 100 * 1024 * 1024;
protected final SystemWebViewEngine parentEngine;
@ -197,7 +197,7 @@ public class SystemWebChromeClient extends WebChromeClient {
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.setLayoutParams(layoutParams);
// the proress bar
// the progress bar
ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
barLayoutParams.gravity = Gravity.CENTER;
@ -294,7 +294,7 @@ public class SystemWebChromeClient extends WebChromeClient {
}
filePathsCallback.onReceiveValue(result);
}
}, chooserIntent, FILECHOOSER_RESULTCODE);
}, chooserIntent, FILE_CHOOSER_RESULT_CODE);
} catch (ActivityNotFoundException e) {
LOG.w(LOG_TAG, "No activity found to handle file chooser intent.", e);
filePathsCallback.onReceiveValue(null);

View File

@ -199,7 +199,7 @@ public class SystemWebViewClient extends WebViewClient {
* one time for the main frame. This also means that onPageStarted will not be called when the contents of an
* embedded frame changes, i.e. clicking a link whose target is an iframe.
*
* @param view The webview initiating the callback.
* @param view The WebView initiating the callback.
* @param url The url of the page.
*/
@Override
@ -216,7 +216,7 @@ public class SystemWebViewClient extends WebViewClient {
* This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet.
*
*
* @param view The webview initiating the callback.
* @param view The WebView initiating the callback.
* @param url The url of the page.
*/
@Override

View File

@ -105,7 +105,7 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
@Override
public void setNetworkAvailable(boolean value) {
//sometimes this can be called after calling webview.destroy() on destroy()
//sometimes this can be called after calling webView.destroy() on destroy()
//thus resulting in a NullPointerException
if(webView!=null) {
webView.setNetworkAvailable(value);
@ -170,16 +170,16 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
String databasePath = webView.getContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
settings.setDatabaseEnabled(true);
// The default is to use the module's debuggable state to decide if the webview inspecter
// should be enabled. However, users can configure InspectableWebview preference to forcefully enable
// or disable the webview inspecter.
String inspectableWebview = preferences.getString("InspectableWebview", null);
// The default is to use the module's debuggable state to decide if the WebView inspector
// should be enabled. However, users can configure InspectableWebView preference to forcefully enable
// or disable the WebView inspector.
String inspectableWebView = preferences.getString("InspectableWebView", null);
boolean shouldEnableInspector = false;
if (inspectableWebview == null) {
if (inspectableWebView == null) {
ApplicationInfo appInfo = webView.getContext().getApplicationContext().getApplicationInfo();
shouldEnableInspector = (appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
}
else if ("true".equals(inspectableWebview)) {
else if ("true".equals(inspectableWebView)) {
shouldEnableInspector = true;
}
@ -244,7 +244,7 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
/**
* Load the url into the webview.
* Load the url into the WebView.
*/
@Override
public void loadUrl(final String url, boolean clearNavigationStack) {
@ -283,7 +283,7 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
*/
@Override
public boolean goBack() {
// Check webview first to see if there is a history
// Check WebView first to see if there is a history
// This is needed to support curPage#diffLink, since they are added to parentEngine's history, but not our history url array (JQMobile behavior)
if (webView.canGoBack()) {
webView.goBack();