mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Style: Apply clang-format to Java files
Only those from org/godotengine/godot though, not the thirdparty ones.
This commit is contained in:
parent
ce0f894b48
commit
7cb6e6b723
@ -44,7 +44,6 @@ AllowShortIfStatementsOnASingleLine: true
|
|||||||
BreakBeforeTernaryOperators: false
|
BreakBeforeTernaryOperators: false
|
||||||
# BreakConstructorInitializersBeforeComma: false
|
# BreakConstructorInitializersBeforeComma: false
|
||||||
BreakConstructorInitializers: AfterColon
|
BreakConstructorInitializers: AfterColon
|
||||||
# BreakAfterJavaFieldAnnotations: false
|
|
||||||
# BreakStringLiterals: true
|
# BreakStringLiterals: true
|
||||||
ColumnLimit: 0
|
ColumnLimit: 0
|
||||||
# CommentPragmas: '^ IWYU pragma:'
|
# CommentPragmas: '^ IWYU pragma:'
|
||||||
@ -113,4 +112,8 @@ Language: ObjC
|
|||||||
ObjCBlockIndentWidth: 4
|
ObjCBlockIndentWidth: 4
|
||||||
# ObjCSpaceAfterProperty: false
|
# ObjCSpaceAfterProperty: false
|
||||||
# ObjCSpaceBeforeProtocolList: true
|
# ObjCSpaceBeforeProtocolList: true
|
||||||
|
---
|
||||||
|
### Java specific config ###
|
||||||
|
Language: Java
|
||||||
|
# BreakAfterJavaFieldAnnotations: false
|
||||||
...
|
...
|
||||||
|
@ -31,7 +31,7 @@ PARSE_EXTS=true
|
|||||||
|
|
||||||
# File types to parse. Only effective when PARSE_EXTS is true.
|
# File types to parse. Only effective when PARSE_EXTS is true.
|
||||||
# FILE_EXTS=".c .h .cpp .hpp"
|
# FILE_EXTS=".c .h .cpp .hpp"
|
||||||
FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc"
|
FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc *.java"
|
||||||
|
|
||||||
# Use pygmentize instead of cat to parse diff with highlighting.
|
# Use pygmentize instead of cat to parse diff with highlighting.
|
||||||
# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
|
# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
|
||||||
|
@ -11,7 +11,7 @@ else
|
|||||||
RANGE=HEAD
|
RANGE=HEAD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc)$")
|
FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java)$")
|
||||||
echo "Checking files:\n$FILES"
|
echo "Checking files:\n$FILES"
|
||||||
|
|
||||||
# create a random filename to store our generated patch
|
# create a random filename to store our generated patch
|
||||||
|
@ -32,7 +32,6 @@ package org.godotengine.godot;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
public class Dictionary extends HashMap<String, Object> {
|
public class Dictionary extends HashMap<String, Object> {
|
||||||
|
|
||||||
protected String[] keys_cache;
|
protected String[] keys_cache;
|
||||||
|
@ -90,9 +90,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Messenger;
|
import android.os.Messenger;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
|
public class Godot extends Activity implements SensorEventListener, IDownloaderClient {
|
||||||
public class Godot extends Activity implements SensorEventListener, IDownloaderClient
|
|
||||||
{
|
|
||||||
|
|
||||||
static final int MAX_SINGLETONS = 64;
|
static final int MAX_SINGLETONS = 64;
|
||||||
private IStub mDownloaderClientStub;
|
private IStub mDownloaderClientStub;
|
||||||
@ -118,7 +116,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
|
|
||||||
static private Intent mCurrentIntent;
|
static private Intent mCurrentIntent;
|
||||||
|
|
||||||
@Override public void onNewIntent(Intent intent) {
|
@Override
|
||||||
|
public void onNewIntent(Intent intent) {
|
||||||
mCurrentIntent = intent;
|
mCurrentIntent = intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,16 +175,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
ptr.toArray(pt);
|
ptr.toArray(pt);
|
||||||
|
|
||||||
GodotLib.method(p_name, method.getName(), method.getReturnType().getName(), pt);
|
GodotLib.method(p_name, method.getName(), method.getReturnType().getName(), pt);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Godot.singletons[Godot.singleton_count++] = this;
|
Godot.singletons[Godot.singleton_count++] = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onMainActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onMainActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onMainPause() {}
|
protected void onMainPause() {}
|
||||||
@ -207,7 +202,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
s.registerMethods();
|
s.registerMethods();
|
||||||
singletons.add(s);
|
singletons.add(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private String[] command_line;
|
private String[] command_line;
|
||||||
@ -216,7 +210,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
public GodotView mView;
|
public GodotView mView;
|
||||||
private boolean godot_initialized = false;
|
private boolean godot_initialized = false;
|
||||||
|
|
||||||
|
|
||||||
private SensorManager mSensorManager;
|
private SensorManager mSensorManager;
|
||||||
private Sensor mAccelerometer;
|
private Sensor mAccelerometer;
|
||||||
private Sensor mGravity;
|
private Sensor mGravity;
|
||||||
@ -226,26 +219,24 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
public FrameLayout layout;
|
public FrameLayout layout;
|
||||||
public RelativeLayout adLayout;
|
public RelativeLayout adLayout;
|
||||||
|
|
||||||
|
|
||||||
static public GodotIO io;
|
static public GodotIO io;
|
||||||
|
|
||||||
public static void setWindowTitle(String title) {
|
public static void setWindowTitle(String title) {
|
||||||
//setTitle(title);
|
//setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static SingletonBase singletons[] = new SingletonBase[MAX_SINGLETONS];
|
static SingletonBase singletons[] = new SingletonBase[MAX_SINGLETONS];
|
||||||
static int singleton_count = 0;
|
static int singleton_count = 0;
|
||||||
|
|
||||||
|
|
||||||
public interface ResultCallback {
|
public interface ResultCallback {
|
||||||
public void callback(int requestCode, int resultCode, Intent data);
|
public void callback(int requestCode, int resultCode, Intent data);
|
||||||
};
|
}
|
||||||
public ResultCallback result_callback;
|
public ResultCallback result_callback;
|
||||||
|
|
||||||
private PaymentsManager mPaymentsManager = null;
|
private PaymentsManager mPaymentsManager = null;
|
||||||
|
|
||||||
@Override protected void onActivityResult (int requestCode, int resultCode, Intent data) {
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == PaymentsManager.REQUEST_CODE_FOR_PURCHASE) {
|
if (requestCode == PaymentsManager.REQUEST_CODE_FOR_PURCHASE) {
|
||||||
mPaymentsManager.processPurchaseResponse(resultCode, data);
|
mPaymentsManager.processPurchaseResponse(resultCode, data);
|
||||||
} else if (result_callback != null) {
|
} else if (result_callback != null) {
|
||||||
@ -313,7 +304,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeepScreenOn(final boolean p_enabled) {
|
public void setKeepScreenOn(final boolean p_enabled) {
|
||||||
@ -353,7 +343,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
return Godot._self;
|
return Godot._self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String[] getCommandLine() {
|
private String[] getCommandLine() {
|
||||||
InputStream is;
|
InputStream is;
|
||||||
try {
|
try {
|
||||||
@ -392,14 +381,10 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
Log.d("GODOT", "**ERROR** Exception " + e.getClass().getName() + ":" + e.getMessage());
|
Log.d("GODOT", "**ERROR** Exception " + e.getClass().getName() + ":" + e.getMessage());
|
||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String expansion_pack_path;
|
String expansion_pack_path;
|
||||||
|
|
||||||
|
|
||||||
private void initializeGodot() {
|
private void initializeGodot() {
|
||||||
|
|
||||||
if (expansion_pack_path != null) {
|
if (expansion_pack_path != null) {
|
||||||
@ -450,7 +435,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
mPaymentsManager = PaymentsManager.createManager(this).initService();
|
mPaymentsManager = PaymentsManager.createManager(this).initService();
|
||||||
|
|
||||||
godot_initialized = true;
|
godot_initialized = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -459,8 +443,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
mRemoteService.onClientUpdated(mDownloaderClientStub.getMessenger());
|
mRemoteService.onClientUpdated(mDownloaderClientStub.getMessenger());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle icicle) {
|
protected void onCreate(Bundle icicle) {
|
||||||
|
|
||||||
@ -481,7 +463,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
|
|
||||||
List<String> new_args = new LinkedList<String>();
|
List<String> new_args = new LinkedList<String>();
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < command_line.length; i++) {
|
for (int i = 0; i < command_line.length; i++) {
|
||||||
|
|
||||||
boolean has_extra = i < command_line.length - 1;
|
boolean has_extra = i < command_line.length - 1;
|
||||||
@ -491,12 +472,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
use_immersive = true;
|
use_immersive = true;
|
||||||
if (Build.VERSION.SDK_INT >= 19.0) { // check if the application runs on an android 4.4+
|
if (Build.VERSION.SDK_INT >= 19.0) { // check if the application runs on an android 4.4+
|
||||||
window.getDecorView().setSystemUiVisibility(
|
window.getDecorView().setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
|
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | // hide nav bar
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
|
View.SYSTEM_UI_FLAG_FULLSCREEN | // hide status bar
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||||
|
|
||||||
UiChangeListener();
|
UiChangeListener();
|
||||||
}
|
}
|
||||||
@ -534,7 +515,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
// Build the full path to the app's expansion files
|
// Build the full path to the app's expansion files
|
||||||
try {
|
try {
|
||||||
expansion_pack_path = Helpers.getSaveFilePath(getApplicationContext());
|
expansion_pack_path = Helpers.getSaveFilePath(getApplicationContext());
|
||||||
expansion_pack_path+="/"+"main."+getPackageManager().getPackageInfo(getPackageName(), 0).versionCode+"."+this.getPackageName()+".obb";
|
expansion_pack_path += "/main." + getPackageManager().getPackageInfo(getPackageName(), 0).versionCode + "." + this.getPackageName() + ".obb";
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -605,9 +586,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
Log.d("GODOT", "Error downloading expansion package:" + e.getMessage());
|
Log.d("GODOT", "Error downloading expansion package:" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,14 +594,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
|
|
||||||
initializeGodot();
|
initializeGodot();
|
||||||
|
|
||||||
|
|
||||||
//instanceSingleton( new GodotFacebook(this) );
|
//instanceSingleton( new GodotFacebook(this) );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Override protected void onDestroy(){
|
protected void onDestroy() {
|
||||||
|
|
||||||
if (mPaymentsManager != null) mPaymentsManager.destroy();
|
if (mPaymentsManager != null) mPaymentsManager.destroy();
|
||||||
for (int i = 0; i < singleton_count; i++) {
|
for (int i = 0; i < singleton_count; i++) {
|
||||||
@ -631,7 +607,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void onPause() {
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if (!godot_initialized) {
|
if (!godot_initialized) {
|
||||||
if (null != mDownloaderClientStub) {
|
if (null != mDownloaderClientStub) {
|
||||||
@ -653,7 +630,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void onResume() {
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (!godot_initialized) {
|
if (!godot_initialized) {
|
||||||
if (null != mDownloaderClientStub) {
|
if (null != mDownloaderClientStub) {
|
||||||
@ -677,21 +655,18 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
if (use_immersive && Build.VERSION.SDK_INT >= 19.0) { // check if the application runs on an android 4.4+
|
if (use_immersive && Build.VERSION.SDK_INT >= 19.0) { // check if the application runs on an android 4.4+
|
||||||
Window window = getWindow();
|
Window window = getWindow();
|
||||||
window.getDecorView().setSystemUiVisibility(
|
window.getDecorView().setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
|
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | // hide nav bar
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
|
View.SYSTEM_UI_FLAG_FULLSCREEN | // hide status bar
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < singleton_count; i++) {
|
for (int i = 0; i < singleton_count; i++) {
|
||||||
|
|
||||||
singletons[i].onMainResume();
|
singletons[i].onMainResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UiChangeListener() {
|
public void UiChangeListener() {
|
||||||
@ -701,18 +676,19 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
public void onSystemUiVisibilityChange(int visibility) {
|
public void onSystemUiVisibilityChange(int visibility) {
|
||||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
||||||
decorView.setSystemUiVisibility(
|
decorView.setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
View.SYSTEM_UI_FLAG_FULLSCREEN |
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onSensorChanged(SensorEvent event) {
|
@Override
|
||||||
|
public void onSensorChanged(SensorEvent event) {
|
||||||
Display display = ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
|
Display display = ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
|
||||||
int displayRotation = display.getRotation();
|
int displayRotation = display.getRotation();
|
||||||
|
|
||||||
@ -721,7 +697,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
{ 1, -1, 0, 1 }, // ROTATION_0
|
{ 1, -1, 0, 1 }, // ROTATION_0
|
||||||
{ -1, -1, 1, 0 }, // ROTATION_90
|
{ -1, -1, 1, 0 }, // ROTATION_90
|
||||||
{ -1, 1, 0, 1 }, // ROTATION_180
|
{ -1, 1, 0, 1 }, // ROTATION_180
|
||||||
{ 1, 1, 1, 0 } }; // ROTATION_270
|
{ 1, 1, 1, 0 }
|
||||||
|
}; // ROTATION_270
|
||||||
|
|
||||||
final int[] as = axisSwap[displayRotation];
|
final int[] as = axisSwap[displayRotation];
|
||||||
adjustedValues[0] = (float)as[0] * event.values[as[2]];
|
adjustedValues[0] = (float)as[0] * event.values[as[2]];
|
||||||
@ -754,7 +731,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public final void onAccuracyChanged(Sensor sensor, int accuracy) {
|
@Override
|
||||||
|
public final void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||||
// Do something here if sensor accuracy changes.
|
// Do something here if sensor accuracy changes.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -774,7 +752,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override public void onBackPressed() {
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
boolean shouldQuit = true;
|
boolean shouldQuit = true;
|
||||||
|
|
||||||
for (int i = 0; i < singleton_count; i++) {
|
for (int i = 0; i < singleton_count; i++) {
|
||||||
@ -799,8 +778,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private boolean obbIsCorrupted(String f, String main_pack_md5) {
|
private boolean obbIsCorrupted(String f, String main_pack_md5) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -819,7 +796,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
}
|
}
|
||||||
} while (numRead != -1);
|
} while (numRead != -1);
|
||||||
|
|
||||||
|
|
||||||
fis.close();
|
fis.close();
|
||||||
byte[] messageDigest = complete.digest();
|
byte[] messageDigest = complete.digest();
|
||||||
|
|
||||||
@ -911,14 +887,16 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean onKeyMultiple(final int inKeyCode, int repeatCount, KeyEvent event) {
|
@Override
|
||||||
|
public boolean onKeyMultiple(final int inKeyCode, int repeatCount, KeyEvent event) {
|
||||||
String s = event.getCharacters();
|
String s = event.getCharacters();
|
||||||
if (s == null || s.length() == 0)
|
if (s == null || s.length() == 0)
|
||||||
return super.onKeyMultiple(inKeyCode, repeatCount, event);
|
return super.onKeyMultiple(inKeyCode, repeatCount, event);
|
||||||
|
|
||||||
final char[] cc = s.toCharArray();
|
final char[] cc = s.toCharArray();
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for (int i = cc.length; --i >= 0; cnt += cc[i] != 0 ? 1 : 0);
|
for (int i = cc.length; --i >= 0; cnt += cc[i] != 0 ? 1 : 0)
|
||||||
|
;
|
||||||
if (cnt == 0) return super.onKeyMultiple(inKeyCode, repeatCount, event);
|
if (cnt == 0) return super.onKeyMultiple(inKeyCode, repeatCount, event);
|
||||||
final Activity me = this;
|
final Activity me = this;
|
||||||
queueEvent(new Runnable() {
|
queueEvent(new Runnable() {
|
||||||
@ -939,7 +917,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
|
|
||||||
private void queueEvent(Runnable runnable) {
|
private void queueEvent(Runnable runnable) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaymentsManager getPaymentsManager() {
|
public PaymentsManager getPaymentsManager() {
|
||||||
@ -952,7 +929,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1046,7 +1022,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
setButtonPausedState(paused);
|
setButtonPausedState(paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDownloadProgress(DownloadProgressInfo progress) {
|
public void onDownloadProgress(DownloadProgressInfo progress) {
|
||||||
mAverageSpeed.setText(getString(com.godot.game.R.string.kilobytes_per_second,
|
mAverageSpeed.setText(getString(com.godot.game.R.string.kilobytes_per_second,
|
||||||
@ -1057,13 +1032,10 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||||||
progress.mOverallTotal = progress.mOverallTotal;
|
progress.mOverallTotal = progress.mOverallTotal;
|
||||||
mPB.setMax((int)(progress.mOverallTotal >> 8));
|
mPB.setMax((int)(progress.mOverallTotal >> 8));
|
||||||
mPB.setProgress((int)(progress.mOverallProgress >> 8));
|
mPB.setProgress((int)(progress.mOverallProgress >> 8));
|
||||||
mProgressPercent.setText(Long.toString(progress.mOverallProgress
|
mProgressPercent.setText(Long.toString(progress.mOverallProgress * 100 /
|
||||||
* 100 /
|
progress.mOverallTotal) +
|
||||||
progress.mOverallTotal) + "%");
|
"%");
|
||||||
mProgressFraction.setText(Helpers.getDownloadProgressString
|
mProgressFraction.setText(Helpers.getDownloadProgressString(progress.mOverallProgress,
|
||||||
(progress.mOverallProgress,
|
|
||||||
progress.mOverallTotal));
|
progress.mOverallTotal));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -81,5 +81,4 @@ public class GodotDownloaderService extends DownloaderService {
|
|||||||
Log.d("GODOT", "getAlarmReceiverClassName()");
|
Log.d("GODOT", "getAlarmReceiverClassName()");
|
||||||
return GodotDownloaderAlarmReceiver.class.getName();
|
return GodotDownloaderAlarmReceiver.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,6 @@ import org.godotengine.godot.input.*;
|
|||||||
|
|
||||||
public class GodotIO {
|
public class GodotIO {
|
||||||
|
|
||||||
|
|
||||||
AssetManager am;
|
AssetManager am;
|
||||||
Godot activity;
|
Godot activity;
|
||||||
GodotEditText edit;
|
GodotEditText edit;
|
||||||
@ -80,7 +79,6 @@ public class GodotIO {
|
|||||||
|
|
||||||
class AssetData {
|
class AssetData {
|
||||||
|
|
||||||
|
|
||||||
public boolean eof = false;
|
public boolean eof = false;
|
||||||
public String path;
|
public String path;
|
||||||
public InputStream is;
|
public InputStream is;
|
||||||
@ -88,10 +86,8 @@ public class GodotIO {
|
|||||||
public int pos;
|
public int pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HashMap<Integer, AssetData> streams;
|
HashMap<Integer, AssetData> streams;
|
||||||
|
|
||||||
|
|
||||||
public int file_open(String path, boolean write) {
|
public int file_open(String path, boolean write) {
|
||||||
|
|
||||||
//System.out.printf("file_open: Attempt to Open %s\n",path);
|
//System.out.printf("file_open: Attempt to Open %s\n",path);
|
||||||
@ -100,7 +96,6 @@ public class GodotIO {
|
|||||||
if (write)
|
if (write)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
||||||
AssetData ad = new AssetData();
|
AssetData ad = new AssetData();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -135,7 +130,6 @@ public class GodotIO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return streams.get(id).len;
|
return streams.get(id).len;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void file_seek(int id, int bytes) {
|
public void file_seek(int id, int bytes) {
|
||||||
|
|
||||||
@ -175,8 +169,6 @@ public class GodotIO {
|
|||||||
System.out.printf("Exception on file_seek: %s\n", e);
|
System.out.printf("Exception on file_seek: %s\n", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int file_tell(int id) {
|
public int file_tell(int id) {
|
||||||
@ -207,7 +199,6 @@ public class GodotIO {
|
|||||||
return new byte[0];
|
return new byte[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AssetData ad = streams.get(id);
|
AssetData ad = streams.get(id);
|
||||||
|
|
||||||
if (ad.pos + bytes > ad.len) {
|
if (ad.pos + bytes > ad.len) {
|
||||||
@ -216,14 +207,11 @@ public class GodotIO {
|
|||||||
ad.eof = true;
|
ad.eof = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (bytes == 0) {
|
if (bytes == 0) {
|
||||||
|
|
||||||
return new byte[0];
|
return new byte[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
byte[] buf1 = new byte[bytes];
|
byte[] buf1 = new byte[bytes];
|
||||||
int r = 0;
|
int r = 0;
|
||||||
try {
|
try {
|
||||||
@ -250,7 +238,6 @@ public class GodotIO {
|
|||||||
|
|
||||||
return buf1;
|
return buf1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void file_close(int id) {
|
public void file_close(int id) {
|
||||||
@ -261,15 +248,12 @@ public class GodotIO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
streams.remove(id);
|
streams.remove(id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
/// DIRECTORIES
|
/// DIRECTORIES
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
|
|
||||||
class AssetDir {
|
class AssetDir {
|
||||||
|
|
||||||
public String[] files;
|
public String[] files;
|
||||||
@ -305,7 +289,6 @@ public class GodotIO {
|
|||||||
dirs.put(last_dir_id, ad);
|
dirs.put(last_dir_id, ad);
|
||||||
|
|
||||||
return last_dir_id;
|
return last_dir_id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean dir_is_dir(int id) {
|
public boolean dir_is_dir(int id) {
|
||||||
@ -351,7 +334,6 @@ public class GodotIO {
|
|||||||
String r = ad.files[ad.current];
|
String r = ad.files[ad.current];
|
||||||
ad.current++;
|
ad.current++;
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dir_close(int id) {
|
public void dir_close(int id) {
|
||||||
@ -364,8 +346,6 @@ public class GodotIO {
|
|||||||
dirs.remove(id);
|
dirs.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GodotIO(Godot p_activity) {
|
GodotIO(Godot p_activity) {
|
||||||
|
|
||||||
am = p_activity.getAssets();
|
am = p_activity.getAssets();
|
||||||
@ -373,10 +353,8 @@ public class GodotIO {
|
|||||||
streams = new HashMap<Integer, AssetData>();
|
streams = new HashMap<Integer, AssetData>();
|
||||||
dirs = new HashMap<Integer, AssetDir>();
|
dirs = new HashMap<Integer, AssetDir>();
|
||||||
applicationContext = activity.getApplicationContext();
|
applicationContext = activity.getApplicationContext();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// AUDIO
|
// AUDIO
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
@ -441,8 +419,6 @@ public class GodotIO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void audioQuit() {
|
public void audioQuit() {
|
||||||
if (mAudioThread != null) {
|
if (mAudioThread != null) {
|
||||||
try {
|
try {
|
||||||
@ -473,8 +449,6 @@ public class GodotIO {
|
|||||||
// MISCELLANEOUS OS IO
|
// MISCELLANEOUS OS IO
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int openURI(String p_uri) {
|
public int openURI(String p_uri) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -576,7 +550,6 @@ public class GodotIO {
|
|||||||
case SCREEN_SENSOR: {
|
case SCREEN_SENSOR: {
|
||||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
|
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -584,8 +557,7 @@ public class GodotIO {
|
|||||||
edit = _edit;
|
edit = _edit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playVideo(String p_path)
|
public void playVideo(String p_path) {
|
||||||
{
|
|
||||||
Uri filePath = Uri.parse(p_path);
|
Uri filePath = Uri.parse(p_path);
|
||||||
mediaPlayer = new MediaPlayer();
|
mediaPlayer = new MediaPlayer();
|
||||||
|
|
||||||
@ -594,9 +566,7 @@ public class GodotIO {
|
|||||||
mediaPlayer.setDataSource(applicationContext, filePath);
|
mediaPlayer.setDataSource(applicationContext, filePath);
|
||||||
mediaPlayer.prepare();
|
mediaPlayer.prepare();
|
||||||
mediaPlayer.start();
|
mediaPlayer.start();
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch(IOException e)
|
|
||||||
{
|
|
||||||
System.out.println("IOError while playing video");
|
System.out.println("IOError while playing video");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -621,7 +591,6 @@ public class GodotIO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final int SYSTEM_DIR_DESKTOP = 0;
|
public static final int SYSTEM_DIR_DESKTOP = 0;
|
||||||
public static final int SYSTEM_DIR_DCIM = 1;
|
public static final int SYSTEM_DIR_DCIM = 1;
|
||||||
public static final int SYSTEM_DIR_DOCUMENTS = 2;
|
public static final int SYSTEM_DIR_DOCUMENTS = 2;
|
||||||
@ -631,7 +600,6 @@ public class GodotIO {
|
|||||||
public static final int SYSTEM_DIR_PICTURES = 6;
|
public static final int SYSTEM_DIR_PICTURES = 6;
|
||||||
public static final int SYSTEM_DIR_RINGTONES = 7;
|
public static final int SYSTEM_DIR_RINGTONES = 7;
|
||||||
|
|
||||||
|
|
||||||
public String getSystemDir(int idx) {
|
public String getSystemDir(int idx) {
|
||||||
|
|
||||||
String what = "";
|
String what = "";
|
||||||
@ -681,5 +649,4 @@ public class GodotIO {
|
|||||||
|
|
||||||
return unique_id;
|
return unique_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ package org.godotengine.godot;
|
|||||||
|
|
||||||
public class GodotLib {
|
public class GodotLib {
|
||||||
|
|
||||||
|
|
||||||
public static GodotIO io;
|
public static GodotIO io;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -71,5 +70,4 @@ public class GodotLib {
|
|||||||
public static native void calldeferred(int p_ID, String p_method, Object[] p_params);
|
public static native void calldeferred(int p_ID, String p_method, Object[] p_params);
|
||||||
|
|
||||||
public static native void setVirtualKeyboardHeight(int p_height);
|
public static native void setVirtualKeyboardHeight(int p_height);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class GodotPaymentV3 extends Godot.SingletonBase {
|
public class GodotPaymentV3 extends Godot.SingletonBase {
|
||||||
|
|
||||||
private Godot activity;
|
private Godot activity;
|
||||||
|
@ -83,7 +83,6 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
|
|
||||||
private Godot activity;
|
private Godot activity;
|
||||||
|
|
||||||
|
|
||||||
private InputManagerCompat mInputManager;
|
private InputManagerCompat mInputManager;
|
||||||
public GodotView(Context context, GodotIO p_io, boolean p_use_gl3, boolean p_use_32_bits, Godot p_activity) {
|
public GodotView(Context context, GodotIO p_io, boolean p_use_gl3, boolean p_use_32_bits, Godot p_activity) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -108,7 +107,8 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
init(translucent, depth, stencil);
|
init(translucent, depth, stencil);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean onTouchEvent (MotionEvent event) {
|
@Override
|
||||||
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
|
|
||||||
return activity.gotTouchEvent(event);
|
return activity.gotTouchEvent(event);
|
||||||
};
|
};
|
||||||
@ -205,7 +205,8 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
return joy_devices.size() - 1;
|
return joy_devices.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onInputDeviceAdded(int deviceId) {
|
@Override
|
||||||
|
public void onInputDeviceAdded(int deviceId) {
|
||||||
joystick joy = new joystick();
|
joystick joy = new joystick();
|
||||||
joy.device_id = deviceId;
|
joy.device_id = deviceId;
|
||||||
final int id = joy_devices.size();
|
final int id = joy_devices.size();
|
||||||
@ -219,8 +220,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
for (InputDevice.MotionRange range : ranges) {
|
for (InputDevice.MotionRange range : ranges) {
|
||||||
if (range.getAxis() == MotionEvent.AXIS_HAT_X || range.getAxis() == MotionEvent.AXIS_HAT_Y) {
|
if (range.getAxis() == MotionEvent.AXIS_HAT_X || range.getAxis() == MotionEvent.AXIS_HAT_Y) {
|
||||||
joy.hats.add(range);
|
joy.hats.add(range);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
joy.axes.add(range);
|
joy.axes.add(range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,7 +233,8 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onInputDeviceRemoved(int deviceId) {
|
@Override
|
||||||
|
public void onInputDeviceRemoved(int deviceId) {
|
||||||
final int id = find_joy_device(deviceId);
|
final int id = find_joy_device(deviceId);
|
||||||
joy_devices.remove(id);
|
joy_devices.remove(id);
|
||||||
queueEvent(new Runnable() {
|
queueEvent(new Runnable() {
|
||||||
@ -244,10 +245,11 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onInputDeviceChanged(int deviceId) {
|
@Override
|
||||||
|
public void onInputDeviceChanged(int deviceId) {
|
||||||
}
|
}
|
||||||
@Override public boolean onKeyUp(final int keyCode, KeyEvent event) {
|
@Override
|
||||||
|
public boolean onKeyUp(final int keyCode, KeyEvent event) {
|
||||||
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
return true;
|
return true;
|
||||||
@ -282,7 +284,8 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
return super.onKeyUp(keyCode, event);
|
return super.onKeyUp(keyCode, event);
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override public boolean onKeyDown(final int keyCode, KeyEvent event) {
|
@Override
|
||||||
|
public boolean onKeyDown(final int keyCode, KeyEvent event) {
|
||||||
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
activity.onBackPressed();
|
activity.onBackPressed();
|
||||||
@ -326,7 +329,8 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean onGenericMotionEvent(MotionEvent event) {
|
@Override
|
||||||
|
public boolean onGenericMotionEvent(MotionEvent event) {
|
||||||
|
|
||||||
if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK && event.getAction() == MotionEvent.ACTION_MOVE) {
|
if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK && event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||||
|
|
||||||
@ -363,7 +367,6 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
return super.onGenericMotionEvent(event);
|
return super.onGenericMotionEvent(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private void init(boolean translucent, int depth, int stencil) {
|
private void init(boolean translucent, int depth, int stencil) {
|
||||||
|
|
||||||
this.setFocusableInTouchMode(true);
|
this.setFocusableInTouchMode(true);
|
||||||
@ -640,7 +643,8 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
Log.w(TAG, String.format(" %s: %d\n", name, value[0]));
|
Log.w(TAG, String.format(" %s: %d\n", name, value[0]));
|
||||||
} else {
|
} else {
|
||||||
// Log.w(TAG, String.format(" %s: failed\n", name));
|
// Log.w(TAG, String.format(" %s: failed\n", name));
|
||||||
while (egl.eglGetError() != EGL10.EGL_SUCCESS);
|
while (egl.eglGetError() != EGL10.EGL_SUCCESS)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -657,7 +661,6 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||||||
|
|
||||||
private static class Renderer implements GLSurfaceView.Renderer {
|
private static class Renderer implements GLSurfaceView.Renderer {
|
||||||
|
|
||||||
|
|
||||||
public void onDrawFrame(GL10 gl) {
|
public void onDrawFrame(GL10 gl) {
|
||||||
GodotLib.step();
|
GodotLib.step();
|
||||||
for (int i = 0; i < Godot.singleton_count; i++) {
|
for (int i = 0; i < Godot.singleton_count; i++) {
|
||||||
|
@ -79,12 +79,10 @@ public class GodotEditText extends EditText {
|
|||||||
@Override
|
@Override
|
||||||
public void handleMessage(final Message msg) {
|
public void handleMessage(final Message msg) {
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case HANDLER_OPEN_IME_KEYBOARD:
|
case HANDLER_OPEN_IME_KEYBOARD: {
|
||||||
{
|
|
||||||
GodotEditText edit = (GodotEditText)msg.obj;
|
GodotEditText edit = (GodotEditText)msg.obj;
|
||||||
String text = edit.mOriginText;
|
String text = edit.mOriginText;
|
||||||
if (edit.requestFocus())
|
if (edit.requestFocus()) {
|
||||||
{
|
|
||||||
edit.removeTextChangedListener(edit.mInputWrapper);
|
edit.removeTextChangedListener(edit.mInputWrapper);
|
||||||
edit.setText("");
|
edit.setText("");
|
||||||
edit.append(text);
|
edit.append(text);
|
||||||
@ -93,19 +91,16 @@ public class GodotEditText extends EditText {
|
|||||||
final InputMethodManager imm = (InputMethodManager)mView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
final InputMethodManager imm = (InputMethodManager)mView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.showSoftInput(edit, 0);
|
imm.showSoftInput(edit, 0);
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
|
|
||||||
case HANDLER_CLOSE_IME_KEYBOARD:
|
case HANDLER_CLOSE_IME_KEYBOARD: {
|
||||||
{
|
|
||||||
GodotEditText edit = (GodotEditText)msg.obj;
|
GodotEditText edit = (GodotEditText)msg.obj;
|
||||||
|
|
||||||
edit.removeTextChangedListener(mInputWrapper);
|
edit.removeTextChangedListener(mInputWrapper);
|
||||||
final InputMethodManager imm = (InputMethodManager)mView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
final InputMethodManager imm = (InputMethodManager)mView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.hideSoftInputFromWindow(edit.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(edit.getWindowToken(), 0);
|
||||||
edit.mView.requestFocus();
|
edit.mView.requestFocus();
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -81,7 +81,6 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(final Editable s) {
|
public void afterTextChanged(final Editable s) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,7 +69,6 @@ public class InputManagerV16 implements InputManagerCompat {
|
|||||||
public void onInputDeviceRemoved(int deviceId) {
|
public void onInputDeviceRemoved(int deviceId) {
|
||||||
mIDL.onInputDeviceRemoved(deviceId);
|
mIDL.onInputDeviceRemoved(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -82,11 +81,9 @@ public class InputManagerV16 implements InputManagerCompat {
|
|||||||
@Override
|
@Override
|
||||||
public void unregisterInputDeviceListener(InputDeviceListener listener) {
|
public void unregisterInputDeviceListener(InputDeviceListener listener) {
|
||||||
V16InputDeviceListener curListener = mListeners.remove(listener);
|
V16InputDeviceListener curListener = mListeners.remove(listener);
|
||||||
if (null != curListener)
|
if (null != curListener) {
|
||||||
{
|
|
||||||
mInputManager.unregisterInputDeviceListener(curListener);
|
mInputManager.unregisterInputDeviceListener(curListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -103,5 +100,4 @@ public class InputManagerV16 implements InputManagerCompat {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
// unused in V16
|
// unused in V16
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,6 @@ public class InputManagerV9 implements InputManagerCompat {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputManagerV9() {
|
public InputManagerV9() {
|
||||||
@ -207,5 +206,4 @@ public class InputManagerV9 implements InputManagerCompat {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
mDefaultHandler.sendEmptyMessage(MESSAGE_TEST_FOR_DISCONNECT);
|
mDefaultHandler.sendEmptyMessage(MESSAGE_TEST_FOR_DISCONNECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ abstract public class ConsumeTask {
|
|||||||
this.mService = mService;
|
this.mService = mService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void consume(final String sku) {
|
public void consume(final String sku) {
|
||||||
//Log.d("XXX", "Consuming product " + sku);
|
//Log.d("XXX", "Consuming product " + sku);
|
||||||
PaymentsCache pc = new PaymentsCache(context);
|
PaymentsCache pc = new PaymentsCache(context);
|
||||||
@ -78,7 +77,6 @@ abstract public class ConsumeTask {
|
|||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
return e.getMessage();
|
return e.getMessage();
|
||||||
|
|
||||||
}
|
}
|
||||||
return "Some error";
|
return "Some error";
|
||||||
}
|
}
|
||||||
@ -91,10 +89,10 @@ abstract public class ConsumeTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}.execute();
|
}
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected void success(String ticket);
|
abstract protected void success(String ticket);
|
||||||
abstract protected void error(String message);
|
abstract protected void error(String message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,6 @@ abstract public class GenericConsumeTask extends AsyncTask<String, String, Strin
|
|||||||
private Context context;
|
private Context context;
|
||||||
private IInAppBillingService mService;
|
private IInAppBillingService mService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public GenericConsumeTask(Context context, IInAppBillingService mService, String sku, String receipt, String signature, String token) {
|
public GenericConsumeTask(Context context, IInAppBillingService mService, String sku, String receipt, String signature, String token) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.mService = mService;
|
this.mService = mService;
|
||||||
@ -78,5 +75,4 @@ abstract public class GenericConsumeTask extends AsyncTask<String, String, Strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract public void onSuccess(String sku, String receipt, String signature, String token);
|
abstract public void onSuccess(String sku, String receipt, String signature, String token);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,6 @@ abstract public class HandlePurchaseTask {
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void handlePurchaseRequest(int resultCode, Intent data) {
|
public void handlePurchaseRequest(int resultCode, Intent data) {
|
||||||
//Log.d("XXX", "Handling purchase response");
|
//Log.d("XXX", "Handling purchase response");
|
||||||
//int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
|
//int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
|
||||||
@ -71,7 +70,6 @@ abstract public class HandlePurchaseTask {
|
|||||||
try {
|
try {
|
||||||
//Log.d("SARLANGA", purchaseData);
|
//Log.d("SARLANGA", purchaseData);
|
||||||
|
|
||||||
|
|
||||||
JSONObject jo = new JSONObject(purchaseData);
|
JSONObject jo = new JSONObject(purchaseData);
|
||||||
//String sku = jo.getString("productId");
|
//String sku = jo.getString("productId");
|
||||||
//alert("You have bought the " + sku + ". Excellent choice, aventurer!");
|
//alert("You have bought the " + sku + ". Excellent choice, aventurer!");
|
||||||
@ -106,6 +104,4 @@ abstract public class HandlePurchaseTask {
|
|||||||
abstract protected void success(String sku, String signature, String ticket);
|
abstract protected void success(String sku, String signature, String ticket);
|
||||||
abstract protected void error(String message);
|
abstract protected void error(String message);
|
||||||
abstract protected void canceled();
|
abstract protected void canceled();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ public class PaymentsCache {
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setConsumableFlag(String set, String sku, Boolean flag) {
|
public void setConsumableFlag(String set, String sku, Boolean flag) {
|
||||||
SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE);
|
SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE);
|
||||||
SharedPreferences.Editor editor = sharedPref.edit();
|
SharedPreferences.Editor editor = sharedPref.edit();
|
||||||
@ -55,7 +54,6 @@ public class PaymentsCache {
|
|||||||
return sharedPref.getBoolean(sku, false);
|
return sharedPref.getBoolean(sku, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setConsumableValue(String set, String sku, String value) {
|
public void setConsumableValue(String set, String sku, String value) {
|
||||||
SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE);
|
SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE);
|
||||||
SharedPreferences.Editor editor = sharedPref.edit();
|
SharedPreferences.Editor editor = sharedPref.edit();
|
||||||
@ -70,5 +68,4 @@ public class PaymentsCache {
|
|||||||
//Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku);
|
//Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku);
|
||||||
return sharedPref.getString(sku, null);
|
return sharedPref.getString(sku, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,6 @@ public class PaymentsManager {
|
|||||||
@Override
|
@Override
|
||||||
protected void error(String message) {
|
protected void error(String message) {
|
||||||
godotPaymentV3.callbackFail();
|
godotPaymentV3.callbackFail();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -119,8 +118,8 @@ public class PaymentsManager {
|
|||||||
godotPaymentV3.callbackAlreadyOwned(sku);
|
godotPaymentV3.callbackAlreadyOwned(sku);
|
||||||
}
|
}
|
||||||
|
|
||||||
}.purchase(sku, transactionId);
|
}
|
||||||
|
.purchase(sku, transactionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void consumeUnconsumedPurchases() {
|
public void consumeUnconsumedPurchases() {
|
||||||
@ -135,16 +134,15 @@ public class PaymentsManager {
|
|||||||
protected void error(String message) {
|
protected void error(String message) {
|
||||||
Log.d("godot", "consumeUnconsumedPurchases :" + message);
|
Log.d("godot", "consumeUnconsumedPurchases :" + message);
|
||||||
godotPaymentV3.callbackFailConsume();
|
godotPaymentV3.callbackFailConsume();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void notRequired() {
|
protected void notRequired() {
|
||||||
Log.d("godot", "callbackSuccessNoUnconsumedPurchases :");
|
Log.d("godot", "callbackSuccessNoUnconsumedPurchases :");
|
||||||
godotPaymentV3.callbackSuccessNoUnconsumedPurchases();
|
godotPaymentV3.callbackSuccessNoUnconsumedPurchases();
|
||||||
|
|
||||||
}
|
}
|
||||||
}.consumeItAll();
|
}
|
||||||
|
.consumeItAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requestPurchased() {
|
public void requestPurchased() {
|
||||||
@ -210,9 +208,9 @@ public class PaymentsManager {
|
|||||||
@Override
|
@Override
|
||||||
protected void error(String message) {
|
protected void error(String message) {
|
||||||
godotPaymentV3.callbackFail();
|
godotPaymentV3.callbackFail();
|
||||||
|
|
||||||
}
|
}
|
||||||
}.consume(sku);
|
}
|
||||||
|
.consume(sku);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +223,8 @@ public class PaymentsManager {
|
|||||||
protected void canceled() {
|
protected void canceled() {
|
||||||
godotPaymentV3.callbackCancel();
|
godotPaymentV3.callbackCancel();
|
||||||
}
|
}
|
||||||
}.handlePurchaseRequest(resultCode, data);
|
}
|
||||||
|
.handlePurchaseRequest(resultCode, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validatePurchase(String purchaseToken, final String sku) {
|
public void validatePurchase(String purchaseToken, final String sku) {
|
||||||
@ -246,8 +245,8 @@ public class PaymentsManager {
|
|||||||
protected void error(String message) {
|
protected void error(String message) {
|
||||||
godotPaymentV3.callbackFail();
|
godotPaymentV3.callbackFail();
|
||||||
}
|
}
|
||||||
}.consume(sku);
|
}
|
||||||
|
.consume(sku);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -259,7 +258,8 @@ public class PaymentsManager {
|
|||||||
protected void canceled() {
|
protected void canceled() {
|
||||||
godotPaymentV3.callbackCancel();
|
godotPaymentV3.callbackCancel();
|
||||||
}
|
}
|
||||||
}.validatePurchase(sku);
|
}
|
||||||
|
.validatePurchase(sku);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoConsume(boolean autoConsume) {
|
public void setAutoConsume(boolean autoConsume) {
|
||||||
@ -278,7 +278,8 @@ public class PaymentsManager {
|
|||||||
protected void error(String message) {
|
protected void error(String message) {
|
||||||
godotPaymentV3.callbackFailConsume();
|
godotPaymentV3.callbackFailConsume();
|
||||||
}
|
}
|
||||||
}.consume(sku);
|
}
|
||||||
|
.consume(sku);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workaround to bug where sometimes response codes come as Long instead of Integer
|
// Workaround to bug where sometimes response codes come as Long instead of Integer
|
||||||
@ -287,8 +288,10 @@ public class PaymentsManager {
|
|||||||
if (o == null) {
|
if (o == null) {
|
||||||
//logDebug("Bundle with null response code, assuming OK (known issue)");
|
//logDebug("Bundle with null response code, assuming OK (known issue)");
|
||||||
return BILLING_RESPONSE_RESULT_OK;
|
return BILLING_RESPONSE_RESULT_OK;
|
||||||
} else if (o instanceof Integer) return ((Integer) o).intValue();
|
} else if (o instanceof Integer)
|
||||||
else if (o instanceof Long) return (int) ((Long) o).longValue();
|
return ((Integer)o).intValue();
|
||||||
|
else if (o instanceof Long)
|
||||||
|
return (int)((Long)o).longValue();
|
||||||
else {
|
else {
|
||||||
//logError("Unexpected type for bundle response code.");
|
//logError("Unexpected type for bundle response code.");
|
||||||
//logError(o.getClass().getName());
|
//logError(o.getClass().getName());
|
||||||
@ -304,25 +307,41 @@ public class PaymentsManager {
|
|||||||
* It also includes the result code numerically.
|
* It also includes the result code numerically.
|
||||||
*/
|
*/
|
||||||
public static String getResponseDesc(int code) {
|
public static String getResponseDesc(int code) {
|
||||||
String[] iab_msgs = ("0:OK/1:User Canceled/2:Unknown/" +
|
String[] iab_msgs = ("0:OK/1:User Canceled/2:Unknown/"
|
||||||
"3:Billing Unavailable/4:Item unavailable/" +
|
+
|
||||||
"5:Developer Error/6:Error/7:Item Already Owned/" +
|
"3:Billing Unavailable/4:Item unavailable/"
|
||||||
"8:Item not owned").split("/");
|
+
|
||||||
String[] iabhelper_msgs = ("0:OK/-1001:Remote exception during initialization/" +
|
"5:Developer Error/6:Error/7:Item Already Owned/"
|
||||||
"-1002:Bad response received/" +
|
+
|
||||||
"-1003:Purchase signature verification failed/" +
|
"8:Item not owned")
|
||||||
"-1004:Send intent failed/" +
|
.split("/");
|
||||||
"-1005:User cancelled/" +
|
String[] iabhelper_msgs = ("0:OK/-1001:Remote exception during initialization/"
|
||||||
"-1006:Unknown purchase response/" +
|
+
|
||||||
"-1007:Missing token/" +
|
"-1002:Bad response received/"
|
||||||
"-1008:Unknown error/" +
|
+
|
||||||
"-1009:Subscriptions not available/" +
|
"-1003:Purchase signature verification failed/"
|
||||||
"-1010:Invalid consumption attempt").split("/");
|
+
|
||||||
|
"-1004:Send intent failed/"
|
||||||
|
+
|
||||||
|
"-1005:User cancelled/"
|
||||||
|
+
|
||||||
|
"-1006:Unknown purchase response/"
|
||||||
|
+
|
||||||
|
"-1007:Missing token/"
|
||||||
|
+
|
||||||
|
"-1008:Unknown error/"
|
||||||
|
+
|
||||||
|
"-1009:Subscriptions not available/"
|
||||||
|
+
|
||||||
|
"-1010:Invalid consumption attempt")
|
||||||
|
.split("/");
|
||||||
|
|
||||||
if (code <= -1000) {
|
if (code <= -1000) {
|
||||||
int index = -1000 - code;
|
int index = -1000 - code;
|
||||||
if (index >= 0 && index < iabhelper_msgs.length) return iabhelper_msgs[index];
|
if (index >= 0 && index < iabhelper_msgs.length)
|
||||||
else return String.valueOf(code) + ":Unknown IAB Helper Error";
|
return iabhelper_msgs[index];
|
||||||
|
else
|
||||||
|
return String.valueOf(code) + ":Unknown IAB Helper Error";
|
||||||
} else if (code < 0 || code >= iab_msgs.length)
|
} else if (code < 0 || code >= iab_msgs.length)
|
||||||
return String.valueOf(code) + ":Unknown";
|
return String.valueOf(code) + ":Unknown";
|
||||||
else
|
else
|
||||||
@ -385,7 +404,8 @@ public class PaymentsManager {
|
|||||||
}
|
}
|
||||||
godotPaymentV3.completeSkuDetail();
|
godotPaymentV3.completeSkuDetail();
|
||||||
}
|
}
|
||||||
})).start();
|
}))
|
||||||
|
.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private GodotPaymentV3 godotPaymentV3;
|
private GodotPaymentV3 godotPaymentV3;
|
||||||
@ -393,5 +413,4 @@ public class PaymentsManager {
|
|||||||
public void setBaseSingleton(GodotPaymentV3 godotPaymentV3) {
|
public void setBaseSingleton(GodotPaymentV3 godotPaymentV3) {
|
||||||
this.godotPaymentV3 = godotPaymentV3;
|
this.godotPaymentV3 = godotPaymentV3;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,6 @@ abstract public class PurchaseTask {
|
|||||||
this.mService = mService;
|
this.mService = mService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isLooping = false;
|
private boolean isLooping = false;
|
||||||
|
|
||||||
public void purchase(final String sku, final String transactionId) {
|
public void purchase(final String sku, final String transactionId) {
|
||||||
@ -100,7 +99,6 @@ abstract public class PurchaseTask {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
|
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
|
||||||
pc.setConsumableValue("validation_hash", sku, hash);
|
pc.setConsumableValue("validation_hash", sku, hash);
|
||||||
try {
|
try {
|
||||||
@ -120,13 +118,9 @@ abstract public class PurchaseTask {
|
|||||||
} catch (SendIntentException e) {
|
} catch (SendIntentException e) {
|
||||||
error(e.getMessage());
|
error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected void error(String message);
|
abstract protected void error(String message);
|
||||||
abstract protected void canceled();
|
abstract protected void canceled();
|
||||||
abstract protected void alreadyOwned();
|
abstract protected void alreadyOwned();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,6 @@ abstract public class ReleaseAllConsumablesTask {
|
|||||||
this.mService = mService;
|
this.mService = mService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void consumeItAll() {
|
public void consumeItAll() {
|
||||||
try {
|
try {
|
||||||
//Log.d("godot", "consumeItall for " + context.getPackageName());
|
//Log.d("godot", "consumeItall for " + context.getPackageName());
|
||||||
@ -66,23 +65,19 @@ abstract public class ReleaseAllConsumablesTask {
|
|||||||
//value.toString(), value.getClass().getName()));
|
//value.toString(), value.getClass().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (bundle.getInt("RESPONSE_CODE") == 0) {
|
if (bundle.getInt("RESPONSE_CODE") == 0) {
|
||||||
|
|
||||||
final ArrayList<String> myPurchases = bundle.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
|
final ArrayList<String> myPurchases = bundle.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
|
||||||
final ArrayList<String> mySignatures = bundle.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");
|
final ArrayList<String> mySignatures = bundle.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");
|
||||||
|
|
||||||
|
|
||||||
if (myPurchases == null || myPurchases.size() == 0) {
|
if (myPurchases == null || myPurchases.size() == 0) {
|
||||||
//Log.d("godot", "No purchases!");
|
//Log.d("godot", "No purchases!");
|
||||||
notRequired();
|
notRequired();
|
||||||
return;
|
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++)
|
for (int i = 0; i < myPurchases.size(); i++) {
|
||||||
{
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String receipt = myPurchases.get(i);
|
String receipt = myPurchases.get(i);
|
||||||
@ -97,12 +92,12 @@ abstract public class ReleaseAllConsumablesTask {
|
|||||||
public void onSuccess(String sku, String receipt, String signature, String token) {
|
public void onSuccess(String sku, String receipt, String signature, String token) {
|
||||||
ReleaseAllConsumablesTask.this.success(sku, receipt, signature, token);
|
ReleaseAllConsumablesTask.this.success(sku, receipt, signature, token);
|
||||||
}
|
}
|
||||||
}.execute();
|
}
|
||||||
|
.execute();
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d("godot", "Error releasing products:" + e.getClass().getName() + ":" + e.getMessage());
|
Log.d("godot", "Error releasing products:" + e.getClass().getName() + ":" + e.getMessage());
|
||||||
@ -112,5 +107,4 @@ abstract public class ReleaseAllConsumablesTask {
|
|||||||
abstract protected void success(String sku, String receipt, String signature, String token);
|
abstract protected void success(String sku, String receipt, String signature, String token);
|
||||||
abstract protected void error(String message);
|
abstract protected void error(String message);
|
||||||
abstract protected void notRequired();
|
abstract protected void notRequired();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,6 @@ abstract public class ValidateTask {
|
|||||||
public void validatePurchase(final String sku) {
|
public void validatePurchase(final String sku) {
|
||||||
new AsyncTask<String, String, String>() {
|
new AsyncTask<String, String, String>() {
|
||||||
|
|
||||||
|
|
||||||
private ProgressDialog dialog;
|
private ProgressDialog dialog;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -112,15 +111,12 @@ abstract public class ValidateTask {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
error(e.getMessage());
|
error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}.execute();
|
}
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
abstract protected void success();
|
abstract protected void success();
|
||||||
abstract protected void error(String message);
|
abstract protected void error(String message);
|
||||||
abstract protected void canceled();
|
abstract protected void canceled();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ import javax.net.ssl.TrustManagerFactory;
|
|||||||
|
|
||||||
import org.apache.http.conn.ssl.SSLSocketFactory;
|
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Luis Linietsky <luis.linietsky@gmail.com>
|
* @author Luis Linietsky <luis.linietsky@gmail.com>
|
||||||
|
@ -63,7 +63,6 @@ import org.apache.http.params.HttpProtocolParams;
|
|||||||
import org.apache.http.protocol.HTTP;
|
import org.apache.http.protocol.HTTP;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -203,7 +202,6 @@ public class HttpRequester {
|
|||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getResponseFromCache(String request) {
|
public String getResponseFromCache(String request) {
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
Log.d("XXX", "No context, cache miss");
|
Log.d("XXX", "No context, cache miss");
|
||||||
@ -231,5 +229,4 @@ public class HttpRequester {
|
|||||||
public void setTtl(long ttl) {
|
public void setTtl(long ttl) {
|
||||||
this.cttl = (ttl * 1000) + new Date().getTime();
|
this.cttl = (ttl * 1000) + new Date().getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,4 @@ public class RequestParams {
|
|||||||
public void setUrl(String url) {
|
public void setUrl(String url) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user