mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
Android: build fixes & compat fixes
This commit is contained in:
parent
dfd5f7cb10
commit
7f023de5cb
@ -4,7 +4,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.4.2'
|
classpath 'com.android.tools.build:gradle:3.5.1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,13 +24,14 @@ def sqlite3_version = "3240000"
|
|||||||
apply plugin: "com.android.application"
|
apply plugin: "com.android.application"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 29
|
||||||
|
buildToolsVersion '29.0.2'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
versionCode 24
|
versionCode 24
|
||||||
versionName "${System.env.VERSION_STR}.${versionCode}"
|
versionName "${System.env.VERSION_STR}.${versionCode}"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 28
|
targetSdkVersion 29
|
||||||
applicationId "net.minetest.minetest"
|
applicationId "net.minetest.minetest"
|
||||||
manifestPlaceholders = [package: "net.minetest.minetest", project: project.name]
|
manifestPlaceholders = [package: "net.minetest.minetest", project: project.name]
|
||||||
ndk {
|
ndk {
|
||||||
@ -41,6 +42,11 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
disable "OldTargetApi", "GoogleAppIndexingWarning"
|
disable "OldTargetApi", "GoogleAppIndexingWarning"
|
||||||
}
|
}
|
||||||
@ -165,5 +171,5 @@ task cleanAll(type: Delete, dependsOn: [clean, cleanAssets, cleanIconv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.android.support:support-v4:28.0.0'
|
implementation 'androidx.core:core:1.1.0'
|
||||||
}
|
}
|
||||||
|
2
build/android/gradle.properties
Normal file
2
build/android/gradle.properties
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
android.enableJetifier=true
|
||||||
|
android.useAndroidX=true
|
@ -1,6 +1 @@
|
|||||||
#Fri Aug 09 22:14:33 CEST 2019
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
|
||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.SET_DEBUG_APP" />
|
|
||||||
</manifest>
|
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="net.minetest.minetest"
|
package="net.minetest.minetest"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
@ -11,14 +12,14 @@
|
|||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="${project}"
|
android:label="${project}"
|
||||||
android:resizeableActivity="false">
|
android:resizeableActivity="false"
|
||||||
|
tools:targetApi="n">
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.max_aspect"
|
android:name="android.max_aspect"
|
||||||
android:value="2.1" />
|
android:value="2.4" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
@ -50,10 +51,10 @@
|
|||||||
android:name=".MinetestTextEntry"
|
android:name=".MinetestTextEntry"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:theme="@style/Theme.Dialog"
|
android:theme="@style/Theme.Dialog"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"/>
|
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".MinetestAssetCopy"
|
android:name=".MinetestAssetCopy"
|
||||||
android:screenOrientation="sensorLandscape"
|
android:screenOrientation="sensorLandscape"
|
||||||
android:theme="@style/AppTheme"/>
|
android:theme="@style/AppTheme" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -6,17 +6,17 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.v4.app.ActivityCompat;
|
|
||||||
import android.support.v4.content.ContextCompat;;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
public class MainActivity extends Activity {
|
||||||
|
|
||||||
private final static int PERMISSIONS = 1;
|
private final static int PERMISSIONS = 1;
|
||||||
private static final String[] REQUIRED_SDK_PERMISSIONS = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
private static final String[] REQUIRED_SDK_PERMISSIONS = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
||||||
|
|
||||||
@ -30,8 +30,8 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkPermission() {
|
private void checkPermission() {
|
||||||
final List<String> missingPermissions = new ArrayList<String>();
|
final List<String> missingPermissions = new ArrayList<>();
|
||||||
// check required permission
|
// check required permission
|
||||||
for (final String permission : REQUIRED_SDK_PERMISSIONS) {
|
for (final String permission : REQUIRED_SDK_PERMISSIONS) {
|
||||||
final int result = ContextCompat.checkSelfPermission(this, permission);
|
final int result = ContextCompat.checkSelfPermission(this, permission);
|
||||||
@ -42,7 +42,7 @@ public class MainActivity extends Activity {
|
|||||||
if (!missingPermissions.isEmpty()) {
|
if (!missingPermissions.isEmpty()) {
|
||||||
// request permission
|
// request permission
|
||||||
final String[] permissions = missingPermissions
|
final String[] permissions = missingPermissions
|
||||||
.toArray(new String[missingPermissions.size()]);
|
.toArray(new String[0]);
|
||||||
ActivityCompat.requestPermissions(this, permissions, PERMISSIONS);
|
ActivityCompat.requestPermissions(this, permissions, PERMISSIONS);
|
||||||
} else {
|
} else {
|
||||||
final int[] grantResults = new int[REQUIRED_SDK_PERMISSIONS.length];
|
final int[] grantResults = new int[REQUIRED_SDK_PERMISSIONS.length];
|
||||||
@ -53,10 +53,9 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||||
@NonNull int[] grantResults) {
|
@NonNull int[] grantResults) {
|
||||||
switch (requestCode) {
|
if (requestCode == PERMISSIONS) {
|
||||||
case PERMISSIONS:
|
|
||||||
for (int index = 0; index < permissions.length; index++) {
|
for (int index = 0; index < permissions.length; index++) {
|
||||||
if (grantResults[index] != PackageManager.PERMISSION_GRANTED) {
|
if (grantResults[index] != PackageManager.PERMISSION_GRANTED) {
|
||||||
// permission not granted - toast and exit
|
// permission not granted - toast and exit
|
||||||
@ -67,11 +66,10 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
// permission were granted - run
|
// permission were granted - run
|
||||||
next();
|
next();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void next() {
|
private void next() {
|
||||||
Intent intent = new Intent(this, MtNativeActivity.class);
|
Intent intent = new Intent(this, MtNativeActivity.class);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.minetest.minetest;
|
package net.minetest.minetest;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.res.AssetFileDescriptor;
|
import android.content.res.AssetFileDescriptor;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
@ -19,13 +20,12 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
public class MinetestAssetCopy extends Activity {
|
public class MinetestAssetCopy extends Activity {
|
||||||
ProgressBar m_ProgressBar;
|
private ProgressBar m_ProgressBar;
|
||||||
TextView m_Filename;
|
private TextView m_Filename;
|
||||||
copyAssetTask m_AssetCopy;
|
private copyAssetTask m_AssetCopy;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@ -62,21 +62,18 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void makeFullScreen() {
|
private void makeFullScreen() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT >= 19)
|
||||||
this.getWindow().getDecorView().setSystemUiVisibility(
|
this.getWindow().getDecorView().setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWindowFocusChanged(boolean hasFocus) {
|
public void onWindowFocusChanged(boolean hasFocus) {
|
||||||
super.onWindowFocusChanged(hasFocus);
|
super.onWindowFocusChanged(hasFocus);
|
||||||
if (hasFocus) {
|
if (hasFocus)
|
||||||
makeFullScreen();
|
makeFullScreen();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* preserve asset copy background task to prevent restart of copying */
|
/* preserve asset copy background task to prevent restart of copying */
|
||||||
/* this way of doing it is not recommended for latest android version */
|
/* this way of doing it is not recommended for latest android version */
|
||||||
@ -85,7 +82,8 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class copyAssetTask extends AsyncTask<String, Integer, String> {
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
private class copyAssetTask extends AsyncTask<String, Integer, String> {
|
||||||
boolean m_copy_started = false;
|
boolean m_copy_started = false;
|
||||||
String m_Foldername = "media";
|
String m_Foldername = "media";
|
||||||
Vector<String> m_foldernames;
|
Vector<String> m_foldernames;
|
||||||
@ -99,7 +97,7 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
InputStream src = getAssets().open(filename);
|
InputStream src = getAssets().open(filename);
|
||||||
byte[] buf = new byte[4096];
|
byte[] buf = new byte[4096];
|
||||||
|
|
||||||
int len = 0;
|
int len;
|
||||||
while ((len = src.read(buf)) > 0) {
|
while ((len = src.read(buf)) > 0) {
|
||||||
size += len;
|
size += len;
|
||||||
}
|
}
|
||||||
@ -111,10 +109,10 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String doInBackground(String... files) {
|
protected String doInBackground(String... files) {
|
||||||
m_foldernames = new Vector<String>();
|
m_foldernames = new Vector<>();
|
||||||
m_filenames = new Vector<String>();
|
m_filenames = new Vector<>();
|
||||||
m_tocopy = new Vector<String>();
|
m_tocopy = new Vector<>();
|
||||||
m_asset_size_unknown = new Vector<String>();
|
m_asset_size_unknown = new Vector<>();
|
||||||
String baseDir =
|
String baseDir =
|
||||||
Environment.getExternalStorageDirectory().getAbsolutePath()
|
Environment.getExternalStorageDirectory().getAbsolutePath()
|
||||||
+ "/";
|
+ "/";
|
||||||
@ -128,9 +126,9 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
} else {
|
} else {
|
||||||
File[] todel = TempFolder.listFiles();
|
File[] todel = TempFolder.listFiles();
|
||||||
|
|
||||||
for (int i = 0; i < todel.length; i++) {
|
for (File file : todel) {
|
||||||
Log.v("MinetestAssetCopy", "deleting: " + todel[i].getAbsolutePath());
|
Log.v("MinetestAssetCopy", "deleting: " + file.getAbsolutePath());
|
||||||
todel[i].delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,9 +164,9 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
if (m_asset_size_unknown.contains(filename)) {
|
if (m_asset_size_unknown.contains(filename)) {
|
||||||
File testme = new File(baseDir + "/" + filename);
|
File testme = new File(baseDir + "/" + filename);
|
||||||
|
|
||||||
if (testme.exists()) {
|
if (testme.exists())
|
||||||
filesize = testme.length();
|
filesize = testme.length();
|
||||||
}
|
|
||||||
asset_size_unknown = true;
|
asset_size_unknown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,12 +247,10 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
protected void onProgressUpdate(Integer... progress) {
|
protected void onProgressUpdate(Integer... progress) {
|
||||||
|
|
||||||
if (m_copy_started) {
|
if (m_copy_started) {
|
||||||
boolean shortened = false;
|
|
||||||
String todisplay = m_tocopy.get(progress[0]);
|
String todisplay = m_tocopy.get(progress[0]);
|
||||||
m_ProgressBar.setProgress(progress[0]);
|
m_ProgressBar.setProgress(progress[0]);
|
||||||
m_Filename.setText(todisplay);
|
m_Filename.setText(todisplay);
|
||||||
} else {
|
} else {
|
||||||
boolean shortened = false;
|
|
||||||
String todisplay = m_Foldername;
|
String todisplay = m_Foldername;
|
||||||
String full_text = "scanning " + todisplay + " ...";
|
String full_text = "scanning " + todisplay + " ...";
|
||||||
m_Filename.setText(full_text);
|
m_Filename.setText(full_text);
|
||||||
@ -264,14 +260,11 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
/**
|
/**
|
||||||
* check all files and folders in filelist
|
* check all files and folders in filelist
|
||||||
*/
|
*/
|
||||||
protected void ProcessFileList() {
|
void ProcessFileList() {
|
||||||
String FlashBaseDir =
|
String FlashBaseDir =
|
||||||
Environment.getExternalStorageDirectory().getAbsolutePath();
|
Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||||
|
|
||||||
Iterator itr = m_filenames.iterator();
|
for (String current_path : m_filenames) {
|
||||||
|
|
||||||
while (itr.hasNext()) {
|
|
||||||
String current_path = (String) itr.next();
|
|
||||||
String FlashPath = FlashBaseDir + "/" + current_path;
|
String FlashPath = FlashBaseDir + "/" + current_path;
|
||||||
|
|
||||||
if (isAssetFolder(current_path)) {
|
if (isAssetFolder(current_path)) {
|
||||||
@ -300,7 +293,7 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
File testme = new File(FlashPath);
|
File testme = new File(FlashPath);
|
||||||
|
|
||||||
long asset_filesize = -1;
|
long asset_filesize = -1;
|
||||||
long stored_filesize = -1;
|
long stored_filesize;
|
||||||
|
|
||||||
if (testme.exists()) {
|
if (testme.exists()) {
|
||||||
try {
|
try {
|
||||||
@ -308,7 +301,6 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
asset_filesize = fd.getLength();
|
asset_filesize = fd.getLength();
|
||||||
fd.close();
|
fd.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
refresh = true;
|
|
||||||
m_asset_size_unknown.add(current_path);
|
m_asset_size_unknown.add(current_path);
|
||||||
Log.e("MinetestAssetCopy", "Failed to open asset file \"" +
|
Log.e("MinetestAssetCopy", "Failed to open asset file \"" +
|
||||||
FlashPath + "\" for size check");
|
FlashPath + "\" for size check");
|
||||||
@ -316,22 +308,20 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
|
|
||||||
stored_filesize = testme.length();
|
stored_filesize = testme.length();
|
||||||
|
|
||||||
if (asset_filesize == stored_filesize) {
|
if (asset_filesize == stored_filesize)
|
||||||
refresh = false;
|
refresh = false;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refresh) {
|
if (refresh)
|
||||||
m_tocopy.add(current_path);
|
m_tocopy.add(current_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read list of folders prepared on package build
|
* read list of folders prepared on package build
|
||||||
*/
|
*/
|
||||||
protected void BuildFolderList() {
|
void BuildFolderList() {
|
||||||
try {
|
try {
|
||||||
InputStream is = getAssets().open("index.txt");
|
InputStream is = getAssets().open("index.txt");
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||||
@ -351,7 +341,7 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
/**
|
/**
|
||||||
* read list of asset files prepared on package build
|
* read list of asset files prepared on package build
|
||||||
*/
|
*/
|
||||||
protected void BuildFileList() {
|
void BuildFileList() {
|
||||||
long entrycount = 0;
|
long entrycount = 0;
|
||||||
try {
|
try {
|
||||||
InputStream is = getAssets().open("filelist.txt");
|
InputStream is = getAssets().open("filelist.txt");
|
||||||
@ -374,7 +364,7 @@ public class MinetestAssetCopy extends Activity {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isAssetFolder(String path) {
|
boolean isAssetFolder(String path) {
|
||||||
return m_foldernames.contains(path);
|
return m_foldernames.contains(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ public class MinetestTextEntry extends Activity {
|
|||||||
private final int MultiLineTextInput = 1;
|
private final int MultiLineTextInput = 1;
|
||||||
private final int SingleLineTextInput = 2;
|
private final int SingleLineTextInput = 2;
|
||||||
private final int SingleLinePasswordInput = 3;
|
private final int SingleLinePasswordInput = 3;
|
||||||
public AlertDialog mTextInputDialog;
|
private AlertDialog mTextInputDialog;
|
||||||
public EditText mTextInputWidget;
|
private EditText mTextInputWidget;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@ -71,7 +71,7 @@ public class MinetestTextEntry extends Activity {
|
|||||||
mTextInputDialog.show();
|
mTextInputDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pushResult(String text) {
|
private void pushResult(String text) {
|
||||||
Intent resultData = new Intent();
|
Intent resultData = new Intent();
|
||||||
resultData.putExtra("text", text);
|
resultData.putExtra("text", text);
|
||||||
setResult(Activity.RESULT_OK, resultData);
|
setResult(Activity.RESULT_OK, resultData);
|
||||||
@ -79,7 +79,7 @@ public class MinetestTextEntry extends Activity {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelDialog() {
|
private void cancelDialog() {
|
||||||
setResult(Activity.RESULT_CANCELED);
|
setResult(Activity.RESULT_CANCELED);
|
||||||
mTextInputDialog.dismiss();
|
mTextInputDialog.dismiss();
|
||||||
finish();
|
finish();
|
||||||
|
@ -37,21 +37,18 @@ public class MtNativeActivity extends NativeActivity {
|
|||||||
makeFullScreen();
|
makeFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void makeFullScreen() {
|
private void makeFullScreen() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT >= 19)
|
||||||
this.getWindow().getDecorView().setSystemUiVisibility(
|
this.getWindow().getDecorView().setSystemUiVisibility(
|
||||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWindowFocusChanged(boolean hasFocus) {
|
public void onWindowFocusChanged(boolean hasFocus) {
|
||||||
super.onWindowFocusChanged(hasFocus);
|
super.onWindowFocusChanged(hasFocus);
|
||||||
if (hasFocus) {
|
if (hasFocus)
|
||||||
makeFullScreen();
|
makeFullScreen();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void copyAssets() {
|
public void copyAssets() {
|
||||||
Intent intent = new Intent(this, MinetestAssetCopy.class);
|
Intent intent = new Intent(this, MinetestAssetCopy.class);
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<style name="AppTheme" parent="@android:style/android:Theme.Material.Light.NoActionBar.Fullscreen">
|
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar.Fullscreen">
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="android:windowAnimationStyle">@null</item>
|
|
||||||
<item name="android:windowBackground">@drawable/bg</item>
|
<item name="android:windowBackground">@drawable/bg</item>
|
||||||
|
<item name="android:windowLayoutInDisplayCutoutMode" tools:ignore="NewApi" tools:targetApi="o_mr1">
|
||||||
|
shortEdges
|
||||||
|
</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.Dialog" parent="@android:style/Theme.Material.Light.Dialog.NoActionBar"/>
|
<style name="Theme.Dialog" parent="@android:style/Theme.Material.Light.Dialog.NoActionBar">
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="AppTheme" parent="@android:style/android:Theme.Holo.Light.NoActionBar.Fullscreen">
|
<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen">
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="android:windowAnimationStyle">@null</item>
|
|
||||||
<item name="android:windowBackground">@drawable/bg</item>
|
<item name="android:windowBackground">@drawable/bg</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.Dialog" parent="@android:style/android:Theme.Holo.Light.Dialog.NoActionBar"/>
|
<style name="Theme.Dialog" parent="android:Theme.Holo.Light.Dialog.NoActionBar">
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user