splash activity

This commit is contained in:
Tungstend 2022-10-29 22:54:03 +08:00
parent 4ce0f7e89b
commit 8003ecbe26
42 changed files with 1356 additions and 61 deletions

View File

@ -33,6 +33,9 @@ dependencies {
implementation project(path: ':FCLCore')
implementation project(path: ':FCLLibrary')
implementation project(path: ':FCLauncher')
implementation 'org.apache.commons:commons-compress:1.21'
implementation 'org.tukaani:xz:1.8'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
1

View File

@ -1,19 +1,51 @@
package com.tungsten.fcl.activity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.tungsten.fcl.R;
import com.tungsten.fcl.fragment.splash.EulaFragment;
import com.tungsten.fcl.fragment.splash.RuntimeFragment;
import com.tungsten.fcllibrary.component.FCLActivity;
@SuppressLint("CustomSplashScreen")
public class SplashActivity extends FCLActivity {
private EulaFragment eulaFragment;
private RuntimeFragment runtimeFragment;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
initFragments();
start();
}
private void initFragments() {
eulaFragment = new EulaFragment();
runtimeFragment = new RuntimeFragment();
}
public void start() {
SharedPreferences sharedPreferences = getSharedPreferences("launcher", MODE_PRIVATE);
if (sharedPreferences.getBoolean("isFirstLaunch", true)) {
getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.norm_start_anim, R.anim.norm_stop_anim).replace(R.id.fragment, eulaFragment).commit();
}
else {
getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.norm_start_anim, R.anim.norm_stop_anim).replace(R.id.fragment, runtimeFragment).commit();
}
}
public void enterLauncher() {
finish();
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
}

View File

@ -0,0 +1,86 @@
package com.tungsten.fcl.fragment.splash;
import static android.content.Context.MODE_PRIVATE;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tungsten.fcl.R;
import com.tungsten.fcl.activity.SplashActivity;
import com.tungsten.fclcore.util.io.NetworkUtils;
import com.tungsten.fcllibrary.component.FCLFragment;
import com.tungsten.fcllibrary.component.view.FCLButton;
import com.tungsten.fcllibrary.component.view.FCLProgressBar;
import com.tungsten.fcllibrary.component.view.FCLTextView;
import java.io.IOException;
public class EulaFragment extends FCLFragment implements View.OnClickListener {
public static final String EULA_URL = "https://gitcode.net/fcl-team/fold-craft-launcher/-/raw/master/res/eula.txt?inline=false";
private FCLProgressBar progressBar;
private FCLTextView eula;
private FCLButton next;
private boolean load = false;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_eula, container, false);
progressBar = findViewById(view, R.id.progress);
eula = findViewById(view, R.id.eula);
next = findViewById(view, R.id.next);
next.setOnClickListener(this);
loadEula();
return view;
}
private void loadEula() {
new Thread(() -> {
String str;
try {
str = NetworkUtils.doGet(NetworkUtils.toURL(EULA_URL));
load = true;
} catch (IOException e) {
e.printStackTrace();
str = getString(R.string.splash_eula_error);
}
final String s = str;
if (getActivity() != null) {
getActivity().runOnUiThread(() -> {
if (load) {
next.setEnabled(true);
}
progressBar.setVisibility(View.GONE);
eula.setText(s);
});
}
}).start();
}
@Override
public void onClick(View view) {
if (view == next) {
if (getActivity() != null) {
SharedPreferences sharedPreferences = getActivity().getSharedPreferences("launcher", MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("isFirstLaunch", false);
editor.apply();
((SplashActivity) getActivity()).start();
}
}
}
}

View File

