Showing with 1,015 additions and 763 deletions.
  1. +5 −4 .clang-format
  2. +5 −5 .github/workflows/android.yml
  3. +1 −0 .gitignore
  4. +1 −1 CMakeLists.txt
  5. 0 {build → }/android/.gitignore
  6. +1 −1 {build → }/android/app/build.gradle
  7. +2 −0 {build → }/android/app/src/main/AndroidManifest.xml
  8. 0 {build → }/android/app/src/main/java/net/minetest/minetest/CustomEditText.java
  9. +8 −0 {build → }/android/app/src/main/java/net/minetest/minetest/GameActivity.java
  10. +47 −16 {build → }/android/app/src/main/java/net/minetest/minetest/MainActivity.java
  11. +254 −0 android/app/src/main/java/net/minetest/minetest/UnzipService.java
  12. +39 −0 android/app/src/main/java/net/minetest/minetest/Utils.java
  13. BIN {build → }/android/app/src/main/res/drawable/background.png
  14. 0 {build → }/android/app/src/main/res/drawable/bg.xml
  15. +5 −2 {build → }/android/app/src/main/res/layout/activity_main.xml
  16. BIN {build → }/android/app/src/main/res/mipmap/ic_launcher.png
  17. +3 −0 {build → }/android/app/src/main/res/values/strings.xml
  18. 0 {build → }/android/app/src/main/res/values/styles.xml
  19. +2 −2 {build → }/android/build.gradle
  20. 0 {build → }/android/gradle.properties
  21. BIN {build → }/android/gradle/wrapper/gradle-wrapper.jar
  22. 0 {build → }/android/gradle/wrapper/gradle-wrapper.properties
  23. 0 {build → }/android/gradlew
  24. 0 {build → }/android/gradlew.bat
  25. +143 −0 android/icons/aux1_btn.svg
  26. 0 {build → }/android/icons/aux_btn.svg
  27. 0 {build → }/android/icons/camera_btn.svg
  28. 0 {build → }/android/icons/chat_btn.svg
  29. 0 {build → }/android/icons/chat_hide_btn.svg
  30. 0 {build → }/android/icons/chat_show_btn.svg
  31. 0 {build → }/android/icons/checkbox_tick.svg
  32. 0 {build → }/android/icons/debug_btn.svg
  33. 0 {build → }/android/icons/down.svg
  34. 0 {build → }/android/icons/drop_btn.svg
  35. 0 {build → }/android/icons/fast_btn.svg
  36. 0 {build → }/android/icons/fly_btn.svg
  37. 0 {build → }/android/icons/gear_icon.svg
  38. 0 {build → }/android/icons/inventory_btn.svg
  39. 0 {build → }/android/icons/joystick_bg.svg
  40. 0 {build → }/android/icons/joystick_center.svg
  41. 0 {build → }/android/icons/joystick_off.svg
  42. 0 {build → }/android/icons/jump_btn.svg
  43. 0 {build → }/android/icons/minimap_btn.svg
  44. 0 {build → }/android/icons/noclip_btn.svg
  45. 0 {build → }/android/icons/rangeview_btn.svg
  46. 0 {build → }/android/icons/rare_controls.svg
  47. 0 {build → }/android/icons/zoom.svg
  48. BIN {build → }/android/keystore-minetest.jks
  49. +7 −2 {build → }/android/native/build.gradle
  50. +219 −0 android/native/jni/Android.mk
  51. 0 {build → }/android/native/jni/Application.mk
  52. 0 {build → }/android/native/src/main/AndroidManifest.xml
  53. 0 {build → }/android/settings.gradle
  54. +0 −82 build/android/app/src/main/java/net/minetest/minetest/CopyZipTask.java
  55. +0 −157 build/android/app/src/main/java/net/minetest/minetest/UnzipService.java
  56. +0 −219 build/android/native/jni/Android.mk
  57. +1 −1 doc/README.android
  58. +1 −1 misc/net.minetest.minetest.appdata.xml
  59. +5 −4 src/client/clientmap.cpp
  60. +1 −1 src/client/clouds.cpp
  61. +8 −8 src/client/hud.cpp
  62. +13 −13 src/client/sky.cpp
  63. +11 −11 src/client/sky.h
  64. +0 −1 src/clientiface.cpp
  65. +2 −2 src/gui/guiButtonItemImage.cpp
  66. +3 −3 src/gui/guiButtonItemImage.h
  67. +4 −3 src/inventory.cpp
  68. +38 −34 src/network/connection.cpp
  69. +16 −24 src/network/connection.h
  70. +22 −42 src/network/connectionthreads.cpp
  71. +3 −6 src/network/networkpacket.cpp
  72. +2 −1 src/network/networkpacket.h
  73. +2 −2 src/nodedef.cpp
  74. +1 −1 src/nodedef.h
  75. +7 −9 src/nodemetadata.cpp
  76. +1 −1 src/pathfinder.cpp
  77. +27 −39 src/porting_android.cpp
  78. +3 −2 src/settings.cpp
  79. +6 −6 src/unittest/test_connection.cpp
  80. +4 −5 src/util/areastore.cpp
  81. +17 −13 src/util/container.h
  82. +3 −7 src/util/enriched_string.cpp
  83. +21 −13 src/util/enriched_string.h
  84. +34 −0 src/util/pointer.h
  85. +6 −8 src/voxelalgorithms.cpp
  86. +1 −1 src/voxelalgorithms.h
  87. +10 −10 util/bump_version.sh
