Android: spaces => tabs

This commit is contained in:
MoNTE48 2020-10-04 20:16:21 +02:00
parent 9b82dbd2cc
commit f45bba820a
38 changed files with 1716 additions and 1724 deletions

View File

@ -1,78 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.multicraft.game"
android:installLocation="auto">
xmlns:tools="http://schemas.android.com/tools"
package="com.multicraft.game"
android:installLocation="auto">
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:node="replace" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:node="replace" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.hardware.wifi"
android:required="false" />
<uses-feature
android:name="android.hardware.wifi"
android:required="false" />
<supports-screens
android:largeScreens="true"
android:xlargeScreens="true" />
<supports-screens
android:largeScreens="true"
android:xlargeScreens="true" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:resizeableActivity="false"
android:roundIcon="@mipmap/ic_launcher_round"
tools:ignore="UnusedAttribute">
<application
android:name=".MyApplication"
android:allowBackup="true"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:resizeableActivity="false"
android:roundIcon="@mipmap/ic_launcher_round"
tools:ignore="UnusedAttribute">
<meta-data
android:name="android.max_aspect"
android:value="3.0" />
<meta-data
android:name="android.max_aspect"
android:value="3.0" />
<activity
android:name="com.multicraft.game.MainActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:maxAspectRatio="3.0"
android:screenOrientation="sensorLandscape"
android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.multicraft.game.MainActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:maxAspectRatio="3.0"
android:screenOrientation="sensorLandscape"
android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.multicraft.game.GameActivity"
android:configChanges="orientation|keyboard|keyboardHidden|navigation|screenSize|smallestScreenSize"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:maxAspectRatio="3.0"
android:screenOrientation="sensorLandscape"
android:theme="@style/AppTheme">
<meta-data
android:name="android.app.lib_name"
android:value="MultiCraft" />
<activity
android:name="com.multicraft.game.GameActivity"
android:configChanges="orientation|keyboard|keyboardHidden|navigation|screenSize|smallestScreenSize"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:maxAspectRatio="3.0"
android:screenOrientation="sensorLandscape"
android:theme="@style/AppTheme">
<meta-data
android:name="android.app.lib_name"
android:value="MultiCraft" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<service
android:name="com.multicraft.game.UnzipService"
android:enabled="true"
android:exported="false" />
</application>
<service
android:name="com.multicraft.game.UnzipService"
android:enabled="true"
android:exported="false" />
</application>
</manifest>

View File

@ -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");
}
}

View File

@ -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
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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<String, String> 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<String> 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<String, String> 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<String> 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<String> 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<String> 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();
}
}
}

View File

@ -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);
}
}

View File

@ -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<AppCompatActivity> activityRef = null;
private static WeakReference<AppCompatActivity> 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());
}
}

View File

@ -23,66 +23,66 @@ package com.multicraft.game;
import java.util.List;
public class RemoteSettings {
private int versionCode = 0;
private List<Integer> badVersionCodes;
private String packageName, content;
private int adsDelay = -1;
private int adsRepeat = -1;
private boolean adsEnabled = true;
private int versionCode = 0;
private List<Integer> 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<Integer> getBadVersionCodes() {
return badVersionCodes;
}
public List<Integer> getBadVersionCodes() {
return badVersionCodes;
}
public void setBadVersionCodes(List<Integer> badVersionCodes) {
this.badVersionCodes = badVersionCodes;
}
public void setBadVersionCodes(List<Integer> 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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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();
}
}

View File

@ -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);
}
}

View File

@ -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());
});
}
}

View File

@ -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());
}
}

View File

@ -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<String> 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<String> 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);
}
}

View File

@ -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<Integer> badVersions) {
return badVersions.contains(versionCode);
}
private boolean isBadVersion(List<Integer> badVersions) {
return badVersions.contains(versionCode);
}
private List<Integer> convertToList(JSONArray badVersions) throws JSONException {
List<Integer> badVersionList = new ArrayList<>();
if (badVersions != null) {
for (int i = 0; i < badVersions.length(); i++)
badVersionList.add(badVersions.getInt(i));
}
return badVersionList;
}
private List<Integer> convertToList(JSONArray badVersions) throws JSONException {
List<Integer> 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");
}
}
}
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/background"
android:tileMode="repeat" />
android:src="@drawable/background"
android:tileMode="repeat" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:radius="12dp" />
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:radius="12dp" />
</shape>

View File

@ -1,10 +1,10 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
<corners android:radius="8dp" />
<padding android:left="8dp" />
<stroke android:width="2dp" android:color="#59000000" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
<corners android:radius="8dp" />
<padding android:left="8dp" />
<stroke android:width="2dp" android:color="#59000000" />
</shape>
</item>
</selector>

