Java 类org.apache.cordova.api.LOG 实例源码
项目:12306-android-Decompile
文件:CordovaChromeClient.java
public void onExceededDatabaseQuota(String paramString1, String paramString2, long paramLong1, long paramLong2, long paramLong3, WebStorage.QuotaUpdater paramQuotaUpdater)
{
String str1 = this.TAG;
Object[] arrayOfObject1 = new Object[3];
arrayOfObject1[0] = Long.valueOf(paramLong2);
arrayOfObject1[1] = Long.valueOf(paramLong1);
arrayOfObject1[2] = Long.valueOf(paramLong3);
LOG.d(str1, "DroidGap: onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", arrayOfObject1);
if (paramLong2 < this.MAX_QUOTA)
{
String str2 = this.TAG;
Object[] arrayOfObject2 = new Object[1];
arrayOfObject2[0] = Long.valueOf(paramLong2);
LOG.d(str2, "calling quotaUpdater.updateQuota newQuota: %d", arrayOfObject2);
paramQuotaUpdater.updateQuota(paramLong2);
return;
}
paramQuotaUpdater.updateQuota(paramLong1);
}
项目:12306-android-Decompile
文件:InAppBrowser.java
public void onExceededDatabaseQuota(String paramString1, String paramString2, long paramLong1, long paramLong2, long paramLong3, WebStorage.QuotaUpdater paramQuotaUpdater)
{
Object[] arrayOfObject1 = new Object[3];
arrayOfObject1[0] = Long.valueOf(paramLong2);
arrayOfObject1[1] = Long.valueOf(paramLong1);
arrayOfObject1[2] = Long.valueOf(paramLong3);
LOG.d("InAppBrowser", "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", arrayOfObject1);
if (paramLong2 < InAppBrowser.this.MAX_QUOTA)
{
Object[] arrayOfObject2 = new Object[1];
arrayOfObject2[0] = Long.valueOf(paramLong2);
LOG.d("InAppBrowser", "calling quotaUpdater.updateQuota newQuota: %d", arrayOfObject2);
paramQuotaUpdater.updateQuota(paramLong2);
return;
}
paramQuotaUpdater.updateQuota(paramLong1);
}
项目:12306-android-Decompile
文件:CordovaWebViewClient.java
public void onReceivedError(WebView paramWebView, int paramInt, String paramString1, String paramString2)
{
Object[] arrayOfObject = new Object[3];
arrayOfObject[0] = Integer.valueOf(paramInt);
arrayOfObject[1] = paramString1;
arrayOfObject[2] = paramString2;
LOG.d("Cordova", "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", arrayOfObject);
CordovaWebView localCordovaWebView = this.appView;
localCordovaWebView.loadUrlTimeout = (1 + localCordovaWebView.loadUrlTimeout);
JSONObject localJSONObject = new JSONObject();
try
{
localJSONObject.put("errorCode", paramInt);
localJSONObject.put("description", paramString1);
localJSONObject.put("url", paramString2);
this.appView.postMessage("onReceivedError", localJSONObject);
return;
}
catch (JSONException localJSONException)
{
while (true)
localJSONException.printStackTrace();
}
}
项目:12306-android-Decompile
文件:DroidGap.java
@SuppressLint({"NewApi"})
public void init(CordovaWebView paramCordovaWebView, CordovaWebViewClient paramCordovaWebViewClient, CordovaChromeClient paramCordovaChromeClient)
{
LOG.d(TAG, "DroidGap.init()");
this.appView = paramCordovaWebView;
this.appView.setId(100);
this.appView.setWebViewClient(paramCordovaWebViewClient);
this.appView.setWebChromeClient(paramCordovaChromeClient);
paramCordovaWebViewClient.setWebView(this.appView);
paramCordovaChromeClient.setWebView(this.appView);
this.appView.setLayoutParams(new LinearLayout.LayoutParams(-1, -1, 1.0F));
if ((getBooleanProperty("disallowOverscroll", false)) && (Build.VERSION.SDK_INT >= 9))
this.appView.setOverScrollMode(2);
this.appView.setVisibility(4);
this.root.addView(this.appView);
setContentView(this.root);
this.cancelLoadUrl = false;
}
项目:12306-android-Decompile
文件:DroidGap.java
public void onCreate(Bundle paramBundle)
{
Config.init(this);
LOG.d(TAG, "DroidGap.onCreate()");
super.onCreate(paramBundle);
if (paramBundle != null)
this.initCallbackClass = paramBundle.getString("callbackClass");
if (!getBooleanProperty("showTitle", false))
getWindow().requestFeature(1);
if (getBooleanProperty("setFullscreen", false))
getWindow().setFlags(1024, 1024);
while (true)
{
Display localDisplay = getWindowManager().getDefaultDisplay();
this.root = new LinearLayoutSoftKeyboardDetect(this, localDisplay.getWidth(), localDisplay.getHeight());
this.root.setOrientation(1);
this.root.setBackgroundColor(this.backgroundColor);
this.root.setLayoutParams(new LinearLayout.LayoutParams(-1, -1, 0.0F));
setVolumeControlStream(3);
return;
getWindow().setFlags(2048, 2048);
}
}
项目:12306-android-Decompile
文件:DroidGap.java
protected void onResume()
{
super.onResume();
LOG.d(TAG, "Resuming the App");
if (this.activityState == ACTIVITY_STARTING)
this.activityState = ACTIVITY_RUNNING;
do
{
do
return;
while (this.appView == null);
this.appView.handleResume(this.keepRunning, this.activityResultKeepRunning);
}
while (((this.keepRunning) && (!this.activityResultKeepRunning)) || (!this.activityResultKeepRunning));
this.keepRunning = this.activityResultKeepRunning;
this.activityResultKeepRunning = false;
}
项目:12306-android-Decompile
文件:CameraLauncher.java
private Uri getUriFromMediaStore()
{
ContentValues localContentValues = new ContentValues();
localContentValues.put("mime_type", "image/jpeg");
try
{
Uri localUri2 = this.cordova.getActivity().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, localContentValues);
return localUri2;
}
catch (UnsupportedOperationException localUnsupportedOperationException1)
{
LOG.d("CameraLauncher", "Can't write to external media storage.");
try
{
Uri localUri1 = this.cordova.getActivity().getContentResolver().insert(MediaStore.Images.Media.INTERNAL_CONTENT_URI, localContentValues);
return localUri1;
}
catch (UnsupportedOperationException localUnsupportedOperationException2)
{
LOG.d("CameraLauncher", "Can't write to internal media storage.");
}
}
return null;
}
项目:12306-android-Decompile
文件:FileHelper.java
public static String getRealPath(String paramString, CordovaInterface paramCordovaInterface)
{
String str;
if (paramString.startsWith("content://"))
{
String[] arrayOfString = { "_data" };
Cursor localCursor = paramCordovaInterface.getActivity().managedQuery(Uri.parse(paramString), arrayOfString, null, null, null);
int i = localCursor.getColumnIndexOrThrow("_data");
localCursor.moveToFirst();
str = localCursor.getString(i);
if (str == null)
LOG.e("FileUtils", "Could get real path for URI string %s", new Object[] { paramString });
}
while (true)
{
return str;
if (!paramString.startsWith("file://"))
break;
str = paramString.substring(7);
if (!str.startsWith("/android_asset/"))
continue;
LOG.e("FileUtils", "Cannot get real path for URI string %s because it is a file:///android_asset/ URI.", new Object[] { paramString });
return null;
}
return paramString;
}
项目:cordova-android-chromeview
文件:CordovaActivity.java
@Override
/**
* Called when the system is about to start resuming a previous activity.
*/
protected void onPause() {
super.onPause();
LOG.d(TAG, "Paused the application!");
// Don't process pause if shutting down, since onDestroy() will be called
if (this.activityState == ACTIVITY_EXITING) {
return;
}
if (this.appView == null) {
return;
}
else
{
this.appView.handlePause(this.keepRunning);
}
// hide the splash screen to avoid leaking a window
this.removeSplashScreen();
}
项目:cordova-android-chromeview
文件:CordovaActivity.java
@Override
/**
* The final call you receive before your activity is destroyed.
*/
public void onDestroy() {
LOG.d(TAG, "CordovaActivity.onDestroy()");
super.onDestroy();
// hide the splash screen to avoid leaking a window
this.removeSplashScreen();
if (this.appView != null) {
appView.handleDestroy();
}
else {
this.activityState = ACTIVITY_EXITING;
}
}
项目:cordova-android-chromeview
文件:CordovaChromeClient.java
/**
* Handle database quota exceeded notification.
*
* @param url
* @param databaseIdentifier
* @param currentQuota
* @param estimatedSize
* @param totalUsedQuota
* @param quotaUpdater
*/
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
LOG.d(TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
if (estimatedSize < MAX_QUOTA)
{
//increase for 1Mb
long newQuota = estimatedSize;
LOG.d(TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota);
quotaUpdater.updateQuota(newQuota);
}
else
{
// Set the quota to whatever it is and force an error
// TODO: get docs on how to handle this properly
quotaUpdater.updateQuota(currentQuota);
}
}
项目:cordova-android-chromeview
文件:InAppBrowser.java
/**
* Handle database quota exceeded notification.
*
* @param url
* @param databaseIdentifier
* @param currentQuota
* @param estimatedSize
* @param totalUsedQuota
* @param quotaUpdater
*/
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
if (estimatedSize < MAX_QUOTA)
{
//increase for 1Mb
long newQuota = estimatedSize;
LOG.d(LOG_TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota);
quotaUpdater.updateQuota(newQuota);
}
else
{
// Set the quota to whatever it is and force an error
// TODO: get docs on how to handle this properly
quotaUpdater.updateQuota(currentQuota);
}
}
项目:cordova-android-chromeview
文件:CordovaWebViewClient.java
/**
* Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
* The errorCode parameter corresponds to one of the ERROR_* constants.
*
* @param view The WebView that is initiating the callback.
* @param errorCode The error code corresponding to an ERROR_* value.
* @param description A String describing the error.
* @param failingUrl The url that failed to load.
*/
@Override
public void onReceivedError(ChromeView view, int errorCode, String description, String failingUrl) {
LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl);
// Clear timeout flag
this.appView.loadUrlTimeout++;
// Handle error
JSONObject data = new JSONObject();
try {
data.put("errorCode", errorCode);
data.put("description", description);
data.put("url", failingUrl);
} catch (JSONException e) {
e.printStackTrace();
}
this.appView.postMessage("onReceivedError", data);
}
项目:cordova-android-chromeview
文件:CordovaWebView.java
/**
* Load the url into the webview after waiting for period of time.
* This is used to display the splashscreen for certain amount of time.
*
* @param url
* @param time The number of ms to wait before loading webview
*/
public void loadUrlIntoView(final String url, final int time) {
// If not first page of app, then load immediately
// Add support for browser history if we use it.
if ((url.startsWith("javascript:")) || this.canGoBack()) {
}
// If first page, then show splashscreen
else {
LOG.d(TAG, "loadUrlIntoView(%s, %d)", url, time);
// Send message to show splashscreen now if desired
this.postMessage("splashscreen", "show");
}
// Load url
this.loadUrlIntoView(url);
}
项目:cordova-android-chromeview
文件:CordovaWebView.java
public void handlePause(boolean keepRunning)
{
LOG.d(TAG, "Handle the pause");
// Send pause event to JavaScript
this.loadUrl("javascript:try{cordova.fireDocumentEvent('pause');}catch(e){console.log('exception firing pause event from native');};");
// Forward to plugins
if (this.pluginManager != null) {
this.pluginManager.onPause(keepRunning);
}
// If app doesn't want to run in background
if (!keepRunning) {
// Pause JavaScript timers (including setInterval)
this.pauseTimers();
}
paused = true;
}
项目:cordova-android-chromeview
文件:CameraLauncher.java
/**
* Create entry in media store for image
*
* @return uri
*/
private Uri getUriFromMediaStore() {
ContentValues values = new ContentValues();
values.put(android.provider.MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
Uri uri;
try {
uri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
} catch (UnsupportedOperationException e) {
LOG.d(LOG_TAG, "Can't write to external media storage.");
try {
uri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, values);
} catch (UnsupportedOperationException ex) {
LOG.d(LOG_TAG, "Can't write to internal media storage.");
return null;
}
}
return uri;
}
项目:cordova-android-chromeview
文件:FileHelper.java
/**
* Returns the real path of the given URI string.
* If the given URI string represents a content:// URI, the real path is retrieved from the media store.
*
* @param uriString the URI string of the audio/image/video
* @param cordova the current application context
* @return the full path to the file
*/
@SuppressWarnings("deprecation")
public static String getRealPath(String uriString, CordovaInterface cordova) {
String realPath = null;
if (uriString.startsWith("content://")) {
String[] proj = { _DATA };
Cursor cursor = cordova.getActivity().managedQuery(Uri.parse(uriString), proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(_DATA);
cursor.moveToFirst();
realPath = cursor.getString(column_index);
if (realPath == null) {
LOG.e(LOG_TAG, "Could get real path for URI string %s", uriString);
}
} else if (uriString.startsWith("file://")) {
realPath = uriString.substring(7);
if (realPath.startsWith("/android_asset/")) {
LOG.e(LOG_TAG, "Cannot get real path for URI string %s because it is a file:///android_asset/ URI.", uriString);
realPath = null;
}
} else {
realPath = uriString;
}
return realPath;
}
项目:12306-android-Decompile
文件:CordovaChromeClient.java
public void onExceededDatabaseQuota(String paramString1, String paramString2, long paramLong1, long paramLong2, long paramLong3, WebStorage.QuotaUpdater paramQuotaUpdater)
{
String str1 = this.TAG;
Object[] arrayOfObject1 = new Object[3];
arrayOfObject1[0] = Long.valueOf(paramLong2);
arrayOfObject1[1] = Long.valueOf(paramLong1);
arrayOfObject1[2] = Long.valueOf(paramLong3);
LOG.d(str1, "DroidGap: onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", arrayOfObject1);
if (paramLong2 < this.MAX_QUOTA)
{
String str2 = this.TAG;
Object[] arrayOfObject2 = new Object[1];
arrayOfObject2[0] = Long.valueOf(paramLong2);
LOG.d(str2, "calling quotaUpdater.updateQuota newQuota: %d", arrayOfObject2);
paramQuotaUpdater.updateQuota(paramLong2);
return;
}
paramQuotaUpdater.updateQuota(paramLong1);
}
项目:12306-android-Decompile
文件:InAppBrowser.java
public void onExceededDatabaseQuota(String paramString1, String paramString2, long paramLong1, long paramLong2, long paramLong3, WebStorage.QuotaUpdater paramQuotaUpdater)
{
Object[] arrayOfObject1 = new Object[3];
arrayOfObject1[0] = Long.valueOf(paramLong2);
arrayOfObject1[1] = Long.valueOf(paramLong1);
arrayOfObject1[2] = Long.valueOf(paramLong3);
LOG.d("InAppBrowser", "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", arrayOfObject1);
if (paramLong2 < InAppBrowser.this.MAX_QUOTA)
{
Object[] arrayOfObject2 = new Object[1];
arrayOfObject2[0] = Long.valueOf(paramLong2);
LOG.d("InAppBrowser", "calling quotaUpdater.updateQuota newQuota: %d", arrayOfObject2);
paramQuotaUpdater.updateQuota(paramLong2);
return;
}
paramQuotaUpdater.updateQuota(paramLong1);
}
项目:12306-android-Decompile
文件:CordovaWebViewClient.java
public void onReceivedError(WebView paramWebView, int paramInt, String paramString1, String paramString2)
{
Object[] arrayOfObject = new Object[3];
arrayOfObject[0] = Integer.valueOf(paramInt);
arrayOfObject[1] = paramString1;
arrayOfObject[2] = paramString2;
LOG.d("Cordova", "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", arrayOfObject);
CordovaWebView localCordovaWebView = this.appView;
localCordovaWebView.loadUrlTimeout = (1 + localCordovaWebView.loadUrlTimeout);
JSONObject localJSONObject = new JSONObject();
try
{
localJSONObject.put("errorCode", paramInt);
localJSONObject.put("description", paramString1);
localJSONObject.put("url", paramString2);
this.appView.postMessage("onReceivedError", localJSONObject);
return;
}
catch (JSONException localJSONException)
{
while (true)
localJSONException.printStackTrace();
}
}
项目:12306-android-Decompile
文件:DroidGap.java
@SuppressLint({"NewApi"})
public void init(CordovaWebView paramCordovaWebView, CordovaWebViewClient paramCordovaWebViewClient, CordovaChromeClient paramCordovaChromeClient)
{
LOG.d(TAG, "DroidGap.init()");
this.appView = paramCordovaWebView;
this.appView.setId(100);
this.appView.setWebViewClient(paramCordovaWebViewClient);
this.appView.setWebChromeClient(paramCordovaChromeClient);
paramCordovaWebViewClient.setWebView(this.appView);
paramCordovaChromeClient.setWebView(this.appView);
this.appView.setLayoutParams(new LinearLayout.LayoutParams(-1, -1, 1.0F));
if ((getBooleanProperty("disallowOverscroll", false)) && (Build.VERSION.SDK_INT >= 9))
this.appView.setOverScrollMode(2);
this.appView.setVisibility(4);
this.root.addView(this.appView);
setContentView(this.root);
this.cancelLoadUrl = false;
}
项目:12306-android-Decompile
文件:DroidGap.java
public void onCreate(Bundle paramBundle)
{
Config.init(this);
LOG.d(TAG, "DroidGap.onCreate()");
super.onCreate(paramBundle);
if (paramBundle != null)
this.initCallbackClass = paramBundle.getString("callbackClass");
if (!getBooleanProperty("showTitle", false))
getWindow().requestFeature(1);
if (getBooleanProperty("setFullscreen", false))
getWindow().setFlags(1024, 1024);
while (true)
{
Display localDisplay = getWindowManager().getDefaultDisplay();
this.root = new LinearLayoutSoftKeyboardDetect(this, localDisplay.getWidth(), localDisplay.getHeight());
this.root.setOrientation(1);
this.root.setBackgroundColor(this.backgroundColor);
this.root.setLayoutParams(new LinearLayout.LayoutParams(-1, -1, 0.0F));
setVolumeControlStream(3);
return;
getWindow().setFlags(2048, 2048);
}
}
项目:12306-android-Decompile
文件:DroidGap.java
protected void onResume()
{
super.onResume();
LOG.d(TAG, "Resuming the App");
if (this.activityState == ACTIVITY_STARTING)
this.activityState = ACTIVITY_RUNNING;
do
{
do
return;
while (this.appView == null);
this.appView.handleResume(this.keepRunning, this.activityResultKeepRunning);
}
while (((this.keepRunning) && (!this.activityResultKeepRunning)) || (!this.activityResultKeepRunning));
this.keepRunning = this.activityResultKeepRunning;
this.activityResultKeepRunning = false;
}
项目:12306-android-Decompile
文件:CameraLauncher.java
private Uri getUriFromMediaStore()
{
ContentValues localContentValues = new ContentValues();
localContentValues.put("mime_type", "image/jpeg");
try
{
Uri localUri2 = this.cordova.getActivity().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, localContentValues);
return localUri2;
}
catch (UnsupportedOperationException localUnsupportedOperationException1)
{
LOG.d("CameraLauncher", "Can't write to external media storage.");
try
{
Uri localUri1 = this.cordova.getActivity().getContentResolver().insert(MediaStore.Images.Media.INTERNAL_CONTENT_URI, localContentValues);
return localUri1;
}
catch (UnsupportedOperationException localUnsupportedOperationException2)
{
LOG.d("CameraLauncher", "Can't write to internal media storage.");
}
}
return null;
}
项目:12306-android-Decompile
文件:FileHelper.java
public static String getRealPath(String paramString, CordovaInterface paramCordovaInterface)
{
String str;
if (paramString.startsWith("content://"))
{
String[] arrayOfString = { "_data" };
Cursor localCursor = paramCordovaInterface.getActivity().managedQuery(Uri.parse(paramString), arrayOfString, null, null, null);
int i = localCursor.getColumnIndexOrThrow("_data");
localCursor.moveToFirst();
str = localCursor.getString(i);
if (str == null)
LOG.e("FileUtils", "Could get real path for URI string %s", new Object[] { paramString });
}
while (true)
{
return str;
if (!paramString.startsWith("file://"))
break;
str = paramString.substring(7);
if (!str.startsWith("/android_asset/"))
continue;
LOG.e("FileUtils", "Cannot get real path for URI string %s because it is a file:///android_asset/ URI.", new Object[] { paramString });
return null;
}
return paramString;
}
项目:cordova-android-chromium
文件:CordovaActivity.java
@Override
/**
* Called when the system is about to start resuming a previous activity.
*/
protected void onPause() {
super.onPause();
LOG.d(TAG, "Paused the application!");
// Don't process pause if shutting down, since onDestroy() will be called
if (this.activityState == ACTIVITY_EXITING) {
return;
}
if (this.appView == null) {
return;
}
else
{
this.appView.handlePause(this.keepRunning);
}
// hide the splash screen to avoid leaking a window
this.removeSplashScreen();
}
项目:cordova-android-chromium
文件:CordovaActivity.java
@Override
/**
* The final call you receive before your activity is destroyed.
*/
public void onDestroy() {
LOG.d(TAG, "CordovaActivity.onDestroy()");
super.onDestroy();
// hide the splash screen to avoid leaking a window
this.removeSplashScreen();
if (this.appView != null) {
appView.handleDestroy();
}
else {
this.activityState = ACTIVITY_EXITING;
}
}
项目:cordova-android-chromium
文件:CordovaChromeClient.java
/**
* Handle database quota exceeded notification.
*
* @param url
* @param databaseIdentifier
* @param currentQuota
* @param estimatedSize
* @param totalUsedQuota
* @param quotaUpdater
*/
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
LOG.d(TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
if (estimatedSize < MAX_QUOTA)
{
//increase for 1Mb
long newQuota = estimatedSize;
LOG.d(TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota);
quotaUpdater.updateQuota(newQuota);
}
else
{
// Set the quota to whatever it is and force an error
// TODO: get docs on how to handle this properly
quotaUpdater.updateQuota(currentQuota);
}
}
项目:cordova-android-chromium
文件:InAppBrowser.java
/**
* Handle database quota exceeded notification.
*
* @param url
* @param databaseIdentifier
* @param currentQuota
* @param estimatedSize
* @param totalUsedQuota
* @param quotaUpdater
*/
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
if (estimatedSize < MAX_QUOTA)
{
//increase for 1Mb
long newQuota = estimatedSize;
LOG.d(LOG_TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota);
quotaUpdater.updateQuota(newQuota);
}
else
{
// Set the quota to whatever it is and force an error
// TODO: get docs on how to handle this properly
quotaUpdater.updateQuota(currentQuota);
}
}
项目:cordova-android-chromium
文件:CordovaWebViewClient.java
/**
* Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
* The errorCode parameter corresponds to one of the ERROR_* constants.
*
* @param view The WebView that is initiating the callback.
* @param errorCode The error code corresponding to an ERROR_* value.
* @param description A String describing the error.
* @param failingUrl The url that failed to load.
*/
@Override
public void onReceivedError(CordovaChromiumView view, int errorCode, String description, String failingUrl) {
LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl);
// Clear timeout flag
this.appView.loadUrlTimeout++;
// Handle error
JSONObject data = new JSONObject();
try {
data.put("errorCode", errorCode);
data.put("description", description);
data.put("url", failingUrl);
} catch (JSONException e) {
e.printStackTrace();
}
this.appView.postMessage("onReceivedError", data);
}
项目:cordova-android-chromium
文件:CordovaWebView.java
/**
* Load the url into the webview after waiting for period of time.
* This is used to display the splashscreen for certain amount of time.
*
* @param url
* @param time The number of ms to wait before loading webview
*/
public void loadUrlIntoView(final String url, final int time) {
// If not first page of app, then load immediately
// Add support for browser history if we use it.
if ((url.startsWith("javascript:")) || this.canGoBack()) {
}
// If first page, then show splashscreen
else {
LOG.d(TAG, "loadUrlIntoView(%s, %d)", url, time);
// Send message to show splashscreen now if desired
this.postMessage("splashscreen", "show");
}
// Load url
this.loadUrlIntoView(url);
}
项目:cordova-android-chromium
文件:CordovaWebView.java
public void handlePause(boolean keepRunning)
{
LOG.d(TAG, "Handle the pause");
// Send pause event to JavaScript
this.loadUrl("javascript:try{cordova.fireDocumentEvent('pause');}catch(e){console.log('exception firing pause event from native');};");
// Forward to plugins
if (this.pluginManager != null) {
this.pluginManager.onPause(keepRunning);
}
// If app doesn't want to run in background
if (!keepRunning) {
// Pause JavaScript timers (including setInterval)
this.pauseTimers();
}
paused = true;
}
项目:cordova-android-chromium
文件:CameraLauncher.java
/**
* Create entry in media store for image
*
* @return uri
*/
private Uri getUriFromMediaStore() {
ContentValues values = new ContentValues();
values.put(android.provider.MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
Uri uri;
try {
uri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
} catch (UnsupportedOperationException e) {
LOG.d(LOG_TAG, "Can't write to external media storage.");
try {
uri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, values);
} catch (UnsupportedOperationException ex) {
LOG.d(LOG_TAG, "Can't write to internal media storage.");
return null;
}
}
return uri;
}
项目:cordova-android-chromium
文件:FileHelper.java
/**
* Returns the real path of the given URI string.
* If the given URI string represents a content:// URI, the real path is retrieved from the media store.
*
* @param uriString the URI string of the audio/image/video
* @param cordova the current application context
* @return the full path to the file
*/
@SuppressWarnings("deprecation")
public static String getRealPath(String uriString, CordovaInterface cordova) {
String realPath = null;
if (uriString.startsWith("content://")) {
String[] proj = { _DATA };
Cursor cursor = cordova.getActivity().managedQuery(Uri.parse(uriString), proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(_DATA);
cursor.moveToFirst();
realPath = cursor.getString(column_index);
if (realPath == null) {
LOG.e(LOG_TAG, "Could get real path for URI string %s", uriString);
}
} else if (uriString.startsWith("file://")) {
realPath = uriString.substring(7);
if (realPath.startsWith("/android_asset/")) {
LOG.e(LOG_TAG, "Cannot get real path for URI string %s because it is a file:///android_asset/ URI.", uriString);
realPath = null;
}
} else {
realPath = uriString;
}
return realPath;
}
项目:12306-android-Decompile
文件:Device.java
private void initTelephonyReceiver()
{
IntentFilter localIntentFilter = new IntentFilter();
localIntentFilter.addAction("android.intent.action.PHONE_STATE");
this.telephonyReceiver = new BroadcastReceiver()
{
public void onReceive(Context paramContext, Intent paramIntent)
{
String str;
if ((paramIntent != null) && (paramIntent.getAction().equals("android.intent.action.PHONE_STATE")) && (paramIntent.hasExtra("state")))
{
str = paramIntent.getStringExtra("state");
if (!str.equals(TelephonyManager.EXTRA_STATE_RINGING))
break label64;
LOG.i("Device", "Telephone RINGING");
Device.this.webView.postMessage("telephone", "ringing");
}
label64:
do
{
return;
if (!str.equals(TelephonyManager.EXTRA_STATE_OFFHOOK))
continue;
LOG.i("Device", "Telephone OFFHOOK");
Device.this.webView.postMessage("telephone", "offhook");
return;
}
while (!str.equals(TelephonyManager.EXTRA_STATE_IDLE));
LOG.i("Device", "Telephone IDLE");
Device.this.webView.postMessage("telephone", "idle");
}
};
this.cordova.getActivity().registerReceiver(this.telephonyReceiver, localIntentFilter);
}
项目:12306-android-Decompile
文件:CordovaChromeClient.java
public void onConsoleMessage(String paramString1, int paramInt, String paramString2)
{
if (Build.VERSION.SDK_INT == 7)
{
String str = this.TAG;
Object[] arrayOfObject = new Object[3];
arrayOfObject[0] = paramString2;
arrayOfObject[1] = Integer.valueOf(paramInt);
arrayOfObject[2] = paramString1;
LOG.d(str, "%s: Line %d : %s", arrayOfObject);
super.onConsoleMessage(paramString1, paramInt, paramString2);
}
}
项目:12306-android-Decompile
文件:CordovaChromeClient.java
@TargetApi(8)
public boolean onConsoleMessage(ConsoleMessage paramConsoleMessage)
{
if (paramConsoleMessage.message() != null)
LOG.d(this.TAG, paramConsoleMessage.message());
return super.onConsoleMessage(paramConsoleMessage);
}
项目:12306-android-Decompile
文件:Config.java
private void _addWhiteListEntry(String paramString, boolean paramBoolean)
{
while (true)
{
try
{
if (paramString.compareTo("*") != 0)
continue;
LOG.d("Config", "Unlimited access to network resources");
this.whiteList.add(Pattern.compile(".*"));
return;
if (!paramBoolean)
break;
if (paramString.startsWith("http"))
{
this.whiteList.add(Pattern.compile(paramString.replaceFirst("https?://", "^https?://(.*\\.)?")));
LOG.d("Config", "Origin to allow with subdomains: %s", new Object[] { paramString });
return;
}
}
catch (Exception localException)
{
LOG.d("Config", "Failed to add origin %s", new Object[] { paramString });
return;
}
this.whiteList.add(Pattern.compile("^https?://(.*\\.)?" + paramString));
}
if (paramString.startsWith("http"))
this.whiteList.add(Pattern.compile(paramString.replaceFirst("https?://", "^https?://")));
while (true)
{
LOG.d("Config", "Origin to allow: %s", new Object[] { paramString });
return;
this.whiteList.add(Pattern.compile("^https?://" + paramString));
}
}
项目:12306-android-Decompile
文件:CordovaWebView.java
public void handlePause(boolean paramBoolean)
{
LOG.d("CordovaWebView", "Handle the pause");
loadUrl("javascript:try{cordova.fireDocumentEvent('pause');}catch(e){console.log('exception firing pause event from native');};");
if (this.pluginManager != null)
this.pluginManager.onPause(paramBoolean);
if (!paramBoolean)
pauseTimers();
this.paused = true;
}
项目:12306-android-Decompile
文件:CordovaWebView.java
public void loadUrlIntoView(String paramString, int paramInt)
{
if ((paramString.startsWith("javascript:")) || (canGoBack()));
while (true)
{
loadUrlIntoView(paramString);
return;
Object[] arrayOfObject = new Object[2];
arrayOfObject[0] = paramString;
arrayOfObject[1] = Integer.valueOf(paramInt);
LOG.d("CordovaWebView", "DroidGap.loadUrl(%s, %d)", arrayOfObject);
postMessage("splashscreen", "show");
}
}