update ui

This commit is contained in:
Tungstend 2023-07-09 22:06:22 +08:00
parent fc6718e5a3
commit 2ee5ec98d3
12 changed files with 38 additions and 14 deletions

View File

@ -208,7 +208,7 @@ public class DownloadPage extends FCLCommonPage implements ManageUI.VersionLoada
sourceSpinner.setVisibility(downloadSources.getSize() > 1 ? View.VISIBLE : View.GONE);
if (downloadSources.getSize() > 1) {
sourceSpinner.setDataList(new ArrayList<>(downloadSources));
ArrayAdapter<String> sourceAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner, new ArrayList<>(downloadSources));
ArrayAdapter<String> sourceAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_auto_tint, new ArrayList<>(downloadSources));
sourceAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown);
sourceSpinner.setAdapter(sourceAdapter);
sourceSpinner.setSelection(downloadSource.get().equals(getContext().getString(R.string.mods_modrinth)) ? 1 : 0);
@ -216,7 +216,7 @@ public class DownloadPage extends FCLCommonPage implements ManageUI.VersionLoada
}
gameVersionSpinner.setDataList(new ArrayList<>(Arrays.stream(RemoteModRepository.DEFAULT_GAME_VERSIONS).collect(Collectors.toList())));
ArrayAdapter<String> gameVersionAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner, new ArrayList<>(Arrays.stream(RemoteModRepository.DEFAULT_GAME_VERSIONS).collect(Collectors.toList())));
ArrayAdapter<String> gameVersionAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_auto_tint, new ArrayList<>(Arrays.stream(RemoteModRepository.DEFAULT_GAME_VERSIONS).collect(Collectors.toList())));
gameVersionAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown);
gameVersionSpinner.setAdapter(gameVersionAdapter);
gameVersionSpinner.setSelection(0);
@ -226,7 +226,7 @@ public class DownloadPage extends FCLCommonPage implements ManageUI.VersionLoada
categoryDataList.add(new CategoryIndented(0, null));
categorySpinner.setDataList(categoryDataList);
ArrayList<String> categoryStringList = categoryDataList.stream().map(this::getLocalizedCategoryIndent).collect(Collectors.toCollection(ArrayList::new));
ArrayAdapter<String> categoryAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner, categoryStringList);
ArrayAdapter<String> categoryAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_auto_tint, categoryStringList);
categoryAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown);
categorySpinner.setAdapter(categoryAdapter);
categorySpinner.setSelection(0);
@ -242,7 +242,7 @@ public class DownloadPage extends FCLCommonPage implements ManageUI.VersionLoada
}
categorySpinner.setDataList(result);
ArrayList<String> resultStr = result.stream().map(this::getLocalizedCategoryIndent).collect(Collectors.toCollection(ArrayList::new));
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner, resultStr);
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_auto_tint, resultStr);
adapter.setDropDownViewResource(R.layout.item_spinner_dropdown);
categorySpinner.setAdapter(adapter);
FXUtils.unbindSelection(categorySpinner, category);
@ -260,7 +260,7 @@ public class DownloadPage extends FCLCommonPage implements ManageUI.VersionLoada
sorts.add(getContext().getString(R.string.curse_sort_last_updated));
sorts.add(getContext().getString(R.string.curse_sort_author));
sorts.add(getContext().getString(R.string.curse_sort_total_downloads));
ArrayAdapter<String> sortAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner, sorts);
ArrayAdapter<String> sortAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_auto_tint, sorts);
sortAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown);
sortSpinner.setAdapter(sortAdapter);
sortSpinner.setSelection(0);

View File

@ -182,7 +182,7 @@ public class ModpackInfoPage extends FCLTempPage implements View.OnClickListener
map.put("", null);
config().getAuthlibInjectorServers().forEach(it -> map.put(it.getName(), it.getUrl()));
serverSpinner.setDataList(list);
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner, list);
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_auto_tint, list);
adapter.setDropDownViewResource(R.layout.item_spinner_dropdown);
serverSpinner.setAdapter(adapter);
SimpleStringProperty serverName = new SimpleStringProperty("");

View File

