client

Clone or download

Modified Files

--- 'a/src/android/AndroidManifest.xml'
+++ b/src/android/AndroidManifest.xml
@@ -1,5 +1,5 @@
<?xml version='1.0'?>
-<manifest xmlns:android='http://schemas.android.com/apk/res/android' package='com.stream_pi.client' android:versionCode='1' android:versionName='1.0.0 EA+3'>
+<manifest xmlns:android='http://schemas.android.com/apk/res/android' package='com.streampi.client' android:versionCode='1' android:versionName='1.0.0 EA+3'>
<supports-screens android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
--- 'a/src/main/java/com/stream_pi/client/controller/ClientListener.java'
+++ b/src/main/java/com/stream_pi/client/controller/ClientListener.java
@@ -2,6 +2,7 @@ package com.stream_pi.client.controller;
import com.stream_pi.action_api.action.Action;
import com.stream_pi.client.connection.Client;
+import com.stream_pi.client.io.Config;
import com.stream_pi.client.profile.ClientProfile;
import com.stream_pi.client.profile.ClientProfiles;
import com.stream_pi.client.window.dashboard.actiongridpane.ActionBox;
@@ -9,6 +10,7 @@ import com.stream_pi.client.window.dashb
import com.stream_pi.theme_api.Theme;
import com.stream_pi.theme_api.Themes;
import com.stream_pi.util.exception.SevereException;
+import javafx.geometry.Orientation;
import java.util.concurrent.ExecutorService;
@@ -73,4 +75,6 @@ public interface ClientListener
void exitApp();
ExecutorService getExecutor();
+
+ Orientation getCurrentOrientation();
}
--- 'a/src/main/java/com/stream_pi/client/controller/Controller.java'
+++ b/src/main/java/com/stream_pi/client/controller/Controller.java
@@ -31,6 +31,7 @@ import javafx.animation.Timeline;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
import javafx.geometry.Orientation;
import javafx.scene.Node;
import javafx.scene.input.KeyCombination;
@@ -178,6 +179,24 @@ public class Controller extends Base
getStage().heightProperty().addListener((observableValue, orientation, t1) -> syncClientSizeDetailsWithServer());
}
+ if(getClientInfo().isPhone() && getConfig().isInvertRowsColsOnDeviceRotate())
+ {
+ OrientationService.create().ifPresent(orientationService -> {
+ if(orientationService.getOrientation().isPresent())
+ {
+ setCurrentOrientation(orientationService.getOrientation().get());
+ orientationService.orientationProperty().addListener((observableValue, oldOrientation, newOrientation) -> {
+ setCurrentOrientation(newOrientation);
+
+ getDashboardPane().renderProfile(
+ getCurrentProfile(),
+ getCurrentParent(),
+ true
+ );
+ });
+ }
+ });
+ }
}
catch (SevereException e)
{
@@ -189,6 +208,19 @@ public class Controller extends Base
}
}
+ private Orientation currentOrientation;
+
+ @Override
+ public Orientation getCurrentOrientation()
+ {
+ return currentOrientation;
+ }
+
+ private void setCurrentOrientation(Orientation currentOrientation)
+ {
+ this.currentOrientation = currentOrientation;
+ }
+
public void syncClientSizeDetailsWithServer()
{
if(isConnected())
--- 'a/src/main/java/com/stream_pi/client/io/Config.java'
+++ b/src/main/java/com/stream_pi/client/io/Config.java
@@ -470,4 +470,20 @@ public class Config
{
getOthersElement().getElementsByTagName("screen-saver-timeout-seconds").item(0).setTextContent(value);
}
+
+
+ public boolean getDefaultInvertRowsColsOnDeviceRotate()
+ {
+ return true;
+ }
+
+ public boolean isInvertRowsColsOnDeviceRotate()
+ {
+ return XMLConfigHelper.getBooleanProperty(getOthersElement(), "invert-rows-cols-on-device-rotate", getDefaultInvertRowsColsOnDeviceRotate(), false, true, document, configFile);
+ }
+
+ public void setInvertRowsColsOnDeviceRotate(boolean value)
+ {
+ getOthersElement().getElementsByTagName("invert-rows-cols-on-device-rotate").item(0).setTextContent(value+"");
+ }
}
--- 'a/src/main/java/com/stream_pi/client/window/dashboard/actiongridpane/ActionGridPane.java'
+++ b/src/main/java/com/stream_pi/client/window/dashboard/actiongridpane/ActionGridPane.java
@@ -6,12 +6,16 @@ import com.stream_pi.action_api.action.A
import com.stream_pi.action_api.action.ActionType;
import com.stream_pi.action_api.action.Location;
import com.stream_pi.client.controller.ClientListener;
+import com.stream_pi.client.info.ClientInfo;
+import com.stream_pi.client.info.StartupFlags;
+import com.stream_pi.client.io.Config;
import com.stream_pi.client.profile.ClientProfile;
import com.stream_pi.client.window.ExceptionAndAlertHandler;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.SevereException;
import javafx.concurrent.Task;
import javafx.geometry.Insets;
+import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.CacheHint;
import javafx.scene.Node;
@@ -258,7 +262,30 @@ public class ActionGridPane extends Scro
actionBox.setStreamPiParent(currentParent);
- actionsGridPane.add(actionBox, col, row);
+ try
+ {
+ if(Config.getInstance().isInvertRowsColsOnDeviceRotate() && ClientInfo.getInstance().isPhone())
+ {
+ if(clientListener.getCurrentOrientation() == Orientation.HORIZONTAL)
+ {
+ actionsGridPane.add(actionBox, col, row);
+ }
+ else
+ {
+ actionsGridPane.add(actionBox, row, col);
+ }
+ }
+ else
+ {
+ actionsGridPane.add(actionBox, col, row);
+ }
+ }
+ catch (SevereException e)
+ {
+ exceptionAndAlertHandler.handleSevereException(e);
+ }
+
+
return actionBox;
}
--- 'a/src/main/java/com/stream_pi/client/window/settings/GeneralTab.java'
+++ b/src/main/java/com/stream_pi/client/window/settings/GeneralTab.java
@@ -79,6 +79,9 @@ public class GeneralTab extends VBox
private HBoxWithSpaceBetween showCursorHBox;
private ToggleSwitch showCursorToggleSwitch;
+ private HBoxWithSpaceBetween invertRowsColsHBox;
+ private ToggleSwitch invertRowsColsToggleSwitch;
+
private TextField themesPathTextField;
private TextField iconsPathTextField;
private TextField profilesPathTextField;
@@ -170,6 +173,10 @@ public class GeneralTab extends VBox
showCursorHBox = new HBoxWithSpaceBetween("Show Cursor", showCursorToggleSwitch);
showCursorHBox.managedProperty().bind(showCursorHBox.visibleProperty());
+ invertRowsColsToggleSwitch = new ToggleSwitch();
+ invertRowsColsHBox = new HBoxWithSpaceBetween("Invert Grid on Rotate", invertRowsColsToggleSwitch);
+ invertRowsColsHBox.managedProperty().bind(invertRowsColsHBox.visibleProperty());
+
int prefWidth = 200;
HBoxInputBox themesPathInputBox = new HBoxInputBox("Themes Path", themesPathTextField, prefWidth);
@@ -234,6 +241,7 @@ public class GeneralTab extends VBox
iconsPathInputBox,
profilesPathInputBox,
screenTimeoutSecondsHBoxInputBox,
+ invertRowsColsHBox,
screenSaverHBox,
tryConnectingToServerIfActionClickedHBox,
fullScreenModeHBox,
@@ -300,13 +308,12 @@ public class GeneralTab extends VBox
}
else
{
- if(!StartupFlags.IS_SHOW_SHUT_DOWN_BUTTON)
- {
- shutdownButton.setVisible(false);
- }
+ shutdownButton.setVisible(StartupFlags.IS_SHOW_SHUT_DOWN_BUTTON);
vibrateOnActionPressHBox.setVisible(false);
+ invertRowsColsHBox.setVisible(false);
+
fullScreenModeHBox.setVisible(StartupFlags.SHOW_FULLSCREEN_TOGGLE_BUTTON);
buttonBar.getChildren().add(exitButton);
@@ -476,6 +483,7 @@ public class GeneralTab extends VBox
connectOnStartupToggleSwitch.setSelected(config.isConnectOnStartup());
vibrateOnActionPressToggleSwitch.setSelected(config.isVibrateOnActionClicked());
tryConnectingToServerIfActionClickedToggleSwitch.setSelected(config.isTryConnectingWhenActionClicked());
+ invertRowsColsToggleSwitch.setSelected(config.isInvertRowsColsOnDeviceRotate());
}
public void onSaveButtonClicked()
@@ -662,7 +670,7 @@ public class GeneralTab extends VBox
}
config.setVibrateOnActionClicked(isVibrateOnActionClicked);
-
+ config.setInvertRowsColsOnDeviceRotate(invertRowsColsToggleSwitch.isSelected());
config.save();
Binary files 'a/src/main/resources/com/stream_pi/client/Default.zip' and b/src/main/resources/com/stream_pi/client/Default.zip differ