Compare commits

..

20 Commits

Author SHA1 Message Date
Nut.andor
3820413d74 beta icon
WhatsNew
map_tree_1+2.png changes
2022-09-22 22:37:41 +02:00
Nut.andor
11db1b29e6 WhatsNew 2022-08-21 01:27:50 +02:00
Nut.andor
b996710e06 We switch to 0.8 - mainly because of the big engine changes 2022-08-20 00:54:05 +02:00
Nut.andor
a01099ab53 Merge branch 'master-Weblate_translations' into switch_to_actual_AndroidStudio
# Conflicts:
#	AndorsTrail/app/src/main/res/values-gl/strings.xml
2022-08-20 00:49:13 +02:00
Nut.andor
5c4b92f7c8 Burhczyd typos 2022-08-07 01:05:48 +02:00
Nut.andor
5717715319 Copy content of release version to old content directories (compatibility for ATCS) 2022-07-24 14:41:21 +02:00
Nut.andor
ff73fe1648 - Burhczyd in Sullengard
- Added sprites
2022-07-24 14:33:53 +02:00
Nut.andor
8c18d38686 refactor results 2022-07-24 14:30:05 +02:00
Nut.andor
e2d06ad22e gradle wrapper 2022-07-24 14:01:35 +02:00
Nut.andor
e07c3814ba do refactor: Right-click on app / java /com.qgpl.rpg.AndorsTrail
- rename  AndorsTrail  to  AndorsTrail_beta2   in whole project
- no comments/strings, no text occurences, Scope: project files
- Don't forget to rename the worldmap location in Util/AndroidStorage.java
- And don't make typos in Manifest :)
2022-07-24 13:32:18 +02:00
Nut.andor
93fb964467 We need the content files duplicate to be compatible with ATCS.
Symlinks would be better, but git doesn't handle them as needed.
2022-07-24 12:48:07 +02:00
Nut.andor
7c54472fae - Large maps bugs
- Debug buttons
2022-06-18 17:24:30 +02:00
Nut.andor
e3926e98c0 Migration to actual AndroidStudio version - final touches for compile 2022-06-18 11:19:06 +02:00
Nut.andor
e95b288412 Migration to actual AndroidStudio version - add whatsnew and Google Play info files 2022-06-18 11:09:03 +02:00
Nut.andor
46cd0db8d3 Then replace the url in the tmx files with an https version of it since it makes problems later on (Replace "http://" to "https://" with Notepad++ for all *.tmx files in subfolder XML)
After that rename all maps to .xml instead of .tmx (CMD:  ren  ...\AndorsTrailRelease\andors-trail\AndorsTrail\app\src\main\res\xml\*.tmx *.xml)
2022-06-18 10:54:56 +02:00
Nut.andor
e74c1d3d14 Migration to actual AndroidStudio version - second part
Edit the .ignore file

Moved Files:
------------
Android Gradle projects use a different directory structure than ADT
Eclipse projects. Here's how the projects were restructured:

* AndroidManifest.xml => app\src\main\AndroidManifest.xml
* assets\ => app\src\main\assets\
* lint.xml => app\lint.xml
* res\ => app\src\main\res\
* src\ => app\src\main\java\
* src\com\gpl\rpg\AndorsTrail\controller\CombatControllerTest.java.txt => app\src\main\resources\com\gpl\rpg\AndorsTrail\controller\CombatControllerTest.java.txt
2022-06-18 10:50:00 +02:00
Nut.andor
9907caed9f Migration to actual AndroidStudio version
Copy  ...\AndorsTrailRelease\andors-trail\AndorsTrail  to  a temporary directory, then delete it.

Open Android Studio, New > Import Project, select the AndorsTrail folder from the temporary location, choose  ...\AndorsTrailRelease\andors-trail\AndorsTrail  as target directory.   Click next a few times.
It then shows some error about not finding build tools. Below it there should be the option to 'Add google Maven reposiroty and sync project'. Click that option and then 'Do Refactor' (Bottom Left).

In the newly created file 'app/build.gradle'
In line 4 change the compileSdkVersion to 30 (or higher?)
In line 9 change the minSdkVersion to 14 instead of 4
In line 22 change the version from '29.+' to '28.0.0' and the compile at the beginning to implementation
Then Click 'Sync Project with Gradle Files' (icon in top right) that should no longer give errors.

