mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
Always call plugin's onPause/onResume with multitasking flag when these lifecycle events occur in activity. It is up to the plugin to handle as necessary.
This commit is contained in:
parent
a65638ab59
commit
1c3ea54dcb
@ -616,7 +616,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
this.appView.loadUrl("javascript:try{PhoneGap.onPause.fire();}catch(e){};");
|
this.appView.loadUrl("javascript:try{PhoneGap.onPause.fire();}catch(e){};");
|
||||||
|
|
||||||
// Forward to plugins
|
// Forward to plugins
|
||||||
this.pluginManager.onPause();
|
this.pluginManager.onPause(this.keepRunning);
|
||||||
|
|
||||||
// If app doesn't want to run in background
|
// If app doesn't want to run in background
|
||||||
if (!this.keepRunning) {
|
if (!this.keepRunning) {
|
||||||
@ -651,7 +651,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
this.appView.loadUrl("javascript:try{PhoneGap.onResume.fire();}catch(e){};");
|
this.appView.loadUrl("javascript:try{PhoneGap.onResume.fire();}catch(e){};");
|
||||||
|
|
||||||
// Forward to plugins
|
// Forward to plugins
|
||||||
this.pluginManager.onResume();
|
this.pluginManager.onResume(this.keepRunning || this.activityResultKeepRunning);
|
||||||
|
|
||||||
// If app doesn't want to run in background
|
// If app doesn't want to run in background
|
||||||
if (!this.keepRunning || this.activityResultKeepRunning) {
|
if (!this.keepRunning || this.activityResultKeepRunning) {
|
||||||
|
@ -54,13 +54,17 @@ public interface 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
|
||||||
*/
|
*/
|
||||||
void onPause();
|
void onPause(boolean multitasking);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the activity will start interacting with the user.
|
* Called when the activity will start interacting with the user.
|
||||||
|
*
|
||||||
|
* @param multitasking Flag indicating if multitasking is turned on for app
|
||||||
*/
|
*/
|
||||||
void onResume();
|
void onResume(boolean multitasking);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The final call you receive before your activity is destroyed.
|
* The final call you receive before your activity is destroyed.
|
||||||
|
@ -64,14 +64,18 @@ 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
|
||||||
*/
|
*/
|
||||||
public void onPause() {
|
public void onPause(boolean multitasking) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the activity will start interacting with the user.
|
* Called when the activity will start interacting with the user.
|
||||||
|
*
|
||||||
|
* @param multitasking Flag indicating if multitasking is turned on for app
|
||||||
*/
|
*/
|
||||||
public void onResume() {
|
public void onResume(boolean multitasking) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -230,27 +230,31 @@ public final class PluginManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*/
|
*/
|
||||||
public void onPause() {
|
public void onPause(boolean multitasking) {
|
||||||
java.util.Set<Entry<String,Plugin>> s = this.plugins.entrySet();
|
java.util.Set<Entry<String,Plugin>> s = this.plugins.entrySet();
|
||||||
java.util.Iterator<Entry<String,Plugin>> it = s.iterator();
|
java.util.Iterator<Entry<String,Plugin>> it = s.iterator();
|
||||||
while(it.hasNext()) {
|
while(it.hasNext()) {
|
||||||
Entry<String,Plugin> entry = it.next();
|
Entry<String,Plugin> entry = it.next();
|
||||||
Plugin plugin = entry.getValue();
|
Plugin plugin = entry.getValue();
|
||||||
plugin.onPause();
|
plugin.onPause(multitasking);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the activity will start interacting with the user.
|
* Called when the activity will start interacting with the user.
|
||||||
|
*
|
||||||
|
* @param multitasking Flag indicating if multitasking is turned on for app
|
||||||
*/
|
*/
|
||||||
public void onResume() {
|
public void onResume(boolean multitasking) {
|
||||||
java.util.Set<Entry<String,Plugin>> s = this.plugins.entrySet();
|
java.util.Set<Entry<String,Plugin>> s = this.plugins.entrySet();
|
||||||
java.util.Iterator<Entry<String,Plugin>> it = s.iterator();
|
java.util.Iterator<Entry<String,Plugin>> it = s.iterator();
|
||||||
while(it.hasNext()) {
|
while(it.hasNext()) {
|
||||||
Entry<String,Plugin> entry = it.next();
|
Entry<String,Plugin> entry = it.next();
|
||||||
Plugin plugin = entry.getValue();
|
Plugin plugin = entry.getValue();
|
||||||
plugin.onResume();
|
plugin.onResume(multitasking);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user