forked from github/cordova-android
CB-8764 Store serviceName instead of class (close #169)
This commit is contained in:
parent
7cf7311a9d
commit
500ccd8e80
@ -18,7 +18,7 @@ public class CordovaInterfaceImpl implements CordovaInterface {
|
|||||||
protected PluginManager pluginManager;
|
protected PluginManager pluginManager;
|
||||||
|
|
||||||
protected CordovaPlugin activityResultCallback;
|
protected CordovaPlugin activityResultCallback;
|
||||||
protected String initCallbackClass;
|
protected String initCallbackService;
|
||||||
protected int activityResultRequestCode;
|
protected int activityResultRequestCode;
|
||||||
|
|
||||||
public CordovaInterfaceImpl(Activity activity) {
|
public CordovaInterfaceImpl(Activity activity) {
|
||||||
@ -77,12 +77,12 @@ public class CordovaInterfaceImpl implements CordovaInterface {
|
|||||||
*/
|
*/
|
||||||
public boolean onActivityResult(int requestCode, int resultCode, Intent intent) {
|
public boolean onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||||
CordovaPlugin callback = activityResultCallback;
|
CordovaPlugin callback = activityResultCallback;
|
||||||
if(callback == null && initCallbackClass != null) {
|
if(callback == null && initCallbackService != null) {
|
||||||
// The application was restarted, but had defined an initial callback
|
// The application was restarted, but had defined an initial callback
|
||||||
// before being shut down.
|
// before being shut down.
|
||||||
callback = pluginManager.getPlugin(initCallbackClass);
|
callback = pluginManager.getPlugin(initCallbackService);
|
||||||
}
|
}
|
||||||
initCallbackClass = null;
|
initCallbackService = null;
|
||||||
activityResultCallback = null;
|
activityResultCallback = null;
|
||||||
|
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
@ -108,8 +108,8 @@ public class CordovaInterfaceImpl implements CordovaInterface {
|
|||||||
*/
|
*/
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
if (activityResultCallback != null) {
|
if (activityResultCallback != null) {
|
||||||
String cClass = activityResultCallback.getClass().getName();
|
String serviceName = activityResultCallback.getServiceName();
|
||||||
outState.putString("callbackClass", cClass);
|
outState.putString("callbackService", serviceName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +117,6 @@ public class CordovaInterfaceImpl implements CordovaInterface {
|
|||||||
* Call this from onCreate() so that any saved startActivityForResult parameters will be restored.
|
* Call this from onCreate() so that any saved startActivityForResult parameters will be restored.
|
||||||
*/
|
*/
|
||||||
public void restoreInstanceState(Bundle savedInstanceState) {
|
public void restoreInstanceState(Bundle savedInstanceState) {
|
||||||
initCallbackClass = savedInstanceState.getString("callbackClass");
|
initCallbackService = savedInstanceState.getString("callbackService");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user