Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Update discover filters
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldieeins committed Jul 21, 2024
1 parent be46406 commit b50f857
Show file tree
Hide file tree
Showing 23 changed files with 370 additions and 14 deletions.
4 changes: 1 addition & 3 deletions application-main/src/main/java/com/zyneonstudios/Main.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.zyneonstudios;

import com.zyneonstudios.application.frame.ZyneonSplash;
import com.zyneonstudios.application.main.ApplicationConfig;
import com.zyneonstudios.application.main.NexusApplication;

import java.net.MalformedURLException;
Expand All @@ -13,8 +12,7 @@ public class Main {
public static void main(String[] args) throws MalformedURLException {
splash = new ZyneonSplash();
splash.setVisible(true);
new ApplicationConfig(args);
NexusApplication application = new NexusApplication();
NexusApplication application = new NexusApplication(args);
application.launch();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public void resolveRequest(String request) {
open(request.replaceFirst("open.",""));
} else if(request.startsWith("init.")) {
init(request.replace("init.", ""));
} else if(request.startsWith("load.")) {
load(request.replace("load.", ""));
}
for(ApplicationModule module:NexusApplication.getModuleLoader().getApplicationModules()) {
module.getConnector().resolveFrameRequest(request);
Expand All @@ -59,6 +61,21 @@ private void open(String request) {
}
}

private void load(String request) {
switch (request) {
case "drive" ->
frame.getBrowser().loadURL("https://drive.zyneonstudios.com/app/?theme=" + ApplicationConfig.theme + "&language=" + ApplicationConfig.language);
case "discover" ->
frame.getBrowser().loadURL(ApplicationConfig.urlBase + ApplicationConfig.language + "/discover.html");
case "downloads" ->
frame.getBrowser().loadURL(ApplicationConfig.urlBase + ApplicationConfig.language + "/downloads.html");
case "library" ->
frame.getBrowser().loadURL(ApplicationConfig.urlBase + ApplicationConfig.language + "/library.html");
case "settings" ->
frame.getBrowser().loadURL(ApplicationConfig.urlBase + ApplicationConfig.language + "/settings.html");
}
}

private void init(String request) {
frame.executeJavaScript("syncDesktop();");
if(request.equals("discover")) {
Expand All @@ -79,6 +96,9 @@ private void init(String request) {

private void sync(String request) {
if(request.startsWith("title.")) {
if(ApplicationConfig.hasDriveAccess()) {
frame.executeJavaScript("document.getElementById('drive-button').style.display = 'flex';");
}
String[] request_ = request.replace("title.","").split("-.-",2);
Color background;
Color foreground;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import org.cef.CefSettings;
import org.cef.browser.CefBrowser;
import org.cef.browser.CefMessageRouter;
import org.cef.callback.CefBeforeDownloadCallback;
import org.cef.callback.CefDownloadItem;
import org.cef.callback.CefDownloadItemCallback;
import org.cef.handler.CefDownloadHandler;
import org.cef.handler.CefFocusHandlerAdapter;

import javax.imageio.ImageIO;
Expand All @@ -21,6 +25,7 @@
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.Objects;

@SuppressWarnings("unused")
Expand Down Expand Up @@ -81,7 +86,23 @@ public void stateHasChanged(CefApp.CefAppState state) {
builder.install();
builder.getCefSettings().windowless_rendering_enabled = false;
app = builder.build();

client = app.createClient();
client.addDownloadHandler(new CefDownloadHandler() {
@Override
public void onBeforeDownload(CefBrowser browser, CefDownloadItem item, String sourceURL, CefBeforeDownloadCallback callback) {
if(Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI(item.getURL()));
} catch (Exception ignore) {}
}
}

@Override
public void onDownloadUpdated(CefBrowser cefBrowser, CefDownloadItem cefDownloadItem, CefDownloadItemCallback cefDownloadItemCallback) {
// Downloadfortschrittsaktualisierungen behandeln (optional)
}
});
CefMessageRouter messageRouter = CefMessageRouter.create();
if(client==null) {
NexusApplication.getLogger().error("[WEBFRAME] Couldn't initialize WebFrame: CefClient client can't be null!");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.zyneonstudios.application.main;

import com.zyneonstudios.Main;
import com.zyneonstudios.application.frame.web.ApplicationFrame;
import live.nerotv.shademebaby.file.Config;
import live.nerotv.shademebaby.utils.FileUtil;

Expand All @@ -17,7 +18,7 @@
import java.util.UUID;

@SuppressWarnings("unused")
public record ApplicationConfig(String[] args) {
public record ApplicationConfig(String[] args, NexusApplication app) {

public static String language = "en";
public static String urlBase = "file://" + getApplicationPath() + "temp/ui/";
Expand All @@ -31,8 +32,12 @@ public record ApplicationConfig(String[] args) {
private static String os = null;
private static Config updateConfig = null;
private static String[] arguments = null;
private static boolean driveAccess = false;
private static NexusApplication application = null;

public ApplicationConfig(String[] args) {
public ApplicationConfig(String[] args, NexusApplication app) {
this.app = app;
application = app;
this.args = args;
arguments = this.args;
for (String arg : args) {
Expand Down Expand Up @@ -82,6 +87,19 @@ else if(arg.startsWith("--path:")) {
}
}

public static boolean hasDriveAccess() {
return driveAccess;
}

public static void enableDriveAccess() {
((ApplicationFrame)application.getFrame()).executeJavaScript("document.getElementById('drive-button').style.display = 'flex';");
driveAccess = true;
}

public static void disableDriveAccess() {
driveAccess = false;
}

public static String[] getArguments() {
return arguments;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ public class NexusApplication {
private final ApplicationRunner runner;
private final DownloadManager downloadManager;

public NexusApplication() {
moduleLoader = new ModuleLoader(this);
logger.log("[APP] Updated application ui: "+update());
public NexusApplication(String[] args) {
try {
FlatDarkLaf.setup();
UIManager.setLookAndFeel(new FlatDarkLaf());
} catch (Exception ignore) {}
new ApplicationConfig(args,this);
moduleLoader = new ModuleLoader(this);
logger.log("[APP] Updated application ui: "+update());
boolean disableCustomFrame = false;
if(ApplicationConfig.getSettings().get("settings.linux.customFrame")!=null) {
try {
Expand Down
Binary file modified application-main/src/main/resources/content.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
--highlight: #ffffff;
--accent: #8732ec;
--accent2: #a458ff;

--active: #46e340;
--inactive: #ff5858;
}

body {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
--highlight: #ffffff;
--accent: #8732ec;
--accent2: #a458ff;

--active: #46e340;
--inactive: #ff5858;
}

body {
Expand Down
128 changes: 125 additions & 3 deletions application-ui/content/assets/application/css/app-discover.css
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,16 @@
margin: 5rem 0.5rem 0.5rem 0.5rem;
width: 15rem;
max-width: 15rem;
height: calc(100% - 7.75rem);
max-height: calc(100% - 7.75rem);
height: calc(100% - 6.75rem);
max-height: calc(100% - 6.75rem);
padding: 0.5rem;
overflow: hidden;

.search-filter {
position: relative;
overflow-y: auto;
height: calc(100% + 0.5rem);
}
}

.discover-content #discover-search .search-flex #search-content {
Expand All @@ -199,4 +207,118 @@
height: 1.5rem;
background: linear-gradient(to top, var(--background4), transparent);
}
}
}

#filter-group-template {
display: none;
}

.filter-group {
transition: all 0.25s ease;
padding: 0.5rem;
border-radius: 0.5rem;

#select-template, #toggle-template {
display: none;
}
}

.filter-toggle {
margin-top: 0.4rem;

.toggle-slider {
transition: all 0.25s ease;
position: relative;
margin-left: 1rem;
width: 3rem;
height: 1.5rem;
border-radius: 0.75rem;
left: -0.575rem;

background: var(--background);

.slider {
transition: all 0.25s ease;
position: absolute;
height: 1.1rem;
width: 1.1rem;
margin: 0.2rem;
border-radius: 0.55rem;
background: var(--inactive);
}

.slider.active {
right: 0.025rem;
background: var(--active);
}
}

.toggle-slider:hover {
cursor: pointer;
background: var(--background3) !important;
}

.toggle-slider.disabled {
background: var(--background) !important;
cursor: not-allowed;

.slider {
background: var(--foreground3);
}
}
}

.filter-toggle.max {

.toggle-slider {
position: absolute !important;
left: 9.9rem;
}
}

.filter-select {
position: relative;
overflow: hidden;

select {
transition: all 0.25s ease;
background: var(--background);
color: var(--foreground);
padding: 0.4rem 0.35rem 0.45rem 0.35rem;
border-radius: 0.5rem;
font-size: 0.9rem;
text-overflow: ellipsis;
position: relative; width: 100%;
}

select:hover {
cursor: pointer;
background: var(--background3) !important;
}

select:disabled {
background: var(--background) !important;
cursor: not-allowed;
color: var(--foreground3);
}
}

.search-filter {
h4 {
font-family: MPLUS1p-Bold, sans-serif;
font-size: 1rem;
margin: -0.2rem 0 0.25rem 0;
}
}

.filter-group:hover {
background: var(--background);

.toggle-slider {
background: var(--background2) !important;
}

select {
background: var(--background2) !important;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ li:hover {
margin-bottom: 1rem;
}

#menu-panel {
#menu-panel, #drive-button {
display: none;
}

Expand Down
Loading

0 comments on commit b50f857

Please sign in to comment.