Building for Android working again
- Migrated old Ant build system to Gradle - Cleaned up stuff - Removed Facebook SDK (yuck) - Removed Android License managing - Disabled the color picker since it doesn't build anymore, will have to replace later - Disabled 64-bit archs for now - Added instructions for building on Android
1
.gitignore
vendored
|
|
@ -41,3 +41,4 @@ gdb.txt
|
|||
principia.state
|
||||
sha1_test
|
||||
.DS_Store
|
||||
*.iml
|
||||
|
|
|
|||
39
README.md
|
|
@ -2,9 +2,7 @@ Principia Open Source Project
|
|||
=========
|
||||
Principia is a sandbox physics game originally released in November 2013. It is the successor to the Android hit game "Apparatus".
|
||||
|
||||
The project can be built on Windows, Linux, Android or iOS. The iOS version lags behind and lacks a lot of UI. The Android version is outdated and probably needs some work to compile.
|
||||
|
||||
Compilation on Windows and Linux should be easy, see further below.
|
||||
The project can be built on Windows, Linux, Android or iOS. The iOS version lags behind and lacks a lot of UI.
|
||||
|
||||
NOTE!
|
||||
Mote documentation and resources will come.
|
||||
|
|
@ -61,8 +59,43 @@ $ build-linux/apparatus2
|
|||
|
||||
(this bug will be fixed in short)
|
||||
|
||||
## Building for Android (on Linux)
|
||||
|
||||
These instructions can likely be easily adapted to build on any platform for Android.
|
||||
|
||||
Download Android Studio from:
|
||||
https://developer.android.com/studio
|
||||
|
||||
Untar the archive (your version number might differ from the example below) and run studio.sh:
|
||||
|
||||
$ tar xzf android-studio-2021.2.1.16-linux.tar.gz
|
||||
|
||||
$ cd bin; ./studio.sh
|
||||
|
||||
Choose Custom in the Installer, click Next a bunch of times. Android Studio will download components for a while. Once finished, in the "Welcome to Android Studio" dialog, choose "Customize" in the left menu and then click "All Settings..." at the bottom center. Open Appearance -> System Settings -> Android SDK. Click the SDK Tools tab and check the following items:
|
||||
|
||||
- NDK (Side by side)
|
||||
- Android SDK Command-line tools
|
||||
|
||||
Click Apply and wait for the components to download. Close Android Studio forever.
|
||||
|
||||
Open a terminal and run the build scripts:
|
||||
|
||||
$ cd build-android;
|
||||
|
||||
$ export ANDROID_HOME=/home/EXAMPLE/Android/Sdk
|
||||
|
||||
$ ./gradlew build
|
||||
|
||||
ANDROID_HOME should be set to the location where Android Studio installed the SDK (which you chose during setup). You might want to put that export line in your .bashrc file.
|
||||
|
||||
Finally, to install the game on your device:
|
||||
|
||||
$ ./gradew install
|
||||
|
||||
|
||||
License
|
||||
---------
|
||||
See LICENSE.md
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.vending.licensing;
|
||||
|
||||
// Android library projects do not yet support AIDL, so this has been
|
||||
// precompiled into the src directory.
|
||||
oneway interface ILicenseResultListener {
|
||||
void verifyLicense(int responseCode, String signedData, String signature);
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.vending.licensing;
|
||||
|
||||
import com.android.vending.licensing.ILicenseResultListener;
|
||||
|
||||
// Android library projects do not yet support AIDL, so this has been
|
||||
// precompiled into the src directory.
|
||||
oneway interface ILicensingService {
|
||||
void checkLicense(long nonce, String packageName, in ILicenseResultListener listener);
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
../../data-mobile/
|
||||
|
|
@ -1 +0,0 @@
|
|||
../../data-shared/
|
||||
10
build-android/build.gradle
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
plugins {
|
||||
id 'com.android.application' version '7.2.2' apply false
|
||||
id 'com.android.library' version '7.2.2' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
4
build-android/gradle.properties
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
kotlin.code.style=official
|
||||
android.useAndroidX=true
|
||||
android.nonTransitiveRClass=true
|
||||
BIN
build-android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
build-android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#Sun Aug 07 11:51:41 CEST 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
185
build-android/gradlew
vendored
Executable file
|
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
|
@ -1 +0,0 @@
|
|||
../src
|
||||
1
build-android/jni
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../src
|
||||
0
build-android/libs/.keep
Normal file
60
build-android/principia/build.gradle
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 32
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.bithack.principia"
|
||||
minSdk 15
|
||||
targetSdk 32
|
||||
versionCode 36
|
||||
versionName "1.6"
|
||||
|
||||
ndk {
|
||||
abiFilters 'x86', 'armeabi-v7a'
|
||||
}
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
path = file("../jni/Android.mk")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
assets.srcDirs = ['src/assets']
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//implementation fileTree(dir: '../libs', include: ['*.jar'])
|
||||
//implementation project(":ColorPickerPreference")
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
}
|
||||
|
||||
1
build-android/principia/src/assets/data-mobile
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../../../data-mobile
|
||||
1
build-android/principia/src/assets/data-shared
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../../../data-shared
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.bithack.principia"
|
||||
android:installLocation="auto"
|
||||
android:versionCode="34"
|
||||
android:versionName="1.5.1">
|
||||
android:installLocation="auto">
|
||||
|
||||
<supports-screens android:resizeable="true" android:smallScreens="false" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true"></supports-screens>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" ></uses-permission>
|
||||
|
|
@ -14,14 +12,13 @@
|
|||
<uses-feature android:glEsVersion="0x00020000" android:required="true"></uses-feature>
|
||||
<uses-feature android:name="android.hardware.screen.landscape" android:required="true"></uses-feature>
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:label="@string/app_name"
|
||||
android:icon="@drawable/icon"
|
||||
android:theme="@style/PrincipiaTheme">
|
||||
<activity android:screenOrientation="landscape" android:name="com.bithack.principia.PrincipiaActivity"
|
||||
android:exported="true"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleInstance">
|
||||
|
|
@ -17,7 +17,8 @@ import android.widget.EditText;
|
|||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
public class CodeEditor extends EditText
|
||||
public class CodeEditor extends androidx.appcompat.widget.AppCompatEditText
|
||||
|
||||
{
|
||||
public interface OnTextChangedListener
|
||||
{
|
||||
|
|
@ -17,8 +17,6 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.google.android.vending.licensing.LicenseValidator;
|
||||
|
||||
public class LinkAccountDialog
|
||||
{
|
||||
static AlertDialog _dialog;
|
||||
|
|
@ -66,34 +64,8 @@ public class LinkAccountDialog
|
|||
return;
|
||||
}
|
||||
|
||||
progressbar.setVisibility(View.VISIBLE);
|
||||
SDLActivity.message("This functionality has been removed", 0);
|
||||
|
||||
LicenseValidator.setListener(new LicenseValidator.Listener() {
|
||||
@Override
|
||||
public void onUpdate(String signature,
|
||||
String userdata) {
|
||||
PrincipiaBackend.linkAccount(username, password, signature, userdata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
Log.v("Principia", "Failed!");
|
||||
SDLActivity.mSingleton.runOnUiThread(new Runnable(){
|
||||
public void run() {
|
||||
LinkAccountDialog.num_tries ++;
|
||||
if (LinkAccountDialog.num_tries < LinkAccountDialog.MAX_TRIES) {
|
||||
SDLActivity.mSingleton.do_check();
|
||||
} else {
|
||||
progressbar.setVisibility(View.GONE);
|
||||
SDLActivity.message("An unknown error has occured when attempting to link your account.", 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
LinkAccountDialog.num_tries = 0;
|
||||
SDLActivity.mSingleton.do_check();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ import android.util.AttributeSet;
|
|||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
|
||||
public class MultiSpinner extends Spinner implements OnMultiChoiceClickListener, OnCancelListener {
|
||||
public class MultiSpinner extends androidx.appcompat.widget.AppCompatSpinner implements OnMultiChoiceClickListener, OnCancelListener {
|
||||
|
||||
private List<String> items;
|
||||
public boolean[] selected;
|
||||
|
|
@ -31,7 +31,7 @@ import com.bithack.principia.R;
|
|||
/**
|
||||
* This class exists purely to cancel long click events.
|
||||
*/
|
||||
public class NumberPickerButton extends ImageButton {
|
||||
public class NumberPickerButton extends androidx.appcompat.widget.AppCompatImageButton {
|
||||
|
||||
private NumberPicker mNumberPicker;
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ import android.widget.ImageView;
|
|||
* @param <T>
|
||||
* The Number type of the range values. One of Long, Double, Integer, Float, Short, Byte or BigDecimal.
|
||||
*/
|
||||
public class RangeSeekBar<T extends Number> extends ImageView {
|
||||
public class RangeSeekBar<T extends Number> extends androidx.appcompat.widget.AppCompatImageView {
|
||||
private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Bitmap thumbImage = BitmapFactory.decodeResource(getResources(), R.drawable.seek_thumb_normal);
|
||||
private final Bitmap thumbPressedImage = BitmapFactory.decodeResource(getResources(), R.drawable.seek_thumb_pressed);
|
||||
|
|
@ -17,8 +17,6 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.google.android.vending.licensing.LicenseValidator;
|
||||
|
||||
public class RegisterDialog
|
||||
{
|
||||
static AlertDialog _dialog;
|
||||
|
|
@ -81,33 +79,7 @@ public class RegisterDialog
|
|||
}
|
||||
|
||||
progressbar.setVisibility(View.VISIBLE);
|
||||
|
||||
LicenseValidator.setListener(new LicenseValidator.Listener() {
|
||||
@Override
|
||||
public void onUpdate(String signature,
|
||||
String userdata) {
|
||||
PrincipiaBackend.register(username, email, password, signature, userdata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
Log.v("Principia", "Failed!");
|
||||
SDLActivity.mSingleton.runOnUiThread(new Runnable(){
|
||||
public void run() {
|
||||
RegisterDialog.num_tries ++;
|
||||
if (RegisterDialog.num_tries < RegisterDialog.MAX_TRIES) {
|
||||
SDLActivity.mSingleton.do_check();
|
||||
} else {
|
||||
progressbar.setVisibility(View.GONE);
|
||||
SDLActivity.message("An unknown error has occured when attempting to register an account.", 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
RegisterDialog.num_tries = 0;
|
||||
SDLActivity.mSingleton.do_check();
|
||||
PrincipiaBackend.register(username, email, password, "", "");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ import org.libsdl.app.PrincipiaBackend;
|
|||
|
||||
import com.bithack.principia.PrincipiaActivity;
|
||||
import com.bithack.principia.R;
|
||||
import com.facebook.AppEventsLogger;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
|
|
@ -216,8 +215,6 @@ public class SettingsDialog implements OnSeekBarChangeListener, OnClickListener
|
|||
|
||||
shadow_quality = sb_shadowsoftness.getProgress();
|
||||
|
||||
AppEventsLogger.setLimitEventUsage(PrincipiaActivity.getContext(), !this.settings_facebook_opt_out.isChecked());
|
||||
|
||||
PrincipiaBackend.setSettings(enable_shadows, enable_ao,
|
||||
shadow_quality, shadow_map_resx, shadow_map_resy,
|
||||
ao_map_res, texture_quality, uiscale,
|
||||
|
|
@ -314,8 +311,6 @@ public class SettingsDialog implements OnSeekBarChangeListener, OnClickListener
|
|||
this.settings_volume.setProgress(vol);
|
||||
this.curr_volume.setText(String.format(Locale.US, "%d%%", vol));
|
||||
this.settings_muted.setChecked(s.muted);
|
||||
|
||||
this.settings_facebook_opt_out.setChecked(!AppEventsLogger.getLimitEventUsage(PrincipiaActivity.getContext()));
|
||||
}
|
||||
|
||||
public Dialog get_dialog()
|
||||
|
|
@ -62,11 +62,6 @@ import com.bithack.principia.shared.VariableDialog;
|
|||
import com.bithack.principia.shared.SoundManDialog;
|
||||
import com.bithack.principia.shared.MultiSelectDialog;
|
||||
import com.bithack.principia.shared.VendorDialog;
|
||||
import com.facebook.AppEventsLogger;
|
||||
import com.google.android.vending.licensing.AESObfuscator;
|
||||
import com.google.android.vending.licensing.LicenseChecker;
|
||||
import com.google.android.vending.licensing.LicenseCheckerCallback;
|
||||
import com.google.android.vending.licensing.ServerManagedPolicy;
|
||||
|
||||
import android.app.*;
|
||||
import android.content.*;
|
||||
|
|
@ -116,60 +111,6 @@ import java.util.Locale;
|
|||
*/
|
||||
public class SDLActivity extends Activity implements DialogInterface.OnDismissListener/*, DialogInterface.OnCancelListener*/, DialogInterface.OnShowListener, OnSeekBarChangeListener
|
||||
{
|
||||
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
|
||||
public void allow(int policyReason) {
|
||||
if (isFinishing()) {
|
||||
// Don't update UI if Activity is finishing.
|
||||
return;
|
||||
}
|
||||
|
||||
// Should allow user access.
|
||||
|
||||
//SDLActivity.message("allow: "+getString(R.string.allow), 0);
|
||||
Log.v("Principia", "allow: "+getString(R.string.allow));
|
||||
}
|
||||
|
||||
public void dontAllow(int policyReason) {
|
||||
if (isFinishing()) {
|
||||
// Don't update UI if Activity is finishing.
|
||||
return;
|
||||
}
|
||||
|
||||
Log.v("Principia", "dontAllow: "+getString(R.string.dont_allow));
|
||||
// Should not allow access. In most cases, the app should assume
|
||||
// the user has access unless it encounters this. If it does,
|
||||
// the app should inform the user of their unlicensed ways
|
||||
// and then either shut down the app or limit the user to a
|
||||
// restricted set of features.
|
||||
// In this example, we show a dialog that takes the user to Market.
|
||||
// If the reason for the lack of license is that the service is
|
||||
// unavailable or there is another problem, we display a
|
||||
// retry button on the dialog and a different message.
|
||||
//displayDialog(policyReason == Policy.RETRY);
|
||||
}
|
||||
|
||||
public void applicationError(int errorCode) {
|
||||
if (isFinishing()) {
|
||||
// Don't update UI if Activity is finishing.
|
||||
return;
|
||||
}
|
||||
// This is a polite way of saying the developer made a mistake
|
||||
// while setting up or calling the license checker library.
|
||||
// Please examine the error code and fix the error.
|
||||
String result = String.format(getString(R.string.application_error), errorCode);
|
||||
Log.v("Principia", "appError: "+result);
|
||||
}
|
||||
}
|
||||
|
||||
private LicenseCheckerCallback mLicenseCheckerCallback;
|
||||
private LicenseChecker mChecker;
|
||||
|
||||
public AppEventsLogger mLogger;
|
||||
|
||||
public void do_check() {
|
||||
mChecker.checkAccess(mLicenseCheckerCallback);
|
||||
}
|
||||
|
||||
public static Dialog wv_dialog;
|
||||
public static WebView wv;
|
||||
public static CookieManager wv_cm;
|
||||
|
|
@ -261,21 +202,9 @@ public class SDLActivity extends Activity implements DialogInterface.OnDismissLi
|
|||
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
|
||||
Log.v("Principia", "did: "+deviceId);
|
||||
|
||||
// Library calls this when it's done.
|
||||
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
|
||||
|
||||
// Construct the LicenseChecker with a policy.
|
||||
mChecker = new LicenseChecker(
|
||||
this, new ServerManagedPolicy(this,
|
||||
new AESObfuscator(PrincipiaBackend.getMiscValues(), getPackageName(), deviceId)),
|
||||
PrincipiaBackend.getMiscSettings());
|
||||
//do_check();
|
||||
|
||||
SDLActivity.open_adapter = new ArrayAdapter<Level>(SDLActivity.mSingleton,
|
||||
android.R.layout.select_dialog_item);
|
||||
QuickaddDialog.object_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line);
|
||||
|
||||
this.mLogger = AppEventsLogger.newLogger(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -336,7 +265,6 @@ public class SDLActivity extends Activity implements DialogInterface.OnDismissLi
|
|||
}*/
|
||||
|
||||
protected void onResume() {
|
||||
AppEventsLogger.activateApp(this);
|
||||
Log.v("SDL", "onResume()");
|
||||
SDLActivity.num_dialogs = 0;
|
||||
mSingleton.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
|
@ -778,22 +706,16 @@ public class SDLActivity extends Activity implements DialogInterface.OnDismissLi
|
|||
}
|
||||
break;
|
||||
case SIGNAL_CLICK_DISCOVER:
|
||||
PrincipiaActivity.mSingleton.mLogger.logEvent("Clicked Discover");
|
||||
break;
|
||||
case SIGNAL_CLICK_SANDBOX:
|
||||
PrincipiaActivity.mSingleton.mLogger.logEvent("Opened Sandbox");
|
||||
break;
|
||||
case SIGNAL_SAVE_LEVEL:
|
||||
PrincipiaActivity.mSingleton.mLogger.logEvent("Saved level");
|
||||
break;
|
||||
case SIGNAL_PLAY_COMMUNITY_LEVEL:
|
||||
PrincipiaActivity.mSingleton.mLogger.logEvent("Played community level");
|
||||
break;
|
||||
case SIGNAL_MAIN_LEVEL_COMPLETED:
|
||||
PrincipiaActivity.mSingleton.mLogger.logEvent("Main level completed"); /* TODO: this needs a bundle with the ID */
|
||||
break;
|
||||
case SIGNAL_LITE_SPECIAL_BUTTON:
|
||||
PrincipiaActivity.mSingleton.mLogger.logEvent("Lite special button");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1240,7 +1162,6 @@ public class SDLActivity extends Activity implements DialogInterface.OnDismissLi
|
|||
{
|
||||
SDLActivity.mSingleton.runOnUiThread(new Runnable(){
|
||||
public void run() {
|
||||
PrincipiaActivity.mSingleton.mLogger.flush();
|
||||
SDLActivity.nativeQuit();
|
||||
|
||||
// Now wait for the SDL thread to quit
|
||||
|
|
@ -1760,7 +1681,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||
setOnKeyListener(this);
|
||||
setOnTouchListener(this);
|
||||
|
||||
mSensorManager = (SensorManager)context.getSystemService("sensor");
|
||||
mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
|
||||
|
||||
// Some arbitrary defaults to avoid a potential division by zero
|
||||
mWidth = 1.0f;
|
||||
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 726 B After Width: | Height: | Size: 726 B |
|
Before Width: | Height: | Size: 888 B After Width: | Height: | Size: 888 B |