mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Use fixed orientation to prevent rendering issues
This commit is contained in:
@@ -13,7 +13,8 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:largeHeap="true">
|
android:largeHeap="true">
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import android.content.res.Configuration;
|
|||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.webkit.MimeTypeMap;
|
import android.webkit.MimeTypeMap;
|
||||||
@@ -32,13 +31,8 @@ public class Main extends AndroidApplication {
|
|||||||
|
|
||||||
AndroidAdapter adapter = new AndroidAdapter(this.getContext());
|
AndroidAdapter adapter = new AndroidAdapter(this.getContext());
|
||||||
|
|
||||||
//enforce portrait orientation for non-tablet screens
|
//enforce orientation based on whether device is a tablet
|
||||||
if (!adapter.isTablet) {
|
adapter.setLandscapeMode(adapter.isTablet);
|
||||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
||||||
if (Build.VERSION.SDK_INT > 8) { //use dual-side portrait mode if supported
|
|
||||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//establish assets directory
|
//establish assets directory
|
||||||
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
|
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
|
||||||
@@ -161,5 +155,15 @@ public class Main extends AndroidApplication {
|
|||||||
public boolean isTablet() {
|
public boolean isTablet() {
|
||||||
return isTablet;
|
return isTablet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLandscapeMode(boolean landscapeMode) {
|
||||||
|
if (landscapeMode) {
|
||||||
|
Main.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Main.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,5 +63,10 @@ public class Main {
|
|||||||
public boolean isTablet() {
|
public boolean isTablet() {
|
||||||
return true; //treat desktop the same as a tablet
|
return true; //treat desktop the same as a tablet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLandscapeMode(boolean landscapeMode) {
|
||||||
|
//TODO: Consider supporting toggling this on desktop for testing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,6 @@ public interface IDeviceAdapter {
|
|||||||
boolean isTablet();
|
boolean isTablet();
|
||||||
String getDownloadsDir();
|
String getDownloadsDir();
|
||||||
boolean openFile(String filename);
|
boolean openFile(String filename);
|
||||||
|
void setLandscapeMode(boolean landscapeMode);
|
||||||
void exit();
|
void exit();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user