mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
update android bg, min spec
This commit is contained in:
@@ -3,6 +3,6 @@
|
|||||||
<gradient
|
<gradient
|
||||||
android:type="linear"
|
android:type="linear"
|
||||||
android:angle="135"
|
android:angle="135"
|
||||||
android:startColor="#24476B"
|
android:startColor="#FFFFFF"
|
||||||
android:endColor="#0C335B" />
|
android:endColor="#FFFFFF" />
|
||||||
</shape>
|
</shape>
|
||||||
@@ -3,14 +3,13 @@
|
|||||||
android:id="@+id/mainview"
|
android:id="@+id/mainview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:gravity="center">
|
||||||
android:background="@color/splashBackground">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/logo_id"
|
android:id="@+id/logo_id"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:maxHeight="400dp"
|
android:maxHeight="250dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:src="@drawable/logo"/>
|
android:src="@drawable/logo"/>
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
<color name="colorPrimaryDark">#303F9F</color>
|
<color name="colorPrimaryDark">#303F9F</color>
|
||||||
<color name="colorAccent">#FF4081</color>
|
<color name="colorAccent">#FF4081</color>
|
||||||
<color name="blue">#258cec</color>
|
<color name="blue">#258cec</color>
|
||||||
<color name="splashBackground">#000000</color>
|
<color name="splashBackground">#FFFFFF</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package forge.app;
|
|||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.AnimatorSet;
|
import android.animation.AnimatorSet;
|
||||||
|
import android.animation.ArgbEvaluator;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
@@ -31,6 +32,7 @@ import android.net.Uri;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.os.Handler;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -293,96 +295,102 @@ public class Main extends AndroidApplication {
|
|||||||
|
|
||||||
private void loadGame(final String title, final String steps, boolean isLandscape, AndroidAdapter adapter, boolean permissiongranted, int totalRAM, boolean isTabletDevice, AndroidApplicationConfiguration config, boolean exception, String msg) {
|
private void loadGame(final String title, final String steps, boolean isLandscape, AndroidAdapter adapter, boolean permissiongranted, int totalRAM, boolean isTabletDevice, AndroidApplicationConfiguration config, boolean exception, String msg) {
|
||||||
try {
|
try {
|
||||||
|
final Handler handler = new Handler();
|
||||||
forgeLogo = findViewById(getResources().getIdentifier("logo_id", "id", getPackageName()));
|
forgeLogo = findViewById(getResources().getIdentifier("logo_id", "id", getPackageName()));
|
||||||
|
activeView = findViewById(getResources().getIdentifier("mainview", "id", getPackageName()));
|
||||||
|
activeView.setBackgroundColor(Color.WHITE);
|
||||||
forgeView = initializeForView(Forge.getApp(getAndroidClipboard(), adapter, ASSETS_DIR, false, !isLandscape, totalRAM, isTabletDevice, Build.VERSION.SDK_INT, Build.VERSION.RELEASE, getDeviceName()), config);
|
forgeView = initializeForView(Forge.getApp(getAndroidClipboard(), adapter, ASSETS_DIR, false, !isLandscape, totalRAM, isTabletDevice, Build.VERSION.SDK_INT, Build.VERSION.RELEASE, getDeviceName()), config);
|
||||||
getAnimator(ObjectAnimator.ofFloat(forgeLogo, "alpha", 0f, 1f).setDuration(1800), null, new AnimatorListenerAdapter() {
|
|
||||||
|
getAnimator(ObjectAnimator.ofFloat(forgeLogo, "alpha", 1f, 1f).setDuration(800), ObjectAnimator.ofObject(activeView, "backgroundColor", new ArgbEvaluator(), Color.WHITE, Color.BLACK).setDuration(1600), new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
super.onAnimationEnd(animation);
|
super.onAnimationEnd(animation);
|
||||||
if (!permissiongranted || exception) {
|
handler.postDelayed(() -> {
|
||||||
displayMessage(forgeLogo, adapter, exception, msg, false);
|
if (!permissiongranted || exception) {
|
||||||
} else if (title.isEmpty() && steps.isEmpty()) {
|
displayMessage(forgeLogo, adapter, exception, msg, false);
|
||||||
if (isLandscape) {
|
} else if (title.isEmpty() && steps.isEmpty()) {
|
||||||
Main.this.setRequestedOrientation(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
|
if (isLandscape) {
|
||||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : //Oreo and above has virtual back/menu buttons
|
Main.this.setRequestedOrientation(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
|
||||||
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : //Oreo and above has virtual back/menu buttons
|
||||||
} else {
|
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
Main.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
} else {
|
||||||
}
|
Main.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
||||||
crossfade(forgeView, forgeLogo);
|
}
|
||||||
} else {
|
|
||||||
if (sharedPreferences.getBoolean("run_anyway", false)) {
|
|
||||||
crossfade(forgeView, forgeLogo);
|
crossfade(forgeView, forgeLogo);
|
||||||
return;
|
} else {
|
||||||
|
if (sharedPreferences.getBoolean("run_anyway", false)) {
|
||||||
|
crossfade(forgeView, forgeLogo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TableLayout TL = new TableLayout(getContext());
|
||||||
|
TL.setBackgroundResource(android.R.color.black);
|
||||||
|
TableRow messageRow = new TableRow(getContext());
|
||||||
|
TableRow checkboxRow = new TableRow(getContext());
|
||||||
|
TableRow buttonRow = new TableRow(getContext());
|
||||||
|
TextView text = new TextView(getContext());
|
||||||
|
text.setGravity(Gravity.LEFT);
|
||||||
|
text.setTypeface(Typeface.SERIF);
|
||||||
|
|
||||||
|
SpannableString ss1 = new SpannableString(title);
|
||||||
|
ss1.setSpan(new StyleSpan(Typeface.BOLD), 0, ss1.length(), 0);
|
||||||
|
text.append(ss1);
|
||||||
|
text.append(steps + "\n");
|
||||||
|
messageRow.addView(text);
|
||||||
|
messageRow.setGravity(Gravity.CENTER);
|
||||||
|
|
||||||
|
CheckBox checkBox = new CheckBox(getContext());
|
||||||
|
checkBox.setTypeface(Typeface.SERIF);
|
||||||
|
checkBox.setGravity(Gravity.TOP);
|
||||||
|
checkBox.setChecked(false);
|
||||||
|
checkBox.setPadding(30, 30, 30, 30);
|
||||||
|
checkBox.setTypeface(Typeface.SERIF);
|
||||||
|
checkBox.setText(" Don't remind me next time. ");
|
||||||
|
checkBox.setScaleX(0.9f);
|
||||||
|
checkBox.setScaleY(0.9f);
|
||||||
|
checkBox.setOnCheckedChangeListener((buttonView, isChecked) ->
|
||||||
|
sharedPreferences.edit().putBoolean("run_anyway", isChecked).apply());
|
||||||
|
checkboxRow.addView(checkBox);
|
||||||
|
checkboxRow.setGravity(Gravity.CENTER);
|
||||||
|
|
||||||
|
int[] colors = {Color.TRANSPARENT, Color.TRANSPARENT};
|
||||||
|
int[] pressed = {Color.GREEN, Color.GREEN};
|
||||||
|
GradientDrawable gd = new GradientDrawable(
|
||||||
|
GradientDrawable.Orientation.TOP_BOTTOM, colors);
|
||||||
|
gd.setStroke(3, Color.DKGRAY);
|
||||||
|
gd.setCornerRadius(100);
|
||||||
|
|
||||||
|
GradientDrawable gd2 = new GradientDrawable(
|
||||||
|
GradientDrawable.Orientation.TOP_BOTTOM, pressed);
|
||||||
|
gd2.setStroke(3, Color.DKGRAY);
|
||||||
|
gd2.setCornerRadius(100);
|
||||||
|
|
||||||
|
Button button = new Button(getContext());
|
||||||
|
button.setText("Run Forge..");
|
||||||
|
button.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
|
|
||||||
|
StateListDrawable states = new StateListDrawable();
|
||||||
|
|
||||||
|
states.addState(new int[]{android.R.attr.state_pressed}, gd2);
|
||||||
|
states.addState(new int[]{}, gd);
|
||||||
|
|
||||||
|
button.setBackground(states);
|
||||||
|
|
||||||
|
button.setTextColor(Color.RED);
|
||||||
|
button.setOnClickListener(v -> {
|
||||||
|
button.setClickable(false);
|
||||||
|
crossfade(forgeView, TL);
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonRow.addView(button);
|
||||||
|
buttonRow.setGravity(Gravity.CENTER);
|
||||||
|
|
||||||
|
TL.addView(messageRow, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
|
||||||
|
TL.addView(checkboxRow, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
|
||||||
|
TL.addView(buttonRow, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
|
||||||
|
TL.setGravity(Gravity.CENTER);
|
||||||
|
crossfade(TL, forgeLogo);
|
||||||
}
|
}
|
||||||
TableLayout TL = new TableLayout(getContext());
|
}, 600);
|
||||||
TL.setBackgroundResource(android.R.color.black);
|
|
||||||
TableRow messageRow = new TableRow(getContext());
|
|
||||||
TableRow checkboxRow = new TableRow(getContext());
|
|
||||||
TableRow buttonRow = new TableRow(getContext());
|
|
||||||
TextView text = new TextView(getContext());
|
|
||||||
text.setGravity(Gravity.LEFT);
|
|
||||||
text.setTypeface(Typeface.SERIF);
|
|
||||||
|
|
||||||
SpannableString ss1 = new SpannableString(title);
|
|
||||||
ss1.setSpan(new StyleSpan(Typeface.BOLD), 0, ss1.length(), 0);
|
|
||||||
text.append(ss1);
|
|
||||||
text.append(steps + "\n");
|
|
||||||
messageRow.addView(text);
|
|
||||||
messageRow.setGravity(Gravity.CENTER);
|
|
||||||
|
|
||||||
CheckBox checkBox = new CheckBox(getContext());
|
|
||||||
checkBox.setTypeface(Typeface.SERIF);
|
|
||||||
checkBox.setGravity(Gravity.TOP);
|
|
||||||
checkBox.setChecked(false);
|
|
||||||
checkBox.setPadding(30, 30, 30, 30);
|
|
||||||
checkBox.setTypeface(Typeface.SERIF);
|
|
||||||
checkBox.setText(" Don't remind me next time. ");
|
|
||||||
checkBox.setScaleX(0.9f);
|
|
||||||
checkBox.setScaleY(0.9f);
|
|
||||||
checkBox.setOnCheckedChangeListener((buttonView, isChecked) ->
|
|
||||||
sharedPreferences.edit().putBoolean("run_anyway", isChecked).apply());
|
|
||||||
checkboxRow.addView(checkBox);
|
|
||||||
checkboxRow.setGravity(Gravity.CENTER);
|
|
||||||
|
|
||||||
int[] colors = {Color.TRANSPARENT, Color.TRANSPARENT};
|
|
||||||
int[] pressed = {Color.GREEN, Color.GREEN};
|
|
||||||
GradientDrawable gd = new GradientDrawable(
|
|
||||||
GradientDrawable.Orientation.TOP_BOTTOM, colors);
|
|
||||||
gd.setStroke(3, Color.DKGRAY);
|
|
||||||
gd.setCornerRadius(100);
|
|
||||||
|
|
||||||
GradientDrawable gd2 = new GradientDrawable(
|
|
||||||
GradientDrawable.Orientation.TOP_BOTTOM, pressed);
|
|
||||||
gd2.setStroke(3, Color.DKGRAY);
|
|
||||||
gd2.setCornerRadius(100);
|
|
||||||
|
|
||||||
Button button = new Button(getContext());
|
|
||||||
button.setText("Run Forge..");
|
|
||||||
button.setTypeface(Typeface.DEFAULT_BOLD);
|
|
||||||
|
|
||||||
StateListDrawable states = new StateListDrawable();
|
|
||||||
|
|
||||||
states.addState(new int[]{android.R.attr.state_pressed}, gd2);
|
|
||||||
states.addState(new int[]{}, gd);
|
|
||||||
|
|
||||||
button.setBackground(states);
|
|
||||||
|
|
||||||
button.setTextColor(Color.RED);
|
|
||||||
button.setOnClickListener(v -> {
|
|
||||||
button.setClickable(false);
|
|
||||||
crossfade(forgeView, TL);
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonRow.addView(button);
|
|
||||||
buttonRow.setGravity(Gravity.CENTER);
|
|
||||||
|
|
||||||
TL.addView(messageRow, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
|
|
||||||
TL.addView(checkboxRow, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
|
|
||||||
TL.addView(buttonRow, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
|
|
||||||
TL.setGravity(Gravity.CENTER);
|
|
||||||
crossfade(TL, forgeLogo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -393,9 +401,8 @@ public class Main extends AndroidApplication {
|
|||||||
private AnimatorSet getAnimator(Animator play, Animator with, AnimatorListenerAdapter adapter) {
|
private AnimatorSet getAnimator(Animator play, Animator with, AnimatorListenerAdapter adapter) {
|
||||||
AnimatorSet animatorSet = new AnimatorSet();
|
AnimatorSet animatorSet = new AnimatorSet();
|
||||||
if (with != null) {
|
if (with != null) {
|
||||||
animatorSet.playTogether(play, with);
|
animatorSet.playSequentially(play, with);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
animatorSet.play(play);
|
animatorSet.play(play);
|
||||||
animatorSet.addListener(adapter);
|
animatorSet.addListener(adapter);
|
||||||
return animatorSet;
|
return animatorSet;
|
||||||
@@ -465,9 +472,11 @@ public class Main extends AndroidApplication {
|
|||||||
adapter.switchOrientationFile = ASSETS_DIR + "switch_orientation.ini";
|
adapter.switchOrientationFile = ASSETS_DIR + "switch_orientation.ini";
|
||||||
boolean landscapeMode = adapter.isTablet == !FileUtil.doesFileExist(adapter.switchOrientationFile);
|
boolean landscapeMode = adapter.isTablet == !FileUtil.doesFileExist(adapter.switchOrientationFile);
|
||||||
|
|
||||||
String info = totalRAM < 3500 || Build.VERSION.SDK_INT < Build.VERSION_CODES.Q ? "Device Specification Check\n" + getDeviceName()
|
String info = totalRAM < 3500 || Build.VERSION.SDK_INT < Build.VERSION_CODES.R ? "Device Specification Check\n" + getDeviceName()
|
||||||
+ "\n" + "Android " + Build.VERSION.RELEASE + "\n" + "RAM " + totalRAM + "MB\n\nMinimum Requirements:" : "";
|
+ "\n" + "Android " + Build.VERSION.RELEASE + "\n" + "RAM " + totalRAM + "MB\n\nRecommended API:" : "";
|
||||||
String lowV = Build.VERSION.SDK_INT < Build.VERSION_CODES.Q ? "\nAPI: Android 10 or higher" : "";
|
// Even though Forge runs on Android 8 as minimum, just show indicator that Android 11 is recommended
|
||||||
|
String lowV = Build.VERSION.SDK_INT < Build.VERSION_CODES.R ? "\nAPI: Android 11 or higher" : "";
|
||||||
|
// also show minimum Device RAM
|
||||||
String lowM = totalRAM < 3500 ? "\nRAM: 4GB RAM or higher" : "";
|
String lowM = totalRAM < 3500 ? "\nRAM: 4GB RAM or higher" : "";
|
||||||
if (landscapeMode && Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) { //Android 11 onwards
|
if (landscapeMode && Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) { //Android 11 onwards
|
||||||
Main.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
Main.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||||
@@ -561,29 +570,32 @@ public class Main extends AndroidApplication {
|
|||||||
try {
|
try {
|
||||||
if (connManager != null) {
|
if (connManager != null) {
|
||||||
connManager.registerDefaultNetworkCallback(
|
connManager.registerDefaultNetworkCallback(
|
||||||
new ConnectivityManager.NetworkCallback() {
|
new ConnectivityManager.NetworkCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onAvailable(Network network) {
|
public void onAvailable(Network network) {
|
||||||
connected = true;
|
connected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLost(Network network) {
|
public void onLost(Network network) {
|
||||||
connected = false;
|
connected = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
connected = false;
|
connected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasInternet() {
|
private boolean hasInternet() {
|
||||||
return isNetworkConnected(false);
|
return isNetworkConnected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasWiFiInternet() {
|
private boolean hasWiFiInternet() {
|
||||||
return isNetworkConnected(true);
|
return isNetworkConnected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNetworkConnected(boolean wifiOnly) {
|
private boolean isNetworkConnected(boolean wifiOnly) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
@@ -612,6 +624,7 @@ public class Main extends AndroidApplication {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isConnectedToInternet() {
|
public boolean isConnectedToInternet() {
|
||||||
//if it can't determine Internet connection within two seconds, assume not connected
|
//if it can't determine Internet connection within two seconds, assume not connected
|
||||||
|
|||||||
Reference in New Issue
Block a user