diff --git a/build/android/app/src/main/AndroidManifest.xml b/build/android/app/src/main/AndroidManifest.xml
index 3634883f..1431cd02 100644
--- a/build/android/app/src/main/AndroidManifest.xml
+++ b/build/android/app/src/main/AndroidManifest.xml
@@ -1,78 +1,78 @@
+ xmlns:tools="http://schemas.android.com/tools"
+ package="com.multicraft.game"
+ android:installLocation="auto">
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
+
+
diff --git a/build/android/app/src/main/java/com/bugsnag/android/Bugsnag.java b/build/android/app/src/main/java/com/bugsnag/android/Bugsnag.java
index a8e2796b..698041ff 100644
--- a/build/android/app/src/main/java/com/bugsnag/android/Bugsnag.java
+++ b/build/android/app/src/main/java/com/bugsnag/android/Bugsnag.java
@@ -4,15 +4,15 @@ import android.app.Application;
import android.util.Log;
public class Bugsnag {
- public static void notify(Throwable e) {
- Log.getStackTraceString(e);
- }
+ public static void notify(Throwable e) {
+ Log.getStackTraceString(e);
+ }
- public static void leaveBreadcrumb(String s) {
- Log.d("Bugsnag", s);
- }
+ public static void leaveBreadcrumb(String s) {
+ Log.d("Bugsnag", s);
+ }
- public static void start(Application application) {
- Log.d("Bugsnag", "Bugsnag initialized");
- }
+ public static void start(Application application) {
+ Log.d("Bugsnag", "Bugsnag initialized");
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/AdManager.java b/build/android/app/src/main/java/com/multicraft/game/AdManager.java
index 8774c318..2564e6f4 100644
--- a/build/android/app/src/main/java/com/multicraft/game/AdManager.java
+++ b/build/android/app/src/main/java/com/multicraft/game/AdManager.java
@@ -24,19 +24,19 @@ import android.app.Activity;
class AdManager {
- static void initAd(final Activity activity, boolean consent) {
- // NDA code here
- }
+ static void initAd(final Activity activity, boolean consent) {
+ // NDA code here
+ }
- static void setAdsCallback(final Activity activity) {
- // NDA code here
- }
+ static void setAdsCallback(final Activity activity) {
+ // NDA code here
+ }
- static void startAd(final Activity activity, boolean isFirstTime, boolean isShowNow) {
- // NDA code here
- }
+ static void startAd(final Activity activity, boolean isFirstTime, boolean isShowNow) {
+ // NDA code here
+ }
- static void stopAd() {
- // NDA code here
- }
+ static void stopAd() {
+ // NDA code here
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/CustomEditText.java b/build/android/app/src/main/java/com/multicraft/game/CustomEditText.java
index c153f97b..03e9e827 100644
--- a/build/android/app/src/main/java/com/multicraft/game/CustomEditText.java
+++ b/build/android/app/src/main/java/com/multicraft/game/CustomEditText.java
@@ -27,17 +27,17 @@ import android.view.inputmethod.InputMethodManager;
import androidx.appcompat.widget.AppCompatEditText;
public class CustomEditText extends AppCompatEditText {
- public CustomEditText(Context context) {
- super(context);
- }
+ public CustomEditText(Context context) {
+ super(context);
+ }
- @Override
- public boolean onKeyPreIme(int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_BACK) {
- InputMethodManager mgr = (InputMethodManager)
- getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- mgr.hideSoftInputFromWindow(this.getWindowToken(), 0);
- }
- return false;
- }
+ @Override
+ public boolean onKeyPreIme(int keyCode, KeyEvent event) {
+ if (keyCode == KeyEvent.KEYCODE_BACK) {
+ InputMethodManager mgr = (InputMethodManager)
+ getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+ mgr.hideSoftInputFromWindow(this.getWindowToken(), 0);
+ }
+ return false;
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/GameActivity.java b/build/android/app/src/main/java/com/multicraft/game/GameActivity.java
index 96b6e29a..da124aeb 100644
--- a/build/android/app/src/main/java/com/multicraft/game/GameActivity.java
+++ b/build/android/app/src/main/java/com/multicraft/game/GameActivity.java
@@ -47,182 +47,181 @@ import static com.multicraft.game.AdManager.initAd;
import static com.multicraft.game.AdManager.setAdsCallback;
import static com.multicraft.game.AdManager.startAd;
import static com.multicraft.game.AdManager.stopAd;
-import static com.multicraft.game.helpers.PreferencesHelper.TAG_BUILD_NUMBER;
import static com.multicraft.game.helpers.PreferencesHelper.getInstance;
import static com.multicraft.game.helpers.Utilities.makeFullScreen;
public class GameActivity extends NativeActivity {
- static {
- try {
- System.loadLibrary("MultiCraft");
- } catch (UnsatisfiedLinkError | OutOfMemoryError e) {
- Bugsnag.notify(e);
- System.exit(0);
- } catch (IllegalArgumentException i) {
- Bugsnag.notify(i);
- System.exit(0);
- } catch (Error | Exception e) {
- Bugsnag.notify(e);
- System.exit(0);
- }
- }
+ static {
+ try {
+ System.loadLibrary("MultiCraft");
+ } catch (UnsatisfiedLinkError | OutOfMemoryError e) {
+ Bugsnag.notify(e);
+ System.exit(0);
+ } catch (IllegalArgumentException i) {
+ Bugsnag.notify(i);
+ System.exit(0);
+ } catch (Error | Exception e) {
+ Bugsnag.notify(e);
+ System.exit(0);
+ }
+ }
- private int messageReturnCode = -1;
- private String messageReturnValue = "";
- private int height, width;
- private boolean consent, isMultiPlayer;
- private PreferencesHelper pf;
- private Disposable adInitSub;
- private boolean hasKeyboard;
+ private int messageReturnCode = -1;
+ private String messageReturnValue = "";
+ private int height, width;
+ private boolean consent, isMultiPlayer;
+ private PreferencesHelper pf;
+ private Disposable adInitSub;
+ private boolean hasKeyboard;
- public static native void putMessageBoxResult(String text);
+ public static native void putMessageBoxResult(String text);
- public static native void pauseGame();
+ public static native void pauseGame();
- public static native void keyboardEvent(boolean keyboard);
+ public static native void keyboardEvent(boolean keyboard);
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Bundle bundle = getIntent().getExtras();
- Resources resources = getResources();
- height = bundle != null ? bundle.getInt("height", 0) : resources.getDisplayMetrics().heightPixels;
- width = bundle != null ? bundle.getInt("width", 0) : resources.getDisplayMetrics().widthPixels;
- consent = bundle == null || bundle.getBoolean("consent", true);
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- hasKeyboard = !(resources.getConfiguration().hardKeyboardHidden == KEYBOARD_QWERTY);
- keyboardEvent(hasKeyboard);
- pf = getInstance(this);
- if (pf.isAdsEnable()) {
- adInitSub = Completable.fromAction(() -> initAd(this, consent))
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(() -> setAdsCallback(this));
- }
- }
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Bundle bundle = getIntent().getExtras();
+ Resources resources = getResources();
+ height = bundle != null ? bundle.getInt("height", 0) : resources.getDisplayMetrics().heightPixels;
+ width = bundle != null ? bundle.getInt("width", 0) : resources.getDisplayMetrics().widthPixels;
+ consent = bundle == null || bundle.getBoolean("consent", true);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ hasKeyboard = !(resources.getConfiguration().hardKeyboardHidden == KEYBOARD_QWERTY);
+ keyboardEvent(hasKeyboard);
+ pf = getInstance(this);
+ if (pf.isAdsEnable()) {
+ adInitSub = Completable.fromAction(() -> initAd(this, consent))
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(() -> setAdsCallback(this));
+ }
+ }
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- super.onWindowFocusChanged(hasFocus);
- if (hasFocus)
- makeFullScreen(this);
- }
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+ if (hasFocus)
+ makeFullScreen(this);
+ }
- @Override
- protected void onResume() {
- super.onResume();
- makeFullScreen(this);
- }
+ @Override
+ protected void onResume() {
+ super.onResume();
+ makeFullScreen(this);
+ }
- @Override
- public void onBackPressed() {
- }
+ @Override
+ public void onBackPressed() {
+ }
- @Override
- protected void onDestroy() {
- super.onDestroy();
- adInitSub.dispose();
- }
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ adInitSub.dispose();
+ }
- public void showDialog(String acceptButton, String hint, String current, int editType) {
- runOnUiThread(() -> showDialogUI(hint, current, editType));
- }
+ public void showDialog(String acceptButton, String hint, String current, int editType) {
+ runOnUiThread(() -> showDialogUI(hint, current, editType));
+ }
- @Override
- protected void onPause() {
- super.onPause();
- pauseGame();
- }
+ @Override
+ protected void onPause() {
+ super.onPause();
+ pauseGame();
+ }
- @Override
- public void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- boolean statusKeyboard = !(getResources().getConfiguration().hardKeyboardHidden == KEYBOARD_QWERTY);
- if (hasKeyboard != statusKeyboard) {
- hasKeyboard = statusKeyboard;
- keyboardEvent(hasKeyboard);
- }
- }
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ boolean statusKeyboard = !(getResources().getConfiguration().hardKeyboardHidden == KEYBOARD_QWERTY);
+ if (hasKeyboard != statusKeyboard) {
+ hasKeyboard = statusKeyboard;
+ keyboardEvent(hasKeyboard);
+ }
+ }
- 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);
- AlertDialog alertDialog = builder.create();
- editText.requestFocus();
- editText.setHint(hint);
- editText.setText(current);
- final InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
- imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
- InputMethodManager.HIDE_IMPLICIT_ONLY);
- if (editType == 1)
- editText.setInputType(InputType.TYPE_CLASS_TEXT |
- InputType.TYPE_TEXT_FLAG_MULTI_LINE);
- else if (editType == 3)
- editText.setInputType(InputType.TYPE_CLASS_TEXT |
- InputType.TYPE_TEXT_VARIATION_PASSWORD);
- else
- editText.setInputType(InputType.TYPE_CLASS_TEXT);
- editText.setSelection(editText.getText().length());
- editText.setOnKeyListener((view, KeyCode, event) -> {
- if (KeyCode == KeyEvent.KEYCODE_ENTER) {
- imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
- messageReturnCode = 0;
- messageReturnValue = editText.getText().toString();
- alertDialog.dismiss();
- return true;
- }
- return false;
- });
- alertDialog.show();
- alertDialog.setOnCancelListener(dialog -> {
- getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
- messageReturnValue = current;
- messageReturnCode = -1;
- });
- }
+ 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);
+ AlertDialog alertDialog = builder.create();
+ editText.requestFocus();
+ editText.setHint(hint);
+ editText.setText(current);
+ final InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
+ imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
+ InputMethodManager.HIDE_IMPLICIT_ONLY);
+ if (editType == 1)
+ editText.setInputType(InputType.TYPE_CLASS_TEXT |
+ InputType.TYPE_TEXT_FLAG_MULTI_LINE);
+ else if (editType == 3)
+ editText.setInputType(InputType.TYPE_CLASS_TEXT |
+ InputType.TYPE_TEXT_VARIATION_PASSWORD);
+ else
+ editText.setInputType(InputType.TYPE_CLASS_TEXT);
+ editText.setSelection(editText.getText().length());
+ editText.setOnKeyListener((view, KeyCode, event) -> {
+ if (KeyCode == KeyEvent.KEYCODE_ENTER) {
+ imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
+ messageReturnCode = 0;
+ messageReturnValue = editText.getText().toString();
+ alertDialog.dismiss();
+ return true;
+ }
+ return false;
+ });
+ alertDialog.show();
+ alertDialog.setOnCancelListener(dialog -> {
+ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
+ messageReturnValue = current;
+ messageReturnCode = -1;
+ });
+ }
- public int getDialogState() {
- return messageReturnCode;
- }
+ public int getDialogState() {
+ return messageReturnCode;
+ }
- public String getDialogValue() {
- messageReturnCode = -1;
- return messageReturnValue;
- }
+ public String getDialogValue() {
+ messageReturnCode = -1;
+ return messageReturnValue;
+ }
- public float getDensity() {
- return getResources().getDisplayMetrics().density;
- }
+ public float getDensity() {
+ return getResources().getDisplayMetrics().density;
+ }
- public int getDisplayHeight() {
- return height;
- }
+ public int getDisplayHeight() {
+ return height;
+ }
- public int getDisplayWidth() {
- return width;
- }
+ public int getDisplayWidth() {
+ return width;
+ }
- public float getMemoryMax() {
- ActivityManager actManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
- ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
- float memory = 1.0f;
- if (actManager != null) {
- actManager.getMemoryInfo(memInfo);
- memory = memInfo.totalMem * 1.0f / (1024 * 1024 * 1024);
- memory = Math.round(memory * 100) / 100.0f;
- }
- return memory;
- }
+ public float getMemoryMax() {
+ ActivityManager actManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
+ ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
+ float memory = 1.0f;
+ if (actManager != null) {
+ actManager.getMemoryInfo(memInfo);
+ memory = memInfo.totalMem * 1.0f / (1024 * 1024 * 1024);
+ memory = Math.round(memory * 100) / 100.0f;
+ }
+ return memory;
+ }
- public void notifyServerConnect(boolean multiplayer) {
- isMultiPlayer = multiplayer;
- if (isMultiPlayer)
- stopAd();
- }
+ public void notifyServerConnect(boolean multiplayer) {
+ isMultiPlayer = multiplayer;
+ if (isMultiPlayer)
+ stopAd();
+ }
- public void notifyExitGame() {
- if (isMultiPlayer && pf.isAdsEnable())
- startAd(this, false, true);
- }
+ public void notifyExitGame() {
+ if (isMultiPlayer && pf.isAdsEnable())
+ startAd(this, false, true);
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/MainActivity.java b/build/android/app/src/main/java/com/multicraft/game/MainActivity.java
index d1c4902b..044ec7ca 100644
--- a/build/android/app/src/main/java/com/multicraft/game/MainActivity.java
+++ b/build/android/app/src/main/java/com/multicraft/game/MainActivity.java
@@ -92,443 +92,443 @@ import static com.multicraft.game.helpers.Utilities.getStoreUrl;
import static com.multicraft.game.helpers.Utilities.makeFullScreen;
public class MainActivity extends AppCompatActivity implements CallBackListener, DialogsCallback {
- public final static Map zipLocations = new HashMap<>();
- private final static String SERVER_URL = "http://updates.multicraft.world/";
- public final static String UPDATE_LINK = SERVER_URL + "Android.json";
- private final static int REQUEST_CONNECTION = 104;
- private final static List EU_COUNTRIES = Arrays.asList(
- "AT", "BE", "BG", "HR", "CY", "CZ",
- "DK", "EE", "FI", "FR", "DE", "GR",
- "HU", "IE", "IT", "LV", "LT", "LU",
- "MT", "NL", "PL", "PT", "RO", "SK",
- "SI", "ES", "SE", "GB", "IS", "LI", "NO");
- private static String FILES, WORLDS, GAMES;
- private final String versionName = BuildConfig.VERSION_NAME;
- private String unzipLocation, appData;
- private int height, width;
- private boolean consent;
- private ProgressBar mProgressBar, mProgressBarIndeterminate;
- private TextView mLoading;
- private VersionManagerHelper versionManagerHelper = null;
- private PreferencesHelper pf;
- private Disposable connectionSub, versionManagerSub, cleanSub, copySub;
- private final BroadcastReceiver myReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- int progress = 0;
- if (intent != null)
- progress = intent.getIntExtra(UnzipService.ACTION_PROGRESS, 0);
- if (progress >= 0) {
- if (mProgressBar != null) {
- showProgress(R.string.loading, R.string.loadingp, progress);
- }
- } else {
- runGame();
- }
- }
- };
+ public final static Map zipLocations = new HashMap<>();
+ private final static String SERVER_URL = "http://updates.multicraft.world/";
+ public final static String UPDATE_LINK = SERVER_URL + "Android.json";
+ private final static int REQUEST_CONNECTION = 104;
+ private final static List EU_COUNTRIES = Arrays.asList(
+ "AT", "BE", "BG", "HR", "CY", "CZ",
+ "DK", "EE", "FI", "FR", "DE", "GR",
+ "HU", "IE", "IT", "LV", "LT", "LU",
+ "MT", "NL", "PL", "PT", "RO", "SK",
+ "SI", "ES", "SE", "GB", "IS", "LI", "NO");
+ private static String FILES, WORLDS, GAMES;
+ private final String versionName = BuildConfig.VERSION_NAME;
+ private String unzipLocation, appData;
+ private int height, width;
+ private boolean consent;
+ private ProgressBar mProgressBar, mProgressBarIndeterminate;
+ private TextView mLoading;
+ private VersionManagerHelper versionManagerHelper = null;
+ private PreferencesHelper pf;
+ private Disposable connectionSub, versionManagerSub, cleanSub, copySub;
+ private final BroadcastReceiver myReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ int progress = 0;
+ if (intent != null)
+ progress = intent.getIntExtra(UnzipService.ACTION_PROGRESS, 0);
+ if (progress >= 0) {
+ if (mProgressBar != null) {
+ showProgress(R.string.loading, R.string.loadingp, progress);
+ }
+ } else {
+ runGame();
+ }
+ }
+ };
- // helpful utilities
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- setContentView(R.layout.activity_main);
- pf = PreferencesHelper.getInstance(this);
- IntentFilter filter = new IntentFilter(UnzipService.ACTION_UPDATE);
- registerReceiver(myReceiver, filter);
- if (!isTaskRoot()) {
- finish();
- return;
- }
- addLaunchTimes();
- PermissionHelper permission = new PermissionHelper(this);
- permission.setListener(this);
- permission.askPermissions();
- }
+ // helpful utilities
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ setContentView(R.layout.activity_main);
+ pf = PreferencesHelper.getInstance(this);
+ IntentFilter filter = new IntentFilter(UnzipService.ACTION_UPDATE);
+ registerReceiver(myReceiver, filter);
+ if (!isTaskRoot()) {
+ finish();
+ return;
+ }
+ addLaunchTimes();
+ PermissionHelper permission = new PermissionHelper(this);
+ permission.setListener(this);
+ permission.askPermissions();
+ }
- @Override
- protected void onResume() {
- super.onResume();
- makeFullScreen(this);
- }
+ @Override
+ protected void onResume() {
+ super.onResume();
+ makeFullScreen(this);
+ }
- @Override
- public void onBackPressed() {
- // Prevent abrupt interruption when copy game files from assets
- }
+ @Override
+ public void onBackPressed() {
+ // Prevent abrupt interruption when copy game files from assets
+ }
- @Override
- protected void onDestroy() {
- super.onDestroy();
- if (connectionSub != null) connectionSub.dispose();
- if (versionManagerSub != null) versionManagerSub.dispose();
- if (cleanSub != null) cleanSub.dispose();
- if (copySub != null) copySub.dispose();
- unregisterReceiver(myReceiver);
- }
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (connectionSub != null) connectionSub.dispose();
+ if (versionManagerSub != null) versionManagerSub.dispose();
+ if (cleanSub != null) cleanSub.dispose();
+ if (copySub != null) copySub.dispose();
+ unregisterReceiver(myReceiver);
+ }
- private void initZipLocations() {
- File externalDir = getExternalFilesDir(null);
- unzipLocation = externalDir + File.separator;
- if (externalDir == null) {
- externalDir = Environment.getExternalStorageDirectory();
- unzipLocation = externalDir + File.separator + "Android/data/com.multicraft.game" + File.separator;
- }
- appData = getFilesDir() + File.separator;
- File cacheDir = getCacheDir();
- String cachePath = cacheDir + File.separator;
- if (cacheDir == null)
- cachePath = unzipLocation + "cache" + File.separator;
+ private void initZipLocations() {
+ File externalDir = getExternalFilesDir(null);
+ unzipLocation = externalDir + File.separator;
+ if (externalDir == null) {
+ externalDir = Environment.getExternalStorageDirectory();
+ unzipLocation = externalDir + File.separator + "Android/data/com.multicraft.game" + File.separator;
+ }
+ appData = getFilesDir() + File.separator;
+ File cacheDir = getCacheDir();
+ String cachePath = cacheDir + File.separator;
+ if (cacheDir == null)
+ cachePath = unzipLocation + "cache" + File.separator;
- FILES = cachePath + "Files.zip";
- WORLDS = cachePath + "worlds.zip";
- GAMES = cachePath + "games.zip";
- zipLocations.put(FILES, appData);
- zipLocations.put(GAMES, appData);
- zipLocations.put(WORLDS, unzipLocation);
- }
+ FILES = cachePath + "Files.zip";
+ WORLDS = cachePath + "worlds.zip";
+ GAMES = cachePath + "games.zip";
+ zipLocations.put(FILES, appData);
+ zipLocations.put(GAMES, appData);
+ zipLocations.put(WORLDS, unzipLocation);
+ }
- private void addLaunchTimes() {
- int i = pf.getLaunchTimes();
- i++;
- pf.saveSettings(TAG_LAUNCH_TIMES, i);
- }
+ private void addLaunchTimes() {
+ int i = pf.getLaunchTimes();
+ i++;
+ pf.saveSettings(TAG_LAUNCH_TIMES, i);
+ }
- private void createDataFolder() {
- File folder = new File(unzipLocation);
- if (!folder.mkdirs() && !folder.isDirectory())
- Bugsnag.leaveBreadcrumb(folder + " (unzipLocation) folder was not created");
- }
+ private void createDataFolder() {
+ File folder = new File(unzipLocation);
+ if (!folder.mkdirs() && !folder.isDirectory())
+ Bugsnag.leaveBreadcrumb(folder + " (unzipLocation) folder was not created");
+ }
- // interface
- private void showProgress(int textMessage, int progressMessage, int progress) {
- if (mProgressBar.getVisibility() == View.GONE)
- updateViews(textMessage, View.VISIBLE, View.GONE, View.VISIBLE);
- else if (progress > 0) {
- mLoading.setText(String.format(getResources().getString(progressMessage), progress));
- mProgressBar.setProgress(progress);
- // colorize the progress bar
- Drawable progressDrawable = ((LayerDrawable)
- mProgressBar.getProgressDrawable()).getDrawable(1);
- int color = Color.rgb(255 - progress * 2, progress * 2, 25);
- if (isGreaterOrEqualQ())
- progressDrawable.setColorFilter(new BlendModeColorFilter(color, BlendMode.SRC_IN));
- else
- progressDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
- }
- }
+ // interface
+ private void showProgress(int textMessage, int progressMessage, int progress) {
+ if (mProgressBar.getVisibility() == View.GONE)
+ updateViews(textMessage, View.VISIBLE, View.GONE, View.VISIBLE);
+ else if (progress > 0) {
+ mLoading.setText(String.format(getResources().getString(progressMessage), progress));
+ mProgressBar.setProgress(progress);
+ // colorize the progress bar
+ Drawable progressDrawable = ((LayerDrawable)
+ mProgressBar.getProgressDrawable()).getDrawable(1);
+ int color = Color.rgb(255 - progress * 2, progress * 2, 25);
+ if (isGreaterOrEqualQ())
+ progressDrawable.setColorFilter(new BlendModeColorFilter(color, BlendMode.SRC_IN));
+ else
+ progressDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
+ }
+ }
- // real screen resolution
- private void getDefaultResolution() {
- Display display = getWindowManager().getDefaultDisplay();
- Point size = new Point();
- if (isGreaterOrEqual(Build.VERSION_CODES.JELLY_BEAN_MR1))
- display.getRealSize(size);
- else
- display.getSize(size);
- height = Math.min(size.x, size.y);
- width = Math.max(size.x, size.y);
- }
+ // real screen resolution
+ private void getDefaultResolution() {
+ Display display = getWindowManager().getDefaultDisplay();
+ Point size = new Point();
+ if (isGreaterOrEqual(Build.VERSION_CODES.JELLY_BEAN_MR1))
+ display.getRealSize(size);
+ else
+ display.getSize(size);
+ height = Math.min(size.x, size.y);
+ width = Math.max(size.x, size.y);
+ }
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- super.onWindowFocusChanged(hasFocus);
- if (hasFocus)
- makeFullScreen(this);
- }
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+ if (hasFocus)
+ makeFullScreen(this);
+ }
- // GDPR check
- private void askGdpr() {
- if (pf.isAskConsent() && isGdprSubject())
- showGdprDialog();
- else {
- consent = true;
- startNative();
- }
- }
+ // GDPR check
+ private void askGdpr() {
+ if (pf.isAskConsent() && isGdprSubject())
+ showGdprDialog();
+ else {
+ consent = true;
+ startNative();
+ }
+ }
- private void init() {
- try {
- initZipLocations();
- } catch (Exception e) {
- showRestartDialog("");
- }
- mProgressBar = findViewById(R.id.PB1);
- mProgressBarIndeterminate = findViewById(R.id.PB2);
- mLoading = findViewById(R.id.tv_progress);
- RateMe.onStart(this);
- if (!pf.isCreateShortcut() && !isGreaterOrEqualOreo())
- addShortcut(this);
- checkAppVersion();
- }
+ private void init() {
+ try {
+ initZipLocations();
+ } catch (Exception e) {
+ showRestartDialog("");
+ }
+ mProgressBar = findViewById(R.id.PB1);
+ mProgressBarIndeterminate = findViewById(R.id.PB2);
+ mLoading = findViewById(R.id.tv_progress);
+ RateMe.onStart(this);
+ if (!pf.isCreateShortcut() && !isGreaterOrEqualOreo())
+ addShortcut(this);
+ checkAppVersion();
+ }
- // game logic
- private void checkRateDialog() {
- if (RateMe.shouldShowRateDialog()) {
- updateViews(R.string.empty, View.GONE, View.GONE, View.GONE);
- RateMe.showRateDialog();
- RateMe.setListener(this);
- } else
- askGdpr();
- }
+ // game logic
+ private void checkRateDialog() {
+ if (RateMe.shouldShowRateDialog()) {
+ updateViews(R.string.empty, View.GONE, View.GONE, View.GONE);
+ RateMe.showRateDialog();
+ RateMe.setListener(this);
+ } else
+ askGdpr();
+ }
- void showUpdateDialog() {
- AlertDialogHelper dialogHelper = new AlertDialogHelper(this);
- dialogHelper.setListener(this);
- dialogHelper.setIcon(getIcon(this));
- dialogHelper.setTitle(getString(R.string.available));
- dialogHelper.setMessage(Html.fromHtml(
- versionManagerHelper.getMessage(), null, versionManagerHelper.getCustomTagHandler()));
- dialogHelper.setButtonPositive(getString(R.string.update));
- dialogHelper.setButtonNeutral(getString(R.string.later));
- dialogHelper.showAlert("VersionManager");
- }
+ void showUpdateDialog() {
+ AlertDialogHelper dialogHelper = new AlertDialogHelper(this);
+ dialogHelper.setListener(this);
+ dialogHelper.setIcon(getIcon(this));
+ dialogHelper.setTitle(getString(R.string.available));
+ dialogHelper.setMessage(Html.fromHtml(
+ versionManagerHelper.getMessage(), null, versionManagerHelper.getCustomTagHandler()));
+ dialogHelper.setButtonPositive(getString(R.string.update));
+ dialogHelper.setButtonNeutral(getString(R.string.later));
+ dialogHelper.showAlert("VersionManager");
+ }
- private void checkUrlVersion() {
- versionManagerHelper = new VersionManagerHelper(this);
- if (versionManagerHelper.isCheckVersion())
- versionManagerSub = Observable.fromCallable(() -> versionManagerHelper.getJson())
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .timeout(3000, TimeUnit.MILLISECONDS)
- .subscribe(result -> isShowDialog(versionManagerHelper.isShow(result)),
- throwable -> runOnUiThread(() -> isShowDialog(false)));
- else isShowDialog(false);
- }
+ private void checkUrlVersion() {
+ versionManagerHelper = new VersionManagerHelper(this);
+ if (versionManagerHelper.isCheckVersion())
+ versionManagerSub = Observable.fromCallable(() -> versionManagerHelper.getJson())
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .timeout(3000, TimeUnit.MILLISECONDS)
+ .subscribe(result -> isShowDialog(versionManagerHelper.isShow(result)),
+ throwable -> runOnUiThread(() -> isShowDialog(false)));
+ else isShowDialog(false);
+ }
- private void runGame() {
- deleteFiles(Arrays.asList(FILES, WORLDS, GAMES));
- pf.saveSettings(TAG_BUILD_NUMBER, versionName);
- connectionSub = checkConnection();
- }
+ private void runGame() {
+ deleteFiles(Arrays.asList(FILES, WORLDS, GAMES));
+ pf.saveSettings(TAG_BUILD_NUMBER, versionName);
+ connectionSub = checkConnection();
+ }
- private void startNative() {
- getDefaultResolution();
- Intent intent = new Intent(this, GameActivity.class);
- intent.putExtra("height", height);
- intent.putExtra("width", width);
- intent.putExtra("consent", consent);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
- startActivity(intent);
- }
+ private void startNative() {
+ getDefaultResolution();
+ Intent intent = new Intent(this, GameActivity.class);
+ intent.putExtra("height", height);
+ intent.putExtra("width", width);
+ intent.putExtra("consent", consent);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ startActivity(intent);
+ }
- private boolean isGdprSubject() {
- String locale;
- if (isGreaterOrEqual(Build.VERSION_CODES.N))
- locale = getResources().getConfiguration().getLocales().get(0).getCountry();
- else
- locale = getResources().getConfiguration().locale.getCountry();
- return EU_COUNTRIES.contains(locale.toUpperCase());
- }
+ private boolean isGdprSubject() {
+ String locale;
+ if (isGreaterOrEqual(Build.VERSION_CODES.N))
+ locale = getResources().getConfiguration().getLocales().get(0).getCountry();
+ else
+ locale = getResources().getConfiguration().locale.getCountry();
+ return EU_COUNTRIES.contains(locale.toUpperCase());
+ }
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == REQUEST_CONNECTION) {
- checkUrlVersion();
- } else askGdpr();
- }
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (requestCode == REQUEST_CONNECTION) {
+ checkUrlVersion();
+ } else askGdpr();
+ }
- private void cleanUpOldFiles(boolean isAll) {
- updateViews(R.string.preparing, View.VISIBLE, View.VISIBLE, View.GONE);
- List filesList;
- if (isAll)
- filesList = Collections.singletonList(unzipLocation);
- else {
- filesList = Arrays.asList(unzipLocation + "cache",
- unzipLocation + "builtin", appData + "builtin",
- unzipLocation + "games", appData + "games",
- unzipLocation + "debug.txt");
- }
- cleanSub = Observable.fromCallable(() -> deleteFiles(filesList))
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(result -> startCopy(isAll));
- }
+ private void cleanUpOldFiles(boolean isAll) {
+ updateViews(R.string.preparing, View.VISIBLE, View.VISIBLE, View.GONE);
+ List filesList;
+ if (isAll)
+ filesList = Collections.singletonList(unzipLocation);
+ else {
+ filesList = Arrays.asList(unzipLocation + "cache",
+ unzipLocation + "builtin", appData + "builtin",
+ unzipLocation + "games", appData + "games",
+ unzipLocation + "debug.txt");
+ }
+ cleanSub = Observable.fromCallable(() -> deleteFiles(filesList))
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(result -> startCopy(isAll));
+ }
- private void checkAppVersion() {
- if (pf.getBuildNumber().equals(versionName)) {
- mProgressBarIndeterminate.setVisibility(View.VISIBLE);
- runGame();
- } else if (pf.getBuildNumber().equals("0")) {
- createDataFolder();
- cleanUpOldFiles(true);
- } else {
- createDataFolder();
- cleanUpOldFiles(false);
- }
- }
+ private void checkAppVersion() {
+ if (pf.getBuildNumber().equals(versionName)) {
+ mProgressBarIndeterminate.setVisibility(View.VISIBLE);
+ runGame();
+ } else if (pf.getBuildNumber().equals("0")) {
+ createDataFolder();
+ cleanUpOldFiles(true);
+ } else {
+ createDataFolder();
+ cleanUpOldFiles(false);
+ }
+ }
- public void updateViews(int text, int textVisib, int progressIndetermVisib, int progressVisib) {
- mLoading.setText(text);
- mLoading.setVisibility(textVisib);
- mProgressBarIndeterminate.setVisibility(progressIndetermVisib);
- mProgressBar.setVisibility(progressVisib);
- }
+ public void updateViews(int text, int textVisib, int progressIndetermVisib, int progressVisib) {
+ mLoading.setText(text);
+ mLoading.setVisibility(textVisib);
+ mProgressBarIndeterminate.setVisibility(progressIndetermVisib);
+ mProgressBar.setVisibility(progressVisib);
+ }
- public void isShowDialog(boolean flag) {
- if (flag) {
- updateViews(R.string.loading, View.VISIBLE, View.VISIBLE, View.GONE);
- showUpdateDialog();
- } else
- checkRateDialog();
- }
+ public void isShowDialog(boolean flag) {
+ if (flag) {
+ updateViews(R.string.loading, View.VISIBLE, View.VISIBLE, View.GONE);
+ showUpdateDialog();
+ } else
+ checkRateDialog();
+ }
- private Disposable checkConnection() {
- return Observable.fromCallable(Utilities::isReachable)
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .timeout(4000, TimeUnit.MILLISECONDS)
- .subscribe(result -> {
- if (result) checkUrlVersion();
- else showConnectionDialog();
- },
- throwable -> runOnUiThread(this::showConnectionDialog));
- }
+ private Disposable checkConnection() {
+ return Observable.fromCallable(Utilities::isReachable)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .timeout(4000, TimeUnit.MILLISECONDS)
+ .subscribe(result -> {
+ if (result) checkUrlVersion();
+ else showConnectionDialog();
+ },
+ throwable -> runOnUiThread(this::showConnectionDialog));
+ }
- private void startCopy(boolean isAll) {
- String[] zips;
- if (isAll)
- zips = new String[]{FILES, WORLDS, GAMES};
- else
- zips = new String[]{FILES, GAMES};
- copySub = Completable.fromAction(() -> copyAssets(zips))
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(() -> startUnzipService(zips),
- throwable -> {
- if (throwable.getLocalizedMessage().contains("ENOSPC"))
- showRestartDialog("ENOSPC");
- else showRestartDialog("UKNWN");
- });
- }
+ private void startCopy(boolean isAll) {
+ String[] zips;
+ if (isAll)
+ zips = new String[]{FILES, WORLDS, GAMES};
+ else
+ zips = new String[]{FILES, GAMES};
+ copySub = Completable.fromAction(() -> copyAssets(zips))
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(() -> startUnzipService(zips),
+ throwable -> {
+ if (throwable.getLocalizedMessage().contains("ENOSPC"))
+ showRestartDialog("ENOSPC");
+ else showRestartDialog("UKNWN");
+ });
+ }
- private void copyAssets(String[] zips) throws IOException {
- for (String zipName : zips) {
- String filename = FilenameUtils.getName(zipName);
- try (InputStream in = getAssets().open(filename)) {
- FileUtils.copyInputStreamToFile(in, new File(zipName));
- }
- }
- }
+ private void copyAssets(String[] zips) throws IOException {
+ for (String zipName : zips) {
+ String filename = FilenameUtils.getName(zipName);
+ try (InputStream in = getAssets().open(filename)) {
+ FileUtils.copyInputStreamToFile(in, new File(zipName));
+ }
+ }
+ }
- private void startUnzipService(String[] file) {
- Intent intent = new Intent(this, UnzipService.class);
- intent.putExtra(UnzipService.EXTRA_KEY_IN_FILE, file);
- startService(intent);
- }
+ private void startUnzipService(String[] file) {
+ Intent intent = new Intent(this, UnzipService.class);
+ intent.putExtra(UnzipService.EXTRA_KEY_IN_FILE, file);
+ startService(intent);
+ }
- private void showRestartDialog(final String source) {
- String message;
- if ("ENOSPC".equals(source))
- message = getString(R.string.no_space);
- else
- message = getString(R.string.restart);
- final AlertDialogHelper dialogHelper = new AlertDialogHelper(this);
- dialogHelper.setListener(this);
- dialogHelper.setMessage(message);
- dialogHelper.setButtonPositive(getString(android.R.string.ok));
- dialogHelper.showAlert("Restart");
- }
+ private void showRestartDialog(final String source) {
+ String message;
+ if ("ENOSPC".equals(source))
+ message = getString(R.string.no_space);
+ else
+ message = getString(R.string.restart);
+ final AlertDialogHelper dialogHelper = new AlertDialogHelper(this);
+ dialogHelper.setListener(this);
+ dialogHelper.setMessage(message);
+ dialogHelper.setButtonPositive(getString(android.R.string.ok));
+ dialogHelper.showAlert("Restart");
+ }
- private void restartApp() {
- Intent intent = new Intent(getApplicationContext(), MainActivity.class);
- int mPendingIntentId = 1337;
- AlarmManager mgr = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE);
- if (mgr != null)
- mgr.set(AlarmManager.RTC, System.currentTimeMillis(), PendingIntent.getActivity(
- getApplicationContext(), mPendingIntentId, intent, PendingIntent.FLAG_CANCEL_CURRENT));
- System.exit(0);
- }
+ private void restartApp() {
+ Intent intent = new Intent(getApplicationContext(), MainActivity.class);
+ int mPendingIntentId = 1337;
+ AlarmManager mgr = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE);
+ if (mgr != null)
+ mgr.set(AlarmManager.RTC, System.currentTimeMillis(), PendingIntent.getActivity(
+ getApplicationContext(), mPendingIntentId, intent, PendingIntent.FLAG_CANCEL_CURRENT));
+ System.exit(0);
+ }
- @Override
- public void onEvent(boolean isContinue) {
- if (isFinishing()) return;
- if (isContinue) init();
- else finish();
- }
+ @Override
+ public void onEvent(boolean isContinue) {
+ if (isFinishing()) return;
+ if (isContinue) init();
+ else finish();
+ }
- private void showGdprDialog() {
- AlertDialogHelper dialogHelper = new AlertDialogHelper(this);
- dialogHelper.setListener(this);
- dialogHelper.setIcon(getIcon(this));
- dialogHelper.setTitle(getString(R.string.app_name));
- TextView tv = new TextView(this);
- tv.setText(R.string.gdpr_main_text);
- tv.setPadding(20, 0, 20, 0);
- tv.setGravity(Gravity.CENTER);
- tv.setMovementMethod(LinkMovementMethod.getInstance());
- dialogHelper.setTV(tv);
- dialogHelper.setButtonPositive(getString(R.string.gdpr_agree));
- dialogHelper.setButtonNegative(getString(R.string.gdpr_disagree));
- dialogHelper.showAlert("GdprDialog");
- }
+ private void showGdprDialog() {
+ AlertDialogHelper dialogHelper = new AlertDialogHelper(this);
+ dialogHelper.setListener(this);
+ dialogHelper.setIcon(getIcon(this));
+ dialogHelper.setTitle(getString(R.string.app_name));
+ TextView tv = new TextView(this);
+ tv.setText(R.string.gdpr_main_text);
+ tv.setPadding(20, 0, 20, 0);
+ tv.setGravity(Gravity.CENTER);
+ tv.setMovementMethod(LinkMovementMethod.getInstance());
+ dialogHelper.setTV(tv);
+ dialogHelper.setButtonPositive(getString(R.string.gdpr_agree));
+ dialogHelper.setButtonNegative(getString(R.string.gdpr_disagree));
+ dialogHelper.showAlert("GdprDialog");
+ }
- private void showConnectionDialog() {
- AlertDialogHelper dialogHelper = new AlertDialogHelper(this);
- dialogHelper.setListener(this);
- dialogHelper.setMessage(getString(R.string.conn_message));
- dialogHelper.setButtonPositive(getString(R.string.conn_wifi));
- dialogHelper.setButtonNegative(getString(R.string.conn_mobile));
- dialogHelper.setButtonNeutral(getString(R.string.ignore));
- dialogHelper.showAlert("ConnectionDialog");
- }
+ private void showConnectionDialog() {
+ AlertDialogHelper dialogHelper = new AlertDialogHelper(this);
+ dialogHelper.setListener(this);
+ dialogHelper.setMessage(getString(R.string.conn_message));
+ dialogHelper.setButtonPositive(getString(R.string.conn_wifi));
+ dialogHelper.setButtonNegative(getString(R.string.conn_mobile));
+ dialogHelper.setButtonNeutral(getString(R.string.ignore));
+ dialogHelper.showAlert("ConnectionDialog");
+ }
- @Override
- public void onPositive(String source) {
- if ("RateMe".equals(source)) {
- Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getStoreUrl()));
- startActivity(intent);
- Toast.makeText(this, R.string.thank, Toast.LENGTH_LONG).show();
- finish();
- } else if ("Restart".equals(source))
- restartApp();
- else if ("ConnectionDialog".equals(source))
- try {
- startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), REQUEST_CONNECTION);
- } catch (ActivityNotFoundException e) {
- Bugsnag.notify(e);
- askGdpr();
- }
- else if ("GdprDialog".equals(source)) {
- pf.saveSettings(TAG_CONSENT_ASKED, false);
- consent = true;
- startNative();
- } else {
- versionManagerHelper.updateNow(versionManagerHelper.getUpdateUrl());
- finish();
- }
- }
+ @Override
+ public void onPositive(String source) {
+ if ("RateMe".equals(source)) {
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getStoreUrl()));
+ startActivity(intent);
+ Toast.makeText(this, R.string.thank, Toast.LENGTH_LONG).show();
+ finish();
+ } else if ("Restart".equals(source))
+ restartApp();
+ else if ("ConnectionDialog".equals(source))
+ try {
+ startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), REQUEST_CONNECTION);
+ } catch (ActivityNotFoundException e) {
+ Bugsnag.notify(e);
+ askGdpr();
+ }
+ else if ("GdprDialog".equals(source)) {
+ pf.saveSettings(TAG_CONSENT_ASKED, false);
+ consent = true;
+ startNative();
+ } else {
+ versionManagerHelper.updateNow(versionManagerHelper.getUpdateUrl());
+ finish();
+ }
+ }
- @Override
- public void onNegative(String source) {
- if ("RateMe".equals(source))
- askGdpr();
- else if ("ConnectionDialog".equals(source))
- try {
- startActivityForResult(new Intent(Settings.ACTION_WIRELESS_SETTINGS), REQUEST_CONNECTION);
- } catch (ActivityNotFoundException e) {
- Bugsnag.notify(e);
- askGdpr();
- }
- else if ("GdprDialog".equals(source)) {
- pf.saveSettings(TAG_CONSENT_ASKED, false);
- consent = false;
- startNative();
- } else
- checkRateDialog();
- }
+ @Override
+ public void onNegative(String source) {
+ if ("RateMe".equals(source))
+ askGdpr();
+ else if ("ConnectionDialog".equals(source))
+ try {
+ startActivityForResult(new Intent(Settings.ACTION_WIRELESS_SETTINGS), REQUEST_CONNECTION);
+ } catch (ActivityNotFoundException e) {
+ Bugsnag.notify(e);
+ askGdpr();
+ }
+ else if ("GdprDialog".equals(source)) {
+ pf.saveSettings(TAG_CONSENT_ASKED, false);
+ consent = false;
+ startNative();
+ } else
+ checkRateDialog();
+ }
- @Override
- public void onNeutral(String source) {
- if ("RateMe".equals(source))
- askGdpr();
- else if ("ConnectionDialog".equals(source))
- askGdpr();
- else {
- versionManagerHelper.remindMeLater();
- checkRateDialog();
- }
- }
+ @Override
+ public void onNeutral(String source) {
+ if ("RateMe".equals(source))
+ askGdpr();
+ else if ("ConnectionDialog".equals(source))
+ askGdpr();
+ else {
+ versionManagerHelper.remindMeLater();
+ checkRateDialog();
+ }
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/MyApplication.java b/build/android/app/src/main/java/com/multicraft/game/MyApplication.java
index e2927dcf..3972f78d 100644
--- a/build/android/app/src/main/java/com/multicraft/game/MyApplication.java
+++ b/build/android/app/src/main/java/com/multicraft/game/MyApplication.java
@@ -25,9 +25,9 @@ import androidx.multidex.MultiDexApplication;
import com.bugsnag.android.Bugsnag;
public class MyApplication extends MultiDexApplication {
- @Override
- public void onCreate() {
- super.onCreate();
- Bugsnag.start(this);
- }
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ Bugsnag.start(this);
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/RateMe.java b/build/android/app/src/main/java/com/multicraft/game/RateMe.java
index 966d45d3..316ce043 100644
--- a/build/android/app/src/main/java/com/multicraft/game/RateMe.java
+++ b/build/android/app/src/main/java/com/multicraft/game/RateMe.java
@@ -42,99 +42,99 @@ import java.util.Date;
import static com.multicraft.game.helpers.ApiLevelHelper.isGreaterOrEqualKitkat;
class RateMe {
- private static final int INSTALL_DAYS = 5;
- private static final int LAUNCH_TIMES = 4;
- private static final String PREF_NAME = "RateMe";
- private static final String KEY_INSTALL_DATE = "rta_install_date";
- private static final String KEY_OPT_OUT = "rta_opt_out";
- private static Date mInstallDate = new Date();
- private static boolean mOptOut = false;
- private static DialogsCallback sCallback = null;
+ private static final int INSTALL_DAYS = 5;
+ private static final int LAUNCH_TIMES = 4;
+ private static final String PREF_NAME = "RateMe";
+ private static final String KEY_INSTALL_DATE = "rta_install_date";
+ private static final String KEY_OPT_OUT = "rta_opt_out";
+ private static Date mInstallDate = new Date();
+ private static boolean mOptOut = false;
+ private static DialogsCallback sCallback = null;
- private static WeakReference activityRef = null;
+ private static WeakReference activityRef = null;
- static void setListener(DialogsCallback callback) {
- sCallback = callback;
- }
+ static void setListener(DialogsCallback callback) {
+ sCallback = callback;
+ }
- static void onStart(AppCompatActivity activity) {
- activityRef = new WeakReference<>(activity);
- SharedPreferences pref = activity.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
- Editor editor = pref.edit();
- // If it is the first launch, save the date in shared preference.
- if (pref.getLong(KEY_INSTALL_DATE, 0) == 0L)
- storeInstallDate(activity, editor);
- editor.apply();
+ static void onStart(AppCompatActivity activity) {
+ activityRef = new WeakReference<>(activity);
+ SharedPreferences pref = activity.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
+ Editor editor = pref.edit();
+ // If it is the first launch, save the date in shared preference.
+ if (pref.getLong(KEY_INSTALL_DATE, 0) == 0L)
+ storeInstallDate(activity, editor);
+ editor.apply();
- mInstallDate = new Date(pref.getLong(KEY_INSTALL_DATE, 0));
- mOptOut = pref.getBoolean(KEY_OPT_OUT, false);
- }
+ mInstallDate = new Date(pref.getLong(KEY_INSTALL_DATE, 0));
+ mOptOut = pref.getBoolean(KEY_OPT_OUT, false);
+ }
- static boolean shouldShowRateDialog() {
- if (mOptOut)
- return false;
- else {
- if (PreferencesHelper.getInstance(activityRef.get()).getLaunchTimes() % LAUNCH_TIMES == 0)
- return true;
- long threshold = INSTALL_DAYS * 24 * 60 * 60 * 1000L;
- return new Date().getTime() - mInstallDate.getTime() >= threshold;
- }
- }
+ static boolean shouldShowRateDialog() {
+ if (mOptOut)
+ return false;
+ else {
+ if (PreferencesHelper.getInstance(activityRef.get()).getLaunchTimes() % LAUNCH_TIMES == 0)
+ return true;
+ long threshold = INSTALL_DAYS * 24 * 60 * 60 * 1000L;
+ return new Date().getTime() - mInstallDate.getTime() >= threshold;
+ }
+ }
- static void showRateDialog() {
- final AppCompatActivity activity = activityRef.get();
- final Dialog dialog = new Dialog(activity, R.style.RateMe);
- dialog.setCancelable(false);
- if (isGreaterOrEqualKitkat())
- dialog.getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
- dialog.setContentView(R.layout.rate_dialog);
- RatingBar ratingBar = dialog.findViewById(R.id.ratingBar);
- ratingBar.setOnRatingBarChangeListener((ratingBar1, rating, fromUser) -> {
- if (rating >= 4) {
- sCallback.onPositive("RateMe");
- dialog.dismiss();
- setOptOut(activity);
- } else {
- sCallback.onNegative("RateMe");
- dialog.dismiss();
- Toast.makeText(activity, R.string.sad, Toast.LENGTH_LONG).show();
- clearSharedPreferences(activity);
- }
- });
- dialog.setOnCancelListener(dialog1 -> {
- sCallback.onNeutral("RateMe");
- clearSharedPreferences(activity);
- });
- if (!activity.isFinishing())
- dialog.show();
- else
- sCallback.onNegative("RateMe");
- }
+ static void showRateDialog() {
+ final AppCompatActivity activity = activityRef.get();
+ final Dialog dialog = new Dialog(activity, R.style.RateMe);
+ dialog.setCancelable(false);
+ if (isGreaterOrEqualKitkat())
+ dialog.getWindow().getDecorView().setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
+ dialog.setContentView(R.layout.rate_dialog);
+ RatingBar ratingBar = dialog.findViewById(R.id.ratingBar);
+ ratingBar.setOnRatingBarChangeListener((ratingBar1, rating, fromUser) -> {
+ if (rating >= 4) {
+ sCallback.onPositive("RateMe");
+ dialog.dismiss();
+ setOptOut(activity);
+ } else {
+ sCallback.onNegative("RateMe");
+ dialog.dismiss();
+ Toast.makeText(activity, R.string.sad, Toast.LENGTH_LONG).show();
+ clearSharedPreferences(activity);
+ }
+ });
+ dialog.setOnCancelListener(dialog1 -> {
+ sCallback.onNeutral("RateMe");
+ clearSharedPreferences(activity);
+ });
+ if (!activity.isFinishing())
+ dialog.show();
+ else
+ sCallback.onNegative("RateMe");
+ }
- private static void clearSharedPreferences(AppCompatActivity activity) {
- Editor editor = activity.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE).edit();
- editor.remove(KEY_INSTALL_DATE);
- editor.apply();
- }
+ private static void clearSharedPreferences(AppCompatActivity activity) {
+ Editor editor = activity.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE).edit();
+ editor.remove(KEY_INSTALL_DATE);
+ editor.apply();
+ }
- private static void setOptOut(final AppCompatActivity activity) {
- Editor editor = activity.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE).edit();
- editor.putBoolean(KEY_OPT_OUT, true);
- editor.apply();
- }
+ private static void setOptOut(final AppCompatActivity activity) {
+ Editor editor = activity.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE).edit();
+ editor.putBoolean(KEY_OPT_OUT, true);
+ editor.apply();
+ }
- private static void storeInstallDate(final AppCompatActivity activity, Editor editor) {
- Date installDate = new Date();
- PackageManager packageManager = activity.getPackageManager();
- try {
- PackageInfo pkgInfo = packageManager.getPackageInfo(activity.getPackageName(), 0);
- installDate = new Date(pkgInfo.firstInstallTime);
- } catch (PackageManager.NameNotFoundException e) {
- Bugsnag.notify(e);
- }
- editor.putLong(KEY_INSTALL_DATE, installDate.getTime());
- }
+ private static void storeInstallDate(final AppCompatActivity activity, Editor editor) {
+ Date installDate = new Date();
+ PackageManager packageManager = activity.getPackageManager();
+ try {
+ PackageInfo pkgInfo = packageManager.getPackageInfo(activity.getPackageName(), 0);
+ installDate = new Date(pkgInfo.firstInstallTime);
+ } catch (PackageManager.NameNotFoundException e) {
+ Bugsnag.notify(e);
+ }
+ editor.putLong(KEY_INSTALL_DATE, installDate.getTime());
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/RemoteSettings.java b/build/android/app/src/main/java/com/multicraft/game/RemoteSettings.java
index 3a6ecb6d..0826027c 100644
--- a/build/android/app/src/main/java/com/multicraft/game/RemoteSettings.java
+++ b/build/android/app/src/main/java/com/multicraft/game/RemoteSettings.java
@@ -23,66 +23,66 @@ package com.multicraft.game;
import java.util.List;
public class RemoteSettings {
- private int versionCode = 0;
- private List badVersionCodes;
- private String packageName, content;
- private int adsDelay = -1;
- private int adsRepeat = -1;
- private boolean adsEnabled = true;
+ private int versionCode = 0;
+ private List badVersionCodes;
+ private String packageName, content;
+ private int adsDelay = -1;
+ private int adsRepeat = -1;
+ private boolean adsEnabled = true;
- public int getVersionCode() {
- return versionCode;
- }
+ public int getVersionCode() {
+ return versionCode;
+ }
- public void setVersionCode(int versionCode) {
- this.versionCode = versionCode;
- }
+ public void setVersionCode(int versionCode) {
+ this.versionCode = versionCode;
+ }
- public List getBadVersionCodes() {
- return badVersionCodes;
- }
+ public List getBadVersionCodes() {
+ return badVersionCodes;
+ }
- public void setBadVersionCodes(List badVersionCodes) {
- this.badVersionCodes = badVersionCodes;
- }
+ public void setBadVersionCodes(List badVersionCodes) {
+ this.badVersionCodes = badVersionCodes;
+ }
- public String getPackageName() {
- return packageName;
- }
+ public String getPackageName() {
+ return packageName;
+ }
- public void setPackageName(String packageName) {
- this.packageName = packageName;
- }
+ public void setPackageName(String packageName) {
+ this.packageName = packageName;
+ }
- public String getContent() {
- return content;
- }
+ public String getContent() {
+ return content;
+ }
- public void setContent(String content) {
- this.content = content;
- }
+ public void setContent(String content) {
+ this.content = content;
+ }
- public int getAdsDelay() {
- return adsDelay;
- }
+ public int getAdsDelay() {
+ return adsDelay;
+ }
- public void setAdsDelay(int adsDelay) {
- this.adsDelay = adsDelay;
- }
+ public void setAdsDelay(int adsDelay) {
+ this.adsDelay = adsDelay;
+ }
- public int getAdsRepeat() {
- return adsRepeat;
- }
+ public int getAdsRepeat() {
+ return adsRepeat;
+ }
- public void setAdsRepeat(int adsRepeat) {
- this.adsRepeat = adsRepeat;
- }
+ public void setAdsRepeat(int adsRepeat) {
+ this.adsRepeat = adsRepeat;
+ }
- public boolean isAdsEnabled() {
- return adsEnabled;
- }
+ public boolean isAdsEnabled() {
+ return adsEnabled;
+ }
- public void setAdsEnabled(boolean adsEnabled) {
- this.adsEnabled = adsEnabled;
- }
+ public void setAdsEnabled(boolean adsEnabled) {
+ this.adsEnabled = adsEnabled;
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/UnzipService.java b/build/android/app/src/main/java/com/multicraft/game/UnzipService.java
index 736da42b..22944c2b 100644
--- a/build/android/app/src/main/java/com/multicraft/game/UnzipService.java
+++ b/build/android/app/src/main/java/com/multicraft/game/UnzipService.java
@@ -44,120 +44,120 @@ import static com.multicraft.game.MainActivity.zipLocations;
import static com.multicraft.game.helpers.ApiLevelHelper.isGreaterOrEqualOreo;
public class UnzipService extends IntentService {
- public static final String ACTION_UPDATE = "com.multicraft.game.UPDATE";
- public static final String EXTRA_KEY_IN_FILE = "file";
- public static final String ACTION_PROGRESS = "progress";
- private final int id = 1;
- private NotificationManager mNotifyManager;
+ public static final String ACTION_UPDATE = "com.multicraft.game.UPDATE";
+ public static final String EXTRA_KEY_IN_FILE = "file";
+ public static final String ACTION_PROGRESS = "progress";
+ private final int id = 1;
+ private NotificationManager mNotifyManager;
- public UnzipService() {
- super("com.multicraft.game.UnzipService");
- }
+ public UnzipService() {
+ super("com.multicraft.game.UnzipService");
+ }
- private void isDir(String dir, String unzipLocation) {
- File f = new File(unzipLocation + dir);
- if (!f.mkdirs() && !f.isDirectory())
- Bugsnag.leaveBreadcrumb(f + " (destination) folder was not created");
- }
+ private void isDir(String dir, String unzipLocation) {
+ File f = new File(unzipLocation + dir);
+ if (!f.mkdirs() && !f.isDirectory())
+ Bugsnag.leaveBreadcrumb(f + " (destination) folder was not created");
+ }
- @Override
- protected void onHandleIntent(Intent intent) {
- createNotification();
- unzip(intent);
- }
+ @Override
+ protected void onHandleIntent(Intent intent) {
+ createNotification();
+ unzip(intent);
+ }
- private String getSettings() {
- return getString(R.string.gdpr_main_text);
- }
+ private String getSettings() {
+ return getString(R.string.gdpr_main_text);
+ }
- private void createNotification() {
- // There are hardcoding only for show it's just strings
- String name = "com.multicraft.game";
- String channelId = "MultiCraft channel"; // The user-visible name of the channel.
- String description = "notifications from MultiCraft"; // The user-visible description of the channel.
- Notification.Builder builder;
- if (mNotifyManager == null)
- mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
- if (isGreaterOrEqualOreo()) {
- int importance = NotificationManager.IMPORTANCE_LOW;
- NotificationChannel mChannel = null;
- if (mNotifyManager != null)
- mChannel = mNotifyManager.getNotificationChannel(channelId);
- if (mChannel == null) {
- mChannel = new NotificationChannel(channelId, name, importance);
- mChannel.setDescription(description);
- // Configure the notification channel, NO SOUND
- mChannel.setSound(null, null);
- mChannel.enableLights(false);
- mChannel.enableVibration(false);
- mNotifyManager.createNotificationChannel(mChannel);
- }
- builder = new Notification.Builder(this, channelId);
- } else
- builder = new Notification.Builder(this);
- builder.setContentTitle(getString(R.string.notification_title))
- .setContentText(getString(R.string.notification_description))
- .setSmallIcon(R.drawable.update);
- mNotifyManager.notify(id, builder.build());
- }
+ private void createNotification() {
+ // There are hardcoding only for show it's just strings
+ String name = "com.multicraft.game";
+ String channelId = "MultiCraft channel"; // The user-visible name of the channel.
+ String description = "notifications from MultiCraft"; // The user-visible description of the channel.
+ Notification.Builder builder;
+ if (mNotifyManager == null)
+ mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ if (isGreaterOrEqualOreo()) {
+ int importance = NotificationManager.IMPORTANCE_LOW;
+ NotificationChannel mChannel = null;
+ if (mNotifyManager != null)
+ mChannel = mNotifyManager.getNotificationChannel(channelId);
+ if (mChannel == null) {
+ mChannel = new NotificationChannel(channelId, name, importance);
+ mChannel.setDescription(description);
+ // Configure the notification channel, NO SOUND
+ mChannel.setSound(null, null);
+ mChannel.enableLights(false);
+ mChannel.enableVibration(false);
+ mNotifyManager.createNotificationChannel(mChannel);
+ }
+ builder = new Notification.Builder(this, channelId);
+ } else
+ builder = new Notification.Builder(this);
+ builder.setContentTitle(getString(R.string.notification_title))
+ .setContentText(getString(R.string.notification_description))
+ .setSmallIcon(R.drawable.update);
+ mNotifyManager.notify(id, builder.build());
+ }
- private void unzip(Intent intent) {
- String[] zips = intent.getStringArrayExtra(EXTRA_KEY_IN_FILE);
- int per = 0;
- int size = getSummarySize(zips);
- for (String zip : zips) {
- File zipFile = new File(zip);
- LocalFileHeader localFileHeader;
- int readLen;
- byte[] readBuffer = new byte[8192];
- try (FileInputStream fileInputStream = new FileInputStream(zipFile);
- ZipInputStream zipInputStream = new ZipInputStream(fileInputStream)) {
- while ((localFileHeader = zipInputStream.getNextEntry()) != null) {
- String fileName = localFileHeader.getFileName();
- if (localFileHeader.isDirectory()) {
- ++per;
- isDir(fileName, zipLocations.get(zip));
- } else {
- File extractedFile = new File(fileName);
- publishProgress(100 * ++per / size);
- try (OutputStream outputStream = new FileOutputStream(zipLocations.get(zip) + extractedFile)) {
- while ((readLen = zipInputStream.read(readBuffer)) != -1) {
- outputStream.write(readBuffer, 0, readLen);
- }
- }
- }
- }
- } catch (FileNotFoundException e) {
- Bugsnag.notify(e);
- } catch (IOException e) {
- Bugsnag.notify(e);
- }
- }
- }
+ private void unzip(Intent intent) {
+ String[] zips = intent.getStringArrayExtra(EXTRA_KEY_IN_FILE);
+ int per = 0;
+ int size = getSummarySize(zips);
+ for (String zip : zips) {
+ File zipFile = new File(zip);
+ LocalFileHeader localFileHeader;
+ int readLen;
+ byte[] readBuffer = new byte[8192];
+ try (FileInputStream fileInputStream = new FileInputStream(zipFile);
+ ZipInputStream zipInputStream = new ZipInputStream(fileInputStream)) {
+ while ((localFileHeader = zipInputStream.getNextEntry()) != null) {
+ String fileName = localFileHeader.getFileName();
+ if (localFileHeader.isDirectory()) {
+ ++per;
+ isDir(fileName, zipLocations.get(zip));
+ } else {
+ File extractedFile = new File(fileName);
+ publishProgress(100 * ++per / size);
+ try (OutputStream outputStream = new FileOutputStream(zipLocations.get(zip) + extractedFile)) {
+ while ((readLen = zipInputStream.read(readBuffer)) != -1) {
+ outputStream.write(readBuffer, 0, readLen);
+ }
+ }
+ }
+ }
+ } catch (FileNotFoundException e) {
+ Bugsnag.notify(e);
+ } catch (IOException e) {
+ Bugsnag.notify(e);
+ }
+ }
+ }
- private void publishProgress(int progress) {
- Intent intentUpdate = new Intent(ACTION_UPDATE);
- intentUpdate.putExtra(ACTION_PROGRESS, progress);
- sendBroadcast(intentUpdate);
- }
+ private void publishProgress(int progress) {
+ Intent intentUpdate = new Intent(ACTION_UPDATE);
+ intentUpdate.putExtra(ACTION_PROGRESS, progress);
+ sendBroadcast(intentUpdate);
+ }
- private int getSummarySize(String[] zips) {
- int size = 0;
- for (String z : zips) {
- try {
- ZipFile zipFile = new ZipFile(z);
- size += zipFile.getFileHeaders().size();
- } catch (IOException e) {
- Bugsnag.notify(e);
- }
- }
- return size;
- }
+ private int getSummarySize(String[] zips) {
+ int size = 0;
+ for (String z : zips) {
+ try {
+ ZipFile zipFile = new ZipFile(z);
+ size += zipFile.getFileHeaders().size();
+ } catch (IOException e) {
+ Bugsnag.notify(e);
+ }
+ }
+ return size;
+ }
- @Override
- public void onDestroy() {
- super.onDestroy();
- mNotifyManager.cancel(id);
- publishProgress(-1);
- }
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ mNotifyManager.cancel(id);
+ publishProgress(-1);
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/callbacks/CallBackListener.java b/build/android/app/src/main/java/com/multicraft/game/callbacks/CallBackListener.java
index 395628bd..1a7bd889 100644
--- a/build/android/app/src/main/java/com/multicraft/game/callbacks/CallBackListener.java
+++ b/build/android/app/src/main/java/com/multicraft/game/callbacks/CallBackListener.java
@@ -21,5 +21,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
package com.multicraft.game.callbacks;
public interface CallBackListener {
- void onEvent(boolean isContinue);
+ void onEvent(boolean isContinue);
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/callbacks/DialogsCallback.java b/build/android/app/src/main/java/com/multicraft/game/callbacks/DialogsCallback.java
index a260ff96..571434e1 100644
--- a/build/android/app/src/main/java/com/multicraft/game/callbacks/DialogsCallback.java
+++ b/build/android/app/src/main/java/com/multicraft/game/callbacks/DialogsCallback.java
@@ -21,9 +21,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
package com.multicraft.game.callbacks;
public interface DialogsCallback {
- void onPositive(String source);
+ void onPositive(String source);
- void onNegative(String source);
+ void onNegative(String source);
- void onNeutral(String source);
+ void onNeutral(String source);
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/helpers/AlertDialogHelper.java b/build/android/app/src/main/java/com/multicraft/game/helpers/AlertDialogHelper.java
index 64c57749..339e5dc5 100644
--- a/build/android/app/src/main/java/com/multicraft/game/helpers/AlertDialogHelper.java
+++ b/build/android/app/src/main/java/com/multicraft/game/helpers/AlertDialogHelper.java
@@ -30,104 +30,104 @@ import com.multicraft.game.callbacks.DialogsCallback;
public class AlertDialogHelper {
- private final AppCompatActivity activity;
- private DialogsCallback sCallback = null;
- private Drawable icon = null;
- private String title = null;
- private CharSequence message = null;
- private TextView tv = null;
- private String buttonPositive = null;
- private String buttonNegative = null;
- private String buttonNeutral = null;
+ private final AppCompatActivity activity;
+ private DialogsCallback sCallback = null;
+ private Drawable icon = null;
+ private String title = null;
+ private CharSequence message = null;
+ private TextView tv = null;
+ private String buttonPositive = null;
+ private String buttonNegative = null;
+ private String buttonNeutral = null;
- public AlertDialogHelper(AppCompatActivity activity) {
- this.activity = activity;
- }
+ public AlertDialogHelper(AppCompatActivity activity) {
+ this.activity = activity;
+ }
- private Drawable getIcon() {
- return icon;
- }
+ private Drawable getIcon() {
+ return icon;
+ }
- public void setIcon(Drawable icon) {
- this.icon = icon;
- }
+ public void setIcon(Drawable icon) {
+ this.icon = icon;
+ }
- private String getTitle() {
- return title;
- }
+ private String getTitle() {
+ return title;
+ }
- public void setTitle(String title) {
- this.title = title;
- }
+ public void setTitle(String title) {
+ this.title = title;
+ }
- private CharSequence getMessage() {
- return message;
- }
+ private CharSequence getMessage() {
+ return message;
+ }
- public void setMessage(CharSequence message) {
- this.message = message;
- }
+ public void setMessage(CharSequence message) {
+ this.message = message;
+ }
- private TextView getTV() {
- return tv;
- }
+ private TextView getTV() {
+ return tv;
+ }
- public void setTV(TextView tv) {
- this.tv = tv;
- }
+ public void setTV(TextView tv) {
+ this.tv = tv;
+ }
- private String getButtonPositive() {
- return buttonPositive;
- }
+ private String getButtonPositive() {
+ return buttonPositive;
+ }
- public void setButtonPositive(String buttonPositive) {
- this.buttonPositive = buttonPositive;
- }
+ public void setButtonPositive(String buttonPositive) {
+ this.buttonPositive = buttonPositive;
+ }
- private String getButtonNegative() {
- return buttonNegative;
- }
+ private String getButtonNegative() {
+ return buttonNegative;
+ }
- public void setButtonNegative(String buttonNegative) {
- this.buttonNegative = buttonNegative;
- }
+ public void setButtonNegative(String buttonNegative) {
+ this.buttonNegative = buttonNegative;
+ }
- private String getButtonNeutral() {
- return buttonNeutral;
- }
+ private String getButtonNeutral() {
+ return buttonNeutral;
+ }
- public void setButtonNeutral(String buttonNeutral) {
- this.buttonNeutral = buttonNeutral;
- }
+ public void setButtonNeutral(String buttonNeutral) {
+ this.buttonNeutral = buttonNeutral;
+ }
- public void setListener(DialogsCallback callback) {
- sCallback = callback;
- }
+ public void setListener(DialogsCallback callback) {
+ sCallback = callback;
+ }
- public void showAlert(final String source) {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- if (getIcon() != null) builder.setIcon(getIcon());
- if (getTitle() != null) builder.setTitle(getTitle());
- if (getMessage() != null) builder.setMessage(getMessage());
- if (getTV() != null) builder.setView(getTV());
- if (getButtonPositive() != null)
- builder.setPositiveButton(getButtonPositive(), (dialogInterface, i) -> {
- dialogInterface.dismiss();
- sCallback.onPositive(source);
- });
- if (getButtonNegative() != null)
- builder.setNegativeButton(getButtonNegative(), (dialogInterface, i) -> {
- dialogInterface.dismiss();
- sCallback.onNegative(source);
- });
- if (getButtonNeutral() != null)
- builder.setNeutralButton(getButtonNeutral(), (dialogInterface, i) -> {
- dialogInterface.dismiss();
- sCallback.onNeutral(source);
- });
- builder.setCancelable(false);
- final AlertDialog dialog = builder.create();
- if (!activity.isFinishing())
- dialog.show();
- }
+ public void showAlert(final String source) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ if (getIcon() != null) builder.setIcon(getIcon());
+ if (getTitle() != null) builder.setTitle(getTitle());
+ if (getMessage() != null) builder.setMessage(getMessage());
+ if (getTV() != null) builder.setView(getTV());
+ if (getButtonPositive() != null)
+ builder.setPositiveButton(getButtonPositive(), (dialogInterface, i) -> {
+ dialogInterface.dismiss();
+ sCallback.onPositive(source);
+ });
+ if (getButtonNegative() != null)
+ builder.setNegativeButton(getButtonNegative(), (dialogInterface, i) -> {
+ dialogInterface.dismiss();
+ sCallback.onNegative(source);
+ });
+ if (getButtonNeutral() != null)
+ builder.setNeutralButton(getButtonNeutral(), (dialogInterface, i) -> {
+ dialogInterface.dismiss();
+ sCallback.onNeutral(source);
+ });
+ builder.setCancelable(false);
+ final AlertDialog dialog = builder.create();
+ if (!activity.isFinishing())
+ dialog.show();
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/helpers/ApiLevelHelper.java b/build/android/app/src/main/java/com/multicraft/game/helpers/ApiLevelHelper.java
index 12605559..6c982b67 100644
--- a/build/android/app/src/main/java/com/multicraft/game/helpers/ApiLevelHelper.java
+++ b/build/android/app/src/main/java/com/multicraft/game/helpers/ApiLevelHelper.java
@@ -27,23 +27,23 @@ import static android.os.Build.VERSION_CODES.O;
import static android.os.Build.VERSION_CODES.Q;
public class ApiLevelHelper {
- public static boolean isGreaterOrEqual(int versionCode) {
- return SDK_INT >= versionCode;
- }
+ public static boolean isGreaterOrEqual(int versionCode) {
+ return SDK_INT >= versionCode;
+ }
- public static boolean isGreaterOrEqualKitkat() {
- return isGreaterOrEqual(KITKAT);
- }
+ public static boolean isGreaterOrEqualKitkat() {
+ return isGreaterOrEqual(KITKAT);
+ }
- public static boolean isGreaterOrEqualLollipop() {
- return isGreaterOrEqual(LOLLIPOP);
- }
+ public static boolean isGreaterOrEqualLollipop() {
+ return isGreaterOrEqual(LOLLIPOP);
+ }
- public static boolean isGreaterOrEqualOreo() {
- return isGreaterOrEqual(O);
- }
+ public static boolean isGreaterOrEqualOreo() {
+ return isGreaterOrEqual(O);
+ }
- public static boolean isGreaterOrEqualQ() {
- return isGreaterOrEqual(Q);
- }
+ public static boolean isGreaterOrEqualQ() {
+ return isGreaterOrEqual(Q);
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/helpers/PermissionHelper.java b/build/android/app/src/main/java/com/multicraft/game/helpers/PermissionHelper.java
index 626915f5..d22686e3 100644
--- a/build/android/app/src/main/java/com/multicraft/game/helpers/PermissionHelper.java
+++ b/build/android/app/src/main/java/com/multicraft/game/helpers/PermissionHelper.java
@@ -31,73 +31,65 @@ import com.tedpark.tedpermission.rx2.TedRx2Permission;
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
public class PermissionHelper {
- private final AppCompatActivity activity;
- private CallBackListener listener;
- private PreferencesHelper pf;
+ private final AppCompatActivity activity;
+ private CallBackListener listener;
+ private PreferencesHelper pf;
- public PermissionHelper(AppCompatActivity activity) {
- this.activity = activity;
- }
+ public PermissionHelper(AppCompatActivity activity) {
+ this.activity = activity;
+ }
- public void setListener(CallBackListener listener) {
- this.listener = listener;
- }
+ public void setListener(CallBackListener listener) {
+ this.listener = listener;
+ }
- public void askPermissions() {
- pf = PreferencesHelper.getInstance(activity);
- askStoragePermissions();
- }
+ public void askPermissions() {
+ pf = PreferencesHelper.getInstance(activity);
+ askStoragePermissions();
+ }
- // permission block
- @SuppressLint("CheckResult")
- private void askStoragePermissions() {
- TedRx2Permission.with(activity)
- .setPermissions(WRITE_EXTERNAL_STORAGE)
- .request()
- .subscribe(tedPermissionResult -> {
- if (tedPermissionResult.isGranted()) {
- listener.onEvent(true);
- } else {
- if (TedRx2Permission.canRequestPermission(activity, WRITE_EXTERNAL_STORAGE))
- askStorageRationalePermissions();
- else askStorageWhenDoNotShow();
- }
- });
- }
+ // permission block
+ @SuppressLint("CheckResult")
+ private void askStoragePermissions() {
+ TedRx2Permission.with(activity)
+ .setPermissions(WRITE_EXTERNAL_STORAGE)
+ .request()
+ .subscribe(tedPermissionResult -> {
+ if (tedPermissionResult.isGranted()) {
+ listener.onEvent(true);
+ } else {
+ if (TedRx2Permission.canRequestPermission(activity, WRITE_EXTERNAL_STORAGE))
+ askStorageRationalePermissions();
+ else askStorageWhenDoNotShow();
+ }
+ });
+ }
- // storage permissions block
- @SuppressLint("CheckResult")
- private void askStorageRationalePermissions() {
- TedRx2Permission.with(activity)
- .setRationaleMessage(R.string.explain)
- .setDeniedMessage(R.string.denied)
- .setDeniedCloseButtonText(R.string.close_game)
- .setGotoSettingButtonText(R.string.settings)
- .setPermissions(WRITE_EXTERNAL_STORAGE)
- .request()
- .subscribe(tedPermissionResult -> {
- if (tedPermissionResult.isGranted()) {
- listener.onEvent(true);
- } else {
- listener.onEvent(false);
- }
- });
- }
+ // storage permissions block
+ @SuppressLint("CheckResult")
+ private void askStorageRationalePermissions() {
+ TedRx2Permission.with(activity)
+ .setRationaleMessage(R.string.explain)
+ .setDeniedMessage(R.string.denied)
+ .setDeniedCloseButtonText(R.string.close_game)
+ .setGotoSettingButtonText(R.string.settings)
+ .setPermissions(WRITE_EXTERNAL_STORAGE)
+ .request()
+ .subscribe(tedPermissionResult -> {
+ listener.onEvent(tedPermissionResult.isGranted());
+ });
+ }
- @SuppressLint("CheckResult")
- private void askStorageWhenDoNotShow() {
- TedRx2Permission.with(activity)
- .setDeniedMessage(R.string.denied)
- .setDeniedCloseButtonText(R.string.close_game)
- .setGotoSettingButtonText(R.string.settings)
- .setPermissions(WRITE_EXTERNAL_STORAGE)
- .request()
- .subscribe(tedPermissionResult -> {
- if (tedPermissionResult.isGranted()) {
- listener.onEvent(true);
- } else {
- listener.onEvent(false);
- }
- });
- }
+ @SuppressLint("CheckResult")
+ private void askStorageWhenDoNotShow() {
+ TedRx2Permission.with(activity)
+ .setDeniedMessage(R.string.denied)
+ .setDeniedCloseButtonText(R.string.close_game)
+ .setGotoSettingButtonText(R.string.settings)
+ .setPermissions(WRITE_EXTERNAL_STORAGE)
+ .request()
+ .subscribe(tedPermissionResult -> {
+ listener.onEvent(tedPermissionResult.isGranted());
+ });
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/helpers/PreferencesHelper.java b/build/android/app/src/main/java/com/multicraft/game/helpers/PreferencesHelper.java
index 04830977..a40b188f 100644
--- a/build/android/app/src/main/java/com/multicraft/game/helpers/PreferencesHelper.java
+++ b/build/android/app/src/main/java/com/multicraft/game/helpers/PreferencesHelper.java
@@ -26,92 +26,92 @@ import android.content.SharedPreferences;
import com.multicraft.game.RemoteSettings;
public class PreferencesHelper {
- public static final String TAG_SHORTCUT_EXIST = "createShortcut";
- public static final String TAG_BUILD_NUMBER = "buildNumber";
- public static final String TAG_LAUNCH_TIMES = "launchTimes";
- public static final String TAG_CONSENT_ASKED = "consentAsked";
- public static final String TAG_COPY_OLD_WORLDS = "copyOldWorlds";
- public static final String IS_LOADED = "interstitialLoaded";
- public static final String RV_LOADED = "rewardedVideoLoaded";
- private static final String ADS_DELAY = "adsDelay";
- private static final String ADS_REPEAT = "adsRepeat";
- private static final String ADS_ENABLE = "adsEnable";
- private static final String SETTINGS = "MultiCraftSettings";
+ public static final String TAG_SHORTCUT_EXIST = "createShortcut";
+ public static final String TAG_BUILD_NUMBER = "buildNumber";
+ public static final String TAG_LAUNCH_TIMES = "launchTimes";
+ public static final String TAG_CONSENT_ASKED = "consentAsked";
+ public static final String TAG_COPY_OLD_WORLDS = "copyOldWorlds";
+ public static final String IS_LOADED = "interstitialLoaded";
+ public static final String RV_LOADED = "rewardedVideoLoaded";
+ private static final String ADS_DELAY = "adsDelay";
+ private static final String ADS_REPEAT = "adsRepeat";
+ private static final String ADS_ENABLE = "adsEnable";
+ private static final String SETTINGS = "MultiCraftSettings";
- private static PreferencesHelper instance;
- private static SharedPreferences sharedPreferences;
+ private static PreferencesHelper instance;
+ private static SharedPreferences sharedPreferences;
- private PreferencesHelper(Context context) {
- sharedPreferences = context.getSharedPreferences(SETTINGS, Context.MODE_PRIVATE);
- }
+ private PreferencesHelper(Context context) {
+ sharedPreferences = context.getSharedPreferences(SETTINGS, Context.MODE_PRIVATE);
+ }
- public static PreferencesHelper getInstance(Context context) {
- if (instance == null) {
- synchronized (PreferencesHelper.class) {
- if (instance == null)
- instance = new PreferencesHelper(context.getApplicationContext());
- }
- }
- return instance;
- }
+ public static PreferencesHelper getInstance(Context context) {
+ if (instance == null) {
+ synchronized (PreferencesHelper.class) {
+ if (instance == null)
+ instance = new PreferencesHelper(context.getApplicationContext());
+ }
+ }
+ return instance;
+ }
- public boolean isCreateShortcut() {
- return sharedPreferences.getBoolean(TAG_SHORTCUT_EXIST, false);
- }
+ public boolean isCreateShortcut() {
+ return sharedPreferences.getBoolean(TAG_SHORTCUT_EXIST, false);
+ }
- public boolean isInterstitialLoaded() {
- return sharedPreferences.getBoolean(IS_LOADED, false);
- }
+ public boolean isInterstitialLoaded() {
+ return sharedPreferences.getBoolean(IS_LOADED, false);
+ }
- public boolean isVideoLoaded() {
- return sharedPreferences.getBoolean(RV_LOADED, false);
- }
+ public boolean isVideoLoaded() {
+ return sharedPreferences.getBoolean(RV_LOADED, false);
+ }
- public boolean isAskConsent() {
- return sharedPreferences.getBoolean(TAG_CONSENT_ASKED, true);
- }
+ public boolean isAskConsent() {
+ return sharedPreferences.getBoolean(TAG_CONSENT_ASKED, true);
+ }
- public boolean isWorldsCopied() {
- return sharedPreferences.getBoolean(TAG_COPY_OLD_WORLDS, false);
- }
+ public boolean isWorldsCopied() {
+ return sharedPreferences.getBoolean(TAG_COPY_OLD_WORLDS, false);
+ }
- public String getBuildNumber() {
- return sharedPreferences.getString(TAG_BUILD_NUMBER, "0");
- }
+ public String getBuildNumber() {
+ return sharedPreferences.getString(TAG_BUILD_NUMBER, "0");
+ }
- public int getLaunchTimes() {
- return sharedPreferences.getInt(TAG_LAUNCH_TIMES, 0);
- }
+ public int getLaunchTimes() {
+ return sharedPreferences.getInt(TAG_LAUNCH_TIMES, 0);
+ }
- public int getAdsDelay() {
- return sharedPreferences.getInt(ADS_DELAY, 600);
- }
+ public int getAdsDelay() {
+ return sharedPreferences.getInt(ADS_DELAY, 600);
+ }
- public int getAdsRepeat() {
- return sharedPreferences.getInt(ADS_REPEAT, 900);
- }
+ public int getAdsRepeat() {
+ return sharedPreferences.getInt(ADS_REPEAT, 900);
+ }
- public boolean isAdsEnable() {
- return sharedPreferences.getBoolean(ADS_ENABLE, true);
- }
+ public boolean isAdsEnable() {
+ return sharedPreferences.getBoolean(ADS_ENABLE, true);
+ }
- public void saveSettings(String tag, boolean bool) {
- sharedPreferences.edit().putBoolean(tag, bool).apply();
- }
+ public void saveSettings(String tag, boolean bool) {
+ sharedPreferences.edit().putBoolean(tag, bool).apply();
+ }
- public void saveSettings(String tag, String value) {
- sharedPreferences.edit().putString(tag, value).apply();
- }
+ public void saveSettings(String tag, String value) {
+ sharedPreferences.edit().putString(tag, value).apply();
+ }
- public void saveSettings(String tag, int value) {
- sharedPreferences.edit().putInt(tag, value).apply();
- }
+ public void saveSettings(String tag, int value) {
+ sharedPreferences.edit().putInt(tag, value).apply();
+ }
- public void saveAdsSettings(RemoteSettings remoteSettings) {
- int delay = remoteSettings.getAdsDelay();
- int repeat = remoteSettings.getAdsRepeat();
- if (delay != -1) saveSettings(ADS_DELAY, delay);
- if (repeat != -1) saveSettings(ADS_REPEAT, repeat);
- saveSettings(ADS_ENABLE, remoteSettings.isAdsEnabled());
- }
+ public void saveAdsSettings(RemoteSettings remoteSettings) {
+ int delay = remoteSettings.getAdsDelay();
+ int repeat = remoteSettings.getAdsRepeat();
+ if (delay != -1) saveSettings(ADS_DELAY, delay);
+ if (repeat != -1) saveSettings(ADS_REPEAT, repeat);
+ saveSettings(ADS_ENABLE, remoteSettings.isAdsEnabled());
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/helpers/Utilities.java b/build/android/app/src/main/java/com/multicraft/game/helpers/Utilities.java
index 048722ce..e493d569 100644
--- a/build/android/app/src/main/java/com/multicraft/game/helpers/Utilities.java
+++ b/build/android/app/src/main/java/com/multicraft/game/helpers/Utilities.java
@@ -47,79 +47,79 @@ import static com.multicraft.game.helpers.ApiLevelHelper.isGreaterOrEqualKitkat;
import static com.multicraft.game.helpers.PreferencesHelper.TAG_SHORTCUT_EXIST;
public class Utilities {
- private static final String appPackage = BuildConfig.APPLICATION_ID;
+ private static final String appPackage = BuildConfig.APPLICATION_ID;
- private static boolean isInternetAvailable(String url) {
- try {
- HttpURLConnection urlc =
- (HttpURLConnection) new URL(url).openConnection();
- urlc.setRequestProperty("Connection", "close");
- urlc.setConnectTimeout(2000);
- urlc.connect();
- int ResponseCode = urlc.getResponseCode();
- return ResponseCode == HttpURLConnection.HTTP_NO_CONTENT ||
- ResponseCode == HttpURLConnection.HTTP_OK;
- } catch (IOException e) {
- return false;
- }
- }
+ private static boolean isInternetAvailable(String url) {
+ try {
+ HttpURLConnection urlc =
+ (HttpURLConnection) new URL(url).openConnection();
+ urlc.setRequestProperty("Connection", "close");
+ urlc.setConnectTimeout(2000);
+ urlc.connect();
+ int ResponseCode = urlc.getResponseCode();
+ return ResponseCode == HttpURLConnection.HTTP_NO_CONTENT ||
+ ResponseCode == HttpURLConnection.HTTP_OK;
+ } catch (IOException e) {
+ return false;
+ }
+ }
- public static boolean isReachable() {
- return isInternetAvailable("http://clients3.google.com/generate_204") ||
- isInternetAvailable("http://servers.multicraft.world");
- }
+ public static boolean isReachable() {
+ return isInternetAvailable("http://clients3.google.com/generate_204") ||
+ isInternetAvailable("http://servers.multicraft.world");
+ }
- public static boolean deleteFiles(List files) {
- boolean result = true;
- for (String f : files) {
- File file = new File(f);
- if (file.exists()) {
- result = result && FileUtils.deleteQuietly(file);
- }
- }
- return result;
- }
+ public static boolean deleteFiles(List files) {
+ boolean result = true;
+ for (String f : files) {
+ File file = new File(f);
+ if (file.exists()) {
+ result = result && FileUtils.deleteQuietly(file);
+ }
+ }
+ return result;
+ }
- public static String getStoreUrl() {
- String store = "market://details?id=";
- return store + appPackage;
- }
+ public static String getStoreUrl() {
+ String store = "market://details?id=";
+ return store + appPackage;
+ }
- public static void makeFullScreen(Activity activity) {
- if (isGreaterOrEqualKitkat())
- activity.getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
- View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
- View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
- }
+ public static void makeFullScreen(Activity activity) {
+ if (isGreaterOrEqualKitkat())
+ activity.getWindow().getDecorView().setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
+ View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
+ View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
+ }
- public static Drawable getIcon(Activity activity) {
- try {
- return activity.getPackageManager().getApplicationIcon(activity.getPackageName());
- } catch (PackageManager.NameNotFoundException e) {
- Bugsnag.notify(e);
- return activity.getResources().getDrawable(R.mipmap.ic_launcher);
- }
- }
+ public static Drawable getIcon(Activity activity) {
+ try {
+ return activity.getPackageManager().getApplicationIcon(activity.getPackageName());
+ } catch (PackageManager.NameNotFoundException e) {
+ Bugsnag.notify(e);
+ return activity.getResources().getDrawable(R.mipmap.ic_launcher);
+ }
+ }
- public static void addShortcut(Activity activity) {
- ActivityManager activityManager =
- (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
- int size = 0;
- if (activityManager != null)
- size = activityManager.getLauncherLargeIconSize();
- Bitmap shortcutIconBitmap = ((BitmapDrawable) getIcon(activity)).getBitmap();
- if (shortcutIconBitmap.getWidth() < size)
- shortcutIconBitmap = Bitmap.createScaledBitmap(shortcutIconBitmap, size, size, true);
- PreferencesHelper.getInstance(activity).saveSettings(TAG_SHORTCUT_EXIST, true);
- Intent shortcutIntent = new Intent(activity, MainActivity.class);
- shortcutIntent.setAction(Intent.ACTION_MAIN);
- Intent addIntent = new Intent();
- addIntent.putExtra("duplicate", false);
- addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
- addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, activity.getResources().getString(R.string.app_name));
- addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, shortcutIconBitmap);
- addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
- activity.sendBroadcast(addIntent);
- }
+ public static void addShortcut(Activity activity) {
+ ActivityManager activityManager =
+ (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
+ int size = 0;
+ if (activityManager != null)
+ size = activityManager.getLauncherLargeIconSize();
+ Bitmap shortcutIconBitmap = ((BitmapDrawable) getIcon(activity)).getBitmap();
+ if (shortcutIconBitmap.getWidth() < size)
+ shortcutIconBitmap = Bitmap.createScaledBitmap(shortcutIconBitmap, size, size, true);
+ PreferencesHelper.getInstance(activity).saveSettings(TAG_SHORTCUT_EXIST, true);
+ Intent shortcutIntent = new Intent(activity, MainActivity.class);
+ shortcutIntent.setAction(Intent.ACTION_MAIN);
+ Intent addIntent = new Intent();
+ addIntent.putExtra("duplicate", false);
+ addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
+ addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, activity.getResources().getString(R.string.app_name));
+ addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, shortcutIconBitmap);
+ addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
+ activity.sendBroadcast(addIntent);
+ }
}
diff --git a/build/android/app/src/main/java/com/multicraft/game/helpers/VersionManagerHelper.java b/build/android/app/src/main/java/com/multicraft/game/helpers/VersionManagerHelper.java
index 71104fcb..9d176304 100644
--- a/build/android/app/src/main/java/com/multicraft/game/helpers/VersionManagerHelper.java
+++ b/build/android/app/src/main/java/com/multicraft/game/helpers/VersionManagerHelper.java
@@ -53,155 +53,155 @@ import static com.multicraft.game.MainActivity.UPDATE_LINK;
import static com.multicraft.game.helpers.Utilities.getStoreUrl;
public class VersionManagerHelper {
- private static final String JSON_VERSION_CODE = "version_code";
- private static final String JSON_VERSION_CODE_BAD = "version_code_bad";
- private static final String JSON_PACKAGE = "package";
- private static final String JSON_CONTENT_RU = "content_ru";
- private static final String JSON_CONTENT_EN = "content_en";
- private static final String JSON_ADS_DELAY = "ads_delay";
- private static final String JSON_ADS_REPEAT = "ads_repeat";
- private static final String JSON_ADS_ENABLE = "ads_enable";
- private final CustomTagHandler customTagHandler;
- private final String PREF_REMINDER_TIME = "w.reminder.time";
- private final AppCompatActivity activity;
- private final int versionCode = BuildConfig.VERSION_CODE;
- private String message, updateUrl;
+ private static final String JSON_VERSION_CODE = "version_code";
+ private static final String JSON_VERSION_CODE_BAD = "version_code_bad";
+ private static final String JSON_PACKAGE = "package";
+ private static final String JSON_CONTENT_RU = "content_ru";
+ private static final String JSON_CONTENT_EN = "content_en";
+ private static final String JSON_ADS_DELAY = "ads_delay";
+ private static final String JSON_ADS_REPEAT = "ads_repeat";
+ private static final String JSON_ADS_ENABLE = "ads_enable";
+ private final CustomTagHandler customTagHandler;
+ private final String PREF_REMINDER_TIME = "w.reminder.time";
+ private final AppCompatActivity activity;
+ private final int versionCode = BuildConfig.VERSION_CODE;
+ private String message, updateUrl;
- public VersionManagerHelper(AppCompatActivity act) {
- this.activity = act;
- this.customTagHandler = new CustomTagHandler();
- }
+ public VersionManagerHelper(AppCompatActivity act) {
+ this.activity = act;
+ this.customTagHandler = new CustomTagHandler();
+ }
- public boolean isCheckVersion() {
- long currentTimeStamp = Calendar.getInstance().getTimeInMillis();
- long reminderTimeStamp = getReminderTime();
- return currentTimeStamp > reminderTimeStamp;
- }
+ public boolean isCheckVersion() {
+ long currentTimeStamp = Calendar.getInstance().getTimeInMillis();
+ long reminderTimeStamp = getReminderTime();
+ return currentTimeStamp > reminderTimeStamp;
+ }
- private boolean isBadVersion(List badVersions) {
- return badVersions.contains(versionCode);
- }
+ private boolean isBadVersion(List badVersions) {
+ return badVersions.contains(versionCode);
+ }
- private List convertToList(JSONArray badVersions) throws JSONException {
- List badVersionList = new ArrayList<>();
- if (badVersions != null) {
- for (int i = 0; i < badVersions.length(); i++)
- badVersionList.add(badVersions.getInt(i));
- }
- return badVersionList;
- }
+ private List convertToList(JSONArray badVersions) throws JSONException {
+ List badVersionList = new ArrayList<>();
+ if (badVersions != null) {
+ for (int i = 0; i < badVersions.length(); i++)
+ badVersionList.add(badVersions.getInt(i));
+ }
+ return badVersionList;
+ }
- private RemoteSettings parseJson(String result) throws JSONException {
- RemoteSettings remoteSettings = new RemoteSettings();
- PreferencesHelper pf = PreferencesHelper.getInstance(activity);
- if (!result.startsWith("{")) // for response who append with unknown char
- result = result.substring(1);
- String mResult = result;
- // json format from server:
- JSONObject json = new JSONObject(new JSONTokener(mResult));
- remoteSettings.setVersionCode(json.getInt(JSON_VERSION_CODE));
- remoteSettings.setBadVersionCodes(convertToList(json.getJSONArray(JSON_VERSION_CODE_BAD)));
- String lang = Locale.getDefault().getLanguage();
- String content = lang.equals("ru") ? JSON_CONTENT_RU : JSON_CONTENT_EN;
- remoteSettings.setContent(json.getString(content));
- setMessage(remoteSettings.getContent());
- remoteSettings.setPackageName(json.getString(JSON_PACKAGE));
- setUpdateUrl("market://details?id=" + remoteSettings.getPackageName());
- remoteSettings.setAdsDelay(json.getInt(JSON_ADS_DELAY));
- remoteSettings.setAdsRepeat(json.getInt(JSON_ADS_REPEAT));
- remoteSettings.setAdsEnabled(json.getBoolean(JSON_ADS_ENABLE));
- pf.saveAdsSettings(remoteSettings);
- return remoteSettings;
- }
+ private RemoteSettings parseJson(String result) throws JSONException {
+ RemoteSettings remoteSettings = new RemoteSettings();
+ PreferencesHelper pf = PreferencesHelper.getInstance(activity);
+ if (!result.startsWith("{")) // for response who append with unknown char
+ result = result.substring(1);
+ String mResult = result;
+ // json format from server:
+ JSONObject json = new JSONObject(new JSONTokener(mResult));
+ remoteSettings.setVersionCode(json.getInt(JSON_VERSION_CODE));
+ remoteSettings.setBadVersionCodes(convertToList(json.getJSONArray(JSON_VERSION_CODE_BAD)));
+ String lang = Locale.getDefault().getLanguage();
+ String content = lang.equals("ru") ? JSON_CONTENT_RU : JSON_CONTENT_EN;
+ remoteSettings.setContent(json.getString(content));
+ setMessage(remoteSettings.getContent());
+ remoteSettings.setPackageName(json.getString(JSON_PACKAGE));
+ setUpdateUrl("market://details?id=" + remoteSettings.getPackageName());
+ remoteSettings.setAdsDelay(json.getInt(JSON_ADS_DELAY));
+ remoteSettings.setAdsRepeat(json.getInt(JSON_ADS_REPEAT));
+ remoteSettings.setAdsEnabled(json.getBoolean(JSON_ADS_ENABLE));
+ pf.saveAdsSettings(remoteSettings);
+ return remoteSettings;
+ }
- public boolean isShow(String result) {
- if (result.equals("{}")) return false;
- RemoteSettings remoteSettings;
- try {
- remoteSettings = parseJson(result);
- } catch (JSONException e) {
- return false;
- }
- return (versionCode < remoteSettings.getVersionCode()) ||
- isBadVersion(remoteSettings.getBadVersionCodes());
- }
+ public boolean isShow(String result) {
+ if (result.equals("{}")) return false;
+ RemoteSettings remoteSettings;
+ try {
+ remoteSettings = parseJson(result);
+ } catch (JSONException e) {
+ return false;
+ }
+ return (versionCode < remoteSettings.getVersionCode()) ||
+ isBadVersion(remoteSettings.getBadVersionCodes());
+ }
- public String getJson() {
- OkHttpClient client = new OkHttpClient.Builder()
- .callTimeout(3000, TimeUnit.MILLISECONDS)
- .build();
- Request request = new Request.Builder()
- .url(UPDATE_LINK)
- .build();
- try {
- Response response = client.newCall(request).execute();
- return response.body().string();
- } catch (IOException | NullPointerException e) {
- // nothing
- }
- return "{}";
- }
+ public String getJson() {
+ OkHttpClient client = new OkHttpClient.Builder()
+ .callTimeout(3000, TimeUnit.MILLISECONDS)
+ .build();
+ Request request = new Request.Builder()
+ .url(UPDATE_LINK)
+ .build();
+ try {
+ Response response = client.newCall(request).execute();
+ return response.body().string();
+ } catch (IOException | NullPointerException e) {
+ // nothing
+ }
+ return "{}";
+ }
- public String getMessage() {
- String defaultMessage = "What's new?";
- return message != null ? message : defaultMessage;
- }
+ public String getMessage() {
+ String defaultMessage = "What's new?";
+ return message != null ? message : defaultMessage;
+ }
- private void setMessage(String message) {
- this.message = message;
- }
+ private void setMessage(String message) {
+ this.message = message;
+ }
- public String getUpdateUrl() {
- return updateUrl != null ? updateUrl : getStoreUrl();
- }
+ public String getUpdateUrl() {
+ return updateUrl != null ? updateUrl : getStoreUrl();
+ }
- private void setUpdateUrl(String updateUrl) {
- this.updateUrl = updateUrl;
- }
+ private void setUpdateUrl(String updateUrl) {
+ this.updateUrl = updateUrl;
+ }
- public void updateNow(String url) {
- if (url != null) {
- try {
- Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
- activity.startActivity(intent);
- } catch (Exception e) {
- Bugsnag.notify(e);
- }
- }
- }
+ public void updateNow(String url) {
+ if (url != null) {
+ try {
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ activity.startActivity(intent);
+ } catch (Exception e) {
+ Bugsnag.notify(e);
+ }
+ }
+ }
- public void remindMeLater() {
- Calendar c = Calendar.getInstance();
- c.add(Calendar.MINUTE, 1);
- long reminderTimeStamp = c.getTimeInMillis();
- setReminderTime(reminderTimeStamp);
- }
+ public void remindMeLater() {
+ Calendar c = Calendar.getInstance();
+ c.add(Calendar.MINUTE, 1);
+ long reminderTimeStamp = c.getTimeInMillis();
+ setReminderTime(reminderTimeStamp);
+ }
- private long getReminderTime() {
- return PreferenceManager.getDefaultSharedPreferences(activity).getLong(
- PREF_REMINDER_TIME, 0);
- }
+ private long getReminderTime() {
+ return PreferenceManager.getDefaultSharedPreferences(activity).getLong(
+ PREF_REMINDER_TIME, 0);
+ }
- private void setReminderTime(long reminderTimeStamp) {
- PreferenceManager.getDefaultSharedPreferences(activity).edit().putLong(
- PREF_REMINDER_TIME, reminderTimeStamp).apply();
- }
+ private void setReminderTime(long reminderTimeStamp) {
+ PreferenceManager.getDefaultSharedPreferences(activity).edit().putLong(
+ PREF_REMINDER_TIME, reminderTimeStamp).apply();
+ }
- public CustomTagHandler getCustomTagHandler() {
- return customTagHandler;
- }
+ public CustomTagHandler getCustomTagHandler() {
+ return customTagHandler;
+ }
- private static class CustomTagHandler implements Html.TagHandler {
- @Override
- public void handleTag(boolean opening, String tag, Editable output,
- XMLReader xmlReader) {
- // you may add more tag handler which are not supported by android here
- if ("li".equals(tag)) {
- if (opening)
- output.append(" \u2022 ");
- else
- output.append("\n");
- }
- }
- }
+ private static class CustomTagHandler implements Html.TagHandler {
+ @Override
+ public void handleTag(boolean opening, String tag, Editable output,
+ XMLReader xmlReader) {
+ // you may add more tag handler which are not supported by android here
+ if ("li".equals(tag)) {
+ if (opening)
+ output.append(" \u2022 ");
+ else
+ output.append("\n");
+ }
+ }
+ }
}
diff --git a/build/android/app/src/main/res/drawable/bg.xml b/build/android/app/src/main/res/drawable/bg.xml
index 493e9f57..903335ed 100644
--- a/build/android/app/src/main/res/drawable/bg.xml
+++ b/build/android/app/src/main/res/drawable/bg.xml
@@ -1,4 +1,4 @@
+ android:src="@drawable/background"
+ android:tileMode="repeat" />
diff --git a/build/android/app/src/main/res/drawable/custom_dialog_rounded.xml b/build/android/app/src/main/res/drawable/custom_dialog_rounded.xml
index 620a5e15..f5e0ff00 100644
--- a/build/android/app/src/main/res/drawable/custom_dialog_rounded.xml
+++ b/build/android/app/src/main/res/drawable/custom_dialog_rounded.xml
@@ -1,6 +1,6 @@
-
-
+ android:shape="rectangle">
+
+
diff --git a/build/android/app/src/main/res/drawable/custom_edittext_rounded.xml b/build/android/app/src/main/res/drawable/custom_edittext_rounded.xml
index 7052bbf9..d72c5785 100644
--- a/build/android/app/src/main/res/drawable/custom_edittext_rounded.xml
+++ b/build/android/app/src/main/res/drawable/custom_edittext_rounded.xml
@@ -1,10 +1,10 @@
- -
-
-
-
-
-
-
-
+ -
+
+
+
+
+
+
+
diff --git a/build/android/app/src/main/res/drawable/custom_progress_bar.xml b/build/android/app/src/main/res/drawable/custom_progress_bar.xml
index 357c4dec..bc8e7053 100644
--- a/build/android/app/src/main/res/drawable/custom_progress_bar.xml
+++ b/build/android/app/src/main/res/drawable/custom_progress_bar.xml
@@ -1,27 +1,27 @@
- -
-
-
-
-
-
-
-
+ -
+
+
+
+
+
+
+
- -
-
-
-
-
-
-
+ -
+
+
+
+
+
+
diff --git a/build/android/app/src/main/res/drawable/ic_launcher_background.xml b/build/android/app/src/main/res/drawable/ic_launcher_background.xml
index 0d025f9b..fe5102ec 100644
--- a/build/android/app/src/main/res/drawable/ic_launcher_background.xml
+++ b/build/android/app/src/main/res/drawable/ic_launcher_background.xml
@@ -1,170 +1,170 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="108"
+ android:viewportHeight="108">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/android/app/src/main/res/layout/activity_main.xml b/build/android/app/src/main/res/layout/activity_main.xml
index f4b3e485..1f364d80 100644
--- a/build/android/app/src/main/res/layout/activity_main.xml
+++ b/build/android/app/src/main/res/layout/activity_main.xml
@@ -1,37 +1,37 @@
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
-
+
-
+
-
+
diff --git a/build/android/app/src/main/res/layout/rate_dialog.xml b/build/android/app/src/main/res/layout/rate_dialog.xml
index bf258fe1..e0515207 100644
--- a/build/android/app/src/main/res/layout/rate_dialog.xml
+++ b/build/android/app/src/main/res/layout/rate_dialog.xml
@@ -1,50 +1,50 @@
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="10dp">
-
+
-
+
-
+
-
+
diff --git a/build/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/build/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index 00f9eaaf..110fbe9e 100644
--- a/build/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/build/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,5 +1,5 @@
-
-
-
\ No newline at end of file
+
+
+
diff --git a/build/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/build/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
index 00f9eaaf..110fbe9e 100644
--- a/build/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ b/build/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -1,5 +1,5 @@
-
-
-
\ No newline at end of file
+
+
+
diff --git a/build/android/app/src/main/res/mipmap-hdpi-v26/ic_launcher_round.png b/build/android/app/src/main/res/mipmap-hdpi-v26/ic_launcher_round.png
deleted file mode 100644
index eac9c502..00000000
Binary files a/build/android/app/src/main/res/mipmap-hdpi-v26/ic_launcher_round.png and /dev/null differ
diff --git a/build/android/app/src/main/res/mipmap-mdpi-v26/ic_launcher_foreground.png b/build/android/app/src/main/res/mipmap-mdpi-v26/ic_launcher_foreground.png
deleted file mode 100644
index 38b71ef8..00000000
Binary files a/build/android/app/src/main/res/mipmap-mdpi-v26/ic_launcher_foreground.png and /dev/null differ
diff --git a/build/android/app/src/main/res/mipmap-mdpi-v26/ic_launcher_round.png b/build/android/app/src/main/res/mipmap-mdpi-v26/ic_launcher_round.png
deleted file mode 100644
index ad7b3618..00000000
Binary files a/build/android/app/src/main/res/mipmap-mdpi-v26/ic_launcher_round.png and /dev/null differ
diff --git a/build/android/app/src/main/res/mipmap-xhdpi-v26/ic_launcher_round.png b/build/android/app/src/main/res/mipmap-xhdpi-v26/ic_launcher_round.png
deleted file mode 100644
index ec628b22..00000000
Binary files a/build/android/app/src/main/res/mipmap-xhdpi-v26/ic_launcher_round.png and /dev/null differ
diff --git a/build/android/app/src/main/res/mipmap-xxhdpi-v26/ic_launcher_round.png b/build/android/app/src/main/res/mipmap-xxhdpi-v26/ic_launcher_round.png
deleted file mode 100644
index 88e5ea12..00000000
Binary files a/build/android/app/src/main/res/mipmap-xxhdpi-v26/ic_launcher_round.png and /dev/null differ
diff --git a/build/android/app/src/main/res/mipmap-xxxhdpi-v26/ic_launcher_round.png b/build/android/app/src/main/res/mipmap-xxxhdpi-v26/ic_launcher_round.png
deleted file mode 100644
index 1751f099..00000000
Binary files a/build/android/app/src/main/res/mipmap-xxxhdpi-v26/ic_launcher_round.png and /dev/null differ
diff --git a/build/android/app/src/main/res/values-ru/strings.xml b/build/android/app/src/main/res/values-ru/strings.xml
index 4ab3cc2a..806ed0f6 100644
--- a/build/android/app/src/main/res/values-ru/strings.xml
+++ b/build/android/app/src/main/res/values-ru/strings.xml
@@ -1,42 +1,42 @@
-
- Подготовка к запуску…
- Загрузка…
- Загрузка… %d%%
- Загрузка новой версии…
- Загрузка новой версии… %d%%
- Загрузка MultiCraft
- Осталось меньше минуты…
- Произошла ошибка, игра будет перезапущена автоматически
- Недостаточно места для записи файлов игры, пожалуйста освободите место в памяти
+
+ Подготовка к запуску…
+ Загрузка…
+ Загрузка… %d%%
+ Загрузка новой версии…
+ Загрузка новой версии… %d%%
+ Загрузка MultiCraft
+ Осталось меньше минуты…
+ Произошла ошибка, игра будет перезапущена автоматически
+ Недостаточно места для записи файлов игры, пожалуйста освободите место в памяти
-
- Разрешение на запись необходимо для распаковки текстур и игровых файлов.
- Доступ к местоположению обеспечивает Вам лучшее взаимодействие с игрой
- Закрыть игру
- Настройки
- Вы не можете играть в MultiCraft без разрешения на запись.\nПожалуйста, включите его в [Настройки] -> [Разрешения]>
+
+ Разрешение на запись необходимо для распаковки текстур и игровых файлов.
+ Доступ к местоположению обеспечивает Вам лучшее взаимодействие с игрой
+ Закрыть игру
+ Настройки
+ Вы не можете играть в MultiCraft без разрешения на запись.\nПожалуйста, включите его в [Настройки] -> [Разрешения]>
-
- Оцените MultiCraft!
- Поделитесь впечатлениями
- ОЦЕНИТЬ
- Нам жаль, что Вам не понравилась игра!
- Пожалуйста, оставьте отзыв для нас. Спасибо!
+
+ Оцените MultiCraft!
+ Поделитесь впечатлениями
+ ОЦЕНИТЬ
+ Нам жаль, что Вам не понравилась игра!
+ Пожалуйста, оставьте отзыв для нас. Спасибо!
-
- Доступна Новая Версия!
- Игнорировать
- Позже
- Обновить
+
+ Доступна Новая Версия!
+ Игнорировать
+ Позже
+ Обновить
-
- Для полноценной игры, MultiCraft требует подключение к интернету.\nВ противном случае невозможно обновление игры, а так же не доступен мультиплеер!
- 3G/4G
+
+ Для полноценной игры, MultiCraft требует подключение к интернету.\nВ противном случае невозможно обновление игры, а так же не доступен мультиплеер!
+ 3G/4G
-
- Удалить старую версию MultiCraft?
+
+ Удалить старую версию MultiCraft?
diff --git a/build/android/app/src/main/res/values/strings.xml b/build/android/app/src/main/res/values/strings.xml
index 11c52421..4424f45d 100644
--- a/build/android/app/src/main/res/values/strings.xml
+++ b/build/android/app/src/main/res/values/strings.xml
@@ -1,51 +1,52 @@
- MultiCraft
+ MultiCraft
-
- Preparing to launch…
- Loading…
- Loading… %d%%
- Downloading new version…
- Downloading new version… %d%%
- Loading MultiCraft
- Less than 1 minute…
- Unexpected issue, the game will be restarted automatically
- No space left for game files, please free space in the memory
+
+ Preparing to launch…
+ Loading…
+ Loading… %d%%
+ Downloading new version…
+ Downloading new version… %d%%
+ Loading MultiCraft
+ Less than 1 minute…
+ Unexpected issue, the game will be restarted automatically
+ No space left for game files, please free space in the memory
+ OK
-
- Storage permissions is necessary to unpack textures and game data.
- Location permission provide you better interaction with game
- Close game
- App settings
- You cannot play MultiCraft without storage permission.\nPlease turn on it at [Settings] -> [Permissions]>
+
+ Storage permissions is necessary to unpack textures and game data.
+ Location permission provide you better interaction with game
+ Close game
+ App settings
+ You cannot play MultiCraft without storage permission.\nPlease turn on it at [Settings] -> [Permissions]>
-
- Please, rate MultiCraft!
- Describe your experience
- SUBMIT
- We are sorry that you did not like the game!
- Please leave a review for us. Thank you!
+
+ Please, rate MultiCraft!
+ Describe your experience
+ SUBMIT
+ We are sorry that you did not like the game!
+ Please leave a review for us. Thank you!
-
- New Version Available!
- Update
- Later
- Ignore
+
+ New Version Available!
+ Update
+ Later
+ Ignore
-
- MultiCraft requires an internet connection to use all game features.\nOtherwise, you will not get updates and multiplayer will be not available!
- Wi-Fi
- Mobile Data
+
+ MultiCraft requires an internet connection to use all game features.\nOtherwise, you will not get updates and multiplayer will be not available!
+ Wi-Fi
+ Mobile Data
-
- Uninstall an old version of MultiCraft?
+
+ Uninstall an old version of MultiCraft?
-
- We care about your privacy and data security. We keep this app free by showing ads.\nCan we continue to use your data to tailor ads for you?\n\nOur partners will collect data and use a unique identifier on your device to show you ads. By agreeing, you confirm that you are 16 years old. You can learn how we and our partners collect and use data on Privacy Policy.
- Yes, I allow
- No
-
+
+ We care about your privacy and data security. We keep this app free by showing ads.\nCan we continue to use your data to tailor ads for you?\n\nOur partners will collect data and use a unique identifier on your device to show you ads. By agreeing, you confirm that you are 16 years old. You can learn how we and our partners collect and use data on Privacy Policy.
+ Yes, I allow
+ No
+
diff --git a/build/android/app/src/main/res/values/styles.xml b/build/android/app/src/main/res/values/styles.xml
index 51b76f78..c4c29def 100644
--- a/build/android/app/src/main/res/values/styles.xml
+++ b/build/android/app/src/main/res/values/styles.xml
@@ -1,23 +1,23 @@
-
+
-
+
-
+
diff --git a/build/android/app/src/main/res/xml/backup_rules.xml b/build/android/app/src/main/res/xml/backup_rules.xml
index 63d873f8..0c018f5c 100644
--- a/build/android/app/src/main/res/xml/backup_rules.xml
+++ b/build/android/app/src/main/res/xml/backup_rules.xml
@@ -1,12 +1,12 @@
-
-
-
+
+
+
diff --git a/build/android/app/src/main/res/xml/network_security_config.xml b/build/android/app/src/main/res/xml/network_security_config.xml
index 258fcf22..8501de96 100644
--- a/build/android/app/src/main/res/xml/network_security_config.xml
+++ b/build/android/app/src/main/res/xml/network_security_config.xml
@@ -1,12 +1,12 @@
-
-
-
-
-
-
-
- 127.0.0.1
-
+
+
+
+
+
+
+
+ 127.0.0.1
+