diff --git a/Android/app/build.gradle b/Android/app/build.gradle index d33816d36..a977d0ee9 100644 --- a/Android/app/build.gradle +++ b/Android/app/build.gradle @@ -2,13 +2,13 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 33 - buildToolsVersion '33.0.2' + compileSdkVersion 34 + buildToolsVersion '34.0.0' ndkVersion '25.2.9519653' defaultConfig { applicationId 'com.multicraft.game' minSdkVersion 21 - targetSdkVersion 33 + targetSdkVersion 34 versionName "${versionMajor}.${versionMinor}.${versionPatch}" versionCode project.versionCode } @@ -100,7 +100,7 @@ tasks.register('prepareAssetsFiles') { tasks.register('zipAssetsFiles', Zip) { dependsOn prepareAssetsFiles archiveFileName = 'assets.zip' - destinationDirectory = file('src/main/assets/data') + destinationDirectory = file('src/main/assets') from('build/assets/Files') } @@ -125,7 +125,8 @@ dependencies { /* Third-party libraries */ implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.appcompat:appcompat-resources:1.6.1' + implementation("androidx.browser:browser:1.6.0") implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2' implementation 'androidx.work:work-runtime-ktx:2.8.1' - implementation 'com.google.android.material:material:1.9.0' + implementation 'com.google.android.material:material:1.10.0' } diff --git a/Android/app/src/main/AndroidManifest.xml b/Android/app/src/main/AndroidManifest.xml index 7e743f503..028143246 100644 --- a/Android/app/src/main/AndroidManifest.xml +++ b/Android/app/src/main/AndroidManifest.xml @@ -28,7 +28,6 @@ + + + diff --git a/Android/app/src/main/java/com/multicraft/game/CustomEditText.kt b/Android/app/src/main/java/com/multicraft/game/CustomEditText.kt index c924a63c8..baf240b64 100644 --- a/Android/app/src/main/java/com/multicraft/game/CustomEditText.kt +++ b/Android/app/src/main/java/com/multicraft/game/CustomEditText.kt @@ -1,7 +1,7 @@ /* MultiCraft -Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik -Copyright (C) 2014-2022 ubulem, Bektur Mambetov +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/Android/app/src/main/java/com/multicraft/game/GameActivity.kt b/Android/app/src/main/java/com/multicraft/game/GameActivity.kt index 371783a38..1118fcce3 100644 --- a/Android/app/src/main/java/com/multicraft/game/GameActivity.kt +++ b/Android/app/src/main/java/com/multicraft/game/GameActivity.kt @@ -1,7 +1,7 @@ /* MultiCraft -Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik -Copyright (C) 2014-2022 ubulem, Bektur Mambetov +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -20,11 +20,9 @@ with this program; if not, write to the Free Software Foundation, Inc., package com.multicraft.game -import android.content.Intent import android.content.res.Configuration -import android.content.res.Configuration.HARDKEYBOARDHIDDEN_NO import android.net.Uri -import android.os.Bundle +import android.os.* import android.text.InputType import android.view.* import android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN @@ -33,12 +31,15 @@ import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager import android.widget.TextView import androidx.appcompat.app.AlertDialog +import androidx.browser.customtabs.CustomTabsIntent +import androidx.browser.customtabs.CustomTabsIntent.SHARE_STATE_OFF import com.multicraft.game.MainActivity.Companion.radius -import com.multicraft.game.databinding.InputTextBinding -import com.multicraft.game.databinding.MultilineInputBinding +import com.multicraft.game.databinding.* import com.multicraft.game.helpers.* import com.multicraft.game.helpers.ApiLevelHelper.isOreo import org.libsdl.app.SDLActivity +import java.util.* +import kotlin.system.exitProcess class GameActivity : SDLActivity() { companion object { @@ -54,21 +55,21 @@ class GameActivity : SDLActivity() { private var messageReturnValue = "" private var hasKeyboard = false + override fun getLibraries() = arrayOf("MultiCraft") - override fun getLibraries(): Array { - return arrayOf( - "MultiCraft" - ) - } - - override fun getMainSharedObject(): String { - return getContext().applicationInfo.nativeLibraryDir + "/libMultiCraft.so" - } + override fun getMainSharedObject() = + "${getContext().applicationInfo.nativeLibraryDir}/libMultiCraft.so" override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) + try { + super.onCreate(savedInstanceState) + } catch (e: Error) { + exitProcess(0) + } catch (e: Exception) { + exitProcess(0) + } window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) - hasKeyboard = resources.configuration.hardKeyboardHidden == HARDKEYBOARDHIDDEN_NO + hasKeyboard = hasHardKeyboard() } override fun onWindowFocusChanged(hasFocus: Boolean) { @@ -88,15 +89,13 @@ class GameActivity : SDLActivity() { override fun onResume() { super.onResume() - if (hasKeyboard) - keyboardEvent(hasKeyboard) + if (hasKeyboard) keyboardEvent(true) window.makeFullScreen() } override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) - val statusKeyboard = - resources.configuration.hardKeyboardHidden == HARDKEYBOARDHIDDEN_NO + val statusKeyboard = hasHardKeyboard() if (hasKeyboard != statusKeyboard) { hasKeyboard = statusKeyboard keyboardEvent(hasKeyboard) @@ -137,8 +136,8 @@ class GameActivity : SDLActivity() { editText.inputType = inputType editText.setSelection(editText.text?.length ?: 0) // for Android OS - editText.setOnEditorActionListener { _: TextView?, KeyCode: Int, _: KeyEvent? -> - if (KeyCode == KeyEvent.KEYCODE_ENTER || KeyCode == KeyEvent.KEYCODE_ENDCALL) { + editText.setOnEditorActionListener { _: TextView?, keyCode: Int, _: KeyEvent? -> + if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_ENDCALL) { imm.hideSoftInputFromWindow(editText.windowToken, 0) messageReturnValue = editText.text.toString() alertDialog.dismiss() @@ -147,16 +146,17 @@ class GameActivity : SDLActivity() { } return@setOnEditorActionListener false } - // for Chrome OS - editText.setOnKeyListener { _: View?, KeyCode: Int, _: KeyEvent? -> - if (KeyCode == KeyEvent.KEYCODE_ENTER || KeyCode == KeyEvent.KEYCODE_ENDCALL) { - imm.hideSoftInputFromWindow(editText.windowToken, 0) - messageReturnValue = editText.text.toString() - alertDialog.dismiss() - isInputActive = false - return@setOnKeyListener true + if (isChromebook()) { + editText.setOnKeyListener { _: View?, keyCode: Int, _: KeyEvent? -> + if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_ENDCALL) { + imm.hideSoftInputFromWindow(editText.windowToken, 0) + messageReturnValue = editText.text.toString() + alertDialog.dismiss() + isInputActive = false + return@setOnKeyListener true + } + return@setOnKeyListener false } - return@setOnKeyListener false } binding.input.setEndIconOnClickListener { imm.hideSoftInputFromWindow(editText.windowToken, 0) @@ -174,7 +174,7 @@ class GameActivity : SDLActivity() { // should be above `show()` alertWindow.setSoftInputMode(SOFT_INPUT_STATE_VISIBLE) alertDialog.show() - if (!resources.getBoolean(R.bool.isTablet)) + if (!isTablet()) alertWindow.makeFullScreenAlert() alertDialog.setOnCancelListener { window.setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_HIDDEN) @@ -200,8 +200,8 @@ class GameActivity : SDLActivity() { editText.setSelection(editText.text?.length ?: 0) val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager // for Android OS - editText.setOnEditorActionListener { _: TextView?, KeyCode: Int, _: KeyEvent? -> - if (KeyCode == KeyEvent.KEYCODE_ENTER || KeyCode == KeyEvent.KEYCODE_ENDCALL) { + editText.setOnEditorActionListener { _: TextView?, keyCode: Int, _: KeyEvent? -> + if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_ENDCALL) { imm.hideSoftInputFromWindow(editText.windowToken, 0) messageReturnValue = editText.text.toString() alertDialog.dismiss() @@ -210,16 +210,17 @@ class GameActivity : SDLActivity() { } return@setOnEditorActionListener false } - // for Chrome OS - editText.setOnKeyListener { _: View?, KeyCode: Int, _: KeyEvent? -> - if (KeyCode == KeyEvent.KEYCODE_ENTER || KeyCode == KeyEvent.KEYCODE_ENDCALL) { - imm.hideSoftInputFromWindow(editText.windowToken, 0) - messageReturnValue = editText.text.toString() - alertDialog.dismiss() - isInputActive = false - return@setOnKeyListener true + if (isChromebook()) { + editText.setOnKeyListener { _: View?, keyCode: Int, _: KeyEvent? -> + if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_ENDCALL) { + imm.hideSoftInputFromWindow(editText.windowToken, 0) + messageReturnValue = editText.text.toString() + alertDialog.dismiss() + isInputActive = false + return@setOnKeyListener true + } + return@setOnKeyListener false } - return@setOnKeyListener false } binding.multiInput.setEndIconOnClickListener { imm.hideSoftInputFromWindow(editText.windowToken, 0) @@ -237,7 +238,7 @@ class GameActivity : SDLActivity() { val alertWindow = alertDialog.window!! alertWindow.setSoftInputMode(SOFT_INPUT_STATE_VISIBLE) alertDialog.show() - if (!resources.getBoolean(R.bool.isTablet)) + if (!isTablet()) alertWindow.makeFullScreenAlert() alertDialog.setOnCancelListener { window.setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_HIDDEN) @@ -270,9 +271,13 @@ class GameActivity : SDLActivity() { @Suppress("unused") fun openURI(uri: String?) { + val builder = CustomTabsIntent.Builder() + builder.setShareState(SHARE_STATE_OFF) + .setStartAnimations(this, R.anim.slide_in_bottom, R.anim.slide_out_top) + .setExitAnimations(this, R.anim.slide_in_top, R.anim.slide_out_bottom) + val customTabsIntent = builder.build() try { - val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(uri)) - startActivity(browserIntent) + customTabsIntent.launchUrl(this, Uri.parse(uri)) } catch (ignored: Exception) { } } @@ -292,7 +297,7 @@ class GameActivity : SDLActivity() { @Suppress("unused") fun getSecretKey(key: String): String { - return "Stub" + return key } @Suppress("unused") diff --git a/Android/app/src/main/java/com/multicraft/game/MainActivity.kt b/Android/app/src/main/java/com/multicraft/game/MainActivity.kt index 3845ddb14..419d54fa1 100644 --- a/Android/app/src/main/java/com/multicraft/game/MainActivity.kt +++ b/Android/app/src/main/java/com/multicraft/game/MainActivity.kt @@ -1,7 +1,7 @@ /* MultiCraft -Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik -Copyright (C) 2014-2022 ubulem, Bektur Mambetov +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -22,18 +22,25 @@ package com.multicraft.game import android.content.Intent import android.content.SharedPreferences -import android.graphics.Color -import android.graphics.drawable.LayerDrawable +import android.graphics.drawable.AnimationDrawable import android.os.Bundle -import android.view.* +import android.provider.Settings.ACTION_WIFI_SETTINGS +import android.provider.Settings.ACTION_WIRELESS_SETTINGS +import android.view.RoundedCorner +import android.view.WindowManager +import androidx.activity.OnBackPressedCallback +import androidx.activity.result.ActivityResultLauncher +import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity -import androidx.core.graphics.BlendModeColorFilterCompat -import androidx.core.graphics.BlendModeCompat -import androidx.lifecycle.* +import androidx.lifecycle.Observer +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.lifecycleScope import androidx.work.WorkInfo import com.multicraft.game.databinding.ActivityMainBinding +import com.multicraft.game.dialogs.ConnectionDialog import com.multicraft.game.helpers.* import com.multicraft.game.helpers.ApiLevelHelper.isAndroid12 +import com.multicraft.game.helpers.ApiLevelHelper.isPie import com.multicraft.game.helpers.PreferenceHelper.TAG_BUILD_VER import com.multicraft.game.helpers.PreferenceHelper.getStringValue import com.multicraft.game.helpers.PreferenceHelper.set @@ -49,11 +56,14 @@ class MainActivity : AppCompatActivity() { private var externalStorage: File? = null private val sep = File.separator private lateinit var prefs: SharedPreferences + private lateinit var restartStartForResult: ActivityResultLauncher + private lateinit var connStartForResult: ActivityResultLauncher private val versionCode = BuildConfig.VERSION_CODE private val versionName = "${BuildConfig.VERSION_NAME}+$versionCode" companion object { var radius = 0 + const val NO_SPACE_LEFT = "ENOSPC" } override fun onCreate(savedInstanceState: Bundle?) { @@ -61,30 +71,34 @@ class MainActivity : AppCompatActivity() { window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) + onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) { + override fun handleOnBackPressed() { + } + }) + connStartForResult = registerForActivityResult( + ActivityResultContracts.StartActivityForResult() + ) { + checkAppVersion() + } + restartStartForResult = registerForActivityResult( + ActivityResultContracts.StartActivityForResult() + ) { + if (it.resultCode == RESULT_OK) + finishApp(true) + else + finishApp(false) + } try { prefs = PreferenceHelper.init(this) externalStorage = getExternalFilesDir(null) - if (filesDir == null || cacheDir == null || externalStorage == null) - throw IOException("Bad disk space state") + listOf(filesDir, cacheDir, externalStorage).requireNoNulls() checkConnection() - } catch (e: Exception) { // Storage -> IOException, Prefs -> GeneralSecurityException - showRestartDialog(!e.message!!.contains("ENOPSC")) + } catch (e: Exception) { + val isRestart = e.message?.contains(NO_SPACE_LEFT) != true + showRestartDialog(restartStartForResult, isRestart) } } - @Deprecated("Deprecated in Java") - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - @Suppress("DEPRECATION") - super.onActivityResult(requestCode, resultCode, data) - if (requestCode == 104) - checkAppVersion() - } - - @Deprecated("Deprecated in Java") - override fun onBackPressed() { - // Prevent abrupt interruption when copy game files from assets - } - override fun onResume() { super.onResume() window.makeFullScreen() @@ -97,81 +111,66 @@ class MainActivity : AppCompatActivity() { override fun onAttachedToWindow() { super.onAttachedToWindow() - if (isAndroid12()) { - val insets = window.decorView.rootWindowInsets - if (insets != null) { - val tl = insets.getRoundedCorner(RoundedCorner.POSITION_TOP_LEFT) - radius = tl?.radius ?: 0 + if (isPie()) { + val cutout = window.decorView.rootWindowInsets.displayCutout + if (cutout != null) { + radius = 40 + } + if (isAndroid12()) { + val insets = window.decorView.rootWindowInsets + if (insets != null) { + val tl = insets.getRoundedCorner(RoundedCorner.POSITION_TOP_LEFT) + radius = tl?.radius ?: if (cutout != null) 40 else 0 + } } } - } - - - // interface - private fun showProgress(textMessage: Int, progress: Int) { - if (binding.progressBar.visibility == View.GONE) { - binding.tvProgress.setText(textMessage) - binding.progressCircle.visibility = View.GONE - binding.progressBar.visibility = View.VISIBLE - binding.progressBar.progress = 0 - } else if (progress > 0) { - val progressMessage = "${getString(textMessage)} $progress%" - binding.tvProgress.text = progressMessage - binding.progressBar.progress = progress - // colorize the progress bar - val progressBarDrawable = - (binding.progressBar.progressDrawable as LayerDrawable).getDrawable(0) - val progressDrawable = (progressBarDrawable as LayerDrawable).getDrawable(1) - val color = Color.rgb(255 - progress * 2, progress * 2, 25) - progressDrawable.colorFilter = - BlendModeColorFilterCompat.createBlendModeColorFilterCompat( - color, BlendModeCompat.SRC_IN - ) - } + val animation = binding.loadingAnim.drawable as AnimationDrawable + animation.start() } private fun startNative() { val initLua = File(filesDir, "builtin${sep}mainmenu${sep}init.lua") if (initLua.exists() && initLua.canRead()) { val intent = Intent(this, GameActivity::class.java) - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) startActivity(intent) } else { prefs[TAG_BUILD_VER] = "0" - showRestartDialog() + showRestartDialog(restartStartForResult) } } private fun prepareToRun() { - binding.tvProgress.setText(R.string.preparing) - binding.progressCircle.visibility = View.VISIBLE - binding.progressBar.visibility = View.GONE - val filesList = listOf( - File(externalStorage, "debug.txt"), - File(filesDir, "builtin"), - File(filesDir, "client"), - File(filesDir, "fonts"), - File(filesDir, "textures") - ) - val zips = assets.list("data")!!.toList() + val filesList = mutableListOf().apply { + addAll(listOf( + "builtin", + "client${sep}shaders", + "fonts", + "games${sep}default", + "textures${sep}base" + ).map { File(filesDir, it) }) + } + + val zips = mutableListOf("assets.zip") + lifecycleScope.launch { filesList.forEach { it.deleteRecursively() } zips.forEach { try { - assets.open("data$sep$it").use { input -> + assets.open(it).use { input -> File(cacheDir, it).copyInputStreamToFile(input) } } catch (e: IOException) { - runOnUiThread { showRestartDialog(!e.message!!.contains("ENOSPC")) } + val isNotEnoughSpace = e.message!!.contains(NO_SPACE_LEFT) + runOnUiThread { showRestartDialog(restartStartForResult, !isNotEnoughSpace) } return@forEach } } try { - startUnzipWorker(zips) + startUnzipWorker(zips.toTypedArray()) } catch (e: Exception) { - runOnUiThread { showRestartDialog() } + runOnUiThread { showRestartDialog(restartStartForResult) } } } } @@ -184,31 +183,47 @@ class MainActivity : AppCompatActivity() { prepareToRun() } + private fun showConnectionDialog() { + val intent = Intent(this, ConnectionDialog::class.java) + val startForResult = registerForActivityResult( + ActivityResultContracts.StartActivityForResult() + ) { + when (it.resultCode) { + RESULT_OK -> connStartForResult.launch(Intent(ACTION_WIFI_SETTINGS)) + RESULT_FIRST_USER -> connStartForResult.launch(Intent(ACTION_WIRELESS_SETTINGS)) + else -> checkAppVersion() + } + } + startForResult.launch(intent) + } + // check connection available private fun checkConnection() = lifecycleScope.launch { - val result = isConnected() - if (result) checkAppVersion() + if (isConnected()) checkAppVersion() else try { - showConnectionDialog { checkAppVersion() } + showConnectionDialog() } catch (e: Exception) { checkAppVersion() } } - private fun startUnzipWorker(file: List) { - val viewModelFactory = WorkerViewModelFactory(application, file.toTypedArray()) + private fun startUnzipWorker(file: Array) { + val viewModelFactory = WorkerViewModelFactory(application, file) val viewModel = ViewModelProvider(this, viewModelFactory)[WorkerViewModel::class.java] viewModel.unzippingWorkObserver .observe(this, Observer { workInfo -> if (workInfo == null) return@Observer val progress = workInfo.progress.getInt(PROGRESS, 0) - showProgress(R.string.loading, progress) + if (progress > 0) { + val progressMessage = "${getString(R.string.loading)} $progress%" + binding.tvProgress.text = progressMessage + } if (workInfo.state.isFinished) { if (workInfo.state == WorkInfo.State.FAILED) { val isRestart = workInfo.outputData.getBoolean("restart", true) - showRestartDialog(isRestart) + showRestartDialog(restartStartForResult, isRestart) } else if (workInfo.state == WorkInfo.State.SUCCEEDED) { prefs[TAG_BUILD_VER] = versionName startNative() diff --git a/Android/app/src/main/java/com/multicraft/game/dialogs/ConnectionDialog.kt b/Android/app/src/main/java/com/multicraft/game/dialogs/ConnectionDialog.kt new file mode 100644 index 000000000..35bd8257b --- /dev/null +++ b/Android/app/src/main/java/com/multicraft/game/dialogs/ConnectionDialog.kt @@ -0,0 +1,96 @@ +/* +MultiCraft +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3.0 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +package com.multicraft.game.dialogs + +import android.app.Activity +import android.content.Context +import android.content.res.Configuration +import android.os.Bundle +import android.telephony.TelephonyManager +import android.telephony.TelephonyManager.SIM_STATE_READY +import android.view.View +import android.widget.LinearLayout +import androidx.activity.OnBackPressedCallback +import androidx.appcompat.app.AppCompatActivity +import com.multicraft.game.databinding.ConnectionDialogBinding +import com.multicraft.game.helpers.ApiLevelHelper.isOreo +import com.multicraft.game.helpers.makeFullScreen +import org.libsdl.app.SDLActivity + +class ConnectionDialog : AppCompatActivity() { + private fun isSimCardPresent(): Boolean { + val telephonyManager = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager + + if (!isOreo()) + return telephonyManager.simState == SIM_STATE_READY + + val isFirstSimPresent = telephonyManager.getSimState(0) == SIM_STATE_READY + val isSecondSimPresent = telephonyManager.getSimState(1) == SIM_STATE_READY + + return isFirstSimPresent || isSecondSimPresent + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val binding = ConnectionDialogBinding.inflate(layoutInflater) + if (SDLActivity.isTablet()) { + val param = LinearLayout.LayoutParams( + 0, + LinearLayout.LayoutParams.WRAP_CONTENT, + 0.5f + ) + binding.connRoot.layoutParams = param + } + if (isSimCardPresent()) + binding.mobile.visibility = View.VISIBLE + setContentView(binding.root) + + onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) { + override fun handleOnBackPressed() { + } + }) + + binding.wifi.setOnClickListener { + setResult(Activity.RESULT_OK) + finish() + } + binding.mobile.setOnClickListener { + setResult(Activity.RESULT_FIRST_USER) + finish() + } + binding.ignore.setOnClickListener { + setResult(Activity.RESULT_CANCELED) + finish() + } + } + + override fun onResume() { + super.onResume() + window.makeFullScreen() + } + + override fun attachBaseContext(base: Context?) { + val configuration = Configuration(base?.resources?.configuration) + configuration.fontScale = 1.0f + applyOverrideConfiguration(configuration) + super.attachBaseContext(base) + } +} diff --git a/Android/app/src/main/java/com/multicraft/game/dialogs/RestartDialog.kt b/Android/app/src/main/java/com/multicraft/game/dialogs/RestartDialog.kt new file mode 100644 index 000000000..733fd6a74 --- /dev/null +++ b/Android/app/src/main/java/com/multicraft/game/dialogs/RestartDialog.kt @@ -0,0 +1,76 @@ +/* +MultiCraft +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3.0 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +package com.multicraft.game.dialogs + +import android.app.Activity +import android.content.Context +import android.content.res.Configuration +import android.os.Bundle +import android.widget.LinearLayout +import androidx.activity.OnBackPressedCallback +import androidx.appcompat.app.AppCompatActivity +import com.multicraft.game.databinding.RestartDialogBinding +import com.multicraft.game.helpers.makeFullScreen +import org.libsdl.app.SDLActivity + +class RestartDialog : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val binding = RestartDialogBinding.inflate(layoutInflater) + if (SDLActivity.isTablet()) { + val param = LinearLayout.LayoutParams( + 0, + LinearLayout.LayoutParams.WRAP_CONTENT, + 0.5f + ) + binding.restartRoot.layoutParams = param + } + setContentView(binding.root) + + onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) { + override fun handleOnBackPressed() { + } + }) + + val message = intent.getStringExtra("message")!! + binding.errorDesc.text = message + binding.restart.setOnClickListener { + setResult(Activity.RESULT_OK) + finish() + } + binding.close.setOnClickListener { + setResult(Activity.RESULT_CANCELED) + finish() + } + } + + override fun onResume() { + super.onResume() + window.makeFullScreen() + } + + override fun attachBaseContext(base: Context?) { + val configuration = Configuration(base?.resources?.configuration) + configuration.fontScale = 1.0f + applyOverrideConfiguration(configuration) + super.attachBaseContext(base) + } +} diff --git a/Android/app/src/main/java/com/multicraft/game/helpers/ApiLevelHelper.kt b/Android/app/src/main/java/com/multicraft/game/helpers/ApiLevelHelper.kt index 10110b846..380760dd7 100644 --- a/Android/app/src/main/java/com/multicraft/game/helpers/ApiLevelHelper.kt +++ b/Android/app/src/main/java/com/multicraft/game/helpers/ApiLevelHelper.kt @@ -1,7 +1,7 @@ /* MultiCraft -Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik -Copyright (C) 2014-2022 ubulem, Bektur Mambetov +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -30,5 +30,7 @@ object ApiLevelHelper { fun isOreo() = isGreaterOrEqual(O) + fun isPie() = isGreaterOrEqual(P) + fun isAndroid12() = isGreaterOrEqual(S) } diff --git a/Android/app/src/main/java/com/multicraft/game/helpers/PreferenceHelper.kt b/Android/app/src/main/java/com/multicraft/game/helpers/PreferenceHelper.kt index 8080789af..11626b39f 100644 --- a/Android/app/src/main/java/com/multicraft/game/helpers/PreferenceHelper.kt +++ b/Android/app/src/main/java/com/multicraft/game/helpers/PreferenceHelper.kt @@ -1,7 +1,7 @@ /* MultiCraft -Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik -Copyright (C) 2014-2022 ubulem, Bektur Mambetov +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/Android/app/src/main/java/com/multicraft/game/helpers/UsefulExtensions.kt b/Android/app/src/main/java/com/multicraft/game/helpers/UsefulExtensions.kt index 966541f2b..a4f0a79aa 100644 --- a/Android/app/src/main/java/com/multicraft/game/helpers/UsefulExtensions.kt +++ b/Android/app/src/main/java/com/multicraft/game/helpers/UsefulExtensions.kt @@ -1,7 +1,7 @@ /* MultiCraft -Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik -Copyright (C) 2014-2022 ubulem, Bektur Mambetov +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -23,31 +23,22 @@ package com.multicraft.game.helpers import android.app.* import android.content.Context import android.content.Intent -import android.content.pm.PackageManager -import android.net.ConnectivityManager -import android.net.NetworkCapabilities -import android.provider.Settings -import android.view.View +import android.content.res.Configuration +import android.net.* +import android.os.* import android.view.Window -import androidx.appcompat.app.AlertDialog +import androidx.activity.result.ActivityResultLauncher import androidx.appcompat.app.AppCompatActivity -import androidx.core.content.ContextCompat import androidx.core.view.* -import com.multicraft.game.R -import com.multicraft.game.databinding.ConnDialogBinding -import com.multicraft.game.databinding.RestartDialogBinding +import com.multicraft.game.* +import com.multicraft.game.databinding.* +import com.multicraft.game.dialogs.RestartDialog import com.multicraft.game.helpers.ApiLevelHelper.isAndroid12 -import java.io.File -import java.io.InputStream -import kotlin.system.exitProcess +import com.multicraft.game.helpers.ApiLevelHelper.isMarshmallow +import java.io.* +import java.util.* // Activity extensions -fun AppCompatActivity.getIcon() = try { - packageManager.getApplicationIcon(packageName) -} catch (e: PackageManager.NameNotFoundException) { - ContextCompat.getDrawable(this, R.mipmap.ic_launcher) -} - fun Activity.finishApp(restart: Boolean) { if (restart) { val intent = Intent(this, this::class.java) @@ -61,72 +52,12 @@ fun Activity.finishApp(restart: Boolean) { ) ) } - exitProcess(0) + finish() } -fun AppCompatActivity.defaultDialog(title: Int, view: View, style: Int = R.style.CustomDialog): AlertDialog { - val builder = AlertDialog.Builder(this, style) - .setIcon(getIcon()) - .setTitle(title) - .setCancelable(false) - .setView(view) - return builder.create() -} - -fun AppCompatActivity.headlessDialog( - view: View, - style: Int = R.style.LightTheme, - isCancelable: Boolean = false -): AlertDialog { - val builder = AlertDialog.Builder(this, style) - .setCancelable(isCancelable) - .setView(view) - return builder.create() -} - -fun AppCompatActivity.show(dialog: AlertDialog) { - window?.makeFullScreen() - if (!isFinishing) dialog.show() -} - -fun AppCompatActivity.showConnectionDialog(listener: (() -> Unit)? = null) { - val binding = ConnDialogBinding.inflate(layoutInflater) - val dialog = defaultDialog(R.string.conn_title, binding.root) - binding.wifi.setOnClickListener { - dialog.dismiss() - startActivityForResult( - Intent(Settings.ACTION_WIFI_SETTINGS), - 104 - ) - } - binding.mobile.setOnClickListener { - dialog.dismiss() - startActivityForResult( - Intent(Settings.ACTION_WIRELESS_SETTINGS), - 104 - ) - } - binding.ignore.setOnClickListener { - dialog.dismiss() - listener?.invoke() - } - show(dialog) -} - -fun AppCompatActivity.showRestartDialog(isRestart: Boolean = true) { - val message = - if (isRestart) getString(R.string.restart) else getString(R.string.no_space) - val binding = RestartDialogBinding.inflate(layoutInflater) - val dialog = headlessDialog(binding.root, R.style.CustomDialog) - binding.errorDesc.text = message - binding.close.setOnClickListener { finishApp(false) } - binding.restart.setOnClickListener { finishApp(true) } - show(dialog) -} - -fun AppCompatActivity.isConnected(): Boolean { +fun Activity.isConnected(): Boolean { val cm = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager - if (ApiLevelHelper.isMarshmallow()) { + if (isMarshmallow()) { val activeNetwork = cm.activeNetwork ?: return false val capabilities = cm.getNetworkCapabilities(activeNetwork) ?: return false return capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED) @@ -136,6 +67,20 @@ fun AppCompatActivity.isConnected(): Boolean { } } +fun AppCompatActivity.showRestartDialog( + startForResult: ActivityResultLauncher, + isRestart: Boolean = true +) { + val message = + if (isRestart) getString(R.string.restart) else getString(R.string.no_space) + val intent = Intent(this, RestartDialog::class.java) + intent.putExtra("message", message) + startForResult.launch(intent) +} + +fun Activity.hasHardKeyboard() = + resources.configuration.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO + // Other extensions fun File.copyInputStreamToFile(inputStream: InputStream) = outputStream().use { fileOut -> inputStream.copyTo(fileOut, 8192) } diff --git a/Android/app/src/main/java/com/multicraft/game/workmanager/UnzipWorker.kt b/Android/app/src/main/java/com/multicraft/game/workmanager/UnzipWorker.kt index b9d71100a..6fe878965 100644 --- a/Android/app/src/main/java/com/multicraft/game/workmanager/UnzipWorker.kt +++ b/Android/app/src/main/java/com/multicraft/game/workmanager/UnzipWorker.kt @@ -1,7 +1,7 @@ /* MultiCraft -Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik -Copyright (C) 2014-2022 ubulem, Bektur Mambetov +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -26,6 +26,7 @@ import android.content.Context import android.content.Context.NOTIFICATION_SERVICE import androidx.core.app.NotificationCompat import androidx.work.* +import com.multicraft.game.MainActivity.Companion.NO_SPACE_LEFT import com.multicraft.game.R import com.multicraft.game.helpers.ApiLevelHelper.isOreo import com.multicraft.game.helpers.copyInputStreamToFile @@ -83,7 +84,7 @@ class UnzipWorker(private val appContext: Context, workerParams: WorkerParameter } Result.success() } catch (e: IOException) { - val isNotEnoughSpace = e.localizedMessage!!.contains("ENOSPC") + val isNotEnoughSpace = e.localizedMessage!!.contains(NO_SPACE_LEFT) val out = Data.Builder() .putBoolean("restart", !isNotEnoughSpace) .build() diff --git a/Android/app/src/main/java/com/multicraft/game/workmanager/WorkerViewModel.kt b/Android/app/src/main/java/com/multicraft/game/workmanager/WorkerViewModel.kt index 2601e56fb..1362df6ff 100644 --- a/Android/app/src/main/java/com/multicraft/game/workmanager/WorkerViewModel.kt +++ b/Android/app/src/main/java/com/multicraft/game/workmanager/WorkerViewModel.kt @@ -1,7 +1,7 @@ /* MultiCraft -Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik -Copyright (C) 2014-2022 ubulem, Bektur Mambetov +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/Android/app/src/main/java/com/multicraft/game/workmanager/WorkerViewModelFactory.kt b/Android/app/src/main/java/com/multicraft/game/workmanager/WorkerViewModelFactory.kt index d47d44182..861c4076e 100644 --- a/Android/app/src/main/java/com/multicraft/game/workmanager/WorkerViewModelFactory.kt +++ b/Android/app/src/main/java/com/multicraft/game/workmanager/WorkerViewModelFactory.kt @@ -1,7 +1,7 @@ /* MultiCraft -Copyright (C) 2014-2022 MoNTE48, Maksim Gamarnik -Copyright (C) 2014-2022 ubulem, Bektur Mambetov +Copyright (C) 2014-2023 MoNTE48, Maksim Gamarnik +Copyright (C) 2014-2023 ubulem, Bektur Mambetov This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/Android/app/src/main/res/anim/slide_in_bottom.xml b/Android/app/src/main/res/anim/slide_in_bottom.xml new file mode 100644 index 000000000..7d71ec0dc --- /dev/null +++ b/Android/app/src/main/res/anim/slide_in_bottom.xml @@ -0,0 +1,5 @@ + + diff --git a/Android/app/src/main/res/anim/slide_in_top.xml b/Android/app/src/main/res/anim/slide_in_top.xml new file mode 100644 index 000000000..2590b13cb --- /dev/null +++ b/Android/app/src/main/res/anim/slide_in_top.xml @@ -0,0 +1,5 @@ + + diff --git a/Android/app/src/main/res/anim/slide_out_bottom.xml b/Android/app/src/main/res/anim/slide_out_bottom.xml new file mode 100644 index 000000000..ee271ddfd --- /dev/null +++ b/Android/app/src/main/res/anim/slide_out_bottom.xml @@ -0,0 +1,5 @@ + + diff --git a/Android/app/src/main/res/anim/slide_out_top.xml b/Android/app/src/main/res/anim/slide_out_top.xml new file mode 100644 index 000000000..139262fe4 --- /dev/null +++ b/Android/app/src/main/res/anim/slide_out_top.xml @@ -0,0 +1,5 @@ + + diff --git a/Android/app/src/main/res/drawable-night/bg_input.xml b/Android/app/src/main/res/drawable-night/bg_input.xml index afda4958d..1a72c7e0b 100644 --- a/Android/app/src/main/res/drawable-night/bg_input.xml +++ b/Android/app/src/main/res/drawable-night/bg_input.xml @@ -2,4 +2,7 @@ + diff --git a/Android/app/src/main/res/drawable/btn_green.xml b/Android/app/src/main/res/drawable/btn_green.xml new file mode 100644 index 000000000..da8f7ac66 --- /dev/null +++ b/Android/app/src/main/res/drawable/btn_green.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Android/app/src/main/res/drawable/btn_red.xml b/Android/app/src/main/res/drawable/btn_red.xml new file mode 100644 index 000000000..d617af9a2 --- /dev/null +++ b/Android/app/src/main/res/drawable/btn_red.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Android/app/src/main/res/drawable/btn_yellow.xml b/Android/app/src/main/res/drawable/btn_yellow.xml new file mode 100644 index 000000000..20509a2f6 --- /dev/null +++ b/Android/app/src/main/res/drawable/btn_yellow.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Android/app/src/main/res/drawable/custom_progress_bar.xml b/Android/app/src/main/res/drawable/custom_progress_bar.xml deleted file mode 100644 index 932804b67..000000000 --- a/Android/app/src/main/res/drawable/custom_progress_bar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/Android/app/src/main/res/drawable/green.9.png b/Android/app/src/main/res/drawable/green.9.png new file mode 100644 index 000000000..98c180602 Binary files /dev/null and b/Android/app/src/main/res/drawable/green.9.png differ diff --git a/Android/app/src/main/res/drawable/green_pressed.9.png b/Android/app/src/main/res/drawable/green_pressed.9.png new file mode 100644 index 000000000..42466f2b3 Binary files /dev/null and b/Android/app/src/main/res/drawable/green_pressed.9.png differ diff --git a/Android/app/src/main/res/drawable/ic_baseline_send.xml b/Android/app/src/main/res/drawable/ic_baseline_send.xml index 516b18892..a8a36dd94 100644 --- a/Android/app/src/main/res/drawable/ic_baseline_send.xml +++ b/Android/app/src/main/res/drawable/ic_baseline_send.xml @@ -6,6 +6,6 @@ android:viewportWidth="24" android:viewportHeight="24"> + android:fillColor="@color/green_mc" + android:pathData="M3.4,20.4l17.45,-7.48c0.81,-0.35 0.81,-1.49 0,-1.84L3.4,3.6c-0.66,-0.29 -1.39,0.2 -1.39,0.91L2,9.12c0,0.5 0.37,0.93 0.87,0.99L17,12 2.87,13.88c-0.5,0.07 -0.87,0.5 -0.87,1l0.01,4.61c0,0.71 0.73,1.2 1.39,0.91z" /> diff --git a/Android/app/src/main/res/drawable/loading.xml b/Android/app/src/main/res/drawable/loading.xml new file mode 100644 index 000000000..bc0d1d733 --- /dev/null +++ b/Android/app/src/main/res/drawable/loading.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/Android/app/src/main/res/drawable/loading_anim1.png b/Android/app/src/main/res/drawable/loading_anim1.png new file mode 100644 index 000000000..33a98fb7a Binary files /dev/null and b/Android/app/src/main/res/drawable/loading_anim1.png differ diff --git a/Android/app/src/main/res/drawable/loading_anim2.png b/Android/app/src/main/res/drawable/loading_anim2.png new file mode 100644 index 000000000..b67bf904c Binary files /dev/null and b/Android/app/src/main/res/drawable/loading_anim2.png differ diff --git a/Android/app/src/main/res/drawable/loading_anim3.png b/Android/app/src/main/res/drawable/loading_anim3.png new file mode 100644 index 000000000..7614239f8 Binary files /dev/null and b/Android/app/src/main/res/drawable/loading_anim3.png differ diff --git a/Android/app/src/main/res/drawable/loading_anim4.png b/Android/app/src/main/res/drawable/loading_anim4.png new file mode 100644 index 000000000..cb7ab685b Binary files /dev/null and b/Android/app/src/main/res/drawable/loading_anim4.png differ diff --git a/Android/app/src/main/res/drawable/loading_anim5.png b/Android/app/src/main/res/drawable/loading_anim5.png new file mode 100644 index 000000000..92d6e3cdf Binary files /dev/null and b/Android/app/src/main/res/drawable/loading_anim5.png differ diff --git a/Android/app/src/main/res/drawable/loading_anim6.png b/Android/app/src/main/res/drawable/loading_anim6.png new file mode 100644 index 000000000..e8cce7bb6 Binary files /dev/null and b/Android/app/src/main/res/drawable/loading_anim6.png differ diff --git a/Android/app/src/main/res/drawable/loading_anim7.png b/Android/app/src/main/res/drawable/loading_anim7.png new file mode 100644 index 000000000..afed436bc Binary files /dev/null and b/Android/app/src/main/res/drawable/loading_anim7.png differ diff --git a/Android/app/src/main/res/drawable/loading_anim8.png b/Android/app/src/main/res/drawable/loading_anim8.png new file mode 100644 index 000000000..081bdbc3a Binary files /dev/null and b/Android/app/src/main/res/drawable/loading_anim8.png differ diff --git a/Android/app/src/main/res/drawable/progress.xml b/Android/app/src/main/res/drawable/progress.xml deleted file mode 100644 index 935315178..000000000 --- a/Android/app/src/main/res/drawable/progress.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/Android/app/src/main/res/drawable/progress_bar.webp b/Android/app/src/main/res/drawable/progress_bar.webp deleted file mode 100644 index fa9667392..000000000 Binary files a/Android/app/src/main/res/drawable/progress_bar.webp and /dev/null differ diff --git a/Android/app/src/main/res/drawable/progress_bar_bg.webp b/Android/app/src/main/res/drawable/progress_bar_bg.webp deleted file mode 100644 index 7b77b3976..000000000 Binary files a/Android/app/src/main/res/drawable/progress_bar_bg.webp and /dev/null differ diff --git a/Android/app/src/main/res/drawable/progress_bar_fg.png b/Android/app/src/main/res/drawable/progress_bar_fg.png deleted file mode 100644 index 0f873f69a..000000000 Binary files a/Android/app/src/main/res/drawable/progress_bar_fg.png and /dev/null differ diff --git a/Android/app/src/main/res/drawable/red.9.png b/Android/app/src/main/res/drawable/red.9.png new file mode 100644 index 000000000..9de391cb2 Binary files /dev/null and b/Android/app/src/main/res/drawable/red.9.png differ diff --git a/Android/app/src/main/res/drawable/red_pressed.9.png b/Android/app/src/main/res/drawable/red_pressed.9.png new file mode 100644 index 000000000..f5a4a47b1 Binary files /dev/null and b/Android/app/src/main/res/drawable/red_pressed.9.png differ diff --git a/Android/app/src/main/res/drawable/yellow.9.png b/Android/app/src/main/res/drawable/yellow.9.png new file mode 100644 index 000000000..9419a8224 Binary files /dev/null and b/Android/app/src/main/res/drawable/yellow.9.png differ diff --git a/Android/app/src/main/res/drawable/yellow_pressed.9.png b/Android/app/src/main/res/drawable/yellow_pressed.9.png new file mode 100644 index 000000000..e3e3f76d5 Binary files /dev/null and b/Android/app/src/main/res/drawable/yellow_pressed.9.png differ diff --git a/Android/app/src/main/res/layout/activity_main.xml b/Android/app/src/main/res/layout/activity_main.xml index 020858e58..c9532e99c 100644 --- a/Android/app/src/main/res/layout/activity_main.xml +++ b/Android/app/src/main/res/layout/activity_main.xml @@ -1,34 +1,22 @@ - + android:layout_height="match_parent" + android:gravity="center" + android:orientation="vertical"> - - - + - - + android:textSize="16sp" /> + diff --git a/Android/app/src/main/res/layout/conn_dialog.xml b/Android/app/src/main/res/layout/conn_dialog.xml deleted file mode 100644 index f47376794..000000000 --- a/Android/app/src/main/res/layout/conn_dialog.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/Android/app/src/main/res/layout/connection_dialog.xml b/Android/app/src/main/res/layout/connection_dialog.xml new file mode 100644 index 000000000..8d825ccca --- /dev/null +++ b/Android/app/src/main/res/layout/connection_dialog.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + diff --git a/Android/app/src/main/res/layout/input_text.xml b/Android/app/src/main/res/layout/input_text.xml index 758ea6c5f..5d0867c81 100644 --- a/Android/app/src/main/res/layout/input_text.xml +++ b/Android/app/src/main/res/layout/input_text.xml @@ -6,16 +6,17 @@ + app:endIconTint="@null" + app:hintTextColor="@color/green_mc"> + app:endIconTint="@null" + app:hintTextColor="@color/green_mc"> - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:baselineAligned="false" + android:gravity="center" + android:weightSum="1"> + android:padding="16dp" + tools:ignore="UselessParent"> + android:textColor="@color/grey_900" /> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="8dp"> - + android:textColor="@color/grey_900" + android:textSize="16sp" /> + android:layout_height="wrap_content" + android:layout_marginTop="8dp"> - + android:textAllCaps="false" + android:textColor="@android:color/white" /> - + android:textAllCaps="false" + android:textColor="@android:color/white" /> - + diff --git a/Android/app/src/main/res/mipmap/ic_dialog.png b/Android/app/src/main/res/mipmap/ic_dialog.png new file mode 100644 index 000000000..12db56f1e Binary files /dev/null and b/Android/app/src/main/res/mipmap/ic_dialog.png differ diff --git a/Android/app/src/main/res/values-ru/strings.xml b/Android/app/src/main/res/values-ru/strings.xml index fe9d33799..b7227a59e 100644 --- a/Android/app/src/main/res/values-ru/strings.xml +++ b/Android/app/src/main/res/values-ru/strings.xml @@ -1,5 +1,6 @@ + Подготовка к запуску… Загрузка… Загрузка MultiCraft @@ -9,9 +10,8 @@ Нет Интернет Подключения! - Для полноценной игры, MultiCraft требует подключение к Интернету.\nВ противном случае вам будет недоступно Обновление игры и режим Мультиплеера! - 3G/4G - Игнорировать + Для полноценной игры, MultiCraft требует подключение к Интернету.\nВ противном случае Обновление игры и режим Мультиплеера будут недоступны! + Пропустить Нам очень жаль! diff --git a/Android/app/src/main/res/values-sw600dp/attrs.xml b/Android/app/src/main/res/values-sw600dp/attrs.xml deleted file mode 100644 index fccd39d6a..000000000 --- a/Android/app/src/main/res/values-sw600dp/attrs.xml +++ /dev/null @@ -1,3 +0,0 @@ - - true - diff --git a/Android/app/src/main/res/values-v26/styles.xml b/Android/app/src/main/res/values-v26/styles.xml new file mode 100644 index 000000000..8a2fe0338 --- /dev/null +++ b/Android/app/src/main/res/values-v26/styles.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/Android/app/src/main/res/values-v27/styles.xml b/Android/app/src/main/res/values-v27/styles.xml new file mode 100644 index 000000000..6e004ae79 --- /dev/null +++ b/Android/app/src/main/res/values-v27/styles.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/Android/app/src/main/res/values/attrs.xml b/Android/app/src/main/res/values/attrs.xml deleted file mode 100644 index 934d5c83d..000000000 --- a/Android/app/src/main/res/values/attrs.xml +++ /dev/null @@ -1,3 +0,0 @@ - - false - diff --git a/Android/app/src/main/res/values/colors.xml b/Android/app/src/main/res/values/colors.xml index a4deeb54d..1aaa212f8 100644 --- a/Android/app/src/main/res/values/colors.xml +++ b/Android/app/src/main/res/values/colors.xml @@ -1,8 +1,6 @@ - #008C80 #FAFAFA #121212 - #FF1744 #32783C #212121 diff --git a/Android/app/src/main/res/values/strings.xml b/Android/app/src/main/res/values/strings.xml index d14e0fa83..bc750c70a 100644 --- a/Android/app/src/main/res/values/strings.xml +++ b/Android/app/src/main/res/values/strings.xml @@ -1,11 +1,12 @@ MultiCraft - + Preparing to launch… Loading… Loading MultiCraft Less than 1 minute… + Enter text Enter password @@ -13,7 +14,7 @@ No Internet Connection! MultiCraft requires an Internet connection to use all game features.\nOtherwise, you will not get Updates and Multiplayer mode will be not available! Wi-Fi - Mobile Data + LTE Ignore diff --git a/Android/app/src/main/res/values/styles.xml b/Android/app/src/main/res/values/styles.xml index 0daff9289..eb01b5255 100644 --- a/Android/app/src/main/res/values/styles.xml +++ b/Android/app/src/main/res/values/styles.xml @@ -1,27 +1,25 @@ + - - - - + diff --git a/Android/native/build.gradle b/Android/native/build.gradle index 31a1e2a17..0fcb12e75 100644 --- a/Android/native/build.gradle +++ b/Android/native/build.gradle @@ -2,12 +2,12 @@ apply plugin: 'com.android.library' apply plugin: 'de.undercouch.download' android { - compileSdkVersion 33 - buildToolsVersion '33.0.2' + compileSdkVersion 34 + buildToolsVersion '34.0.0' ndkVersion '25.2.9519653' defaultConfig { minSdkVersion 21 - targetSdkVersion 33 + targetSdkVersion 34 externalNativeBuild { ndkBuild { arguments '-j' + Runtime.getRuntime().availableProcessors(),