essential-actions

Clone or download

Modified Files

package com.stream_pi.democustomtoggleaction;
package com.stream_pi.democustomtoggleaction;
import com.stream_pi.action_api.action.DisplayTextAlignment;
import com.stream_pi.action_api.actionproperty.property.ControlType;
import com.stream_pi.action_api.actionproperty.property.ControlType;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.normalaction.ToggleAction;
import com.stream_pi.action_api.externalplugin.ToggleAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import java.util.ArrayList;
import java.util.ArrayList;
public class DemoCustomToggleAction extends ToggleAction
public class DemoCustomToggleAction extends ToggleAction
{
{
public DemoCustomToggleAction()
public DemoCustomToggleAction()
{
{
setName("Demo Action");
setName("Demo Action");
setAuthor("dubbadhar");
setAuthor("dubbadhar");
setHelpLink("https://github.com/Stream-Pi/");
setHelpLink("https://github.com/Stream-Pi/");
setVersion(new Version(1,0,0));
setVersion(new Version(1,0,0));
setCategory("Custom Actions");
setCategory("Custom Actions");
}
}
@Override
@Override
public void onToggleOn() throws Exception {
public void onToggleOn() throws Exception
new StreamPiAlert("Alert", "Toggle ON").show();
{
}
@Override
public void onActionCreate()
{
setDisplayText("Hi");
setDisplayTextAlignment(DisplayTextAlignment.BOTTOM);
try
{
setToggleOnIcon(getClass().getResource("streamdeck_key.png").openStream().readAllBytes());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
@Override
@Override
public void onToggleOff() throws Exception {
public void onToggleOff() throws Exception {
new StreamPiAlert("Alert", "Toggle OFF").show();
new StreamPiAlert("Alert", "Toggle OFF").show();
}
}
@Override
@Override
public void initProperties() throws Exception {
public void initProperties() throws Exception {
//Called First
//Called First
}
}
@Override
@Override
public void initAction() {
public void initAction() {
// This is called after initProperties()
// This is called after initProperties()
}
}
@Override
@Override
public void onShutDown() throws Exception {
public void onShutDown() throws Exception {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
}
}
}
}
module com.stream_pi.democustomtoggleaction
module com.stream_pi.democustomtoggleaction
{
{
requires com.stream_pi.action_api;
requires com.stream_pi.action_api;
requires org.kordamp.ikonli.javafx;
requires org.kordamp.ikonli.javafx;
provides com.stream_pi.action_api.normalaction.ExternalPlugin with com.stream_pi.democustomtoggleaction.DemoCustomToggleAction;
provides com.stream_pi.action_api.externalplugin.ExternalPlugin with com.stream_pi.democustomtoggleaction.DemoCustomToggleAction;
}
}
package com.stream_pi.websiteaction;
package com.stream_pi.websiteaction;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.normalaction.NormalAction;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import java.awt.*;
import java.awt.*;
import java.net.URI;
import java.net.URI;
public class WebsiteAction extends NormalAction {
public class WebsiteAction extends NormalAction
{
public WebsiteAction()
public WebsiteAction()
{
{
setName("Website");
setName("Website");
setCategory("Essentials");
setCategory("Essentials");
setAuthor("rnayabed");
setAuthor("rnayabed");
setServerButtonGraphic("fas-globe");
setServerButtonGraphic("fas-globe");
setHelpLink("https://github.com/stream-pi/essentialactions");
setHelpLink("https://github.com/stream-pi/essentialactions");
setVersion(new Version(1,0,0));
setVersion(new Version(1,0,0));
}
}
@Override
public void onActionSavedFromServer() throws Exception
{
String website = getClientProperties().getSingleProperty("websiteURL").getStringValue();
if(website != null)
{
if(website.contains("google.com"))
setDisplayText("GOOGLE");
saveClientAction();
}
}
@Override
@Override
public void initProperties() throws Exception {
public void initProperties() throws Exception {
Property websiteUrl = new Property("websiteURL", Type.STRING);
Property websiteUrl = new Property("websiteURL", Type.STRING);
websiteUrl.setDisplayName("Website URL");
websiteUrl.setDisplayName("Website URL");
websiteUrl.setDefaultValueStr("https://stream-pi.com/");
websiteUrl.setDefaultValueStr("https://stream-pi.com/");
websiteUrl.setCanBeBlank(false);
websiteUrl.setCanBeBlank(false);
addClientProperties(websiteUrl);
addClientProperties(websiteUrl);
}
}
@Override
@Override
public void initAction() throws Exception {
public void initAction() throws Exception {
}
}
@Override
@Override
public void onActionClicked() throws Exception {
public void onActionClicked() throws Exception {
Property website = getClientProperties().getSingleProperty("websiteURL");
Property website = getClientProperties().getSingleProperty("websiteURL");
String urlToOpen = website.getStringValue();
String urlToOpen = website.getStringValue();
if(!urlToOpen.startsWith("https://") && !urlToOpen.startsWith("http://"))
if(!urlToOpen.startsWith("https://") && !urlToOpen.startsWith("http://"))
{
{
urlToOpen = "https://" + urlToOpen;
urlToOpen = "https://" + urlToOpen;
}
}
try
try
{
{
Desktop.getDesktop().browse(new URI(urlToOpen));
Desktop.getDesktop().browse(new URI(urlToOpen));
}
}
catch (Exception e)
catch (Exception e)
{
{
throw new MinorException("Unable to open URL '"+urlToOpen+"'. Check if its correct.");
throw new MinorException("Unable to open URL '"+urlToOpen+"'. Check if its correct.");
}
}
}
}
@Override
@Override
public void onShutDown() throws Exception {
public void onShutDown() throws Exception {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
}
}
}
}
module com.stream_pi.websiteaction {
module com.stream_pi.websiteaction {
requires com.stream_pi.action_api;
requires com.stream_pi.action_api;
requires com.stream_pi.util;
requires com.stream_pi.util;
requires org.kordamp.ikonli.javafx;
requires org.kordamp.ikonli.javafx;
requires org.kordamp.ikonli.fontawesome5;
requires org.kordamp.ikonli.fontawesome5;
requires java.desktop;
requires java.desktop;
provides com.stream_pi.action_api.normalaction.NormalAction with com.stream_pi.websiteaction.WebsiteAction;
provides com.stream_pi.action_api.externalplugin.ExternalPlugin with com.stream_pi.websiteaction.WebsiteAction;
}
}