View File

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<stroke
android:width="2.5dp"
android:color="#000000" />
<padding
android:bottom="3dp"
android:left="3dp"
android:right="3dp"
android:top="3dp" />
<corners android:radius="40dip" />
<gradient
android:endColor="#6a6a6a"
android:startColor="#6a6a6a" />
</shape>
</item>
<item>
<shape>
<stroke
android:width="2.5dp"
android:color="#000000" />
<padding
android:bottom="3dp"
android:left="3dp"
android:right="3dp"
android:top="3dp" />
<corners android:radius="40dip" />
<gradient
android:endColor="#6a6a6a"
android:startColor="#6a6a6a" />
</shape>
</item>
<item>
<clip>
<shape>
<corners android:radius="40dip" />
</shape>
</clip>
</item>
<item>
<clip>
<shape>
<corners android:radius="40dip" />
</shape>
</clip>
</item>
</layer-list>

View File

@ -1,170 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@ -1,37 +1,37 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/PB1"
style="@style/CustomProgressBar"
android:layout_width="400dp"
android:layout_height="45dp"
android:layout_centerInParent="true"
android:layout_marginLeft="120dp"
android:layout_marginRight="120dp"
android:indeterminate="false"
android:max="100"
android:visibility="gone" />
<ProgressBar
android:id="@+id/PB1"
style="@style/CustomProgressBar"
android:layout_width="400dp"
android:layout_height="45dp"
android:layout_centerInParent="true"
android:layout_marginLeft="120dp"
android:layout_marginRight="120dp"
android:indeterminate="false"
android:max="100"
android:visibility="gone" />
<ProgressBar
android:id="@+id/PB2"
style="Widget.AppCompat.ProgressBar"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_centerInParent="true"
android:indeterminate="true"
android:visibility="gone" />
<ProgressBar
android:id="@+id/PB2"
style="Widget.AppCompat.ProgressBar"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_centerInParent="true"
android:indeterminate="true"
android:visibility="gone" />
<TextView
android:id="@+id/tv_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/PB2"
android:layout_centerInParent="true"
android:text="@string/loading"
android:textColor="#fefefe"
android:textSize="14sp"
android:visibility="gone" />
<TextView
android:id="@+id/tv_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/PB2"
android:layout_centerInParent="true"
android:text="@string/loading"
android:textColor="#fefefe"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>

View File

@ -1,50 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/ratingTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/rate_dialog_title"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/ratingTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/rate_dialog_title"
android:textSize="20sp"
android:textStyle="bold" />
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:numStars="5"
android:stepSize="1" />
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:numStars="5"
android:stepSize="1" />
<EditText
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:background="@drawable/custom_edittext_rounded"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:hint="@string/rate_description"
android:importantForAutofill="no"
android:inputType="text"
android:textSize="14sp" />
<EditText
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:background="@drawable/custom_edittext_rounded"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:hint="@string/rate_description"
android:importantForAutofill="no"
android:inputType="text"
android:textSize="14sp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="5dp"
android:background="@android:color/transparent"
android:enabled="false"
android:text="@string/rate_submit"
android:textColor="#008c80"
android:textStyle="bold" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="5dp"
android:background="@android:color/transparent"
android:enabled="false"
android:text="@string/rate_submit"
android:textColor="#008c80"
android:textStyle="bold" />
</LinearLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

View File