@ -0,0 +1,268 @@
package com.tungsten.fcl.fragment.splash;
import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tungsten.fcl.R;
import com.tungsten.fcl.activity.SplashActivity;
import com.tungsten.fcl.util.RuntimeUtils;
import com.tungsten.fclauncher.FCLPath;
import com.tungsten.fcllibrary.component.FCLFragment;
import com.tungsten.fcllibrary.component.view.FCLButton;
import com.tungsten.fcllibrary.component.view.FCLImageView;
import java.io.IOException;
public class RuntimeFragment extends FCLFragment implements View.OnClickListener {
boolean lwjgl2 = false;
boolean lwjgl3 = false;
boolean cacio = false;
boolean cacio17 = false;
boolean java8 = false;
boolean java17 = false;
private ProgressBar lwjgl2Progress;
private ProgressBar lwjgl3Progress;
private ProgressBar cacioProgress;
private ProgressBar cacio17Progress;
private ProgressBar java8Progress;
private ProgressBar java17Progress;
private FCLImageView lwjgl2State;
private FCLImageView lwjgl3State;
private FCLImageView cacioState;
private FCLImageView cacio17State;
private FCLImageView java8State;
private FCLImageView java17State;
private FCLButton install;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_runtime, container, false);
lwjgl2Progress = findViewById(view, R.id.lwjgl2_progress);
lwjgl3Progress = findViewById(view, R.id.lwjgl3_progress);
cacioProgress = findViewById(view, R.id.cacio_progress);
cacio17Progress = findViewById(view, R.id.cacio17_progress);
java8Progress = findViewById(view, R.id.java8_progress);
java17Progress = findViewById(view, R.id.java17_progress);
lwjgl2State = findViewById(view, R.id.lwjgl2_state);
lwjgl3State = findViewById(view, R.id.lwjgl3_state);
cacioState = findViewById(view, R.id.cacio_state);
cacio17State = findViewById(view, R.id.cacio17_state);
java8State = findViewById(view, R.id.java8_state);
java17State = findViewById(view, R.id.java17_state);
initState();
refreshDrawables();
check();
install = findViewById(view, R.id.install);
install.setOnClickListener(this);
return view;
}
private void initState() {
try {
lwjgl2 = RuntimeUtils.isLatest(FCLPath.LWJGL2_DIR, "/assets/app_runtime/lwjgl2");
} catch (IOException e) {
e.printStackTrace();
}
try {
lwjgl3 = RuntimeUtils.isLatest(FCLPath.LWJGL3_DIR, "/assets/app_runtime/lwjgl3");
} catch (IOException e) {
e.printStackTrace();
}
try {
cacio = RuntimeUtils.isLatest(FCLPath.CACIOCAVALLO_8_DIR, "/assets/app_runtime/caciocavallo");
} catch (IOException e) {
e.printStackTrace();
}
try {
cacio17 = RuntimeUtils.isLatest(FCLPath.CACIOCAVALLO_17_DIR, "/assets/app_runtime/caciocavallo17");
} catch (IOException e) {
e.printStackTrace();
}
try {
java8 = RuntimeUtils.isLatest(FCLPath.JAVA_8_PATH, "/assets/app_runtime/java/jre8");
} catch (IOException e) {
e.printStackTrace();
}
try {
java17 = RuntimeUtils.isLatest(FCLPath.JAVA_17_PATH, "/assets/app_runtime/java/jre17");
} catch (IOException e) {
e.printStackTrace();
}
}
private void refreshDrawables() {
if (getContext() != null) {
@SuppressLint("UseCompatLoadingForDrawables") Drawable stateUpdate = getContext().getDrawable(R.drawable.ic_baseline_update_24);
@SuppressLint("UseCompatLoadingForDrawables") Drawable stateDone = getContext().getDrawable(R.drawable.ic_baseline_done_24);
lwjgl2State.setBackgroundDrawable(lwjgl2 ? stateDone : stateUpdate);
lwjgl3State.setBackgroundDrawable(lwjgl3 ? stateDone : stateUpdate);
cacioState.setBackgroundDrawable(cacio ? stateDone : stateUpdate);
cacio17State.setBackgroundDrawable(cacio17 ? stateDone : stateUpdate);
java8State.setBackgroundDrawable(java8 ? stateDone : stateUpdate);
java17State.setBackgroundDrawable(java17 ? stateDone : stateUpdate);
}
}
private boolean isLatest() {
return lwjgl2 && lwjgl3 && cacio && cacio17 && java8 && java17;
}
private void check() {
if (isLatest()) {
if (getActivity() != null) {
((SplashActivity) getActivity()).enterLauncher();
}
}
}
private void install() {
if (!lwjgl2) {
lwjgl2State.setVisibility(View.GONE);
lwjgl2Progress.setVisibility(View.VISIBLE);
new Thread(() -> {
try {
RuntimeUtils.install(getContext(), FCLPath.LWJGL2_DIR, "app_runtime/lwjgl2");
lwjgl2 = true;
} catch (IOException e) {
e.printStackTrace();
}
if (getActivity() != null) {
getActivity().runOnUiThread(() -> {
lwjgl2State.setVisibility(View.VISIBLE);
lwjgl2Progress.setVisibility(View.GONE);
refreshDrawables();
check();
});
}
}).start();
}
if (!lwjgl3) {
lwjgl3State.setVisibility(View.GONE);
lwjgl3Progress.setVisibility(View.VISIBLE);
new Thread(() -> {
try {
RuntimeUtils.install(getContext(), FCLPath.LWJGL3_DIR, "app_runtime/lwjgl3");
lwjgl3 = true;
} catch (IOException e) {
e.printStackTrace();
}
if (getActivity() != null) {
getActivity().runOnUiThread(() -> {
lwjgl3State.setVisibility(View.VISIBLE);
lwjgl3Progress.setVisibility(View.GONE);
refreshDrawables();
check();
});
}
}).start();
}
if (!cacio) {
cacioState.setVisibility(View.GONE);
cacioProgress.setVisibility(View.VISIBLE);
new Thread(() -> {
try {
RuntimeUtils.install(getContext(), FCLPath.CACIOCAVALLO_8_DIR, "app_runtime/caciocavallo");
cacio = true;
} catch (IOException e) {
e.printStackTrace();
}
if (getActivity() != null) {
getActivity().runOnUiThread(() -> {
cacioState.setVisibility(View.VISIBLE);
cacioProgress.setVisibility(View.GONE);
refreshDrawables();
check();
});
}
}).start();
}
if (!cacio17) {
cacio17State.setVisibility(View.GONE);
cacio17Progress.setVisibility(View.VISIBLE);
new Thread(() -> {
try {
RuntimeUtils.install(getContext(), FCLPath.CACIOCAVALLO_17_DIR, "app_runtime/caciocavallo17");
cacio17 = true;
} catch (IOException e) {
e.printStackTrace();
}
if (getActivity() != null) {
getActivity().runOnUiThread(() -> {
cacio17State.setVisibility(View.VISIBLE);
cacio17Progress.setVisibility(View.GONE);
refreshDrawables();
check();
});
}
}).start();
}
if (!java8) {
java8State.setVisibility(View.GONE);
java8Progress.setVisibility(View.VISIBLE);
new Thread(() -> {
try {
RuntimeUtils.installJava(getContext(), FCLPath.JAVA_8_PATH, "app_runtime/java/jre8");
java8 = true;
} catch (IOException e) {
e.printStackTrace();
}
if (getActivity() != null) {
getActivity().runOnUiThread(() -> {
java8State.setVisibility(View.VISIBLE);
java8Progress.setVisibility(View.GONE);
refreshDrawables();
check();
});
}
}).start();
}
if (!java17) {
java17State.setVisibility(View.GONE);
java17Progress.setVisibility(View.VISIBLE);
new Thread(() -> {
try {
RuntimeUtils.installJava(getContext(), FCLPath.JAVA_17_PATH, "app_runtime/java/jre17");
java17 = true;
} catch (IOException e) {
e.printStackTrace();
}
if (getActivity() != null) {
getActivity().runOnUiThread(() -> {
java17State.setVisibility(View.VISIBLE);
java17Progress.setVisibility(View.GONE);
refreshDrawables();
check();
});
}
}).start();
}
}
@Override
public void onClick(View view) {
if (view == install) {
install();
}
}
}

