update
This commit is contained in:
parent
74d495941f
commit
9a00a7e2a0
|
@ -20,7 +20,7 @@ public class FCLApplication extends Application implements Application.ActivityL
|
|||
this.registerActivityLifecycleCallbacks(this);
|
||||
}
|
||||
|
||||
public static Activity getCurrentActivity(){
|
||||
public static Activity getCurrentActivity() {
|
||||
return currentActivity.get();
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class FCLApplication extends Application implements Application.ActivityL
|
|||
|
||||
@Override
|
||||
public void onActivityDestroyed(@NonNull Activity activity) {
|
||||
if (currentActivity.get() == activity){
|
||||
if (currentActivity.get() == activity) {
|
||||
currentActivity = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class JVMActivity extends FCLActivity implements TextureView.SurfaceTextu
|
|||
private MenuCallback menu;
|
||||
private static MenuType menuType;
|
||||
private static FCLBridge fclBridge;
|
||||
private boolean isTranslated=false;
|
||||
private boolean isTranslated = false;
|
||||
|
||||
public static void setFClBridge(FCLBridge fclBridge, MenuType menuType) {
|
||||
JVMActivity.fclBridge = fclBridge;
|
||||
|
@ -60,11 +60,11 @@ public class JVMActivity extends FCLActivity implements TextureView.SurfaceTextu
|
|||
int screenHeight = getWindow().getDecorView().getHeight();
|
||||
Rect rect = new Rect();
|
||||
getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
|
||||
if (screenHeight * 2 / 3 > rect.bottom){
|
||||
textureView.setTranslationY(rect.bottom-screenHeight);
|
||||
if (screenHeight * 2 / 3 > rect.bottom) {
|
||||
textureView.setTranslationY(rect.bottom - screenHeight);
|
||||
isTranslated = true;
|
||||
} else if (isTranslated){
|
||||
isTranslated = false;
|
||||
} else if (isTranslated) {
|
||||
isTranslated = false;
|
||||
textureView.setTranslationY(0);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -503,7 +503,6 @@ public class GameMenu implements MenuCallback, View.OnClickListener {
|
|||
this.cursorModeProperty.set(mode);
|
||||
activity.runOnUiThread(() -> {
|
||||
if (mode == FCLBridge.CursorEnabled) {
|
||||
getInput().setPointer(getCursorX(),getCursorY());
|
||||
getCursor().setVisibility(View.VISIBLE);
|
||||
gameItemBar.setVisibility(View.GONE);
|
||||
} else {
|
||||
|
|
|
@ -17,6 +17,7 @@ import androidx.appcompat.widget.AppCompatButton;
|
|||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
|
||||
import com.tungsten.fcl.FCLApplication;
|
||||
import com.tungsten.fcl.R;
|
||||
import com.tungsten.fcl.control.GameMenu;
|
||||
import com.tungsten.fcl.control.GestureMode;
|
||||
|
@ -92,8 +93,8 @@ public class ControlButton extends AppCompatButton {
|
|||
boundaryPaint.setColor(Color.RED);
|
||||
boundaryPaint.setStyle(Paint.Style.STROKE);
|
||||
boundaryPaint.setStrokeWidth(3);
|
||||
screenWidth = AndroidUtils.getScreenWidth(getContext());
|
||||
screenHeight = AndroidUtils.getScreenHeight(getContext());
|
||||
screenWidth = AndroidUtils.getScreenWidth(FCLApplication.getCurrentActivity());
|
||||
screenHeight = AndroidUtils.getScreenHeight(FCLApplication.getCurrentActivity());
|
||||
|
||||
post(() -> {
|
||||
notifyData();
|
||||
|
|
|
@ -113,7 +113,7 @@ public final class TexturesLoader {
|
|||
}
|
||||
}
|
||||
Bitmap img;
|
||||
try(InputStream in = Files.newInputStream(file)){
|
||||
try (InputStream in = Files.newInputStream(file)) {
|
||||
img = BitmapFactory.decodeStream(in);
|
||||
}
|
||||
if (img == null) {
|
||||
|
@ -148,7 +148,7 @@ public final class TexturesLoader {
|
|||
}
|
||||
|
||||
Bitmap img;
|
||||
try(InputStream in = Files.newInputStream(file)){
|
||||
try (InputStream in = Files.newInputStream(file)) {
|
||||
img = BitmapFactory.decodeStream(in);
|
||||
}
|
||||
if (img == null) {
|
||||
|
|
|
@ -88,18 +88,18 @@ public class AndroidUtils {
|
|||
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
Point point = new Point();
|
||||
wm.getDefaultDisplay().getRealSize(point);
|
||||
if (fullscreen || SDK_INT < Build.VERSION_CODES.P){
|
||||
if (fullscreen || SDK_INT < Build.VERSION_CODES.P) {
|
||||
return point.x;
|
||||
} else {
|
||||
try {
|
||||
Rect notchRect;
|
||||
if(SDK_INT >= Build.VERSION_CODES.S){
|
||||
if (SDK_INT >= Build.VERSION_CODES.S) {
|
||||
notchRect = wm.getCurrentWindowMetrics().getWindowInsets().getDisplayCutout().getBoundingRects().get(0);
|
||||
} else {
|
||||
notchRect = context.getWindow().getDecorView().getRootWindowInsets().getDisplayCutout().getBoundingRects().get(0);
|
||||
}
|
||||
return point.x-Math.min(notchRect.width(), notchRect.height());
|
||||
} catch (Exception e){
|
||||
return point.x - Math.min(notchRect.width(), notchRect.height());
|
||||
} catch (Exception e) {
|
||||
return point.x;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -324,7 +324,7 @@
|
|||
<string name="settings_fcl_renderer_gl4es" translatable="false">Holy GL4ES (OpenGL 2.1)</string>
|
||||
<string name="settings_fcl_renderer_virgl" translatable="false">VirGLRenderer (OpenGL 4.3)</string>
|
||||
<string name="settings_fcl_renderer_angle">ANGLE (OpenGL 4.6, only support 1.17+)</string>
|
||||
<string name="settings_fcl_renderer_vgpu" translatable="false">Vgpu (OpenGL 2.1+)</string>
|
||||
<string name="settings_fcl_renderer_vgpu" translatable="false">VGPU (OpenGL 2.1+)</string>
|
||||
|
||||
<string name="settings_game">Game Settings</string>
|
||||
<string name="settings_game_dimension">Resolution</string>
|
||||
|
|
Loading…
Reference in New Issue