Merge branch 'main' into pojav

This commit is contained in:
ShirosakiMio 2024-08-28 09:31:04 +08:00
commit 8204b4fdde
14 changed files with 129 additions and 22 deletions

View File

@ -44,8 +44,8 @@ android {
applicationId "com.tungsten.fcl"
minSdk 26
targetSdk 34
versionCode 1176
versionName "1.1.7.6"
versionCode 1177
versionName "1.1.7.7"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -230,7 +230,9 @@ class MainActivity : FCLActivity(), OnSelectListener, View.OnClickListener {
}
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
_uiManager?.onBackPressed()
if (event?.keyCode == KeyEvent.KEYCODE_BACK) {
_uiManager?.onBackPressed()
}
return true
}

View File

@ -1,5 +1,8 @@
package com.tungsten.fcl.control;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@ -555,6 +558,12 @@ public class GameMenu implements MenuCallback, View.OnClickListener {
initRightMenu();
viewManager.setup();
if (new File(FCLPath.FILES_DIR, "cursor.png").exists()) {
Bitmap bitmap = BitmapFactory.decodeFile(new File(FCLPath.FILES_DIR, "cursor.png").getAbsolutePath());
BitmapDrawable drawable = new BitmapDrawable(getActivity().getResources(), bitmap);
getCursor().setImageDrawable(drawable);
}
}
@Override

View File

@ -67,9 +67,11 @@ public class LauncherSettingPage extends FCLCommonPage implements View.OnClickLi
private FCLButton theme;
private FCLButton ltBackground;
private FCLButton dkBackground;
private FCLButton cursor;
private FCLButton resetTheme;
private FCLButton resetLtBackground;
private FCLButton resetDkBackground;
private FCLButton resetCursor;
private FCLSwitch ignoreNotch;
private FCLSeekBar animationSpeed;
private FCLTextView animationSpeedText;
@ -94,9 +96,11 @@ public class LauncherSettingPage extends FCLCommonPage implements View.OnClickLi
theme = findViewById(R.id.theme);
ltBackground = findViewById(R.id.background_lt);
dkBackground = findViewById(R.id.background_dk);
cursor = findViewById(R.id.cursor);
resetTheme = findViewById(R.id.reset_theme);
resetLtBackground = findViewById(R.id.reset_background_lt);
resetDkBackground = findViewById(R.id.reset_background_dk);
resetCursor = findViewById(R.id.reset_cursor);
ignoreNotch = findViewById(R.id.ignore_notch);
animationSpeed = findViewById(R.id.animation_speed);
animationSpeedText = findViewById(R.id.animation_speed_text);
@ -113,9 +117,11 @@ public class LauncherSettingPage extends FCLCommonPage implements View.OnClickLi
theme.setOnClickListener(this);
ltBackground.setOnClickListener(this);
dkBackground.setOnClickListener(this);
cursor.setOnClickListener(this);
resetTheme.setOnClickListener(this);
resetLtBackground.setOnClickListener(this);
resetDkBackground.setOnClickListener(this);
resetCursor.setOnClickListener(this);
ArrayList<String> languageList = new ArrayList<>();
languageList.add(getContext().getString(R.string.settings_launcher_language_system));
@ -311,6 +317,28 @@ public class LauncherSettingPage extends FCLCommonPage implements View.OnClickLi
}
}));
}
if(v == cursor) {
FileBrowser.Builder builder = new FileBrowser.Builder(getContext());
builder.setLibMode(LibMode.FILE_CHOOSER);
builder.setSelectionMode(SelectionMode.SINGLE_SELECTION);
ArrayList<String> suffix = new ArrayList<>();
suffix.add(".png");
builder.setSuffix(suffix);
builder.create().browse(getActivity(), RequestCodes.SELECT_CURSOR_CODE, ((requestCode, resultCode, data) -> {
if (requestCode == RequestCodes.SELECT_CURSOR_CODE && resultCode == Activity.RESULT_OK && data != null) {
String path = FileBrowser.getSelectedFiles(data).get(0);
Uri uri = Uri.parse(path);
if (AndroidUtils.isDocUri(uri)) {
AndroidUtils.copyFile(getActivity(), uri, new File(FCLPath.FILES_DIR, "cursor.png"));
} else {
try {
FileUtils.copyFile(new File(path), new File(FCLPath.FILES_DIR, "cursor.png"));
} catch (IOException ignore) {
}
}
}
}));
}
if (v == resetTheme) {
ThemeEngine.getInstance().applyAndSave(getContext(), ThemeEngine.getWallpaperColor(getContext()), false);
}
@ -330,6 +358,9 @@ public class LauncherSettingPage extends FCLCommonPage implements View.OnClickLi
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().applyAndSave(getContext(), ((MainActivity) getActivity()).bind.background, null, null));
}).start();
}
if (v == resetCursor) {
new File(FCLPath.FILES_DIR, "cursor.png").delete();
}
}
@Override

