Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3cdc8ee2c | ||
|
|
2275ac5e27 | ||
|
|
6ed5f7c953 | ||
|
|
5067dba275 | ||
|
|
f446e11bd7 | ||
|
|
e6ccde2343 | ||
|
|
9514685337 |
No files matched your search
@@ -51,7 +51,7 @@ def getVersionName = {
|
||||
return ("LOCAL-" + "${getDate()}")
|
||||
}else {
|
||||
// Used by github actions
|
||||
TAG_STRING = 'gladiolus-' + "${getDate()}" + "-" + TAG_PART_COMMIT.toString().trim()
|
||||
TAG_STRING = 'foxglove-' + "${getDate()}" + "-" + TAG_PART_COMMIT.toString().trim()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -132,9 +132,6 @@ public abstract class SideDialogView {
|
||||
return;
|
||||
}
|
||||
|
||||
mSideDialogAnimator.removeAllUpdateListeners();
|
||||
mSideDialogAnimator.removeAllListeners();
|
||||
|
||||
mParent.removeView(mDialogLayout);
|
||||
mIsInstantiated = false;
|
||||
|
||||
@@ -215,6 +212,7 @@ public abstract class SideDialogView {
|
||||
mSideDialogAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mSideDialogAnimator.removeListener(this);
|
||||
deflateLayout();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -654,27 +654,37 @@ public final class Tools {
|
||||
}
|
||||
|
||||
public static void setFullscreen(Activity activity, boolean fullscreen) {
|
||||
final View decorView = activity.getWindow().getDecorView();
|
||||
View.OnSystemUiVisibilityChangeListener visibilityChangeListener = visibility -> {
|
||||
boolean multiWindowMode = SDK_INT >= 24 && activity.isInMultiWindowMode();
|
||||
// When in multi-window mode, asking for fullscreen makes no sense (cause the launcher runs in a window)
|
||||
// So, ignore the fullscreen setting when activity is in multi window mode
|
||||
if(fullscreen && !multiWindowMode){
|
||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
}else{
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
}
|
||||
WindowInsetsControllerCompat windowInsetsController =
|
||||
WindowCompat.getInsetsController(activity.getWindow(), activity.getWindow().getDecorView());
|
||||
if (windowInsetsController == null) {
|
||||
Log.w(APP_NAME, "WindowInsetsController is null, cannot set fullscreen");
|
||||
return;
|
||||
}
|
||||
|
||||
// Configure the behavior of the hidden system bars.
|
||||
windowInsetsController.setSystemBarsBehavior(
|
||||
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
);
|
||||
|
||||
ViewCompat.setOnApplyWindowInsetsListener(
|
||||
activity.getWindow().getDecorView(),
|
||||
(view, windowInsets) -> {
|
||||
boolean fullscreenImpl = fullscreen;
|
||||
if (SDK_INT >= Build.VERSION_CODES.N && activity.isInMultiWindowMode())
|
||||
fullscreenImpl = false;
|
||||
|
||||
if (fullscreenImpl) {
|
||||
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars());
|
||||
} else {
|
||||
windowInsetsController.show(WindowInsetsCompat.Type.systemBars());
|
||||
}
|
||||
|
||||
if(SDK_INT >= Build.VERSION_CODES.R)
|
||||
activity.getWindow().setDecorFitsSystemWindows(!fullscreenImpl);
|
||||
|
||||
return ViewCompat.onApplyWindowInsets(view, windowInsets);
|
||||
});
|
||||
|
||||
};
|
||||
decorView.setOnSystemUiVisibilityChangeListener(visibilityChangeListener);
|
||||
visibilityChangeListener.onSystemUiVisibilityChange(decorView.getSystemUiVisibility()); //call it once since the UI state may not change after the call, so the activity wont become fullscreen
|
||||
}
|
||||
|
||||
public static DisplayMetrics currentDisplayMetrics;
|
||||
|
||||
+1
-5
@@ -80,10 +80,6 @@ public class ControlLayout extends FrameLayout {
|
||||
}
|
||||
|
||||
public void loadLayout(CustomControls controlLayout) {
|
||||
boolean sanitizedModified = false;
|
||||
if(controlLayout != null) {
|
||||
sanitizedModified = LayoutSanitizer.sanitizeLayout(controlLayout);
|
||||
}
|
||||
if(mActionRow == null){
|
||||
mActionRow = new ActionRow(getContext());
|
||||
addView(mActionRow);
|
||||
@@ -122,7 +118,7 @@ public class ControlLayout extends FrameLayout {
|
||||
|
||||
mLayout.scaledAt = LauncherPreferences.PREF_BUTTONSIZE;
|
||||
|
||||
setModified(sanitizedModified);
|
||||
setModified(false);
|
||||
mButtons = null;
|
||||
getButtonChildren(); // Force refresh
|
||||
} // loadLayout
|
||||
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package net.kdt.pojavlaunch.customcontrols;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class LayoutSanitizer {
|
||||
|
||||
// Maybe add more conditions here later?
|
||||
private static boolean isInvalidFormula(String formula) {
|
||||
return formula.contains("Infinity");
|
||||
}
|
||||
|
||||
private static boolean isSaneData(ControlData controlData) {
|
||||
if(controlData.getWidth() == 0 || controlData.getHeight() == 0) return false;
|
||||
if(isInvalidFormula(controlData.dynamicX) || isInvalidFormula(controlData.dynamicY)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static ControlData getControlData(Object dataEntry) {
|
||||
if(dataEntry instanceof ControlData) {
|
||||
return (ControlData) dataEntry;
|
||||
}else if(dataEntry instanceof ControlDrawerData) {
|
||||
return ((ControlDrawerData) dataEntry).properties;
|
||||
}else throw new RuntimeException("Encountered wrong type during ControlData sanitization");
|
||||
}
|
||||
|
||||
private static boolean sanitizeList(List<?> controlDataList) {
|
||||
boolean madeChanges = false;
|
||||
Iterator<?> iterator = controlDataList.iterator();
|
||||
while(iterator.hasNext()) {
|
||||
ControlData controlData = getControlData(iterator.next());
|
||||
if(!isSaneData(controlData)) {
|
||||
madeChanges = true;
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
return madeChanges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check all buttons in a control layout and ensure they're sane (contain values valid enough
|
||||
* to be displayed properly). Removes any buttons deemed not sane.
|
||||
* @param controls the original control layout.
|
||||
* @return whether the sanitization process made any changes to the layout
|
||||
*/
|
||||
public static boolean sanitizeLayout(CustomControls controls) {
|
||||
boolean madeChanges = sanitizeList(controls.mControlDataList);
|
||||
if(sanitizeList(controls.mDrawerDataList)) madeChanges = true;
|
||||
if(sanitizeList(controls.mJoystickDataList)) madeChanges = true;
|
||||
return madeChanges;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user