View File

@ -0,0 +1,139 @@
package com.tungsten.fcl.util;
import android.content.Context;
import android.system.Os;
import com.tungsten.fclauncher.FCLauncher;
import com.tungsten.fclauncher.utils.Architecture;
import com.tungsten.fclcore.util.Logging;
import com.tungsten.fclcore.util.Pack200Utils;
import com.tungsten.fclcore.util.io.FileUtils;
import com.tungsten.fclcore.util.io.IOUtils;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.compressors.xz.XZCompressorInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
import java.util.logging.Level;
public class RuntimeUtils {
public static boolean isLatest(String targetDir, String srcDir) throws IOException {
File targetFile = new File(targetDir + "/version");
int version = Integer.parseInt(IOUtils.readFullyAsString(RuntimeUtils.class.getResourceAsStream(srcDir + "/version"), StandardCharsets.UTF_8));
return targetFile.exists() && Integer.parseInt(FileUtils.readText(targetFile)) == version;
}
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void install(Context context, String targetDir, String srcDir) throws IOException {
FileUtils.deleteDirectory(new File(targetDir));
new File(targetDir).mkdirs();
copyAssets(context, srcDir, targetDir);
}
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void installJava(Context context, String targetDir, String srcDir) throws IOException {
FileUtils.deleteDirectory(new File(targetDir));
new File(targetDir).mkdirs();
String universalPath = srcDir + "/universal.tar.xz";
String archPath = srcDir + "/bin-" + Architecture.archAsString(Architecture.getDeviceArchitecture()) + ".tar.xz";
String version = IOUtils.readFullyAsString(RuntimeUtils.class.getResourceAsStream("/assets/" + srcDir + "/version"), StandardCharsets.UTF_8);
uncompressTarXZ(context.getAssets().open(universalPath), new File(targetDir));
uncompressTarXZ(context.getAssets().open(archPath), new File(targetDir));
FileUtils.writeText(new File(targetDir + "/version"), version);
patchJava(context, targetDir);
}
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void copyAssets(Context context, String src, String dest) throws IOException {
String[] fileNames = context.getAssets().list(src);
if (fileNames.length > 0) {
File file = new File(dest);
if (!file.exists())
file.mkdirs();
for (String fileName : fileNames) {
if (!src.equals("")) {
copyAssets(context, src + File.separator + fileName, dest + File.separator + fileName);
} else {
copyAssets(context, fileName, dest + File.separator + fileName);
}
}
} else {
File outFile = new File(dest);
InputStream is = context.getAssets().open(src);
FileOutputStream fos = new FileOutputStream(outFile);
byte[] buffer = new byte[1024];
int byteCount;
while ((byteCount = is.read(buffer)) != -1) {
fos.write(buffer, 0, byteCount);
}
fos.flush();
is.close();
fos.close();
}
}
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void uncompressTarXZ(final InputStream tarFileInputStream, final File dest) throws IOException {
dest.mkdirs();
TarArchiveInputStream tarIn = new TarArchiveInputStream(new XZCompressorInputStream(tarFileInputStream));
TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
while (tarEntry != null) {
if (tarEntry.getSize() <= 20480) {
try {
Thread.sleep(25);
} catch (InterruptedException ignored) {
}
}
File destPath = new File(dest, tarEntry.getName());
if (tarEntry.isSymbolicLink()) {
Objects.requireNonNull(destPath.getParentFile()).mkdirs();
try {
Os.symlink(tarEntry.getName(), tarEntry.getLinkName());
} catch (Throwable e) {
Logging.LOG.log(Level.WARNING, e.getMessage());
}
} else if (tarEntry.isDirectory()) {
destPath.mkdirs();
destPath.setExecutable(true);
} else if (!destPath.exists() || destPath.length() != tarEntry.getSize()) {
Objects.requireNonNull(destPath.getParentFile()).mkdirs();
destPath.createNewFile();
FileOutputStream os = new FileOutputStream(destPath);
byte[] buffer = new byte[1024];
int byteCount;
while ((byteCount = tarIn.read(buffer)) != -1) {
os.write(buffer, 0, byteCount);
}
os.close();
}
tarEntry = tarIn.getNextTarEntry();
}
tarIn.close();
}
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void patchJava(Context context, String javaPath) throws IOException {
Pack200Utils.unpack(context.getApplicationInfo().nativeLibraryDir, javaPath);
File dest = new File(javaPath);
if(!dest.exists())
return;
String libFolder = FCLauncher.getJreLibDir(javaPath);
File ftIn = new File(dest, libFolder + "/libfreetype.so.6");
File ftOut = new File(dest, libFolder + "/libfreetype.so");
if (ftIn.exists() && (!ftOut.exists() || ftIn.length() != ftOut.length())) {
ftIn.renameTo(ftOut);
}
File fileLib = new File(dest, "/" + libFolder + "/libawt_xawt.so");
fileLib.delete();
FileUtils.copyFile(new File(context.getApplicationInfo().nativeLibraryDir, "libawt_xawt.so"), fileLib);
}
}

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="500"
android:fromAlpha="0"
android:toAlpha="1" />
<translate
android:duration="500"
android:fromXDelta="100%"
android:fromYDelta="0"
android:toXDelta="0"
android:toYDelta="0" />
</set>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="500"
android:fromAlpha="1"
android:toAlpha="0" />
<translate
android:duration="500"
android:fromXDelta="0"
android:fromYDelta="0"
android:toXDelta="-100%"
android:toYDelta="0" />
</set>

