Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavo committed Nov 1, 2024
1 parent 3bf5204 commit 2d7f185
Show file tree
Hide file tree
Showing 114 changed files with 14,798 additions and 44 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
# TODO: Java 8
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 8
java-version: 11
java-package: 'jdk+fx'
- name: Build with Gradle
run: ./gradlew build --no-daemon
Expand Down
23 changes: 14 additions & 9 deletions HMCL/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ version = "$versionRoot.$buildNumber"

dependencies {
implementation(project(":HMCLCore"))
implementation("libs:JFoenix")
// implementation("com.jfoenix:jfoenix:9.0.10")
}

fun digest(algorithm: String, bytes: ByteArray): ByteArray = MessageDigest.getInstance(algorithm).digest(bytes)
Expand Down Expand Up @@ -81,21 +81,25 @@ fun attachSignature(jar: File) {
}
}

val java11 = sourceSets.create("java11") {
tasks.checkstyleMain {
exclude("**/com/jfoenix/**")
}

val java9 = sourceSets.create("java9") {
java {
srcDir("src/main/java11")
srcDir("src/main/java9")
}
}

tasks.getByName<JavaCompile>(java11.compileJavaTaskName) {
tasks.getByName<JavaCompile>(java9.compileJavaTaskName) {
if (JavaVersion.current() < JavaVersion.VERSION_11) {
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(11))
})
}
options.compilerArgs.add("--add-exports=java.base/jdk.internal.loader=ALL-UNNAMED")
sourceCompatibility = "11"
targetCompatibility = "11"
sourceCompatibility = "9"
targetCompatibility = "9"
}

tasks.jar {
Expand All @@ -113,7 +117,7 @@ tasks.getByName<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("sha

minimize {
exclude(dependency("com.google.code.gson:.*:.*"))
exclude(dependency("libs:JFoenix:.*"))
// exclude(dependency("com.jfoenix:.*:.*"))
}

manifest {
Expand All @@ -135,6 +139,7 @@ tasks.getByName<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("sha
"javafx.base/com.sun.javafx.event",
"javafx.base/com.sun.javafx.runtime",
"javafx.graphics/javafx.css",
"javafx.graphics/com.sun.javafx.scene",
"javafx.graphics/com.sun.javafx.stage",
"javafx.graphics/com.sun.prism",
"javafx.controls/com.sun.javafx.scene.control",
Expand Down Expand Up @@ -186,9 +191,9 @@ tasks.processResources {
convertToBSS("assets/css/blue.css")

into("META-INF/versions/11") {
from(sourceSets["java11"].output)
from(java9.output)
}
dependsOn(tasks["java11Classes"])
dependsOn(tasks[java9.classesTaskName])
}

val makeExecutables = tasks.create("makeExecutables") {
Expand Down
47 changes: 47 additions & 0 deletions HMCL/src/main/java/com/jfoenix/adapters/VirtualFlowAdapter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.jfoenix.adapters;

import javafx.scene.Node;
import javafx.scene.control.IndexedCell;
import javafx.scene.control.skin.VirtualFlow;

public final class VirtualFlowAdapter<T extends IndexedCell<?>> {
@SuppressWarnings("unchecked")
public static <T extends IndexedCell<?>> VirtualFlowAdapter<T> wrap(Node node) {
return new VirtualFlowAdapter<>((VirtualFlow<T>) node);
}

private final VirtualFlow<T> flow;

VirtualFlowAdapter(VirtualFlow<T> flow) {
this.flow = flow;
}

public Node getFlow() {
return flow;
}

public int getCellCount() {
return flow.getCellCount();
}

public T getCell(int index) {
return flow.getCell(index);
}
}
43 changes: 43 additions & 0 deletions HMCL/src/main/java/com/jfoenix/adapters/VirtualFlowHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.jfoenix.adapters;

import javafx.scene.Node;
import javafx.scene.control.IndexedCell;
import javafx.scene.control.skin.VirtualFlow;

import java.util.function.BiFunction;

public final class VirtualFlowHelper {
private VirtualFlowHelper() {
}



public static <T extends IndexedCell<?>, R extends Number> R forEach(Node virtualFlow, R init, BiFunction<T, R, R> func) {
@SuppressWarnings("unchecked")
VirtualFlow<T> flow = (VirtualFlow<T>) virtualFlow;

for (int i = 0; i < flow.getCellCount(); ++i) {
T cell = flow.getCell(i);
init = func.apply(cell, init);
}
return init;
}
}

2 changes: 2 additions & 0 deletions HMCL/src/main/java/com/jfoenix/adapters/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// TODO: Multi-Release
package com.jfoenix.adapters;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.jfoenix.adapters.skins;

import javafx.scene.control.Button;

public class ButtonSkinAdapter extends javafx.scene.control.skin.ButtonSkin {
public ButtonSkinAdapter(Button control) {
super(control);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.jfoenix.adapters.skins;

import javafx.beans.value.ObservableValue;
import javafx.scene.control.CheckBox;
import javafx.scene.control.skin.CheckBoxSkin;

public class CheckBoxSkinAdapter extends CheckBoxSkin {
public CheckBoxSkinAdapter(CheckBox control) {
super(control);
}

protected final void __registerChangeListener(ObservableValue<?> property, String key) {
this.registerChangeListener(property, ignored -> __handleControlPropertyChanged(key));
}

protected void __handleControlPropertyChanged(String key) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.jfoenix.adapters.skins;

import javafx.scene.control.ListView;
import javafx.scene.control.skin.ListViewSkin;

public class ListViewSkinAdapter<T> extends ListViewSkin<T> {
public ListViewSkinAdapter(ListView<T> control) {
super(control);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.jfoenix.adapters.skins;

import javafx.animation.Animation;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.skin.ProgressBarSkin;
import javafx.scene.control.skin.ProgressIndicatorSkin;

import java.lang.invoke.MethodHandles;
import java.lang.invoke.VarHandle;

public class ProgressBarSkinAdapter extends ProgressBarSkin {
private static final VarHandle indeterminateTransitionFieldHandle;

static {
try {
MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(ProgressIndicatorSkin.class, MethodHandles.lookup());
indeterminateTransitionFieldHandle = lookup.findVarHandle(ProgressIndicatorSkin.class, "indeterminateTransition", Animation.class);
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new ExceptionInInitializerError(e);
}
}

public ProgressBarSkinAdapter(ProgressBar control) {
super(control);
}

protected void __registerChangeListener(ObservableValue<?> property, String key) {
this.registerChangeListener(property, (property2) -> __handleControlPropertyChanged(key));
}

protected void __handleControlPropertyChanged(String p) {

}

protected Animation __getIndeterminateTransition() {
return (Animation) indeterminateTransitionFieldHandle.get(this);
}

protected void __setIndeterminateTransition(Animation animation) {
indeterminateTransitionFieldHandle.set(this, animation);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2024 huangyuhui <[email protected]> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.jfoenix.adapters.skins;

import javafx.beans.value.ObservableValue;
import javafx.scene.control.RadioButton;
import javafx.scene.control.skin.RadioButtonSkin;

public class RadioButtonSkinAdapter extends RadioButtonSkin {
public RadioButtonSkinAdapter(RadioButton control) {
super(control);
}

protected void __registerChangeListener(ObservableValue<?> property, String key) {
this.registerChangeListener(property, ignored -> __handleControlPropertyChanged(key));
}

protected void __handleControlPropertyChanged(String key) {
}
}
Loading

0 comments on commit 2d7f185

Please sign in to comment.