@ -160,7 +160,7 @@ public class VersionSettingPage extends FCLCommonPage implements ManageUI.Versio
javaVersionList.add(getContext().getString(R.string.settings_game_java_version_auto));
javaVersionList.add("JRE 8");
javaVersionList.add("JRE 17");
ArrayAdapter<String> javaAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner, javaVersionList);
ArrayAdapter<String> javaAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_auto_tint, javaVersionList);
javaAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown);
javaSpinner.setAdapter(javaAdapter);
@ -168,7 +168,7 @@ public class VersionSettingPage extends FCLCommonPage implements ManageUI.Versio
processPriorityList.add(getContext().getString(R.string.settings_advanced_process_priority_low));
processPriorityList.add(getContext().getString(R.string.settings_advanced_process_priority_normal));
processPriorityList.add(getContext().getString(R.string.settings_advanced_process_priority_high));
ArrayAdapter<String> processPriorityAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner, processPriorityList);
ArrayAdapter<String> processPriorityAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_auto_tint, processPriorityList);
processPriorityAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown);
processPrioritySpinner.setAdapter(processPriorityAdapter);
@ -177,7 +177,7 @@ public class VersionSettingPage extends FCLCommonPage implements ManageUI.Versio
rendererList.add(getContext().getString(R.string.settings_fcl_renderer_virgl));
rendererList.add(getContext().getString(R.string.settings_fcl_renderer_angle));
rendererList.add(getContext().getString(R.string.settings_fcl_renderer_vgpu));
ArrayAdapter<String> rendererAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner, rendererList);
ArrayAdapter<String> rendererAdapter = new ArrayAdapter<>(getContext(), R.layout.item_spinner_auto_tint, rendererList);
rendererAdapter.setDropDownViewResource(R.layout.item_spinner_dropdown);
rendererSpinner.setAdapter(rendererAdapter);

View File

@ -63,7 +63,7 @@
android:layout_gravity="center"/>
<com.tungsten.fcllibrary.component.view.FCLImageButton
app:auto_tint="true"
android:tint="@android:color/darker_gray"
android:layout_marginStart="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.tungsten.fcllibrary.component.view.FCLTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fclTextView"
android:padding="8dp"
style="?android:attr/spinnerItemStyle"
@ -11,5 +10,5 @@
android:singleLine="true"
android:textAlignment="inherit"
android:background="@android:color/transparent"
app:auto_text_tint="true"
android:textColor="@android:color/darker_gray"
android:textSize="14sp"/>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<com.tungsten.fcllibrary.component.view.FCLTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fclTextView"
android:padding="8dp"
style="?android:attr/spinnerItemStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:ellipsize="marquee"
android:singleLine="true"
android:textAlignment="inherit"
android:background="@android:color/transparent"
app:auto_text_tint="true"
android:textSize="14sp"/>

View File

@ -10,4 +10,5 @@
android:singleLine="true"
android:textAlignment="inherit"
android:background="@android:color/transparent"
android:textColor="@android:color/darker_gray"
android:textSize="12sp"/>

View File

@ -6,6 +6,7 @@
android:orientation="horizontal">
<com.tungsten.fcllibrary.component.view.FCLImageView
android:tint="@android:color/darker_gray"
android:id="@+id/icon"
android:layout_width="16dp"
android:layout_height="16dp"

View File

@ -24,6 +24,7 @@
<com.tungsten.fcllibrary.component.view.FCLCheckBox
android:id="@+id/release"
app:auto_hint_tint="true"
android:layout_gravity="center"
android:text="@string/version_game_release"
android:layout_width="wrap_content"
@ -31,6 +32,7 @@
<com.tungsten.fcllibrary.component.view.FCLCheckBox
android:id="@+id/snapshot"
app:auto_hint_tint="true"
android:layout_gravity="center"
android:text="@string/version_game_snapshot"
android:layout_marginStart="10dp"
@ -39,6 +41,7 @@
<com.tungsten.fcllibrary.component.view.FCLCheckBox
android:id="@+id/old"
app:auto_hint_tint="true"
android:layout_gravity="center"
android:text="@string/version_game_old"
android:layout_marginStart="10dp"

View File

@ -38,7 +38,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_home_24"
app:auto_tint="true"
android:tint="@android:color/darker_gray"
android:id="@+id/home"/>
<com.tungsten.fcllibrary.component.view.FCLImageButton
@ -47,7 +47,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_baseline_person_add_24"
app:auto_tint="true"
android:tint="@android:color/darker_gray"
android:id="@+id/register"/>
</androidx.appcompat.widget.LinearLayoutCompat>

View File

@ -67,6 +67,10 @@ public class Theme {
return autoTint.get();
}
public int getAutoHintTint() {
return ColorUtils.calculateLuminance(getColor()) >= 0.5 ? Color.parseColor("#99000000") : Color.parseColor("#99FFFFFF");
}
public boolean isFullscreen() {
return fullscreen.get();
}

View File

@ -85,6 +85,7 @@ public class FCLEditText extends AppCompatEditText {
}
if (autoTint) {
setTextColor(ThemeEngine.getInstance().getTheme().getAutoTint());
setHintTextColor(ThemeEngine.getInstance().getTheme().getAutoHintTint());
}
}