View File

@ -0,0 +1,10 @@
<vector
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="@android:color/white"
android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="@android:color/white"
android:pathData="M21,10.12h-6.78l2.74,-2.82c-2.73,-2.7 -7.15,-2.8 -9.88,-0.1c-2.73,2.71 -2.73,7.08 0,9.79s7.15,2.71 9.88,0C18.32,15.65 19,14.08 19,12.1h2c0,1.98 -0.88,4.55 -2.64,6.29c-3.51,3.48 -9.21,3.48 -12.72,0c-3.5,-3.47 -3.53,-9.11 -0.02,-12.58s9.14,-3.47 12.65,0L21,3V10.12zM12.5,8v4.25l3.5,2.08l-0.72,1.21L11,13V8H12.5z"/>
</vector>

View File

@ -1,6 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".activity.SplashActivity">
<com.tungsten.fcllibrary.component.view.FCLTitleView
android:id="@+id/title"
app:title="@string/splash_title"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintVertical_bias="0"
app:layout_constraintWidth_percent="0.75"
app:layout_constraintHeight_percent="0.10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@+id/title"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ScrollView
android:id="@+id/eula_parent"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintWidth_percent="0.6"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/next">
<com.tungsten.fcllibrary.component.view.FCLTextView
android:id="@+id/eula"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"/>
</ScrollView>
<com.tungsten.fcllibrary.component.view.FCLProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintVertical_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/next"/>
<View
android:id="@+id/split_left"
android:background="@android:color/darker_gray"
android:layout_width="1dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/next"
app:layout_constraintEnd_toStartOf="@id/eula_parent"/>
<View
android:id="@+id/split_right"
android:background="@android:color/darker_gray"
android:layout_width="1dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/next"
app:layout_constraintStart_toEndOf="@id/eula_parent"/>
<com.tungsten.fcllibrary.component.view.FCLButton
android:enabled="false"
android:text="@string/splash_eula_next"
app:auto_padding="false"
android:id="@+id/next"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintVertical_bias="1"
app:layout_constraintHeight_percent="0.12"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,306 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ScrollView
android:id="@+id/runtime_parent"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintWidth_percent="0.6"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/install">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.tungsten.fcllibrary.component.view.FCLTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:padding="10dp"
android:gravity="center"
android:text="@string/splash_runtime_title"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<com.tungsten.fcllibrary.component.view.FCLTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/splash_runtime_lwjgl2"
android:layout_gravity="center"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.tungsten.fcllibrary.component.view.FCLProgressBar
android:visibility="gone"
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/lwjgl2_progress"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
<com.tungsten.fcllibrary.component.view.FCLImageView
app:auto_src_tint="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lwjgl2_state"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<com.tungsten.fcllibrary.component.view.FCLTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/splash_runtime_lwjgl3"
android:layout_gravity="center"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.tungsten.fcllibrary.component.view.FCLProgressBar
android:visibility="gone"
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/lwjgl3_progress"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
<com.tungsten.fcllibrary.component.view.FCLImageView
app:auto_src_tint="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lwjgl3_state"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<com.tungsten.fcllibrary.component.view.FCLTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/splash_runtime_cacio"
android:layout_gravity="center"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.tungsten.fcllibrary.component.view.FCLProgressBar
android:visibility="gone"
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/cacio_progress"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
<com.tungsten.fcllibrary.component.view.FCLImageView
app:auto_src_tint="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cacio_state"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<com.tungsten.fcllibrary.component.view.FCLTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/splash_runtime_cacio17"
android:layout_gravity="center"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.tungsten.fcllibrary.component.view.FCLProgressBar
android:visibility="gone"
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/cacio17_progress"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
<com.tungsten.fcllibrary.component.view.FCLImageView
app:auto_src_tint="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cacio17_state"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<com.tungsten.fcllibrary.component.view.FCLTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/splash_runtime_java8"
android:layout_gravity="center"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.tungsten.fcllibrary.component.view.FCLProgressBar
android:visibility="gone"
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/java8_progress"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
<com.tungsten.fcllibrary.component.view.FCLImageView
app:auto_src_tint="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/java8_state"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="horizontal">
<com.tungsten.fcllibrary.component.view.FCLTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/splash_runtime_java17"
android:layout_gravity="center"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.tungsten.fcllibrary.component.view.FCLProgressBar
android:visibility="gone"
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/java17_progress"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
<com.tungsten.fcllibrary.component.view.FCLImageView
app:auto_src_tint="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/java17_state"
android:layout_gravity="center"
android:layout_marginStart="10dp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
</ScrollView>
<View
android:id="@+id/split_left"
android:background="@android:color/darker_gray"
android:layout_width="1dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/install"
app:layout_constraintEnd_toStartOf="@id/runtime_parent"/>
<View
android:id="@+id/split_right"
android:background="@android:color/darker_gray"
android:layout_width="1dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/install"
app:layout_constraintStart_toEndOf="@id/runtime_parent"/>
<com.tungsten.fcllibrary.component.view.FCLButton
android:text="@string/splash_runtime_install"
app:auto_padding="false"
android:id="@+id/install"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintVertical_bias="1"
app:layout_constraintHeight_percent="0.12"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="splash_title">欢迎使用 Fold Craft Launcher</string>
<string name="splash_eula_error">无法获取用户协议,请检查网络。</string>
<string name="splash_eula_next">同意并继续</string>
<string name="splash_runtime_title">安装或更新运行环境</string>
<string name="splash_runtime_install">安装 / 更新</string>
</resources>