@ -1,42 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- подготовка к запуску -->
<string name="preparing">Подготовка к запуску&#8230;</string>
<string name="loading">Загрузка&#8230;</string>
<string name="loadingp">Загрузка&#8230; %d%%</string>
<string name="downloading">Загрузка новой версии&#8230;</string>
<string name="downloadingp">Загрузка новой версии&#8230; %d%%</string>
<string name="notification_title">Загрузка MultiCraft</string>
<string name="notification_description">Осталось меньше минуты&#8230;</string>
<string name="restart">Произошла ошибка, игра будет перезапущена автоматически</string>
<string name="no_space">Недостаточно места для записи файлов игры, пожалуйста освободите место в памяти</string>
<!-- подготовка к запуску -->
<string name="preparing">Подготовка к запуску&#8230;</string>
<string name="loading">Загрузка&#8230;</string>
<string name="loadingp">Загрузка&#8230; %d%%</string>
<string name="downloading">Загрузка новой версии&#8230;</string>
<string name="downloadingp">Загрузка новой версии&#8230; %d%%</string>
<string name="notification_title">Загрузка MultiCraft</string>
<string name="notification_description">Осталось меньше минуты&#8230;</string>
<string name="restart">Произошла ошибка, игра будет перезапущена автоматически</string>
<string name="no_space">Недостаточно места для записи файлов игры, пожалуйста освободите место в памяти</string>
<!-- разрешения -->
<string name="explain">Разрешение на запись необходимо для распаковки текстур и игровых файлов.</string>
<string name="location">Доступ к местоположению обеспечивает Вам лучшее взаимодействие с игрой</string>
<string name="close_game">Закрыть игру</string>
<string name="settings">Настройки</string>
<string name="denied">Вы не можете играть в MultiCraft без разрешения на запись.\nПожалуйста, включите его в [Настройки] -> [Разрешения]></string>
<!-- разрешения -->
<string name="explain">Разрешение на запись необходимо для распаковки текстур и игровых файлов.</string>
<string name="location">Доступ к местоположению обеспечивает Вам лучшее взаимодействие с игрой</string>
<string name="close_game">Закрыть игру</string>
<string name="settings">Настройки</string>
<string name="denied">Вы не можете играть в MultiCraft без разрешения на запись.\nПожалуйста, включите его в [Настройки] -> [Разрешения]></string>
<!-- диалог оценки -->
<string name="rate_dialog_title">Оцените MultiCraft!</string>
<string name="rate_description">Поделитесь впечатлениями</string>
<string name="rate_submit">ОЦЕНИТЬ</string>
<string name="sad">Нам жаль, что Вам не понравилась игра!</string>
<string name="thank">Пожалуйста, оставьте отзыв для нас. Спасибо!</string>
<!-- диалог оценки -->
<string name="rate_dialog_title">Оцените MultiCraft!</string>
<string name="rate_description">Поделитесь впечатлениями</string>
<string name="rate_submit">ОЦЕНИТЬ</string>
<string name="sad">Нам жаль, что Вам не понравилась игра!</string>
<string name="thank">Пожалуйста, оставьте отзыв для нас. Спасибо!</string>
<!-- диалог обновления -->
<string name="available">Доступна Новая Версия!</string>
<string name="ignore">Игнорировать</string>
<string name="later">Позже</string>
<string name="update">Обновить</string>
<!-- диалог обновления -->
<string name="available">Доступна Новая Версия!</string>
<string name="ignore">Игнорировать</string>
<string name="later">Позже</string>
<string name="update">Обновить</string>
<!-- диалог отсутствия подключения -->
<string name="conn_message">Для полноценной игры, MultiCraft требует подключение к интернету.\nВ противном случае невозможно обновление игры, а так же не доступен мультиплеер!</string>
<string name="conn_mobile">3G/4G</string>
<!-- диалог отсутствия подключения -->
<string name="conn_message">Для полноценной игры, MultiCraft требует подключение к интернету.\nВ противном случае невозможно обновление игры, а так же не доступен мультиплеер!</string>
<string name="conn_mobile">3G/4G</string>
<!-- диалог удаления старой версии -->
<string name="del_message">Удалить старую версию MultiCraft?</string>
<!-- диалог удаления старой версии -->
<string name="del_message">Удалить старую версию MultiCraft?</string>
</resources>

View File

