Android: update java-part

master
MoNTE48 2020-03-13 13:01:05 +01:00
parent d9b86f84bb
commit 4a6fe58502
8 changed files with 29 additions and 33 deletions

View File

@ -7,8 +7,8 @@ android {
applicationId 'com.multicraft.game'
minSdkVersion 16
targetSdkVersion 29
versionCode 39
versionName "1.9.0"
versionCode 40
versionName "1.9.0b"
/*multiDexEnabled true
useLibrary 'org.apache.http.legacy'*/
}

View File

@ -34,12 +34,12 @@
<meta-data
android:name="android.max_aspect"
android:value="2.4" />
android:value="3" />
<activity
android:name="com.multicraft.game.MainActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:maxAspectRatio="2.4"
android:maxAspectRatio="3"
android:screenOrientation="sensorLandscape"
android:theme="@style/AppTheme">
<intent-filter>
@ -53,7 +53,7 @@
android:configChanges="orientation|keyboard|keyboardHidden|navigation|screenSize|smallestScreenSize"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:maxAspectRatio="2.4"
android:maxAspectRatio="3"
android:screenOrientation="sensorLandscape"
android:theme="@style/AppTheme"
tools:ignore="LockedOrientationActivity">
@ -68,14 +68,13 @@
<activity
android:name="com.multicraft.game.InputDialogActivity"
android:maxAspectRatio="2.4"
android:maxAspectRatio="3"
android:theme="@style/InputTheme" />
<service
android:name="com.multicraft.game.UnzipService"
android:enabled="true"
android:exported="false" />
</application>
</manifest>

View File

@ -34,7 +34,8 @@ public class InputDialogActivity extends AppCompatActivity {
editText.setHint(hint);
editText.setText(current);
final InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
Objects.requireNonNull(imm).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
Objects.requireNonNull(imm).toggleSoftInput(
InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
if (editType == 3)
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
else

View File

@ -204,8 +204,8 @@ public class MainActivity extends AppCompatActivity implements WVersionManager.A
private void makeFullScreen() {
if (Build.VERSION.SDK_INT >= 19)
this.getWindow().getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
this.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
@Override

View File

@ -66,22 +66,18 @@ public class UnzipService extends IntentService {
if (mChannel == null) {
mChannel = new NotificationChannel(channelId, name, importance);
mChannel.setDescription(description);
//Configure the notification channel, NO SOUND
// 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);
builder.setContentTitle(getString(R.string.notification_title)) // required
.setSmallIcon(R.drawable.update) // required
.setContentText(getString(R.string.notification_description)); // required
} else {
} else
builder = new Notification.Builder(this);
builder.setContentTitle(getString(R.string.notification_title))
.setContentText(getString(R.string.notification_description))
.setSmallIcon(R.drawable.update);
}
builder.setContentTitle(getString(R.string.notification_title))
.setContentText(getString(R.string.notification_description))
.setSmallIcon(R.drawable.update);
mNotifyManager.notify(id, builder.build());
}

View File

@ -80,8 +80,8 @@ class WVersionManager implements DialogsCallback {
private void setLaunchTimes() {
int launchTimes = getLaunchTimes();
launchTimes++;
PreferenceManager.getDefaultSharedPreferences(activity).edit().putInt(PREF_LAUNCH_TIMES, launchTimes)
.apply();
PreferenceManager.getDefaultSharedPreferences(activity).edit().putInt(
PREF_LAUNCH_TIMES, launchTimes).apply();
}
private String getMessage() {
@ -122,22 +122,22 @@ class WVersionManager implements DialogsCallback {
}
private long getReminderTime() {
return PreferenceManager.getDefaultSharedPreferences(activity).getLong(PREF_REMINDER_TIME, 0);
return PreferenceManager.getDefaultSharedPreferences(activity).getLong
(PREF_REMINDER_TIME, 0);
}
private void setReminderTime(long reminderTimeStamp) {
PreferenceManager.getDefaultSharedPreferences(activity).edit().putLong(PREF_REMINDER_TIME, reminderTimeStamp)
.apply();
PreferenceManager.getDefaultSharedPreferences(activity).edit().putLong(
PREF_REMINDER_TIME, reminderTimeStamp).apply();
}
void ignoreThisVersion() {
PreferenceManager.getDefaultSharedPreferences(activity).edit().putInt(PREF_IGNORE_VERSION_CODE, mVersionCode)
.apply();
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;
return "market://details?id=" + activity.getApplicationInfo().packageName;
}
private int getLaunchTimes() {
@ -255,8 +255,8 @@ class WVersionManager implements DialogsCallback {
setMessage(content);
al.isShowUpdateDialog(true);
} else if (mVersionCode == getIgnoreVersionCode() && getLaunchTimes() % 3 == 0) {
PreferenceManager.getDefaultSharedPreferences(activity).edit().putInt(PREF_LAUNCH_TIMES, 0)
.apply();
PreferenceManager.getDefaultSharedPreferences(activity).edit().putInt(
PREF_LAUNCH_TIMES, 0).apply();
setMessage(content);
al.isShowUpdateDialog(true);
} else

View File

@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
classpath 'com.android.tools.build:gradle:3.6.1'
//noinspection GradleDynamicVersion
/*classpath 'com.bugsnag:bugsnag-android-gradle-plugin:4.+'*/
classpath 'org.ajoberstar.grgit:grgit-gradle:4.0.1'

View File

@ -1,6 +1,6 @@
#Mon Mar 02 20:44:06 CET 2020
#Thu Mar 12 13:52:50 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip