summaryrefslogtreecommitdiff
path: root/platform/android/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/java/src')
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java30
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotView.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java16
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java4
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java22
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java4
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java22
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java14
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java10
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java14
11 files changed, 74 insertions, 66 deletions
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index 94d29a3350..610f707b47 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -257,8 +257,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
public void onVideoInit(boolean use_gl2) {
-// mView = new GodotView(getApplication(),io,use_gl2);
-// setContentView(mView);
+ //mView = new GodotView(getApplication(),io,use_gl2);
+ //setContentView(mView);
layout = new FrameLayout(this);
layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
@@ -582,7 +582,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
initializeGodot();
- // instanceSingleton( new GodotFacebook(this) );
+ //instanceSingleton( new GodotFacebook(this) );
}
@@ -804,9 +804,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
} break;
case MotionEvent.ACTION_MOVE: {
GodotLib.touch(1,0,evcount,arr);
- //for(int i=0;i<event.getPointerCount();i++) {
- // System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i));
- //}
+ /*
+ for(int i=0;i<event.getPointerCount();i++) {
+ System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i));
+ }
+ */
} break;
case MotionEvent.ACTION_POINTER_UP: {
final int indexPointUp = event.getActionIndex();
@@ -822,9 +824,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP: {
GodotLib.touch(2,0,evcount,arr);
- //for(int i=0;i<event.getPointerCount();i++) {
- // System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i));
- //}
+ /*
+ for(int i=0;i<event.getPointerCount();i++) {
+ System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i));
+ }
+ */
} break;
}
@@ -866,9 +870,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
return mPaymentsManager;
}
-// public void setPaymentsManager(PaymentsManager mPaymentsManager) {
-// this.mPaymentsManager = mPaymentsManager;
-// };
+ /*
+ public void setPaymentsManager(PaymentsManager mPaymentsManager) {
+ this.mPaymentsManager = mPaymentsManager;
+ }
+ */
// Audio
diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java
index 878528f7c7..fba082e80d 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java
@@ -57,7 +57,7 @@ public class GodotDownloaderService extends DownloaderService {
Log.d("GODOT", "getting public key:" + prefs.getString("store_public_key", null));
return prefs.getString("store_public_key", null);
-// return BASE64_PUBLIC_KEY;
+ //return BASE64_PUBLIC_KEY;
}
/**
diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java
index db67144bcc..4cfe295835 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotView.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotView.java
@@ -265,7 +265,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
if (keyCode == KeyEvent.KEYCODE_BACK) {
GodotLib.quit();
// press 'back' button should not terminate program
- // normal handle 'back' event in game logic
+ //normal handle 'back' event in game logic
return true;
}
diff --git a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java
index 13a24994f8..67293df2a8 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java
@@ -47,19 +47,19 @@ abstract public class ConsumeTask {
public void consume(final String sku){
-// Log.d("XXX", "Consuming product " + sku);
+ //Log.d("XXX", "Consuming product " + sku);
PaymentsCache pc = new PaymentsCache(context);
Boolean isBlocked = pc.getConsumableFlag("block", sku);
String _token = pc.getConsumableValue("token", sku);
-// Log.d("XXX", "token " + _token);
+ //Log.d("XXX", "token " + _token);
if(!isBlocked && _token == null){
-// _token = "inapp:"+context.getPackageName()+":android.test.purchased";
-// Log.d("XXX", "Consuming product " + sku + " with token " + _token);
+ //_token = "inapp:"+context.getPackageName()+":android.test.purchased";
+ //Log.d("XXX", "Consuming product " + sku + " with token " + _token);
}else if(!isBlocked){
-// Log.d("XXX", "It is not blocked ¿?");
+ //Log.d("XXX", "It is not blocked ¿?");
return;
}else if(_token == null){
-// Log.d("XXX", "No token available");
+ //Log.d("XXX", "No token available");
this.error("No token for sku:" + sku);
return;
}
@@ -69,9 +69,9 @@ abstract public class ConsumeTask {
@Override
protected String doInBackground(String... params) {
try {
-// Log.d("XXX", "Requesting to release item.");
+ //Log.d("XXX", "Requesting to release item.");
int response = mService.consumePurchase(3, context.getPackageName(), token);
-// Log.d("XXX", "release response code: " + response);
+ //Log.d("XXX", "release response code: " + response);
if(response == 0 || response == 8){
return null;
}
diff --git a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java
index 20feaef581..dfa363ed75 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java
@@ -60,9 +60,9 @@ abstract public class GenericConsumeTask extends AsyncTask<String, String, Strin
@Override
protected String doInBackground(String... params) {
try {
-// Log.d("godot", "Requesting to consume an item with token ." + token);
+ //Log.d("godot", "Requesting to consume an item with token ." + token);
int response = mService.consumePurchase(3, context.getPackageName(), token);
-// Log.d("godot", "consumePurchase response: " + response);
+ //Log.d("godot", "consumePurchase response: " + response);
if(response == 0 || response == 8){
return null;
}
diff --git a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java
index 1aa210265d..3850453a77 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java
@@ -56,29 +56,29 @@ abstract public class HandlePurchaseTask {
public void handlePurchaseRequest(int resultCode, Intent data){
-// Log.d("XXX", "Handling purchase response");
-// int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
+ //Log.d("XXX", "Handling purchase response");
+ //int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
PaymentsCache pc = new PaymentsCache(context);
String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA");
-// Log.d("XXX", "Purchase data:" + purchaseData);
+ //Log.d("XXX", "Purchase data:" + purchaseData);
String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE");
//Log.d("XXX", "Purchase signature:" + dataSignature);
if (resultCode == Activity.RESULT_OK) {
try {
-// Log.d("SARLANGA", purchaseData);
+ //Log.d("SARLANGA", purchaseData);
JSONObject jo = new JSONObject(purchaseData);
-// String sku = jo.getString("productId");
-// alert("You have bought the " + sku + ". Excellent choice, aventurer!");
-// String orderId = jo.getString("orderId");
-// String packageName = jo.getString("packageName");
+ //String sku = jo.getString("productId");
+ //alert("You have bought the " + sku + ". Excellent choice, aventurer!");
+ //String orderId = jo.getString("orderId");
+ //String packageName = jo.getString("packageName");
String productId = jo.getString("productId");
-// Long purchaseTime = jo.getLong("purchaseTime");
-// Integer state = jo.getInt("purchaseState");
+ //Long purchaseTime = jo.getLong("purchaseTime");
+ //Integer state = jo.getInt("purchaseState");
String developerPayload = jo.getString("developerPayload");
String purchaseToken = jo.getString("purchaseToken");
@@ -86,7 +86,7 @@ abstract public class HandlePurchaseTask {
error("Untrusted callback");
return;
}
-// Log.d("XXX", "Este es el product ID:" + productId);
+ //Log.d("XXX", "Este es el product ID:" + productId);
pc.setConsumableValue("ticket_signautre", productId, dataSignature);
pc.setConsumableValue("ticket", productId, purchaseData);
pc.setConsumableFlag("block", productId, true);
diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java
index 88fd1a0fe4..4678dae1b3 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java
@@ -59,14 +59,14 @@ public class PaymentsCache {
SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(sku, value);
-// Log.d("XXX", "Setting asset: consumables_" + set + ":" + sku);
+ //Log.d("XXX", "Setting asset: consumables_" + set + ":" + sku);
editor.commit();
}
public String getConsumableValue(String set, String sku){
SharedPreferences sharedPref = context.getSharedPreferences(
"consumables_" + set, Context.MODE_PRIVATE);
-// Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku);
+ //Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku);
return sharedPref.getString(sku, null);
}
diff --git a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java
index d154ef0c78..5ad96b35ee 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java
@@ -63,18 +63,20 @@ abstract public class PurchaseTask {
Log.d("XXX", "Starting purchase for: " + sku);
PaymentsCache pc = new PaymentsCache(context);
Boolean isBlocked = pc.getConsumableFlag("block", sku);
-// if(isBlocked){
-// Log.d("XXX", "Is awaiting payment confirmation");
-// error("Awaiting payment confirmation");
-// return;
-// }
+ /*
+ if(isBlocked){
+ Log.d("XXX", "Is awaiting payment confirmation");
+ error("Awaiting payment confirmation");
+ return;
+ }
+ */
final String hash = transactionId;
Bundle buyIntentBundle;
try {
buyIntentBundle = mService.getBuyIntent(3, context.getApplicationContext().getPackageName(), sku, "inapp", hash );
} catch (RemoteException e) {
-// Log.d("XXX", "Error: " + e.getMessage());
+ //Log.d("XXX", "Error: " + e.getMessage());
error(e.getMessage());
return;
}
@@ -87,7 +89,7 @@ abstract public class PurchaseTask {
}else if( rc instanceof Long){
responseCode = (int)((Long)rc).longValue();
}
-// Log.d("XXX", "Buy intent response code: " + responseCode);
+ //Log.d("XXX", "Buy intent response code: " + responseCode);
if(responseCode == 1 || responseCode == 3 || responseCode == 4){
canceled();
return;
@@ -102,12 +104,12 @@ abstract public class PurchaseTask {
pc.setConsumableValue("validation_hash", sku, hash);
try {
if(context == null){
-// Log.d("XXX", "No context!");
+ //Log.d("XXX", "No context!");
}
if(pendingIntent == null){
-// Log.d("XXX", "No pending intent");
+ //Log.d("XXX", "No pending intent");
}
-// Log.d("XXX", "Starting activity for purchase!");
+ //Log.d("XXX", "Starting activity for purchase!");
context.startIntentSenderForResult(
pendingIntent.getIntentSender(),
PaymentsManager.REQUEST_CODE_FOR_PURCHASE,
diff --git a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java
index c74269890d..60a43a9070 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java
@@ -56,13 +56,13 @@ abstract public class ReleaseAllConsumablesTask {
public void consumeItAll(){
try{
-// Log.d("godot", "consumeItall for " + context.getPackageName());
+ //Log.d("godot", "consumeItall for " + context.getPackageName());
Bundle bundle = mService.getPurchases(3, context.getPackageName(), "inapp",null);
for (String key : bundle.keySet()) {
- Object value = bundle.get(key);
-// Log.d("godot", String.format("%s %s (%s)", key,
-// value.toString(), value.getClass().getName()));
+ Object value = bundle.get(key);
+ //Log.d("godot", String.format("%s %s (%s)", key,
+ //value.toString(), value.getClass().getName()));
}
@@ -73,13 +73,13 @@ abstract public class ReleaseAllConsumablesTask {
if (myPurchases == null || myPurchases.size() == 0){
-// Log.d("godot", "No purchases!");
+ //Log.d("godot", "No purchases!");
notRequired();
return;
}
-// Log.d("godot", "# products to be consumed:" + myPurchases.size());
+ //Log.d("godot", "# products to be consumed:" + myPurchases.size());
for (int i=0;i<myPurchases.size();i++)
{
@@ -89,7 +89,7 @@ abstract public class ReleaseAllConsumablesTask {
String sku = inappPurchaseData.getString("productId");
String token = inappPurchaseData.getString("purchaseToken");
String signature = mySignatures.get(i);
-// Log.d("godot", "A punto de consumir un item con token:" + token + "\n" + receipt);
+ //Log.d("godot", "A punto de consumir un item con token:" + token + "\n" + receipt);
new GenericConsumeTask(context, mService, sku, receipt,signature, token) {
@Override
diff --git a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java
index dafab13ad7..f09bcbf9a4 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java
@@ -79,14 +79,14 @@ abstract public class ValidateTask {
param.put("ticket", pc.getConsumableValue("ticket", sku));
param.put("purchaseToken", pc.getConsumableValue("token", sku));
param.put("sku", sku);
-// Log.d("XXX", "Haciendo request a " + url);
-// Log.d("XXX", "ticket: " + pc.getConsumableValue("ticket", sku));
-// Log.d("XXX", "purchaseToken: " + pc.getConsumableValue("token", sku));
-// Log.d("XXX", "sku: " + sku);
+ //Log.d("XXX", "Haciendo request a " + url);
+ //Log.d("XXX", "ticket: " + pc.getConsumableValue("ticket", sku));
+ //Log.d("XXX", "purchaseToken: " + pc.getConsumableValue("token", sku));
+ //Log.d("XXX", "sku: " + sku);
param.put("package", context.getApplicationContext().getPackageName());
HttpRequester requester = new HttpRequester();
String jsonResponse = requester.post(param);
-// Log.d("XXX", "Validation response:\n"+jsonResponse);
+ //Log.d("XXX", "Validation response:\n"+jsonResponse);
return jsonResponse;
}
diff --git a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java
index 9dd08a9563..faefbbd2c6 100644
--- a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java
+++ b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java
@@ -78,12 +78,12 @@ public class HttpRequester {
private long cttl=0;
public HttpRequester(){
-// Log.d("XXX", "Creando http request sin contexto");
+ //Log.d("XXX", "Creando http request sin contexto");
}
public HttpRequester(Context context){
this.context=context;
-// Log.d("XXX", "Creando http request con contexto");
+ //Log.d("XXX", "Creando http request con contexto");
}
public String post(RequestParams params){
@@ -99,7 +99,7 @@ public class HttpRequester {
public String get(RequestParams params){
String response = getResponseFromCache(params.getUrl());
if(response == null){
-// Log.d("XXX", "Cache miss!");
+ //Log.d("XXX", "Cache miss!");
HttpGet httpget = new HttpGet(params.getUrl());
long timeInit = new Date().getTime();
response = request(httpget);
@@ -117,7 +117,7 @@ public class HttpRequester {
}
private String request(HttpUriRequest request){
-// Log.d("XXX", "Haciendo request a: " + request.getURI() );
+ //Log.d("XXX", "Haciendo request a: " + request.getURI() );
Log.d("PPP", "Haciendo request a: " + request.getURI() );
long init = new Date().getTime();
HttpClient httpclient = getNewHttpClient();
@@ -128,10 +128,10 @@ public class HttpRequester {
try {
HttpResponse response = httpclient.execute(request);
Log.d("PPP", "Fin de request (" + (new Date().getTime() - init) + ") a: " + request.getURI() );
-// Log.d("XXX1", "Status:" + response.getStatusLine().toString());
+ //Log.d("XXX1", "Status:" + response.getStatusLine().toString());
if(response.getStatusLine().getStatusCode() == 200){
String strResponse = EntityUtils.toString(response.getEntity());
-// Log.d("XXX2", strResponse);
+ //Log.d("XXX2", strResponse);
return strResponse;
}else{
Log.d("XXX3", "Response status code:" + response.getStatusLine().getStatusCode() + "\n" + EntityUtils.toString(response.getEntity()));
@@ -192,7 +192,7 @@ public class HttpRequester {
public void saveResponseIntoCache(String request, String response){
if(context == null){
-// Log.d("XXX", "No context, cache failed!");
+ //Log.d("XXX", "No context, cache failed!");
return;
}
SharedPreferences sharedPref = context.getSharedPreferences("http_get_cache", Context.MODE_PRIVATE);