@ -1,51 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">MultiCraft</string>
<string name="app_name" translatable="false">MultiCraft</string>
<!-- preparation for start -->
<string name="preparing">Preparing to launch&#8230;</string>
<string name="loading">Loading&#8230;</string>
<string name="loadingp">Loading&#8230; %d%%</string>
<string name="downloading">Downloading new version&#8230;</string>
<string name="downloadingp">Downloading new version&#8230; %d%%</string>
<string name="notification_title">Loading MultiCraft</string>
<string name="notification_description">Less than 1 minute&#8230;</string>
<string name="restart">Unexpected issue, the game will be restarted automatically</string>
<string name="no_space">No space left for game files, please free space in the memory</string>
<!-- preparation for start -->
<string name="preparing">Preparing to launch&#8230;</string>
<string name="loading">Loading&#8230;</string>
<string name="loadingp">Loading&#8230; %d%%</string>
<string name="downloading">Downloading new version&#8230;</string>
<string name="downloadingp">Downloading new version&#8230; %d%%</string>
<string name="notification_title">Loading MultiCraft</string>
<string name="notification_description">Less than 1 minute&#8230;</string>
<string name="restart">Unexpected issue, the game will be restarted automatically</string>
<string name="no_space">No space left for game files, please free space in the memory</string>
<string name="ok" translatable="false">OK</string>
<!-- permission block -->
<string name="explain">Storage permissions is necessary to unpack textures and game data.</string>
<string name="location">Location permission provide you better interaction with game</string>
<string name="close_game">Close game</string>
<string name="settings">App settings</string>
<string name="denied">You cannot play MultiCraft without storage permission.\nPlease turn on it at [Settings] -> [Permissions]></string>
<!-- permission block -->
<string name="explain">Storage permissions is necessary to unpack textures and game data.</string>
<string name="location">Location permission provide you better interaction with game</string>
<string name="close_game">Close game</string>
<string name="settings">App settings</string>
<string name="denied">You cannot play MultiCraft without storage permission.\nPlease turn on it at [Settings] -> [Permissions]></string>
<!-- rate dialog -->
<string name="rate_dialog_title">Please, rate MultiCraft!</string>
<string name="rate_description">Describe your experience</string>
<string name="rate_submit">SUBMIT</string>
<string name="sad">We are sorry that you did not like the game!</string>
<string name="thank">Please leave a review for us. Thank you!</string>
<!-- rate dialog -->
<string name="rate_dialog_title">Please, rate MultiCraft!</string>
<string name="rate_description">Describe your experience</string>
<string name="rate_submit">SUBMIT</string>
<string name="sad">We are sorry that you did not like the game!</string>
<string name="thank">Please leave a review for us. Thank you!</string>
<!-- update dialog -->
<string name="available">New Version Available!</string>
<string name="update">Update</string>
<string name="later">Later</string>
<string name="ignore">Ignore</string>
<!-- update dialog -->
<string name="available">New Version Available!</string>
<string name="update">Update</string>
<string name="later">Later</string>
<string name="ignore">Ignore</string>
<!-- no connection dialog -->
<string name="conn_message">MultiCraft requires an internet connection to use all game features.\nOtherwise, you will not get updates and multiplayer will be not available!</string>
<string name="conn_wifi" translatable="false">Wi-Fi</string>
<string name="conn_mobile">Mobile Data</string>
<!-- no connection dialog -->
<string name="conn_message">MultiCraft requires an internet connection to use all game features.\nOtherwise, you will not get updates and multiplayer will be not available!</string>
<string name="conn_wifi" translatable="false">Wi-Fi</string>
<string name="conn_mobile">Mobile Data</string>
<!-- uninstall old version dialog -->
<string name="del_message">Uninstall an old version of MultiCraft?</string>
<!-- uninstall old version dialog -->
<string name="del_message">Uninstall an old version of MultiCraft?</string>
<!-- GDPR -->
<string name="gdpr_main_text" translatable="false"><b>We care about your privacy and data security. We keep this app free by showing ads.\n<big>Can we continue to use your data to tailor ads for you?</big></b>\n\n<small>Our 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 <a href="https://www.appodeal.com/privacy-policy">Privacy Policy</a>.</small></string>
<string name="gdpr_agree" translatable="false">Yes, I allow</string>
<string name="gdpr_disagree" translatable="false">No</string>
<string name="empty" translatable="false" />
<!-- GDPR -->
<string name="gdpr_main_text" translatable="false"><b>We care about your privacy and data security. We keep this app free by showing ads.\n<big>Can we continue to use your data to tailor ads for you?</big></b>\n\n<small>Our 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 <a href="https://www.appodeal.com/privacy-policy">Privacy Policy</a>.</small></string>
<string name="gdpr_agree" translatable="false">Yes, I allow</string>
<string name="gdpr_disagree" translatable="false">No</string>
<string name="empty" translatable="false" />
</resources>

View File

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="android:windowBackground">@drawable/bg</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="p">shortEdges
</item>
<item name="android:fontFamily">@font/retron2000</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="android:windowBackground">@drawable/bg</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="p">shortEdges
</item>
<item name="android:fontFamily">@font/retron2000</item>
</style>
<style name="RateMe" parent="Theme.AppCompat.Light.Dialog">
<item name="colorControlActivated">#008c80</item>
<item name="android:windowBackground">@drawable/custom_dialog_rounded</item>
</style>
<style name="RateMe" parent="Theme.AppCompat.Light.Dialog">
<item name="colorControlActivated">#008c80</item>
<item name="android:windowBackground">@drawable/custom_dialog_rounded</item>
</style>
<style name="CustomProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/custom_progress_bar</item>
</style>
<style name="CustomProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/custom_progress_bar</item>
</style>
</resources>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<exclude
domain="sharedpref"
path="MultiCraftSettings.xml" />
<exclude
domain="sharedpref"
path="RateMe.xml" />
<exclude
domain="sharedpref"
path="com.multicraft.game_preferences.xml" />
<exclude
domain="sharedpref"
path="MultiCraftSettings.xml" />
<exclude
domain="sharedpref"
path="RateMe.xml" />
<exclude
domain="sharedpref"
path="com.multicraft.game_preferences.xml" />
</full-backup-content>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">127.0.0.1</domain>
</domain-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">127.0.0.1</domain>
</domain-config>
</network-security-config>