cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] infil00p closed pull request #385: CB-12835: add a Context getter in CordovaInterface
Date Thu, 01 Jan 1970 00:00:00 GMT
infil00p closed pull request #385: CB-12835: add a Context getter in CordovaInterface
URL: https://github.com/apache/cordova-android/pull/385
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/framework/src/org/apache/cordova/CordovaInterface.java b/framework/src/org/apache/cordova/CordovaInterface.java
index 3b8468f3b..ff9068346 100755
--- a/framework/src/org/apache/cordova/CordovaInterface.java
+++ b/framework/src/org/apache/cordova/CordovaInterface.java
@@ -19,6 +19,7 @@ Licensed to the Apache Software Foundation (ASF) under one
 package org.apache.cordova;
 
 import android.app.Activity;
+import android.content.Context;
 import android.content.Intent;
 
 import org.apache.cordova.CordovaPlugin;
@@ -51,10 +52,18 @@ Licensed to the Apache Software Foundation (ASF) under one
     /**
      * Get the Android activity.
      *
+     * If a custom engine lives outside of the Activity's lifecycle the return value may
be null.
+     *
      * @return the Activity
      */
     public abstract Activity getActivity();
-    
+
+    /**
+     * Get the Android context.
+     *
+     * @return the Context
+     */
+    public Context getContext();
 
     /**
      * Called when a message is sent to plugin.
diff --git a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
index 71dcb7828..3c459025f 100644
--- a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
+++ b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
@@ -20,6 +20,7 @@ Licensed to the Apache Software Foundation (ASF) under one
 package org.apache.cordova;
 
 import android.app.Activity;
+import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.os.Build;
@@ -84,6 +85,11 @@ public Activity getActivity() {
         return activity;
     }
 
+    @Override
+    public Context getContext() {
+        return activity;
+    }
+
     @Override
     public Object onMessage(String id, Object data) {
         if ("exit".equals(id)) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message