View File

@ -146,6 +146,22 @@ public class AndroidUtils {
return dest.getAbsolutePath();
}
public static String copyFile(Activity activity, Uri uri, File dest) {
try {
InputStream inputStream = activity.getContentResolver().openInputStream(uri);
if (inputStream == null) {
throw new IOException("Failed to open content stream");
}
try (FileOutputStream outputStream = new FileOutputStream(dest)) {
IOUtils.copyTo(inputStream, outputStream);
}
inputStream.close();
} catch (Exception e) {
}
return dest.getAbsolutePath();
}
public static boolean isDocUri(Uri uri) {
return Objects.equals(uri.getScheme(), ContentResolver.SCHEME_FILE) || Objects.equals(uri.getScheme(),ContentResolver.SCHEME_CONTENT);
}

View File

@ -35,4 +35,6 @@ public class RequestCodes {
public static final int SELECT_DATAPACK_CODE = 750;
public static final int SELECT_LAUNCHER_BACKGROUND_CODE = 800;
public static final int SELECT_CURSOR_CODE = 850;
}

View File

@ -313,6 +313,53 @@
</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:minHeight="48dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<com.tungsten.fcllibrary.component.view.FCLTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:auto_text_tint="true"
android:layout_gravity="center"
android:singleLine="true"
android:text="@string/settings_launcher_cursor"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.tungsten.fcllibrary.component.view.FCLButton
app:ripple="true"
android:text="@string/button_reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/reset_cursor"/>
<com.tungsten.fcllibrary.component.view.FCLButton
app:ripple="true"
android:layout_marginStart="10dp"
android:text="@string/button_set"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/cursor"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<View
android:layout_width="match_parent"
android:layout_height="1dp"

View File

@ -1,8 +1,6 @@
<resources>
<string name="app_name" translatable="false">Fold Craft Launcher</string>
<string name="oauth_api_key" translatable="false">null</string>
<string name="splash_permission_msg">بدون مجوز ذخیره سازی، لطفاً به Fold Craft Launcher اجازه دهید.</string>
<string name="splash_permission_grant">اعطا کردن</string>
<string name="splash_permission_title">مجوز ذخیره مورد نیاز است</string>

View File

@ -1,8 +1,6 @@
<resources>
<string name="app_name" translatable="false">Fold Craft Launcher</string>
<string name="oauth_api_key" translatable="false">null</string>
<string name="splash_permission_msg">Sem permissão de armazenamento, por favor conceda a permissão ao Fold Craft Launcher.</string>
<string name="splash_permission_grant">Grant</string>
<string name="splash_permission_title">Permission to store needed</string>

View File

@ -1,8 +1,6 @@
<resources>
<string name="app_name" translatable="false">Fold Craft Launcher</string>
<string name="oauth_api_key" translatable="false">null</string>
<string name="splash_permission_msg">Нет доступа к хранилищу, предоствьте разрешение приложению Fold Craft Launcher в настройках.</string>
<string name="splash_permission_grant">Grant</string>
<string name="splash_permission_title">Permission to store needed</string>

View File