View File

@ -1,3 +1,14 @@
<resources>
<string name="app_name" translatable="false">Fold Craft Launcher</string>
<string name="splash_title">Welcome to Fold Craft Launcher</string>
<string name="splash_eula_error">Cannot get EULA, please check the network.</string>
<string name="splash_eula_next">Agree and Continue</string>
<string name="splash_runtime_title">Install or update app runtime</string>
<string name="splash_runtime_lwjgl2" translatable="false">LWJGL 2</string>
<string name="splash_runtime_lwjgl3" translatable="false">LWJGL 3</string>
<string name="splash_runtime_cacio" translatable="false">Caciocavallo</string>
<string name="splash_runtime_cacio17" translatable="false">Caciocavallo 17</string>
<string name="splash_runtime_java8" translatable="false">JRE 8</string>
<string name="splash_runtime_java17" translatable="false">JRE 17</string>
<string name="splash_runtime_install">Install / Update</string>
</resources>

View File

@ -1,4 +0,0 @@
package com.tungsten.fclcore.constant;
public class RequestCodes {
}

View File

@ -2,7 +2,7 @@ package com.tungsten.fclcore.download.game;
import com.google.gson.JsonParseException;
import com.google.gson.annotations.SerializedName;
import com.tungsten.fclcore.constant.UrlConstants;
import com.tungsten.fclcore.util.Constants;
import com.tungsten.fclcore.game.ReleaseType;
import com.tungsten.fclcore.util.StringUtils;
import com.tungsten.fclcore.util.gson.Validation;
@ -31,7 +31,7 @@ public final class GameRemoteVersionInfo implements Validation {
}
public GameRemoteVersionInfo(String gameVersion, Date time, Date releaseTime, ReleaseType type) {
this(gameVersion, time, releaseTime, type, UrlConstants.DEFAULT_LIBRARY_URL + gameVersion + "/" + gameVersion + ".json");
this(gameVersion, time, releaseTime, type, Constants.DEFAULT_LIBRARY_URL + gameVersion + "/" + gameVersion + ".json");
}
public GameRemoteVersionInfo(String gameVersion, Date time, Date releaseTime, ReleaseType type, String url) {

View File

@ -2,7 +2,7 @@ package com.tungsten.fclcore.game;
import com.google.gson.*;
import com.google.gson.annotations.SerializedName;
import com.tungsten.fclcore.constant.UrlConstants;
import com.tungsten.fclcore.util.Constants;
import com.tungsten.fclcore.util.ToStringBuilder;
import com.tungsten.fclcore.util.gson.TolerableValidationException;
import com.tungsten.fclcore.util.gson.Validation;
@ -113,7 +113,7 @@ public class Library implements Comparable<Library>, Validation {
LibraryDownloadInfo temp = getRawDownloadInfo();
String path = getPath();
return new LibraryDownloadInfo(path,
Optional.ofNullable(temp).map(LibraryDownloadInfo::getUrl).orElse(Optional.ofNullable(url).orElse(UrlConstants.DEFAULT_LIBRARY_URL) + path),
Optional.ofNullable(temp).map(LibraryDownloadInfo::getUrl).orElse(Optional.ofNullable(url).orElse(Constants.DEFAULT_LIBRARY_URL) + path),
temp != null ? temp.getSha1() : null,
temp != null ? temp.getSize() : 0
);

View File

@ -1,7 +1,7 @@
package com.tungsten.fclcore.game;
import com.google.gson.JsonParseException;
import com.tungsten.fclcore.constant.UrlConstants;
import com.tungsten.fclcore.util.Constants;
import com.tungsten.fclcore.util.Lang;
import com.tungsten.fclcore.util.Logging;
import com.tungsten.fclcore.util.StringUtils;
@ -200,14 +200,14 @@ public class Version implements Comparable<Version>, Validation {
DownloadInfo client = downloads == null ? null : downloads.get(DownloadType.CLIENT);
String jarName = jar == null ? id : jar;
if (client == null)
return new DownloadInfo(String.format("%s%s/%s.jar", UrlConstants.DEFAULT_VERSION_DOWNLOAD_URL, jarName, jarName));
return new DownloadInfo(String.format("%s%s/%s.jar", Constants.DEFAULT_VERSION_DOWNLOAD_URL, jarName, jarName));
else
return client;
}
public AssetIndexInfo getAssetIndex() {
String assetsId = assets == null ? "legacy" : assets;
return assetIndex == null ? new AssetIndexInfo(assetsId, UrlConstants.DEFAULT_INDEX_URL + assetsId + ".json") : assetIndex;
return assetIndex == null ? new AssetIndexInfo(assetsId, Constants.DEFAULT_INDEX_URL + assetsId + ".json") : assetIndex;
}
public boolean appliesToCurrentEnvironment() {

View File

@ -1,6 +1,6 @@
package com.tungsten.fclcore.constant;
package com.tungsten.fclcore.util;
public class UrlConstants {
public class Constants {
public static final String DEFAULT_LIBRARY_URL = "https://libraries.minecraft.net/";
public static final String DEFAULT_VERSION_DOWNLOAD_URL = "https://s3.amazonaws.com/Minecraft.Download/versions/";

View File

@ -14,7 +14,7 @@ public class Pack200Utils {
* @param nativeLibraryDir The native lib path, required to execute the unpack200 binary
* @param dir The path of the directory which contains .pack file
*/
private static void unpack(String nativeLibraryDir, String dir) {
public static void unpack(String nativeLibraryDir, String dir) {
File basePath = new File(dir);
Collection<File> files = listFiles(basePath, new String[] { "pack" }, true);

View File

@ -4,7 +4,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

View File

@ -0,0 +1,13 @@
package com.tungsten.fcllibrary.component;
import android.view.View;
import androidx.fragment.app.Fragment;
public class FCLFragment extends Fragment {
public final <T extends View> T findViewById(View view, int id) {
return view.findViewById(id);
}
}

View File

@ -10,7 +10,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tungsten.fclauncher.FCLPath;
import com.tungsten.fcllibrary.component.theme.Theme;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
public class FCLService extends Service {

View File

@ -0,0 +1,61 @@
package com.tungsten.fcllibrary.component.view;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import com.tungsten.fcllibrary.R;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
public class FCLImageView extends AppCompatImageView {
private boolean autoTint;
private final Runnable runnable = () -> {
if (autoTint) {
int[][] state = {
{
}
};
int[] color = {
ThemeEngine.getInstance().getTheme().getAutoTint()
};
setImageTintList(new ColorStateList(state, color));
}
};
public FCLImageView(@NonNull Context context) {
super(context);
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLImageView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLImageView);
autoTint = typedArray.getBoolean(R.styleable.FCLImageView_auto_src_tint, false);
typedArray.recycle();
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLImageView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLImageView);
autoTint = typedArray.getBoolean(R.styleable.FCLImageView_auto_src_tint, false);
typedArray.recycle();
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public void setAutoTint(boolean autoTint) {
this.autoTint = autoTint;
}
public boolean isAutoTint() {
return autoTint;
}
}

View File

@ -11,7 +11,7 @@
android:layout_height="0dp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintVertical_bias="0"
app:layout_constraintWidth_percent="0.5"
app:layout_constraintWidth_percent="0.75"
app:layout_constraintHeight_percent="0.10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@ -10,7 +10,7 @@
android:layout_height="0dp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintVertical_bias="0"
app:layout_constraintWidth_percent="0.5"
app:layout_constraintWidth_percent="0.75"
app:layout_constraintHeight_percent="0.10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@ -7,6 +7,9 @@
<declare-styleable name="FCLImageButton">
<attr name="auto_tint" format="boolean"/>
</declare-styleable>
<declare-styleable name="FCLImageView">
<attr name="auto_src_tint" format="boolean"/>
</declare-styleable>
<declare-styleable name="FCLTextView">
<attr name="auto_text_tint" format="boolean"/>
</declare-styleable>

View File

@ -16,6 +16,8 @@ public class FCLPath {
public static String JAVA_17_PATH;
public static String LWJGL2_DIR;
public static String LWJGL3_DIR;
public static String CACIOCAVALLO_8_DIR;
public static String CACIOCAVALLO_17_DIR;
public static void loadPaths(Context context) {
CONTEXT = context;
@ -30,6 +32,8 @@ public class FCLPath {
JAVA_17_PATH = RUNTIME_DIR + "/java/jre17";
LWJGL2_DIR = RUNTIME_DIR + "/lwjgl2";
LWJGL3_DIR = RUNTIME_DIR + "/lwjgl3";
CACIOCAVALLO_8_DIR = RUNTIME_DIR + "/caciocavallo";
CACIOCAVALLO_17_DIR = RUNTIME_DIR + "/caciocavallo17";
}
}

View File

@ -50,7 +50,7 @@ public class FCLauncher {
return jreReleaseMap;
}
private static String getJreLibDir(String javaPath) throws IOException {
public static String getJreLibDir(String javaPath) throws IOException {
String jreArchitecture = readJREReleaseProperties(javaPath).get("OS_ARCH");
if (Architecture.archAsInt(jreArchitecture) == ARCH_X86) {
jreArchitecture = "i386/i486/i586";

View File

@ -1,50 +1,61 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := xhook
LOCAL_SRC_FILES := xhook/xhook.c \
xhook/xh_core.c \
xhook/xh_elf.c \
xhook/xh_jni.c \
xhook/xh_log.c \
xhook/xh_util.c \
xhook/xh_version.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/xhook/include
LOCAL_CFLAGS := -Wall -Wextra -Werror -fvisibility=hidden
LOCAL_CONLYFLAGS := -std=c11
LOCAL_LDLIBS := -llog
LOCAL_MODULE := xhook
LOCAL_SRC_FILES := xhook/xhook.c \
xhook/xh_core.c \
xhook/xh_elf.c \
xhook/xh_jni.c \
xhook/xh_log.c \
xhook/xh_util.c \
xhook/xh_version.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/xhook/include
LOCAL_CFLAGS := -Wall -Wextra -Werror -fvisibility=hidden
LOCAL_CONLYFLAGS := -std=c11
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := fcl
LOCAL_SHARED_LIBRARIES := xhook
LOCAL_SRC_FILES := fcl/fcl_bridge.c \
fcl/fcl_event.c \
fcl/fcl_loader.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/xhook/include \
$(LOCAL_PATH)/fcl/include
LOCAL_LDLIBS := -llog -ldl -landroid
LOCAL_MODULE := fcl
LOCAL_SHARED_LIBRARIES := xhook
LOCAL_SRC_FILES := fcl/fcl_bridge.c \
fcl/fcl_event.c \
fcl/fcl_loader.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/xhook/include \
$(LOCAL_PATH)/fcl/include
LOCAL_LDLIBS := -llog -ldl -landroid
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := glfw
LOCAL_SHARED_LIBRARIES := fcl
LOCAL_SRC_FILES := glfw/context.c \
glfw/init.c \
glfw/input.c \
glfw/monitor.c \
glfw/vulkan.c \
glfw/window.c \
glfw/fcl_init.c \
glfw/fcl_monitor.c \
glfw/fcl_window.c \
glfw/null_joystick.c \
glfw/egl_context.c \
glfw/osmesa_context.c \
glfw/posix_thread.c \
glfw/posix_time.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/fcl/include \
$(LOCAL_PATH)/glfw/include
LOCAL_CFLAGS := -Wall -fuse-ld=gold -Werror=implicit-function-declaration
LOCAL_LDLIBS := -llog -ldl -landroid
LOCAL_MODULE := glfw
LOCAL_SHARED_LIBRARIES := fcl
LOCAL_SRC_FILES := glfw/context.c \
glfw/init.c \
glfw/input.c \
glfw/monitor.c \
glfw/vulkan.c \
glfw/window.c \
glfw/fcl_init.c \
glfw/fcl_monitor.c \
glfw/fcl_window.c \
glfw/null_joystick.c \
glfw/egl_context.c \
glfw/osmesa_context.c \
glfw/posix_thread.c \
glfw/posix_time.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/fcl/include \
$(LOCAL_PATH)/glfw/include
LOCAL_CFLAGS := -Wall -fuse-ld=gold -Werror=implicit-function-declaration
LOCAL_LDLIBS := -llog -ldl -landroid
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := awt_headless
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := awt_xawt
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/awt_xawt
LOCAL_SHARED_LIBRARIES := awt_headless
LOCAL_SRC_FILES := awt_xawt/xawt_fake.c
include $(BUILD_SHARED_LIBRARY)

View File

@ -0,0 +1,215 @@
#include <jni.h>
// java.awt.*
JNIEXPORT void JNICALL
Java_java_awt_AWTEvent_initIDs(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Button_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Component_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Container_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Checkbox_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Cursor_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Cursor_finalizeImpl(JNIEnv *env, jclass clazz, jlong pData)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Dialog_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Event_initIDs(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_FileDialog_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Frame_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Insets_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_KeyboardFocusManager_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_Menu_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_MenuComponent_initIDs(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_MenuItem_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Scrollbar_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_ScrollPane_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_TextArea_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_TextField_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_TrayIcon_initIDs(JNIEnv *env , jclass clazz)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Window_initIDs
(JNIEnv *env, jclass cls)
{
}
// java.awt.event.*
JNIEXPORT void JNICALL
Java_java_awt_event_InputEvent_initIDs(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_event_KeyEvent_initIDs(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self,
jobject newSource)
{
// Maybe implement this?
}
// sun.awt.SunToolkit
JNIEXPORT void JNICALL
Java_sun_awt_SunToolkit_closeSplashScreen
(JNIEnv *env, jclass cls)
{
}
// sun.awt.UNIXToolkit
JNIEXPORT jboolean JNICALL
Java_sun_awt_UNIXToolkit_check_1gtk(JNIEnv *env, jclass klass, jint version) {
return JNI_FALSE;
}
JNIEXPORT jint JNICALL
Java_sun_awt_UNIXToolkit_get_1gtk_1version(JNIEnv *env, jclass klass)
{
// return GTK_ANY;
return (jint) 1;
}
JNIEXPORT jboolean JNICALL
Java_sun_awt_UNIXToolkit_gtkCheckVersionImpl(JNIEnv *env, jobject this,
jint major, jint minor, jint micro)
{
return JNI_FALSE;
}
JNIEXPORT jboolean JNICALL
Java_sun_awt_UNIXToolkit_load_1gtk(JNIEnv *env, jclass klass, jint version,
jboolean verbose) {
return JNI_FALSE;
}
JNIEXPORT jboolean JNICALL
Java_sun_awt_UNIXToolkit_load_1gtk_1icon(JNIEnv *env, jobject this,
jstring filename)
{
return JNI_FALSE;
}
JNIEXPORT jboolean JNICALL
Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
jint widget_type, jstring stock_id, jint icon_size,
jint text_direction, jstring detail)
{
return JNI_FALSE;
}
JNIEXPORT void JNICALL
Java_sun_awt_UNIXToolkit_nativeSync(JNIEnv *env, jobject this)
{
}
JNIEXPORT jboolean JNICALL
Java_sun_awt_UNIXToolkit_unload_1gtk(JNIEnv *env, jclass klass)
{
return JNI_FALSE;
}