Then replace the url in the tmx files with an https version of it since it makes problems later on (Replace  "http://"  to  "https://"  with Notepad++ for all *.tmx  files in subfolder XML)

After that rename all maps to .xml instead of .tmx (CMD:  ren  ...\AndorsTrailRelease\andors-trail\AndorsTrail\app\src\main\res\xml\*.tmx *.xml)

Edit the .ignore file
2022-06-18 10:25:29 +02:00
Nut.andor
a0fcb9faa1 Merge branch 'pulls/1829009049/37' into switch_to_actual_AndroidStudio 2022-06-18 09:51:28 +02:00
Nut.andor
d42db1e1a9 Merge branch 'pulls/1829009049/36' into switch_to_actual_AndroidStudio 2022-06-18 09:40:03 +02:00
Nut.andor
c05c0f9382 Merge branch 'pulls/1829009049/35' into switch_to_actual_AndroidStudio 2022-06-18 09:38:54 +02:00
3037 changed files with 3085081 additions and 4875429 deletions

23
.gitignore vendored
View File

@@ -1 +1,22 @@
/AndorsTrail/.idea/workspace.xml
# Android ignores
gen/
bin/
target/
local.properties
#IntelliJ
.idea/
out/production/
out/test/
*.iws
*.ipr
# Other
.metadata
.svn/
/AndorsTrail/.gradle
/AndorsTrail/gradle/wrapper
/AndorsTrail/app/build/
/AndorsTrail/app/debug/
/AndorsTrail/app/release/

View File

@@ -1,55 +0,0 @@
gen/
bin/
target/
local.properties
app/build/intermediates/
build/
debug/
beta/
release/
.gradle/
#IntelliJ
.idea/
out/production/
out/test/
*.iws
*.ipr
# Other
.metadata
.svn/
#copied from https://github.com/github/gitignore/blob/main/Gradle.gitignore
.gradle
**/build/
!src/**/build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties
# Cache of project
.gradletasknamecache
# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
#copied from https://github.com/github/gitignore/blob/main/Gradle.gitignore
/AndorsTrail/.gradle
/AndorsTrail/gradle/wrapper
/AndorsTrail/app/build/
/AndorsTrail/app/debug/
/AndorsTrail/app/beta/
/AndorsTrail/app/release/
/AndorsTrail/app/beta/

View File

@@ -1,91 +1,23 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 35
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.gpl.rpg.AndorsTrail"
applicationId "com.gpl.rpg.AndorsTrail_beta2"
minSdkVersion 14
targetSdkVersion 35
targetSdkVersion 30
}
buildTypes {
release {
manifestPlaceholders icon_name: 'icon', fileproviderPath: 'AndorsTrail'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
manifestPlaceholders icon_name: 'icon_beta', fileproviderPath: 'AndorsTrail.beta2'
applicationIdSuffix 'beta2'
versionNameSuffix = "dev"
signingConfig signingConfigs.debug
}
beta {
manifestPlaceholders icon_name: 'icon_beta', fileproviderPath: 'AndorsTrail.beta2'
applicationIdSuffix 'beta2'
versionNameSuffix = "beta"
signingConfig signingConfigs.debug
}
}
namespace 'com.gpl.rpg.AndorsTrail'
sourceSets {
main {
res.srcDirs = ['build/gen-res', 'src/main/res']
assets.srcDirs = ['build/gen-assets', 'src/main/assets']
}
}
}
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}
task copyRes(type: Copy) {
description "Copies the res folder to the modules res folder (& renames .tmx to .xml)"
from "${rootDir}/res"
into "${projectDir}/build/gen-res"
rename "(.*)\\.tmx", "\$1.xml"
}
task copyResValuesIn(type: Copy) {
description "Exception Indonesian language code (Old IN was renamed to now ID)"
from "${rootDir}/res/values-id/"
into "${projectDir}/build/gen-res/values-in/"
}
task copyTranslation(type: Copy) {
description("Copies the translation files to the modules translations folder")
from "${rootDir}/assets/translation"
into "${projectDir}/build/gen-assets/translation"
}
task cleanup(type: Delete) {
description("Deletes the assets/translation and the res folder from the modules folder")
delete "${projectDir}/build/gen-res", "${projectDir}/build/gen-assets/translation"
}
afterEvaluate {
project.tasks.copyRes.dependsOn project.tasks.copyResValuesIn
mapReleaseSourceSetPaths.dependsOn project.tasks.copyRes
generateReleaseResources.dependsOn project.tasks.copyRes
generateDebugResources.dependsOn project.tasks.copyRes
mapDebugSourceSetPaths.dependsOn project.tasks.copyRes
mergeDebugResources.dependsOn project.tasks.copyRes
extractDeepLinksDebug.dependsOn project.tasks.copyRes
mergeReleaseResources.dependsOn project.tasks.copyRes
extractDeepLinksRelease.dependsOn project.tasks.copyRes
generateDebugResources.dependsOn project.tasks.copyTranslation
mapDebugSourceSetPaths.dependsOn project.tasks.copyTranslation
mergeDebugAssets.dependsOn project.tasks.copyTranslation
mergeReleaseAssets.dependsOn project.tasks.copyTranslation
extractDeepLinksDebug.dependsOn project.tasks.copyTranslation
extractDeepLinksRelease.dependsOn project.tasks.copyTranslation
clean.dependsOn project.tasks.cleanup
implementation 'com.android.support:support-v4:28.0.0'
}