9 changes: 5 additions & 4 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
BasedOnStyle: LLVM
IndentWidth: 8
IndentWidth: 4
UseTab: Always
TabWidth: 4
BreakBeforeBraces: Custom
Standard: Cpp11
BraceWrapping:
Expand All @@ -16,7 +17,7 @@ BraceWrapping:
FixNamespaceComments: false
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AccessModifierOffset: -8
AccessModifierOffset: -4
ColumnLimit: 90
AllowShortFunctionsOnASingleLine: InlineOnly
SortIncludes: false
Expand All @@ -26,7 +27,7 @@ IncludeCategories:
- Regex: '^<.*'
Priority: 1
AlignAfterOpenBracket: DontAlign
ContinuationIndentWidth: 16
ConstructorInitializerIndentWidth: 16
ContinuationIndentWidth: 8
ConstructorInitializerIndentWidth: 8
BreakConstructorInitializers: AfterColon
AlwaysBreakTemplateDeclarations: Yes
10 changes: 5 additions & 5 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:
- 'lib/**.cpp'
- 'src/**.[ch]'
- 'src/**.cpp'
- 'build/android/**'
- 'android/**'
- '.github/workflows/android.yml'
pull_request:
paths:
- 'lib/**.[ch]'
- 'lib/**.cpp'
- 'src/**.[ch]'
- 'src/**.cpp'
- 'build/android/**'
- 'android/**'
- '.github/workflows/android.yml'

