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