View File

@@ -2,12 +2,16 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gpl.rpg.AndorsTrail"
android:versionCode="82"
android:versionName="0.8.15"
package="com.gpl.rpg.AndorsTrail_beta2"
android:versionCode="65"
android:versionName="0.8.1beta"
android:installLocation="auto"
>
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="30"
/>
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
@@ -21,9 +25,9 @@
<application
android:name="com.gpl.rpg.AndorsTrail.AndorsTrailApplication"
android:name=".AndorsTrailApplication"
android:label="@string/app_name"
android:icon="@drawable/${icon_name}"
android:icon="@drawable/icon_beta"
android:description="@string/app_description"
android:allowBackup="true"
android:theme="@style/AndorsTrailTheme_Blue"
@@ -31,9 +35,8 @@
android:hasFragileUserData="true"
android:preserveLegacyExternalStorage="true"
>
<activity
android:exported="true"
android:name="com.gpl.rpg.AndorsTrail.activity.StartScreenActivity"
<activity
android:name=".activity.StartScreenActivity"
android:clearTaskOnLaunch="true"
>
<intent-filter>
@@ -42,29 +45,29 @@
</intent-filter>
</activity>
<activity
android:name="com.gpl.rpg.AndorsTrail.activity.MainActivity"
android:name=".activity.MainActivity"
android:label="@string/app_name"
android:theme="@style/AndorsTrailTheme_Blue.NoBackground"
/>
<activity android:name="com.gpl.rpg.AndorsTrail.activity.HeroinfoActivity" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.MonsterInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.ItemInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.LevelUpActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.MonsterEncounterActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.ConversationActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.ShopActivity" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.AboutActivity" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.LoadingActivity" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.Preferences" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.LoadSaveActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.ActorConditionInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.BulkSelectionInterface" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.SkillInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name="com.gpl.rpg.AndorsTrail.activity.DisplayWorldMapActivity" />
<activity android:name=".activity.HeroinfoActivity" />
<activity android:name=".activity.MonsterInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name=".activity.ItemInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name=".activity.LevelUpActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name=".activity.MonsterEncounterActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name=".activity.ConversationActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name=".activity.ShopActivity" />
<activity android:name=".activity.AboutActivity" />
<activity android:name=".activity.LoadingActivity" />
<activity android:name=".activity.Preferences" />
<activity android:name=".activity.LoadSaveActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name=".activity.ActorConditionInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name=".activity.BulkSelectionInterface" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name=".activity.SkillInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
<activity android:name=".activity.DisplayWorldMapActivity" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:name="android.support.v4.content.FileProvider"
android:authorities="com.gpl.rpg.AndorsTrail_beta2.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data

View File