@ -751,6 +751,7 @@
<string name="settings_launcher_theme">主题</string>
<string name="settings_launcher_background_lt">亮色模式启动器背景图片</string>
<string name="settings_launcher_background_dk">暗色模式启动器背景图片</string>
<string name="settings_launcher_cursor">鼠标图片</string>
<string name="settings_launcher_ignore_notch">忽略刘海屏</string>
<string name="settings_launcher_animation_speed">动画速度</string>

View File

@ -1,8 +1,6 @@
<resources>
<string name="app_name" translatable="false">Fold Craft Launcher</string>
<string name="oauth_api_key" translatable="false">null</string>
<string name="splash_permission_msg">No storage permission, please grant Fold Craft Launcher the permission.</string>
<string name="splash_permission_grant">Grant</string>
<string name="splash_permission_title">Permission to store needed</string>
@ -797,6 +795,7 @@
<string name="settings_launcher_theme">Theme</string>
<string name="settings_launcher_background_lt">Light Mode Launcher Background</string>
<string name="settings_launcher_background_dk">Dark Mode Launcher Background</string>
<string name="settings_launcher_cursor">Cursor Picture</string>
<string name="settings_launcher_ignore_notch">Ignore Notch</string>
<string name="settings_launcher_animation_speed">Animation Speed</string>

View File

@ -18,10 +18,16 @@ public class LibFilter {
"{\n" +
" \"name\": \"net.java.dev.jna:jna:5.13.0\"\n" +
"}";
private static final String OSHI_6_3_STRING =
"{\n" +
" \"name\": \"com.github.oshi:oshi-core:6.3.0\"\n" +
"}";
private static final String OSHI_6_3_STRING = "{\n" +
" \"name\": \"com.github.oshi:oshi-core:6.3.0\",\n" +
" \"downloads\": {\n" +
" \"artifact\": {\n" +
" \"path\": \"com/github/oshi/oshi-core/6.3.0/oshi-core-6.3.0.jar\",\n" +
" \"sha1\": \"9e98cf55be371cafdb9c70c35d04ec2a8c2b42ac\",\n" +
" \"url\": \"https://repo1.maven.org/maven2/com/github/oshi/oshi-core/6.3.0/oshi-core-6.3.0.jar\"\n" +
" }\n" +
" }\n" +
" }";
private static final Library ASM_ALL_5_2 = GSON.fromJson(ASM_ALL_5_2_STRING, Library.class);
private static final Library JNA_5_13 = GSON.fromJson(JNA_5_13_STRING, Library.class);

View File

@ -1,20 +1,20 @@
[
{
"type": "release",
"versionCode": 1176,
"versionName": "1.1.7.6",
"date": "2024.08.23",
"versionCode": 1177,
"versionName": "1.1.7.7",
"date": "2024.08.27",
"description": [
{
"lang": "en",
"text": "Fix some fatal error.\nAdd some features. \nSee github for details."
"text": "1.Fix oshi core.\n2.Fix windows scale.\n3.Add custom cursor.\n4.Fix some bug.\nSee github for more details."
},
{
"lang": "zh_CN",
"text": "FCL 1.1.7.6更新内容(若启动器内下载缓慢请使用网盘下载,64位的请下载arm64不知道该下哪个的请下载all\n1.修复微软登录时的错误提示\n2.修复neoforge整合包版本错误\n3.修复手动选择整合包时的整合包为非正常格式时无法安装的bug\n4.可手动选择执行jar文件使用的java\n5.同步部分HMCL Core修复些许bug"
"text": "FCL 1.1.7.7更新内容(若启动器内下载缓慢请使用网盘下载,64位的请下载arm64不知道该下哪个的请下载all\n1.修复oshi core\n2.修复窗口缩放\n3.添加自定义光标\n4.添加更多动画效果"
}
],
"netdiskUrl": "https://pan.quark.cn/s/04bc07022a7d",
"url": "https://github.com/FCL-Team/FoldCraftLauncher/releases/download/1.1.7.6/FCL-release-1.1.7.6-all.apk"
"netdiskUrl": "https://pan.quark.cn/s/5fac965e464b",
"url": "https://github.com/FCL-Team/FoldCraftLauncher/releases/download/1.1.7.7/FCL-release-1.1.7.7-all.apk"
}
]