aboutsummaryrefslogtreecommitdiff
path: root/android/app
diff options
context:
space:
mode:
Diffstat (limited to 'android/app')
-rw-r--r--android/app/build.gradle21
-rw-r--r--android/app/src/main/AndroidManifest.xml8
-rw-r--r--android/app/src/main/java/net/minetest/minetest/GameActivity.java33
-rw-r--r--android/app/src/main/java/net/minetest/minetest/MainActivity.java3
-rw-r--r--android/app/src/main/java/net/minetest/minetest/UnzipService.java5
5 files changed, 52 insertions, 18 deletions
diff --git a/android/app/build.gradle b/android/app/build.gradle
index b7d93ef0f..e8ba95722 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 29
+ compileSdkVersion 30
buildToolsVersion '30.0.3'
- ndkVersion '22.0.7026061'
+ ndkVersion "$ndk_version"
defaultConfig {
applicationId 'net.minetest.minetest'
minSdkVersion 16
- targetSdkVersion 29
+ targetSdkVersion 30
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
versionCode project.versionCode
}
@@ -68,7 +68,7 @@ task prepareAssets() {
from "${projRoot}/client/shaders" into "${assetsFolder}/client/shaders"
}
copy {
- from "../native/deps/Android/Irrlicht/shaders" into "${assetsFolder}/client/shaders/Irrlicht"
+ from "../native/deps/armeabi-v7a/Irrlicht/Shaders" into "${assetsFolder}/client/shaders/Irrlicht"
}
copy {
from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
@@ -76,10 +76,13 @@ task prepareAssets() {
copy {
from "${projRoot}/games/${gameToCopy}" into "${assetsFolder}/games/${gameToCopy}"
}
- /*copy {
- // ToDo: fix broken locales
- from "${projRoot}/po" into "${assetsFolder}/po"
- }*/
+ fileTree("${projRoot}/po").include("**/*.po").forEach { poFile ->
+ def moPath = "${assetsFolder}/locale/${poFile.parentFile.name}/LC_MESSAGES/"
+ file(moPath).mkdirs()
+ exec {
+ commandLine 'msgfmt', '-o', "${moPath}/minetest.mo", poFile
+ }
+ }
copy {
from "${projRoot}/textures" into "${assetsFolder}/textures"
}
@@ -109,5 +112,5 @@ android.applicationVariants.all { variant ->
dependencies {
implementation project(':native')
- implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.appcompat:appcompat:1.3.1'
}
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 314a38b5c..6ea677cb9 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -19,8 +19,6 @@
android:label="@string/label"
android:requestLegacyExternalStorage="true"
android:resizeableActivity="false"
- android:hasFragileUserData="true"
- android:isGame="true"
tools:ignore="UnusedAttribute">
<meta-data
@@ -32,7 +30,8 @@
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:maxAspectRatio="3.0"
android:screenOrientation="sensorLandscape"
- android:theme="@style/AppTheme">
+ android:theme="@style/AppTheme"
+ android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -46,7 +45,8 @@
android:launchMode="singleTask"
android:maxAspectRatio="3.0"
android:screenOrientation="sensorLandscape"
- android:theme="@style/AppTheme">
+ android:theme="@style/AppTheme"
+ android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
diff --git a/android/app/src/main/java/net/minetest/minetest/GameActivity.java b/android/app/src/main/java/net/minetest/minetest/GameActivity.java
index dc2e564be..46fc9b1de 100644
--- a/android/app/src/main/java/net/minetest/minetest/GameActivity.java
+++ b/android/app/src/main/java/net/minetest/minetest/GameActivity.java
@@ -30,7 +30,9 @@ import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
+import android.widget.Button;
import android.widget.EditText;
+import android.widget.LinearLayout;
import androidx.appcompat.app.AlertDialog;
@@ -85,9 +87,19 @@ public class GameActivity extends NativeActivity {
private void showDialogUI(String hint, String current, int editType) {
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
- EditText editText = new CustomEditText(this);
- builder.setView(editText);
+ LinearLayout container = new LinearLayout(this);
+ container.setOrientation(LinearLayout.VERTICAL);
+ builder.setView(container);
AlertDialog alertDialog = builder.create();
+ EditText editText;
+ // For multi-line, do not close the dialog after pressing back button
+ if (editType == 1) {
+ editText = new EditText(this);
+ } else {
+ editText = new CustomEditText(this);
+ }
+ container.addView(editText);
+ editText.setMaxLines(8);
editText.requestFocus();
editText.setHint(hint);
editText.setText(current);
@@ -103,8 +115,9 @@ public class GameActivity extends NativeActivity {
else
editText.setInputType(InputType.TYPE_CLASS_TEXT);
editText.setSelection(editText.getText().length());
- editText.setOnKeyListener((view, KeyCode, event) -> {
- if (KeyCode == KeyEvent.KEYCODE_ENTER) {
+ editText.setOnKeyListener((view, keyCode, event) -> {
+ // For multi-line, do not submit the text after pressing Enter key
+ if (keyCode == KeyEvent.KEYCODE_ENTER && editType != 1) {
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
messageReturnCode = 0;
messageReturnValue = editText.getText().toString();
@@ -113,6 +126,18 @@ public class GameActivity extends NativeActivity {
}
return false;
});
+ // For multi-line, add Done button since Enter key does not submit text
+ if (editType == 1) {
+ Button doneButton = new Button(this);
+ container.addView(doneButton);
+ doneButton.setText(R.string.ime_dialog_done);
+ doneButton.setOnClickListener((view -> {
+ imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
+ messageReturnCode = 0;
+ messageReturnValue = editText.getText().toString();
+ alertDialog.dismiss();
+ }));
+ }
alertDialog.show();
alertDialog.setOnCancelListener(dialog -> {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
diff --git a/android/app/src/main/java/net/minetest/minetest/MainActivity.java b/android/app/src/main/java/net/minetest/minetest/MainActivity.java
index 56615fca7..b6567b4b7 100644
--- a/android/app/src/main/java/net/minetest/minetest/MainActivity.java
+++ b/android/app/src/main/java/net/minetest/minetest/MainActivity.java
@@ -101,7 +101,8 @@ public class MainActivity extends AppCompatActivity {
mTextView = findViewById(R.id.textView);
sharedPreferences = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
+ Build.VERSION.SDK_INT < Build.VERSION_CODES.R)
checkPermission();
else
checkAppVersion();
diff --git a/android/app/src/main/java/net/minetest/minetest/UnzipService.java b/android/app/src/main/java/net/minetest/minetest/UnzipService.java
index b513a7fe0..a61a49139 100644
--- a/android/app/src/main/java/net/minetest/minetest/UnzipService.java
+++ b/android/app/src/main/java/net/minetest/minetest/UnzipService.java
@@ -32,6 +32,7 @@ import android.os.Environment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes;
import java.io.File;
@@ -200,6 +201,10 @@ public class UnzipService extends IntentService {
* Migrates user data from deprecated external storage to app scoped storage
*/
private void migrate(Notification.Builder notificationBuilder, File newLocation) throws IOException {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ return;
+ }
+
File oldLocation = new File(Environment.getExternalStorageDirectory(), "Minetest");
if (!oldLocation.isDirectory())
return;