mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-cordova-android into audio
This commit is contained in:
commit
6415848383
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
|||||||
default.properties
|
default.properties
|
||||||
gen
|
gen
|
||||||
assets/www/cordova.js
|
assets/www/cordova.js
|
||||||
|
framework/assets/www/.tmp*
|
||||||
local.properties
|
local.properties
|
||||||
framework/proguard.cfg
|
framework/proguard.cfg
|
||||||
framework/cordova.jar
|
framework/cordova.jar
|
||||||
|
@ -619,10 +619,12 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
|
|
||||||
// If app doesn't want to run in background
|
// If app doesn't want to run in background
|
||||||
if (!this.keepRunning) {
|
if (!this.keepRunning) {
|
||||||
|
|
||||||
// Pause JavaScript timers (including setInterval)
|
// Pause JavaScript timers (including setInterval)
|
||||||
this.appView.pauseTimers();
|
this.appView.pauseTimers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hide the splash screen to avoid leaking a window
|
||||||
|
this.removeSplashScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -684,6 +686,9 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
LOG.d(TAG, "onDestroy()");
|
LOG.d(TAG, "onDestroy()");
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
|
// hide the splash screen to avoid leaking a window
|
||||||
|
this.removeSplashScreen();
|
||||||
|
|
||||||
if (this.appView != null) {
|
if (this.appView != null) {
|
||||||
|
|
||||||
// Send destroy event to JavaScript
|
// Send destroy event to JavaScript
|
||||||
@ -966,7 +971,7 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
* Removes the Dialog that displays the splash screen
|
* Removes the Dialog that displays the splash screen
|
||||||
*/
|
*/
|
||||||
public void removeSplashScreen() {
|
public void removeSplashScreen() {
|
||||||
if (splashDialog != null) {
|
if (splashDialog != null && splashDialog.isShowing()) {
|
||||||
splashDialog.dismiss();
|
splashDialog.dismiss();
|
||||||
splashDialog = null;
|
splashDialog = null;
|
||||||
}
|
}
|
||||||
|
78
framework/src/org/apache/cordova/api/LegacyContext.java
Normal file
78
framework/src/org/apache/cordova/api/LegacyContext.java
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
package org.apache.cordova.api;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.AssetManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
|
||||||
|
public class LegacyContext implements CordovaInterface {
|
||||||
|
private CordovaInterface cordova;
|
||||||
|
|
||||||
|
public LegacyContext(CordovaInterface cordova) {
|
||||||
|
this.cordova = cordova;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelLoadUrl() {
|
||||||
|
this.cordova.cancelLoadUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Activity getActivity() {
|
||||||
|
return this.cordova.getActivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Context getContext() {
|
||||||
|
return this.cordova.getContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onMessage(String arg0, Object arg1) {
|
||||||
|
return this.cordova.onMessage(arg0, arg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivityResultCallback(IPlugin arg0) {
|
||||||
|
this.cordova.setActivityResultCallback(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startActivityForResult(IPlugin arg0, Intent arg1, int arg2) {
|
||||||
|
this.cordova.startActivityForResult(arg0, arg1, arg2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startActivity(Intent intent) {
|
||||||
|
this.cordova.getActivity().startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getSystemService(String name) {
|
||||||
|
return this.cordova.getActivity().getSystemService(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AssetManager getAssets() {
|
||||||
|
return this.cordova.getActivity().getAssets();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runOnUiThread(Runnable runnable) {
|
||||||
|
this.cordova.getActivity().runOnUiThread(runnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Context getApplicationContext() {
|
||||||
|
return this.cordova.getActivity().getApplicationContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PackageManager getPackageManager() {
|
||||||
|
return this.cordova.getActivity().getPackageManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SharedPreferences getSharedPreferences(String name, int mode) {
|
||||||
|
return this.cordova.getActivity().getSharedPreferences(name, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unregisterReceiver(BroadcastReceiver receiver) {
|
||||||
|
this.cordova.getActivity().unregisterReceiver(receiver);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resources getResources() {
|
||||||
|
return this.cordova.getActivity().getResources();
|
||||||
|
}
|
||||||
|
}
|
@ -32,12 +32,12 @@ public abstract class Plugin implements IPlugin {
|
|||||||
|
|
||||||
public String id;
|
public String id;
|
||||||
public CordovaWebView webView; // WebView object
|
public CordovaWebView webView; // WebView object
|
||||||
public CordovaInterface ctx; // CordovaActivity object
|
public LegacyContext ctx; // LegacyContext object
|
||||||
public CordovaInterface cordova;
|
public CordovaInterface cordova;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the request and returns PluginResult.
|
* Executes the request and returns PluginResult.
|
||||||
*
|
*
|
||||||
* @param action The action to execute.
|
* @param action The action to execute.
|
||||||
* @param args JSONArry of arguments for the plugin.
|
* @param args JSONArry of arguments for the plugin.
|
||||||
* @param callbackId The callback id used when calling back into JavaScript.
|
* @param callbackId The callback id used when calling back into JavaScript.
|
||||||
@ -63,13 +63,13 @@ public abstract class Plugin implements IPlugin {
|
|||||||
*/
|
*/
|
||||||
public void setContext(CordovaInterface ctx) {
|
public void setContext(CordovaInterface ctx) {
|
||||||
this.cordova = ctx;
|
this.cordova = ctx;
|
||||||
this.ctx = cordova;
|
this.ctx = new LegacyContext(cordova);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the main View of the application, this is the WebView within which
|
* Sets the main View of the application, this is the WebView within which
|
||||||
* a Cordova app runs.
|
* a Cordova app runs.
|
||||||
*
|
*
|
||||||
* @param webView The Cordova WebView
|
* @param webView The Cordova WebView
|
||||||
*/
|
*/
|
||||||
public void setView(CordovaWebView webView) {
|
public void setView(CordovaWebView webView) {
|
||||||
@ -77,8 +77,8 @@ public abstract class Plugin implements IPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the system is about to start resuming a previous activity.
|
* Called when the system is about to start resuming a previous activity.
|
||||||
*
|
*
|
||||||
* @param multitasking Flag indicating if multitasking is turned on for app
|
* @param multitasking Flag indicating if multitasking is turned on for app
|
||||||
*/
|
*/
|
||||||
public void onPause(boolean multitasking) {
|
public void onPause(boolean multitasking) {
|
||||||
|
Loading…
Reference in New Issue
Block a user