Actualize java part
This commit is contained in:
parent
ba6a27e137
commit
91e89fb7d3
@ -2,7 +2,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="mobi.MultiCraft"
|
package="mobi.MultiCraft"
|
||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
android:versionCode="20"
|
android:versionCode="25"
|
||||||
android:versionName="@string/ver">
|
android:versionName="@string/ver">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
@ -9,6 +9,7 @@ import android.view.WindowManager;
|
|||||||
|
|
||||||
public class GameActivity extends NativeActivity {
|
public class GameActivity extends NativeActivity {
|
||||||
static {
|
static {
|
||||||
|
System.loadLibrary("gnustl_shared");
|
||||||
System.loadLibrary("multicraft");
|
System.loadLibrary("multicraft");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +66,7 @@ public class GameActivity extends NativeActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == 101) {
|
if (requestCode == 101) {
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
|
@ -10,6 +10,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -28,27 +29,38 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||||
|
import static mobi.MultiCraft.PermissionManager.permissionsRejected;
|
||||||
|
import static mobi.MultiCraft.PermissionManager.permissionsToRequest;
|
||||||
import static mobi.MultiCraft.PreferencesHelper.TAG_BUILD_NUMBER;
|
import static mobi.MultiCraft.PreferencesHelper.TAG_BUILD_NUMBER;
|
||||||
|
import static mobi.MultiCraft.PreferencesHelper.TAG_LAUNCH_TIMES;
|
||||||
import static mobi.MultiCraft.PreferencesHelper.TAG_SHORTCUT_CREATED;
|
import static mobi.MultiCraft.PreferencesHelper.TAG_SHORTCUT_CREATED;
|
||||||
import static mobi.MultiCraft.PreferencesHelper.getBuildNumber;
|
import static mobi.MultiCraft.PreferencesHelper.getBuildNumber;
|
||||||
|
import static mobi.MultiCraft.PreferencesHelper.getLaunchTimes;
|
||||||
import static mobi.MultiCraft.PreferencesHelper.isCreateShortcut;
|
import static mobi.MultiCraft.PreferencesHelper.isCreateShortcut;
|
||||||
import static mobi.MultiCraft.PreferencesHelper.loadSettings;
|
import static mobi.MultiCraft.PreferencesHelper.loadSettings;
|
||||||
import static mobi.MultiCraft.PreferencesHelper.saveSettings;
|
import static mobi.MultiCraft.PreferencesHelper.saveSettings;
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
public class MainActivity extends Activity implements WVersionManager.ActivityListener {
|
||||||
|
private final static int COARSE_LOCATION_RESULT = 100;
|
||||||
|
private final static int WRITE_EXTERNAL_RESULT = 101;
|
||||||
|
private final static int ALL_PERMISSIONS_RESULT = 102;
|
||||||
|
|
||||||
public final static String TAG = "Error";
|
public final static String TAG = "Error";
|
||||||
public final static String CREATE_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT";
|
public final static String CREATE_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT";
|
||||||
public final static String FILES = Environment.getExternalStorageDirectory() + "/Files.zip";
|
public final static String FILES = Environment.getExternalStorageDirectory() + "/Files.zip";
|
||||||
public final static String WORLDS = Environment.getExternalStorageDirectory() + "/worlds.zip";
|
public final static String WORLDS = Environment.getExternalStorageDirectory() + "/worlds.zip";
|
||||||
public final static String GAMES = Environment.getExternalStorageDirectory() + "/games.zip";
|
public final static String GAMES = Environment.getExternalStorageDirectory() + "/games.zip";
|
||||||
public final static String NOMEDIA = ".nomedia";
|
public final static String NOMEDIA = ".nomedia";
|
||||||
private final static int REQUEST_STORAGE = 0;
|
|
||||||
private ProgressDialog mProgressDialog;
|
private ProgressDialog mProgressDialog;
|
||||||
private String dataFolder = "/Android/data/mobi.MultiCraft/files/";
|
private String dataFolder = "/Android/data/mobi.MultiCraft/files/";
|
||||||
private String unzipLocation = Environment.getExternalStorageDirectory() + dataFolder;
|
private String unzipLocation = Environment.getExternalStorageDirectory() + dataFolder;
|
||||||
private ProgressBar mProgressBar;
|
private ProgressBar mProgressBar;
|
||||||
private Utilities util;
|
private Utilities util;
|
||||||
|
private WVersionManager versionManager = null;
|
||||||
|
private PermissionManager pm = null;
|
||||||
private BroadcastReceiver myReceiver = new BroadcastReceiver() {
|
private BroadcastReceiver myReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@ -75,14 +87,52 @@ public class MainActivity extends Activity {
|
|||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int i = getLaunchTimes();
|
||||||
|
i++;
|
||||||
if (ActivityCompat.checkSelfPermission(this,
|
saveSettings(TAG_LAUNCH_TIMES, i);
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
pm = new PermissionManager(this);
|
||||||
requestStoragePermission();
|
String[] permList = pm.requestPermissions();
|
||||||
|
if (permList.length > 0) {
|
||||||
|
ActivityCompat.requestPermissions(this, permList, ALL_PERMISSIONS_RESULT);
|
||||||
} else {
|
} else {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void isShowUpdateDialog(boolean flag) {
|
||||||
|
if (flag) {
|
||||||
|
versionManager.showDialog();
|
||||||
|
versionManager.setCallback(new WVersionManager.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onPositive() {
|
||||||
|
versionManager.updateNow(versionManager.getUpdateUrl());
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNegative() {
|
||||||
|
versionManager.ignoreThisVersion();
|
||||||
|
checkRateDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemind() {
|
||||||
|
versionManager.remindMeLater(versionManager.getReminderTimer());
|
||||||
|
checkRateDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
checkRateDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkNewVersion() {
|
||||||
|
versionManager = new WVersionManager(this);
|
||||||
|
versionManager.setVersionContentUrl("http://pastebin.com/raw/aeM2bmSB");
|
||||||
|
versionManager.checkVersion();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void makeFullScreen() {
|
public void makeFullScreen() {
|
||||||
@ -134,16 +184,22 @@ public class MainActivity extends Activity {
|
|||||||
mProgressBar = (ProgressBar) findViewById(R.id.PB1);
|
mProgressBar = (ProgressBar) findViewById(R.id.PB1);
|
||||||
Drawable draw;
|
Drawable draw;
|
||||||
draw = getResources().getDrawable(R.drawable.custom_progress_bar);
|
draw = getResources().getDrawable(R.drawable.custom_progress_bar);
|
||||||
|
mProgressBar.setVisibility(View.VISIBLE);
|
||||||
mProgressBar.setProgressDrawable(draw);
|
mProgressBar.setProgressDrawable(draw);
|
||||||
util = new Utilities();
|
util = new Utilities();
|
||||||
util.createDataFolder();
|
util.createDataFolder();
|
||||||
util.checkVersion();
|
util.checkVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isNetworkConnected() {
|
||||||
|
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
return cm.getActiveNetworkInfo() != null;
|
||||||
|
}
|
||||||
|
|
||||||
private void requestPermissionAfterExplain() {
|
private void requestPermissionAfterExplain() {
|
||||||
Toast.makeText(this, R.string.explain, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, R.string.explain, Toast.LENGTH_LONG).show();
|
||||||
ActivityCompat.requestPermissions(MainActivity.this,
|
ActivityCompat.requestPermissions(MainActivity.this,
|
||||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE);
|
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, WRITE_EXTERNAL_RESULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void requestStoragePermission() {
|
private void requestStoragePermission() {
|
||||||
@ -151,20 +207,39 @@ public class MainActivity extends Activity {
|
|||||||
requestPermissionAfterExplain();
|
requestPermissionAfterExplain();
|
||||||
} else {
|
} else {
|
||||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||||
REQUEST_STORAGE);
|
WRITE_EXTERNAL_RESULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||||
@NonNull int[] grantResults) {
|
@NonNull int[] grantResults) {
|
||||||
|
switch (requestCode) {
|
||||||
// Check if the only required permission has been granted
|
case WRITE_EXTERNAL_RESULT:
|
||||||
if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
init();
|
init();
|
||||||
} else {
|
} else {
|
||||||
requestStoragePermission();
|
requestStoragePermission();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case COARSE_LOCATION_RESULT:
|
||||||
|
break;
|
||||||
|
case ALL_PERMISSIONS_RESULT:
|
||||||
|
for (String perms : permissionsToRequest) {
|
||||||
|
if (!pm.hasPermission(perms)) {
|
||||||
|
permissionsRejected.add(perms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (permissionsRejected.size() == 0) {
|
||||||
|
init();
|
||||||
|
} else if (!Arrays.asList(permissionsRejected.toArray()).contains(WRITE_EXTERNAL_STORAGE)) {
|
||||||
|
Toast.makeText(this, R.string.location, Toast.LENGTH_SHORT).show();
|
||||||
|
init();
|
||||||
|
} else {
|
||||||
|
requestStoragePermission();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSpinnerDialog(int message) {
|
private void showSpinnerDialog(int message) {
|
||||||
@ -183,10 +258,7 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runGame() {
|
private void checkRateDialog() {
|
||||||
util.deleteZip(FILES);
|
|
||||||
util.deleteZip(WORLDS);
|
|
||||||
util.deleteZip(GAMES);
|
|
||||||
if (RateMe.shouldShowRateDialog()) {
|
if (RateMe.shouldShowRateDialog()) {
|
||||||
hideViews();
|
hideViews();
|
||||||
RateMe.showRateDialog(this);
|
RateMe.showRateDialog(this);
|
||||||
@ -212,6 +284,17 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void runGame() {
|
||||||
|
util.deleteZip(FILES);
|
||||||
|
util.deleteZip(WORLDS);
|
||||||
|
util.deleteZip(GAMES);
|
||||||
|
if (isNetworkConnected()) {
|
||||||
|
checkNewVersion();
|
||||||
|
} else {
|
||||||
|
startGameActivity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void hideViews() {
|
private void hideViews() {
|
||||||
mProgressBar.setVisibility(View.GONE);
|
mProgressBar.setVisibility(View.GONE);
|
||||||
findViewById(R.id.imageView).setVisibility(View.GONE);
|
findViewById(R.id.imageView).setVisibility(View.GONE);
|
||||||
@ -358,7 +441,7 @@ public class MainActivity extends Activity {
|
|||||||
return availableSpace / SIZE_MB;
|
return availableSpace / SIZE_MB;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkVersion() {
|
void checkVersion() {
|
||||||
if (getBuildNumber().equals(getString(R.string.ver))) {
|
if (getBuildNumber().equals(getString(R.string.ver))) {
|
||||||
runGame();
|
runGame();
|
||||||
} else if (getBuildNumber().equals("0")) {
|
} else if (getBuildNumber().equals("0")) {
|
||||||
@ -383,7 +466,7 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createNomedia() {
|
void createNomedia() {
|
||||||
File myFile = new File(unzipLocation, NOMEDIA);
|
File myFile = new File(unzipLocation, NOMEDIA);
|
||||||
if (!myFile.exists())
|
if (!myFile.exists())
|
||||||
try {
|
try {
|
||||||
|
@ -0,0 +1,84 @@
|
|||||||
|
package mobi.MultiCraft;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v4.app.ActivityCompat;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
|
||||||
|
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||||
|
import static mobi.MultiCraft.PreferencesHelper.getLaunchTimes;
|
||||||
|
|
||||||
|
class PermissionManager {
|
||||||
|
private Activity activity;
|
||||||
|
private SharedPreferences sharedPreferences;
|
||||||
|
static ArrayList<String> permissionsToRequest;
|
||||||
|
static ArrayList<String> permissionsRejected;
|
||||||
|
|
||||||
|
PermissionManager(Activity activity) {
|
||||||
|
this.activity = activity;
|
||||||
|
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] requestPermissions() {
|
||||||
|
ArrayList<String> permissions = new ArrayList<>();
|
||||||
|
permissions.add(WRITE_EXTERNAL_STORAGE);
|
||||||
|
if (getLaunchTimes() > 2) {
|
||||||
|
permissions.add(ACCESS_COARSE_LOCATION);
|
||||||
|
}
|
||||||
|
//filter out the permissions we have already accepted
|
||||||
|
permissionsToRequest = findUnAskedPermissions(permissions);
|
||||||
|
//get the permissions we have asked for before but are not granted..
|
||||||
|
//we will store this in a global list to access later.
|
||||||
|
permissionsRejected = findRejectedPermissions(permissions);
|
||||||
|
if (permissionsToRequest.size() > 0) {//we need to ask for permissions
|
||||||
|
for (String perm : permissionsToRequest) {
|
||||||
|
markAsAsked(perm);
|
||||||
|
}
|
||||||
|
return permissionsToRequest.toArray(new String[permissionsToRequest.size()]);
|
||||||
|
} else if (permissionsRejected.size() > 0 && getLaunchTimes() % 3 == 0) {
|
||||||
|
return permissionsRejected.toArray(new String[permissionsRejected.size()]);
|
||||||
|
}
|
||||||
|
return new String[]{};
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean hasPermission(String permission) {
|
||||||
|
return (ActivityCompat.checkSelfPermission(activity, permission) == PackageManager.PERMISSION_GRANTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean shouldWeAsk(String permission) {
|
||||||
|
return sharedPreferences.getBoolean(permission, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void markAsAsked(String permission) {
|
||||||
|
sharedPreferences.edit().putBoolean(permission, false).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<String> findUnAskedPermissions(ArrayList<String> wanted) {
|
||||||
|
ArrayList<String> result = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String perm : wanted) {
|
||||||
|
if (!hasPermission(perm) && shouldWeAsk(perm)) {
|
||||||
|
result.add(perm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<String> findRejectedPermissions(ArrayList<String> wanted) {
|
||||||
|
ArrayList<String> result = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String perm : wanted) {
|
||||||
|
if (!hasPermission(perm) && !shouldWeAsk(perm)) {
|
||||||
|
result.add(perm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,38 +3,42 @@ package mobi.MultiCraft;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
public class PreferencesHelper {
|
class PreferencesHelper {
|
||||||
public static final String SETTINGS = "settings";
|
private static final String SETTINGS = "settings";
|
||||||
public static final String TAG_SHORTCUT_CREATED = "createShortcut";
|
static final String TAG_SHORTCUT_CREATED = "createShortcut";
|
||||||
public static final String TAG_BUILD_NUMBER = "buildNumber";
|
static final String TAG_BUILD_NUMBER = "buildNumber";
|
||||||
|
static final String TAG_LAUNCH_TIMES = "launchTimes";
|
||||||
private static boolean createShortcut;
|
private static boolean createShortcut;
|
||||||
private static String buildNumber;
|
private static String buildNumber;
|
||||||
private static SharedPreferences settings;
|
private static SharedPreferences settings;
|
||||||
|
|
||||||
public static boolean isCreateShortcut() {
|
static boolean isCreateShortcut() {
|
||||||
return createShortcut;
|
return createShortcut;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getBuildNumber() {
|
static String getBuildNumber() {
|
||||||
return buildNumber;
|
return buildNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadSettings(final Context context) {
|
static void loadSettings(final Context context) {
|
||||||
settings = context.getSharedPreferences(SETTINGS, Context.MODE_PRIVATE);
|
settings = context.getSharedPreferences(SETTINGS, Context.MODE_PRIVATE);
|
||||||
createShortcut = settings.getBoolean(TAG_SHORTCUT_CREATED, true);
|
createShortcut = settings.getBoolean(TAG_SHORTCUT_CREATED, true);
|
||||||
buildNumber = settings.getString(TAG_BUILD_NUMBER, "0");
|
buildNumber = settings.getString(TAG_BUILD_NUMBER, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveSettings(String tag, boolean bool) {
|
static void saveSettings(String tag, boolean bool) {
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
settings.edit().putBoolean(tag, bool).apply();
|
||||||
editor.putBoolean(tag, bool);
|
|
||||||
editor.apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveSettings(String tag, String value) {
|
static int getLaunchTimes() {
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
return settings.getInt(TAG_LAUNCH_TIMES, 0);
|
||||||
editor.putString(tag, value);
|
|
||||||
editor.apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void saveSettings(String tag, String value) {
|
||||||
|
settings.edit().putString(tag, value).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void saveSettings(String tag, int value) {
|
||||||
|
settings.edit().putInt(tag, value).apply();
|
||||||
|
}
|
||||||
}
|
}
|
@ -16,11 +16,11 @@ import android.widget.RatingBar;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class RateMe {
|
class RateMe {
|
||||||
|
|
||||||
public static final int INSTALL_DAYS = 3;
|
private static final int INSTALL_DAYS = 3;
|
||||||
public static final int LAUNCH_TIMES = 3;
|
private static final int LAUNCH_TIMES = 2;
|
||||||
public static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
private static final String TAG = RateMe.class.getSimpleName();
|
private static final String TAG = RateMe.class.getSimpleName();
|
||||||
private static final String GOOGLE_PLAY = "https://play.google.com/store/apps/details?id=";
|
private static final String GOOGLE_PLAY = "https://play.google.com/store/apps/details?id=";
|
||||||
private static final String PREF_NAME = "RateMe";
|
private static final String PREF_NAME = "RateMe";
|
||||||
@ -32,11 +32,11 @@ public class RateMe {
|
|||||||
private static boolean mOptOut = false;
|
private static boolean mOptOut = false;
|
||||||
private static Callback sCallback = null;
|
private static Callback sCallback = null;
|
||||||
|
|
||||||
public static void setCallback(Callback callback) {
|
static void setCallback(Callback callback) {
|
||||||
sCallback = callback;
|
sCallback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onStart(Context context) {
|
static void onStart(Context context) {
|
||||||
SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
|
SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
|
||||||
Editor editor = pref.edit();
|
Editor editor = pref.edit();
|
||||||
// If it is the first launch, save the date in shared preference.
|
// If it is the first launch, save the date in shared preference.
|
||||||
@ -57,7 +57,7 @@ public class RateMe {
|
|||||||
printStatus();
|
printStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean shouldShowRateDialog() {
|
static boolean shouldShowRateDialog() {
|
||||||
if (mOptOut) {
|
if (mOptOut) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -69,7 +69,7 @@ public class RateMe {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showRateDialog(final Context context) {
|
static void showRateDialog(final Context context) {
|
||||||
final Dialog dialog = new Dialog(context, R.style.DialogTheme);
|
final Dialog dialog = new Dialog(context, R.style.DialogTheme);
|
||||||
dialog.setCanceledOnTouchOutside(false);
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
if (Build.VERSION.SDK_INT >= 19) {
|
if (Build.VERSION.SDK_INT >= 19) {
|
||||||
@ -115,10 +115,6 @@ public class RateMe {
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void stopRateDialog(final Context context) {
|
|
||||||
setOptOut(context, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void clearSharedPreferences(Context context) {
|
private static void clearSharedPreferences(Context context) {
|
||||||
SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
|
SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
|
||||||
Editor editor = pref.edit();
|
Editor editor = pref.edit();
|
||||||
@ -163,7 +159,7 @@ public class RateMe {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Callback {
|
interface Callback {
|
||||||
void onPositive();
|
void onPositive();
|
||||||
|
|
||||||
void onNegative();
|
void onNegative();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package mobi.MultiCraft;
|
package mobi.MultiCraft;
|
||||||
|
|
||||||
public class Transliteration {
|
class Transliteration {
|
||||||
|
|
||||||
private static final String[] CHAR_TABLE = new String[81];
|
private static final String[] CHAR_TABLE = new String[81];
|
||||||
private static final char START_CHAR = 'Ё';
|
private static final char START_CHAR = 'Ё';
|
||||||
@ -55,7 +55,7 @@ public class Transliteration {
|
|||||||
* каждая русская буква будет заменена на соответствующую английскую.
|
* каждая русская буква будет заменена на соответствующую английскую.
|
||||||
* Не русские символы останутся прежними.
|
* Не русские символы останутся прежними.
|
||||||
*/
|
*/
|
||||||
public static String toLatin(String text) {
|
static String toLatin(String text) {
|
||||||
char charBuffer[] = text.toCharArray();
|
char charBuffer[] = text.toCharArray();
|
||||||
StringBuilder sb = new StringBuilder(text.length());
|
StringBuilder sb = new StringBuilder(text.length());
|
||||||
for (char symbol : charBuffer) {
|
for (char symbol : charBuffer) {
|
||||||
|
408
build/android/src/main/java/mobi/MultiCraft/WVersionManager.java
Normal file
408
build/android/src/main/java/mobi/MultiCraft/WVersionManager.java
Normal file
@ -0,0 +1,408 @@
|
|||||||
|
package mobi.MultiCraft;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.ContextThemeWrapper;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.json.JSONTokener;
|
||||||
|
import org.xml.sax.XMLReader;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.ProtocolException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
class WVersionManager {
|
||||||
|
private static final String TAG = "WVersionManager";
|
||||||
|
|
||||||
|
private CustomTagHandler customTagHandler;
|
||||||
|
|
||||||
|
private String PREF_IGNORE_VERSION_CODE = "w.ignore.version.code";
|
||||||
|
private String PREF_REMINDER_TIME = "w.reminder.time";
|
||||||
|
private String PREF_LAUNCH_TIMES = "w.launch.times";
|
||||||
|
|
||||||
|
private Activity activity;
|
||||||
|
private Drawable icon;
|
||||||
|
private String title;
|
||||||
|
private String message;
|
||||||
|
private String updateNowLabel;
|
||||||
|
private String remindMeLaterLabel;
|
||||||
|
private String ignoreThisVersionLabel;
|
||||||
|
private String updateUrl;
|
||||||
|
private String versionContentUrl;
|
||||||
|
private int reminderTimer;
|
||||||
|
private int mVersionCode;
|
||||||
|
private AlertDialogButtonListener listener;
|
||||||
|
private boolean mDialogCancelable = false;
|
||||||
|
private static WVersionManager.Callback sCallback = null;
|
||||||
|
private ActivityListener al;
|
||||||
|
|
||||||
|
void setCallback(WVersionManager.Callback callback) {
|
||||||
|
sCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ActivityListener {
|
||||||
|
void isShowUpdateDialog(boolean flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
WVersionManager(Activity act) {
|
||||||
|
this.activity = act;
|
||||||
|
al = (ActivityListener) act;
|
||||||
|
this.listener = new AlertDialogButtonListener();
|
||||||
|
this.customTagHandler = new CustomTagHandler();
|
||||||
|
setLaunchTimes();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable getDefaultAppIcon() {
|
||||||
|
return activity.getApplicationInfo().loadIcon(activity.getPackageManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkVersion() {
|
||||||
|
String versionContentUrl = getVersionContentUrl();
|
||||||
|
if (versionContentUrl == null) {
|
||||||
|
Log.e(TAG, "Please set versionContentUrl first");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
long currentTimeStamp = c.getTimeInMillis();
|
||||||
|
long reminderTimeStamp = getReminderTime();
|
||||||
|
if (currentTimeStamp > reminderTimeStamp) {
|
||||||
|
// fire request to get update version content
|
||||||
|
VersionContentRequest request = new VersionContentRequest(activity);
|
||||||
|
request.execute(getVersionContentUrl());
|
||||||
|
} else {
|
||||||
|
al.isShowUpdateDialog(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showDialog() {
|
||||||
|
ContextThemeWrapper ctw = new ContextThemeWrapper(activity, R.style.CustomLollipopDialogStyle);
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(ctw);
|
||||||
|
builder.setIcon(getIcon());
|
||||||
|
builder.setTitle(getTitle());
|
||||||
|
//noinspection deprecation
|
||||||
|
builder.setMessage(Html.fromHtml(getMessage(), null, getCustomTagHandler()));
|
||||||
|
|
||||||
|
builder.setPositiveButton(getUpdateNowLabel(), listener);
|
||||||
|
builder.setNeutralButton(getRemindMeLaterLabel(), listener);
|
||||||
|
builder.setNegativeButton(getIgnoreThisVersionLabel(), listener);
|
||||||
|
|
||||||
|
builder.setCancelable(isDialogCancelable());
|
||||||
|
|
||||||
|
AlertDialog dialog = builder.create();
|
||||||
|
if (activity != null && !activity.isFinishing()) {
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setLaunchTimes() {
|
||||||
|
int launchTimes = getLaunchTimes();
|
||||||
|
launchTimes++;
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(activity).edit().putInt(PREF_LAUNCH_TIMES, launchTimes)
|
||||||
|
.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getUpdateNowLabel() {
|
||||||
|
return updateNowLabel != null ? updateNowLabel : activity.getString(R.string.update);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getRemindMeLaterLabel() {
|
||||||
|
return remindMeLaterLabel != null ? remindMeLaterLabel : activity.getString(R.string.later);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getIgnoreThisVersionLabel() {
|
||||||
|
return ignoreThisVersionLabel != null ? ignoreThisVersionLabel : activity.getString(R.string.ignore);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getMessage() {
|
||||||
|
String defaultMessage = "What's new in this version";
|
||||||
|
return message != null ? message : defaultMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getTitle() {
|
||||||
|
String defaultTitle = "New Update Available";
|
||||||
|
return title != null ? title : defaultTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable getIcon() {
|
||||||
|
return icon != null ? icon : getDefaultAppIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
String getUpdateUrl() {
|
||||||
|
return updateUrl != null ? updateUrl : getGooglePlayStoreUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getVersionContentUrl() {
|
||||||
|
return versionContentUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int getReminderTimer() {
|
||||||
|
return reminderTimer > 0 ? reminderTimer : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void updateNow(String url) {
|
||||||
|
if (url != null) {
|
||||||
|
try {
|
||||||
|
Uri uri = Uri.parse(url);
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "is update url correct?" + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void setVersionContentUrl(String versionContentUrl) {
|
||||||
|
this.versionContentUrl = versionContentUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void remindMeLater(int reminderTimer) {
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
|
||||||
|
c.add(Calendar.MINUTE, reminderTimer);
|
||||||
|
long reminderTimeStamp = c.getTimeInMillis();
|
||||||
|
|
||||||
|
setReminderTime(reminderTimeStamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setReminderTime(long reminderTimeStamp) {
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(activity).edit().putLong(PREF_REMINDER_TIME, reminderTimeStamp)
|
||||||
|
.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
private long getReminderTime() {
|
||||||
|
return PreferenceManager.getDefaultSharedPreferences(activity).getLong(PREF_REMINDER_TIME, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ignoreThisVersion() {
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(activity).edit().putInt(PREF_IGNORE_VERSION_CODE, mVersionCode)
|
||||||
|
.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getGooglePlayStoreUrl() {
|
||||||
|
String id = activity.getApplicationInfo().packageName; // current google play is using package name as id
|
||||||
|
return "market://details?id=" + id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AlertDialogButtonListener implements DialogInterface.OnClickListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
switch (which) {
|
||||||
|
case AlertDialog.BUTTON_POSITIVE:
|
||||||
|
if (sCallback != null) {
|
||||||
|
sCallback.onPositive();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AlertDialog.BUTTON_NEUTRAL:
|
||||||
|
if (sCallback != null) {
|
||||||
|
sCallback.onRemind();
|
||||||
|
}
|
||||||
|
remindMeLater(getReminderTimer());
|
||||||
|
break;
|
||||||
|
case AlertDialog.BUTTON_NEGATIVE:
|
||||||
|
if (sCallback != null) {
|
||||||
|
sCallback.onNegative();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class VersionContentRequest extends AsyncTask<String, Void, String> {
|
||||||
|
Context context;
|
||||||
|
|
||||||
|
VersionContentRequest(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doInBackground(String... uri) {
|
||||||
|
String path = getVersionContentUrl();
|
||||||
|
String result = null;
|
||||||
|
try {
|
||||||
|
URL u = new URL(path);
|
||||||
|
HttpURLConnection c = (HttpURLConnection) u.openConnection();
|
||||||
|
c.setRequestMethod("GET");
|
||||||
|
c.connect();
|
||||||
|
InputStream in = c.getInputStream();
|
||||||
|
final ByteArrayOutputStream bo = new ByteArrayOutputStream();
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
in.read(buffer); // Read from Buffer.
|
||||||
|
bo.write(buffer); // Write Into Buffer.
|
||||||
|
result = bo.toString();
|
||||||
|
bo.close();
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
Log.e("WTF", "Malformed content: " + e.getMessage());
|
||||||
|
} catch (ProtocolException e) {
|
||||||
|
Log.e("WTF", "Protocol error: " + e.getMessage());
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e("WTF", "IO error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(String result) {
|
||||||
|
mVersionCode = 0;
|
||||||
|
String content;
|
||||||
|
String packageName;
|
||||||
|
try {
|
||||||
|
if (!result.startsWith("{")) { // for response who append with unknown char
|
||||||
|
result = result.substring(1);
|
||||||
|
}
|
||||||
|
String mResult = result;
|
||||||
|
// json format from server:
|
||||||
|
JSONObject json = (JSONObject) new JSONTokener(mResult).nextValue();
|
||||||
|
mVersionCode = json.optInt("version_code");
|
||||||
|
String lang = Locale.getDefault().getLanguage();
|
||||||
|
if (lang.equals("ru")) {
|
||||||
|
content = json.optString("content_ru");
|
||||||
|
} else {
|
||||||
|
content = json.optString("content_en");
|
||||||
|
}
|
||||||
|
packageName = json.optString("package");
|
||||||
|
setUpdateUrl("market://details?id=" + packageName);
|
||||||
|
int currentVersionCode = getCurrentVersionCode();
|
||||||
|
if (currentVersionCode < mVersionCode) {
|
||||||
|
if (mVersionCode != getIgnoreVersionCode()) {
|
||||||
|
setMessage(content);
|
||||||
|
al.isShowUpdateDialog(true);
|
||||||
|
} else if (mVersionCode == getIgnoreVersionCode() && getLaunchTimes() % 3 == 0) {
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(activity).edit().putInt(PREF_LAUNCH_TIMES, 0)
|
||||||
|
.apply();
|
||||||
|
setMessage(content);
|
||||||
|
al.isShowUpdateDialog(true);
|
||||||
|
} else {
|
||||||
|
al.isShowUpdateDialog(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
al.isShowUpdateDialog(false);
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Log.e(TAG, "is your server response have valid json format?");
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getLaunchTimes() {
|
||||||
|
return PreferenceManager.getDefaultSharedPreferences(activity).getInt(PREF_LAUNCH_TIMES, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getCurrentVersionCode() {
|
||||||
|
int currentVersionCode = 0;
|
||||||
|
PackageInfo pInfo;
|
||||||
|
try {
|
||||||
|
pInfo = activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0);
|
||||||
|
currentVersionCode = pInfo.versionCode;
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
// return 0
|
||||||
|
}
|
||||||
|
return currentVersionCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getIgnoreVersionCode() {
|
||||||
|
return PreferenceManager.getDefaultSharedPreferences(activity).getInt(PREF_IGNORE_VERSION_CODE, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CustomTagHandler getCustomTagHandler() {
|
||||||
|
return customTagHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDialogCancelable() {
|
||||||
|
return mDialogCancelable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Callback {
|
||||||
|
void onPositive();
|
||||||
|
|
||||||
|
void onNegative();
|
||||||
|
|
||||||
|
void onRemind();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateNowLabel(String updateNowLabel) {
|
||||||
|
this.updateNowLabel = updateNowLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemindMeLaterLabel(String remindMeLaterLabel) {
|
||||||
|
this.remindMeLaterLabel = remindMeLaterLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIgnoreThisVersionLabel(String ignoreThisVersionLabel) {
|
||||||
|
this.ignoreThisVersionLabel = ignoreThisVersionLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIcon(Drawable icon) {
|
||||||
|
this.icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUpdateUrl(String updateUrl) {
|
||||||
|
this.updateUrl = updateUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setReminderTimer(int minutes) {
|
||||||
|
if (minutes > 0) {
|
||||||
|
reminderTimer = minutes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDialogCancelable(boolean dialogCancelable) {
|
||||||
|
mDialogCancelable = dialogCancelable;
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,7 @@
|
|||||||
android:layout_height="28dp"
|
android:layout_height="28dp"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:background="#404040"
|
android:background="#404040"
|
||||||
|
android:visibility="gone"
|
||||||
android:indeterminate="false"
|
android:indeterminate="false"
|
||||||
android:max="100" />
|
android:max="100" />
|
||||||
|
|
||||||
|
9
build/android/src/main/res/layout/count_dialog.xml
Normal file
9
build/android/src/main/res/layout/count_dialog.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/textView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/recommend"
|
||||||
|
android:textSize="24sp" />
|
@ -7,11 +7,18 @@
|
|||||||
<string name="notification_title">Загрузка MultiCraft</string>
|
<string name="notification_title">Загрузка MultiCraft</string>
|
||||||
<string name="notification_description">Осталось меньше минуты…</string>
|
<string name="notification_description">Осталось меньше минуты…</string>
|
||||||
<string name="not_enough_space">Недостаточно места для распаковки.\nОсвободите пространство в памяти устройства!</string>
|
<string name="not_enough_space">Недостаточно места для распаковки.\nОсвободите пространство в памяти устройства!</string>
|
||||||
|
<!-- разрешения -->
|
||||||
<string name="explain">Для корректной работы, игре требуется разрешение записывать в память устройтсва.</string>
|
<string name="explain">Для корректной работы, игре требуется разрешение записывать в память устройтсва.</string>
|
||||||
|
<string name="location">Знание местоположения обеспечивает Вам лучшее взаимодействие с игрой</string>
|
||||||
<!-- диалог оценки -->
|
<!-- диалог оценки -->
|
||||||
<string name="rta_dialog_title">Оцените MultiCraft!</string>
|
<string name="rta_dialog_title">Оцените MultiCraft!</string>
|
||||||
<string name="rate_title">Название</string>
|
<string name="rate_title">Название</string>
|
||||||
<string name="rate_submit">ОЦЕНИТЬ</string>
|
<string name="rate_submit">ОЦЕНИТЬ</string>
|
||||||
<string name="rate_description">Описание</string>
|
<string name="rate_description">Описание</string>
|
||||||
<string name="sad">Нам жаль, что Вам не понравился MultiCraft!</string>
|
<string name="sad">Нам жаль, что Вам не понравилась игра!</string>
|
||||||
|
<string name="recommend">Загрузка рекомендаций \n для Вас \n%1$s</string>
|
||||||
|
<!-- обновление -->
|
||||||
|
<string name="ignore">Игнорировать</string>
|
||||||
|
<string name="later">Позже</string>
|
||||||
|
<string name="update">Обновить</string>
|
||||||
</resources>
|
</resources>
|
@ -7,10 +7,16 @@
|
|||||||
|
|
||||||
<style name="DialogTheme" parent="android:Theme.Material.Light.Dialog" />
|
<style name="DialogTheme" parent="android:Theme.Material.Light.Dialog" />
|
||||||
|
|
||||||
|
<style name="CountDialogTheme" parent="android:Theme.Material.Light.Dialog">
|
||||||
|
<item name="android:colorBackground">#70FFFFFF</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="Theme.Transparent" parent="@android:style/Theme.Material.Light.NoActionBar.Fullscreen">
|
<style name="Theme.Transparent" parent="@android:style/Theme.Material.Light.NoActionBar.Fullscreen">
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
<item name="android:windowIsTranslucent">true</item>
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="CustomLollipopDialogStyle" parent="android:Theme.Material.Light.Dialog.Alert"/>
|
||||||
</resources>
|
</resources>
|
@ -2,7 +2,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name" translatable="false">MultiCraft</string>
|
<string name="app_name" translatable="false">MultiCraft</string>
|
||||||
<string name="ver" translatable="false">1.1.3.1</string>
|
<string name="ver" translatable="false">1.1.5</string>
|
||||||
<string name="google_app_id" translatable="false">312077575425</string>
|
<string name="google_app_id" translatable="false">312077575425</string>
|
||||||
<!-- preparation for start -->
|
<!-- preparation for start -->
|
||||||
|
|
||||||
@ -16,10 +16,18 @@
|
|||||||
|
|
||||||
<!-- permission block -->
|
<!-- permission block -->
|
||||||
<string name="explain">Game need permission to write files to storage memory.</string>
|
<string name="explain">Game need permission to write files to storage memory.</string>
|
||||||
|
<string name="location">Location permission provide you better interaction with game</string>
|
||||||
<!-- rate dialog -->
|
<!-- rate dialog -->
|
||||||
<string name="rta_dialog_title">Please, rate MultiCraft!</string>
|
<string name="rta_dialog_title">Please, rate MultiCraft!</string>
|
||||||
<string name="rate_title">Title</string>
|
<string name="rate_title">Title</string>
|
||||||
<string name="rate_submit">SUBMIT</string>
|
<string name="rate_submit">SUBMIT</string>
|
||||||
<string name="rate_description">Description</string>
|
<string name="rate_description">Description</string>
|
||||||
<string name="sad">We are sorry that you did not like the MultiCraft!</string>
|
<string name="sad">We are sorry that you did not like the game!</string>
|
||||||
|
<string name="recommend">Loading recommendations \n for you \n %1$s</string>
|
||||||
|
|
||||||
|
<!--update dialog -->
|
||||||
|
<string name="update">Update</string>
|
||||||
|
<string name="later">Later</string>
|
||||||
|
<string name="ignore">Ignore</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -7,6 +7,11 @@
|
|||||||
|
|
||||||
<style name="DialogTheme" parent="android:Theme.Holo.Light.Dialog" />
|
<style name="DialogTheme" parent="android:Theme.Holo.Light.Dialog" />
|
||||||
|
|
||||||
|
<style name="CountDialogTheme" parent="android:Theme.Holo.Light.Dialog">
|
||||||
|
<item name="android:colorBackground">#70FFFFFF</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="Theme.Transparent" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen">
|
<style name="Theme.Transparent" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen">
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user