jobs:
Expand All @@ -29,14 +29,14 @@ jobs:
with:
java-version: 1.8
- name: Build with Gradle
run: cd build/android; ./gradlew assemblerelease
run: cd android; ./gradlew assemblerelease
- name: Save armeabi artifact
uses: actions/upload-artifact@v2
with:
name: Minetest-armeabi-v7a.apk
path: build/android/app/build/outputs/apk/release/app-armeabi-v7a-release-unsigned.apk
path: android/app/build/outputs/apk/release/app-armeabi-v7a-release-unsigned.apk
- name: Save arm64 artifact
uses: actions/upload-artifact@v2
with:
name: Minetest-arm64-v8a.apk
path: build/android/app/build/outputs/apk/release/app-arm64-v8a-release-unsigned.apk
path: android/app/build/outputs/apk/release/app-arm64-v8a-release-unsigned.apk
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ doc/mkdocs/docs/*.md
doc/mkdocs/mkdocs.yml

## Build files
build/
CMakeFiles
Makefile
cmake_install.cmake
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set(CLANG_MINIMUM_VERSION "3.4")
# Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing
set(VERSION_MAJOR 5)
set(VERSION_MINOR 4)
set(VERSION_PATCH 1)
set(VERSION_PATCH 2)
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")

# Change to false for releases
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ android {

task prepareAssets() {
def assetsFolder = "build/assets"
def projRoot = "../../.."
def projRoot = "../.."
def gameToCopy = "minetest_game"

copy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
android:label="@string/label"
android:requestLegacyExternalStorage="true"
android:resizeableActivity="false"
android:hasFragileUserData="true"
android:isGame="true"
tools:ignore="UnusedAttribute">

<meta-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,12 @@ public void openURI(String uri) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(browserIntent);
}

public String getUserDataPath() {
return Utils.getUserDataDirectory(this).getAbsolutePath();
}

public String getCachePath() {
return Utils.getCacheDirectory(this).getAbsolutePath();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
Expand All @@ -43,11 +45,7 @@
import java.util.Arrays;
import java.util.List;

import static net.minetest.minetest.UnzipService.ACTION_FAILURE;
import static net.minetest.minetest.UnzipService.ACTION_PROGRESS;
import static net.minetest.minetest.UnzipService.ACTION_UPDATE;
import static net.minetest.minetest.UnzipService.FAILURE;
import static net.minetest.minetest.UnzipService.SUCCESS;
import static net.minetest.minetest.UnzipService.*;

public class MainActivity extends AppCompatActivity {
private final static int versionCode = BuildConfig.VERSION_CODE;
Expand All @@ -56,26 +54,40 @@ public class MainActivity extends AppCompatActivity {
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
private static final String SETTINGS = "MinetestSettings";
private static final String TAG_VERSION_CODE = "versionCode";

private ProgressBar mProgressBar;
private TextView mTextView;
private SharedPreferences sharedPreferences;

private final BroadcastReceiver myReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
int progress = 0;
if (intent != null)
@StringRes int message = 0;
if (intent != null) {
progress = intent.getIntExtra(ACTION_PROGRESS, 0);
if (progress >= 0) {
message = intent.getIntExtra(ACTION_PROGRESS_MESSAGE, 0);
}

if (progress == FAILURE) {
Toast.makeText(MainActivity.this, intent.getStringExtra(ACTION_FAILURE), Toast.LENGTH_LONG).show();
finish();
} else if (progress == SUCCESS) {
startNative();
} else {
if (mProgressBar != null) {
mProgressBar.setVisibility(View.VISIBLE);
mProgressBar.setProgress(progress);
if (progress == INDETERMINATE) {
mProgressBar.setIndeterminate(true);
} else {
mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(progress);
}
}
mTextView.setVisibility(View.VISIBLE);
} else if (progress == FAILURE) {
Toast.makeText(MainActivity.this, intent.getStringExtra(ACTION_FAILURE), Toast.LENGTH_LONG).show();
finish();
} else if (progress == SUCCESS)
startNative();
if (message != 0)
mTextView.setText(message);
}
}
};

Expand All @@ -88,6 +100,7 @@ public void onCreate(Bundle savedInstanceState) {
mProgressBar = findViewById(R.id.progressBar);
mTextView = findViewById(R.id.textView);
sharedPreferences = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
checkPermission();
else
Expand Down Expand Up @@ -120,17 +133,35 @@ public void onRequestPermissionsResult(int requestCode,
if (grantResult != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, R.string.not_granted, Toast.LENGTH_LONG).show();
finish();
return;
}
}
checkAppVersion();
}
}

private void checkAppVersion() {
if (sharedPreferences.getInt(TAG_VERSION_CODE, 0) == versionCode)
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
Toast.makeText(this, R.string.no_external_storage, Toast.LENGTH_LONG).show();
finish();
return;
}

if (UnzipService.getIsRunning()) {
mProgressBar.setVisibility(View.VISIBLE);
mProgressBar.setIndeterminate(true);
mTextView.setVisibility(View.VISIBLE);
} else if (sharedPreferences.getInt(TAG_VERSION_CODE, 0) == versionCode &&
Utils.isInstallValid(this)) {
startNative();
else
new CopyZipTask(this).execute(getCacheDir() + "/Minetest.zip");
} else {
mProgressBar.setVisibility(View.VISIBLE);
mProgressBar.setIndeterminate(true);
mTextView.setVisibility(View.VISIBLE);

Intent intent = new Intent(this, UnzipService.class);
startService(intent);
}
}

private void startNative() {
Expand Down
Loading