Skip to content

Commit

Permalink
Added support for ToggleFullScreen. Using Input.ExecuteAction instead…
Browse files Browse the repository at this point in the history
… of GUI.SetFullscreen because the later doesn't work.
  • Loading branch information
SyncedSynapse committed Jan 25, 2015
1 parent be130b8 commit c4d5c4b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
24 changes: 24 additions & 0 deletions app/src/main/java/com/syncedsynapse/kore2/jsonrpc/method/GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.syncedsynapse.kore2.jsonrpc.ApiException;
import com.syncedsynapse.kore2.jsonrpc.ApiMethod;
import com.syncedsynapse.kore2.utils.JsonUtils;

/**
* All JSON RPC methods in GUI.*
Expand Down Expand Up @@ -181,4 +182,27 @@ public String resultFromJson(ObjectNode jsonObject) throws ApiException {
}
}

/**
* Toggle fullscreen/GUI
*/
public static final class SetFullscreen extends ApiMethod<Boolean> {
public final static String METHOD_NAME = "GUI.SetFullscreen";

/**
* Toggle fullscreen/GUI
*/
public SetFullscreen() {
super();
addParameterToRequest("fullscreen", "toggle");
}

@Override
public String getMethodName() { return METHOD_NAME; }

@Override
public Boolean resultFromJson(ObjectNode jsonObject) throws ApiException {
return JsonUtils.booleanFromJsonNode(jsonObject, RESULT_NODE);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@
import com.syncedsynapse.kore2.host.HostConnectionObserver;
import com.syncedsynapse.kore2.host.HostManager;
import com.syncedsynapse.kore2.jsonrpc.ApiCallback;
import com.syncedsynapse.kore2.jsonrpc.method.*;
import com.syncedsynapse.kore2.jsonrpc.method.Application;
import com.syncedsynapse.kore2.jsonrpc.method.AudioLibrary;
import com.syncedsynapse.kore2.jsonrpc.method.Input;
import com.syncedsynapse.kore2.jsonrpc.method.System;
import com.syncedsynapse.kore2.jsonrpc.method.VideoLibrary;
import com.syncedsynapse.kore2.jsonrpc.type.ListType;
import com.syncedsynapse.kore2.jsonrpc.type.PlayerType;
import com.syncedsynapse.kore2.ui.hosts.AddHostActivity;
Expand Down Expand Up @@ -173,6 +176,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
SendTextDialogFragment.newInstance(getString(R.string.send_text));
dialog.show(getSupportFragmentManager(), null);
return true;
case R.id.toggle_fullscreen:
// GUI.SetFullscreen actionSetFullscreen = new GUI.SetFullscreen();
Input.ExecuteAction actionSetFullscreen = new Input.ExecuteAction(Input.ExecuteAction.TOGGLEFULLSCREEN);
actionSetFullscreen.execute(hostManager.getConnection(), null, null);
return true;
case R.id.clean_video_library:
VideoLibrary.Clean actionCleanVideo = new VideoLibrary.Clean();
actionCleanVideo.execute(hostManager.getConnection(), null, null);
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/menu/remote.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@
app:showAsAction="never"/>
</menu>
</item>
<item android:id="@+id/toggle_fullscreen"
android:title="@string/toggle_fullscreen"
android:orderInCategory="4"
app:showAsAction="never"/>
</menu>
2 changes: 2 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="update_video_library">Mettre à jour la bibliothèque vidéo</string>
<string name="update_audio_library">Mettre à jour la bibliothèque audio</string>

<string name="toggle_fullscreen">Plein écran</string>

<string name="connected_to">Connecté à %1$s</string>
<string name="connecting">Connexion en cours\u2026</string>
<string name="connecting_to">Connexion à %1$s (%2$s)\u2026</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="update_video_library">Update video library</string>
<string name="update_audio_library">Update audio library</string>

<string name="toggle_fullscreen">Toggle fullscreen</string>

<string name="connected_to">Connected to %1$s</string>
<string name="connecting">Connecting…</string>
<string name="connecting_to">Connecting to %1$s (%2$s)…</string>
Expand Down

0 comments on commit c4d5c4b

Please sign in to comment.