Backport of clang-format 7cb6e6b723
This commit is contained in:
parent
ddcbdbd67c
commit
0af3f8e053
|
@ -113,4 +113,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() {}
|
||||
|
@ -215,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;
|
||||
|
@ -225,26 +219,25 @@ 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) {
|
||||
|
@ -284,7 +277,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
adLayout = new RelativeLayout(this);
|
||||
adLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
||||
layout.addView(adLayout);
|
||||
|
||||
}
|
||||
|
||||
public void setKeepScreenOn(final boolean p_enabled) {
|
||||
|
@ -324,7 +316,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
return Godot._self;
|
||||
}
|
||||
|
||||
|
||||
private String[] getCommandLine() {
|
||||
InputStream is;
|
||||
try {
|
||||
|
@ -363,14 +354,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) {
|
||||
|
@ -419,7 +406,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
|
||||
mPaymentsManager = PaymentsManager.createManager(this).initService();
|
||||
godot_initialized = true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -428,8 +414,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
mRemoteService.onClientUpdated(mDownloaderClientStub.getMessenger());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
|
||||
|
@ -441,7 +425,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
//window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
||||
|
||||
|
||||
//check for apk expansion API
|
||||
if (true) {
|
||||
boolean md5mismatch = false;
|
||||
|
@ -452,7 +435,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;
|
||||
|
@ -462,10 +444,7 @@ 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_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);
|
||||
|
||||
|
@ -505,7 +484,8 @@ 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();
|
||||
}
|
||||
|
@ -576,9 +556,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
// TODO Auto-generated catch block
|
||||
Log.d("GODOT", "Error downloading expansion package:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -586,14 +564,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++) {
|
||||
|
@ -602,7 +577,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) {
|
||||
|
@ -619,7 +595,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) {
|
||||
|
@ -637,10 +614,7 @@ 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_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);
|
||||
}
|
||||
|
@ -649,9 +623,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
|
||||
singletons[i].onMainResume();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void UiChangeListener() {
|
||||
|
@ -661,18 +632,14 @@ 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();
|
||||
|
||||
|
@ -681,7 +648,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]];
|
||||
|
@ -707,7 +675,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.
|
||||
}
|
||||
|
||||
|
@ -727,7 +696,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++) {
|
||||
|
@ -748,8 +718,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
System.exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean obbIsCorrupted(String f, String main_pack_md5) {
|
||||
|
||||
try {
|
||||
|
@ -768,7 +736,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
}
|
||||
} while (numRead != -1);
|
||||
|
||||
|
||||
fis.close();
|
||||
byte[] messageDigest = complete.digest();
|
||||
|
||||
|
@ -845,19 +812,20 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
// System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i));
|
||||
//}
|
||||
} break;
|
||||
|
||||
}
|
||||
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() {
|
||||
|
@ -878,7 +846,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
|
||||
private void queueEvent(Runnable runnable) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public PaymentsManager getPaymentsManager() {
|
||||
|
@ -889,7 +856,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
// this.mPaymentsManager = mPaymentsManager;
|
||||
// };
|
||||
|
||||
|
||||
// Audio
|
||||
|
||||
/**
|
||||
|
@ -983,7 +949,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,
|
||||
|
@ -994,13 +959,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 {
|
|||
// MISCELANEOUS 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 {
|
||||
|
@ -68,5 +67,4 @@ public class GodotLib {
|
|||
public static native String getGlobal(String p_key);
|
||||
public static native void callobject(int p_ID, String p_method, Object[] p_params);
|
||||
public static native void calldeferred(int p_ID, String p_method, Object[] p_params);
|
||||
|
||||
}
|
||||
|
|
|
@ -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_gl2, 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;
|
||||
int id = joy_devices.size();
|
||||
|
@ -218,8 +219,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);
|
||||
}
|
||||
}
|
||||
|
@ -227,16 +227,18 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||
GodotLib.joyconnectionchanged(id, true, joy.name);
|
||||
}
|
||||
|
||||
@Override public void onInputDeviceRemoved(int deviceId) {
|
||||
@Override
|
||||
public void onInputDeviceRemoved(int deviceId) {
|
||||
int id = find_joy_device(deviceId);
|
||||
joy_devices.remove(id);
|
||||
GodotLib.joyconnectionchanged(id, false, "");
|
||||
}
|
||||
|
||||
@Override public void onInputDeviceChanged(int deviceId) {
|
||||
|
||||
@Override
|
||||
public void onInputDeviceChanged(int deviceId) {
|
||||
}
|
||||
@Override public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
return true;
|
||||
|
@ -261,7 +263,8 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||
return super.onKeyUp(keyCode, event);
|
||||
};
|
||||
|
||||
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
activity.onBackPressed();
|
||||
|
@ -295,7 +298,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) {
|
||||
|
||||
|
@ -321,7 +325,6 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||
return super.onGenericMotionEvent(event);
|
||||
};
|
||||
|
||||
|
||||
private void init(boolean translucent, int depth, int stencil) {
|
||||
|
||||
this.setFocusableInTouchMode(true);
|
||||
|
@ -596,7 +599,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)
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +617,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
|
||||
|
@ -103,7 +102,6 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
|||
GodotLib.key(0, ch, true);
|
||||
GodotLib.key(0, ch, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -116,7 +116,6 @@ public class PaymentsManager {
|
|||
@Override
|
||||
protected void error(String message) {
|
||||
godotPaymentV3.callbackFail();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -129,8 +128,8 @@ public class PaymentsManager {
|
|||
godotPaymentV3.callbackAlreadyOwned(sku);
|
||||
}
|
||||
|
||||
}.purchase(sku, transactionId);
|
||||
|
||||
}
|
||||
.purchase(sku, transactionId);
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
|
@ -149,16 +148,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() {
|
||||
|
@ -224,9 +222,9 @@ public class PaymentsManager {
|
|||
@Override
|
||||
protected void error(String message) {
|
||||
godotPaymentV3.callbackFail();
|
||||
|
||||
}
|
||||
}.consume(sku);
|
||||
}
|
||||
.consume(sku);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,7 +237,8 @@ public class PaymentsManager {
|
|||
protected void canceled() {
|
||||
godotPaymentV3.callbackCancel();
|
||||
}
|
||||
}.handlePurchaseRequest(resultCode, data);
|
||||
}
|
||||
.handlePurchaseRequest(resultCode, data);
|
||||
}
|
||||
|
||||
public void validatePurchase(String purchaseToken, final String sku) {
|
||||
|
@ -260,8 +259,8 @@ public class PaymentsManager {
|
|||
protected void error(String message) {
|
||||
godotPaymentV3.callbackFail();
|
||||
}
|
||||
}.consume(sku);
|
||||
|
||||
}
|
||||
.consume(sku);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -273,7 +272,8 @@ public class PaymentsManager {
|
|||
protected void canceled() {
|
||||
godotPaymentV3.callbackCancel();
|
||||
}
|
||||
}.validatePurchase(sku);
|
||||
}
|
||||
.validatePurchase(sku);
|
||||
}
|
||||
|
||||
public void setAutoConsume(boolean autoConsume) {
|
||||
|
@ -292,7 +292,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
|
||||
|
@ -301,8 +302,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());
|
||||
|
@ -318,25 +321,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
|
||||
|
@ -399,7 +418,8 @@ public class PaymentsManager {
|
|||
}
|
||||
godotPaymentV3.completeSkuDetail();
|
||||
}
|
||||
})).start();
|
||||
}))
|
||||
.start();
|
||||
}
|
||||
|
||||
private GodotPaymentV3 godotPaymentV3;
|
||||
|
@ -407,5 +427,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) {
|
||||
|
@ -98,7 +97,6 @@ abstract public class PurchaseTask {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
|
||||
pc.setConsumableValue("validation_hash", sku, hash);
|
||||
try {
|
||||
|
@ -118,13 +116,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 a new issue