@@ -0,0 +1,20 @@
# Android ignores
gen/
bin/
target/
local.properties
#IntelliJ
.idea/
out/production/
out/test/
*.iws
*.ipr
# Other
.metadata
.svn/
#/AndorsTrail/app/build/*
#/AndorsTrail/app/release/*
#/AndorsTrail/.gradle/*

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,225 +0,0 @@
package com.gpl.rpg.AndorsTrail;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
import com.gpl.rpg.AndorsTrail.context.WorldContext;
import com.gpl.rpg.AndorsTrail.controller.Constants;
import com.gpl.rpg.AndorsTrail.util.AndroidStorage;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Insets;
import android.os.Build;
import android.os.Environment;
import android.util.Pair;
import android.view.View;
import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowInsetsController;
import android.view.WindowManager;
import androidx.annotation.RequiresApi;
public final class AndorsTrailApplication extends Application {
public static final String CURRENT_VERSION_DISPLAY = BuildConfig.VERSION_NAME;
public static final boolean IS_DEV_VERSION = CURRENT_VERSION_DISPLAY.endsWith("dev");
public static final boolean IS_BETA_VERSION = CURRENT_VERSION_DISPLAY.endsWith("beta");
public static final boolean IS_RELEASE_VERSION = !CURRENT_VERSION_DISPLAY.matches(".*[a-zA-Z].*");
public static final boolean DEVELOPMENT_DEBUGRESOURCES = false;
public static final boolean DEVELOPMENT_FORCE_STARTNEWGAME = false;
public static final boolean DEVELOPMENT_FORCE_CONTINUEGAME = false;
public static final boolean DEVELOPMENT_DEBUGBUTTONS = IS_DEV_VERSION;
public static final boolean DEVELOPMENT_FASTSPEED = false;
public static final boolean DEVELOPMENT_VALIDATEDATA = IS_BETA_VERSION;
public static final boolean DEVELOPMENT_DEBUGMESSAGES = IS_DEV_VERSION;
public static final boolean DEVELOPMENT_INCOMPATIBLE_SAVEGAMES = DEVELOPMENT_DEBUGRESOURCES || DEVELOPMENT_DEBUGBUTTONS || DEVELOPMENT_FASTSPEED || !IS_RELEASE_VERSION;
public static final int DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION = 999;
public static final int CURRENT_VERSION = DEVELOPMENT_INCOMPATIBLE_SAVEGAMES ? DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION : BuildConfig.VERSION_CODE;
private final AndorsTrailPreferences preferences = new AndorsTrailPreferences();
private WorldContext world = new WorldContext();
private ControllerContext controllers = new ControllerContext(this, world);
private WorldSetup setup = new WorldSetup(world, controllers, this);
public WorldContext getWorld() { return world; }
public WorldSetup getWorldSetup() { return setup; }
public AndorsTrailPreferences getPreferences() { return preferences; }
public ControllerContext getControllerContext() { return controllers; }
public static AndorsTrailApplication getApplicationFromActivity(Activity activity) {
return ((AndorsTrailApplication) activity.getApplication());
}
public static AndorsTrailApplication getApplicationFromActivityContext(Context context) {
return getApplicationFromActivity(getActivityFromActivityContext(context));
}
private static Activity getActivityFromActivityContext(Context context) {
return (Activity) context;
}
public boolean isInitialized() { return world.model != null; }
public void setWindowParameters(Activity activity) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
}
public void setFullscreenMode(Activity activity) {
setFullscreenMode(preferences.fullscreen, activity.getWindow());
}
public static void setFullscreenMode(boolean fullscreen, Window window) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
final WindowInsetsController insetsController = window.getInsetsController();
if (insetsController != null) {
insetsController.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
int insetType = WindowInsets.Type.statusBars();
if (fullscreen) {
insetsController.hide(insetType);
} else {
insetsController.show(insetType);
}
}
} else {
if (fullscreen) {
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
window.setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
}
@RequiresApi(Build.VERSION_CODES.R)
public int getUsableTouchAreaInsetMask(){
int i = 0;
i |= WindowInsets.Type.displayCutout();
i |= WindowInsets.Type.navigationBars();
if (!preferences.fullscreen) {
i |= WindowInsets.Type.statusBars();
}
return i;
}
//Get default locale at startup, as somehow it seems that changing the app's
//configured locale impacts the value returned by Locale.getDefault() nowadays.
private final Locale defaultLocale = Locale.getDefault();
private Pair<String, Locale> lastLocale = null;
public boolean setLocale(Activity context) {
Resources res = context.getResources();
Configuration conf = res.getConfiguration();
Locale targetLocale;
if (lastLocale != null && lastLocale.first == preferences.language) {
targetLocale = lastLocale.second;
} else {
targetLocale = localeForLanguageTag(preferences.language);
lastLocale = new Pair<String, Locale>(preferences.language, targetLocale);
}
if (targetLocale.equals(conf.locale)) {
return false;
}
conf.locale = targetLocale;
res.updateConfiguration(conf, res.getDisplayMetrics());
this.getResources().updateConfiguration(conf, res.getDisplayMetrics());
return true;
}
// Supports language or language_COUNTRY in short form e.g. "en" or "en_US"
private Locale localeForLanguageTag(String languageTag) {
Locale locale = null;
if (languageTag != null && !languageTag.equalsIgnoreCase("default")) {
final int pos = languageTag.indexOf('-');
if (pos == -1) {
locale = new Locale(languageTag);
}
else locale = new Locale(languageTag.substring(0, pos), languageTag.substring(pos+1));
}
if (locale == null) {
locale = defaultLocale;
}
return locale;
}
/**
* Logging to text file system as found on https://stackoverflow.com/questions/19565685/saving-logcat-to-a-text-file-in-android-device
*/
public void onCreate() {
super.onCreate();
if ( DEVELOPMENT_DEBUGMESSAGES && isExternalStorageWritable() ) {
File appDirectory = AndroidStorage.getStorageDirectory(getApplicationContext(), Constants.FILENAME_SAVEGAME_DIRECTORY);
File logDirectory = new File( appDirectory, "log" );
File logFile = new File( logDirectory, "logcat" + System.currentTimeMillis() + ".txt" );
// create app folder
if ( !appDirectory.exists() ) {
appDirectory.mkdir();
}
// create log folder
if ( !logDirectory.exists() ) {
logDirectory.mkdir();
}
// clear the previous logcat and then write the new one to the file
try {
Process process = Runtime.getRuntime().exec("logcat -c");
process = Runtime.getRuntime().exec("logcat -f " + logFile+" *:W");
} catch ( IOException e ) {
e.printStackTrace();
}
}
}
/* Checks if external storage is available for read and write */
public boolean isExternalStorageWritable() {
String state = Environment.getExternalStorageState();
if ( Environment.MEDIA_MOUNTED.equals( state ) ) {
return true;
}
return false;
}
/* Checks if external storage is available to at least read */
public boolean isExternalStorageReadable() {
String state = Environment.getExternalStorageState();
if ( Environment.MEDIA_MOUNTED.equals( state ) ||
Environment.MEDIA_MOUNTED_READ_ONLY.equals( state ) ) {
return true;
}
return false;
}
public void discardWorld() {
world = new WorldContext();
controllers = new ControllerContext(this, world);
setup = new WorldSetup(world, controllers, getApplicationContext());
}
public void setUsablePadding(View root) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
root.setOnApplyWindowInsetsListener((v, insets) -> {
Insets bars = insets.getInsets(getUsableTouchAreaInsetMask());
int left = Math.max(bars.left, v.getPaddingLeft());
int top = Math.max(bars.top, v.getPaddingTop());
int right = Math.max(bars.right, v.getPaddingRight());
int bottom = Math.max(bars.bottom, v.getPaddingBottom());
v.setPadding(left, top, right, bottom);
return WindowInsets.CONSUMED;
});
}
}
}

View File

@@ -1,35 +0,0 @@
package com.gpl.rpg.AndorsTrail.activity;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.IdRes;
import androidx.annotation.LayoutRes;
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
public abstract class AndorsTrailBaseActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
app.setLocale(this);
}
@Override
protected void onResume() {
super.onResume();
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
app.setLocale(this);
}
protected void initializeView(Activity activity, @LayoutRes int layoutId, @IdRes int rootViewId) {
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(activity);
app.setWindowParameters(activity);
activity.setContentView(layoutId);
View root = activity.findViewById(rootViewId);
app.setUsablePadding(root);
app.setFullscreenMode(activity);
}
}

Some files were not shown because too many files have changed in this diff Show More