diff --git a/FCL/src/main/java/com/tungsten/fcl/activity/MainActivity.kt b/FCL/src/main/java/com/tungsten/fcl/activity/MainActivity.kt index 45e6da7e..3cb064f5 100644 --- a/FCL/src/main/java/com/tungsten/fcl/activity/MainActivity.kt +++ b/FCL/src/main/java/com/tungsten/fcl/activity/MainActivity.kt @@ -344,6 +344,7 @@ class MainActivity : FCLActivity(), OnSelectListener, View.OnClickListener { accountHint.text = getString(R.string.account_state_add) avatar.setBackgroundDrawable( BitmapDrawable( + resources, TexturesLoader.toAvatar( TexturesLoader.getDefaultSkin(TextureModel.ALEX).image, ConvertUtils.dip2px( @@ -473,7 +474,7 @@ class MainActivity : FCLActivity(), OnSelectListener, View.OnClickListener { bind.apply { val speed = ThemeEngine.getInstance().getTheme().animationSpeed AnimUtil.playTranslationX( - listOf(leftMenu, splitLeft), + listOf(leftMenu), speed * 100L, -100f, 0f diff --git a/FCL/src/main/java/com/tungsten/fcl/ui/version/ProfileListAdapter.java b/FCL/src/main/java/com/tungsten/fcl/ui/version/ProfileListAdapter.java index 9fdc7a12..0b149371 100644 --- a/FCL/src/main/java/com/tungsten/fcl/ui/version/ProfileListAdapter.java +++ b/FCL/src/main/java/com/tungsten/fcl/ui/version/ProfileListAdapter.java @@ -61,6 +61,7 @@ public class ProfileListAdapter extends FCLAdapter { viewHolder.parent.setBackground(profile == Profiles.getSelectedProfile() ? getContext().getDrawable(R.drawable.bg_container_transparent_selected) : getContext().getDrawable(R.drawable.bg_container_transparent_clickable)); viewHolder.name.setText(profile.getName()); viewHolder.path.setText(profile.getGameDir().getAbsolutePath()); + viewHolder.path.setSelected(true); viewHolder.parent.setOnClickListener(view1 -> { Profiles.setSelectedProfile(profile); notifyDataSetChanged(); diff --git a/FCL/src/main/res/layout/activity_main.xml b/FCL/src/main/res/layout/activity_main.xml index 6b0bb94c..26f60177 100644 --- a/FCL/src/main/res/layout/activity_main.xml +++ b/FCL/src/main/res/layout/activity_main.xml @@ -1,305 +1,310 @@ + + app:layout_constraintBottom_toTopOf="@id/manage" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintBottom_toTopOf="@id/download" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/home" /> + app:layout_constraintBottom_toTopOf="@id/controller" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/manage" /> + app:layout_constraintBottom_toTopOf="@id/multiplayer" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/download" /> + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@id/setting" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/controller" /> + app:layout_constraintBottom_toTopOf="@id/back" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/multiplayer" /> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/setting" /> - - - + android:background="@android:color/darker_gray" + app:layout_constraintEnd_toStartOf="@id/right_menu" + app:use_theme_color="true" /> + app:use_theme_color="true" /> - + app:layout_constraintTop_toBottomOf="@id/account_textview" + app:use_theme_color="true" /> + android:focusable="true" + android:orientation="horizontal" + android:padding="10dp" + android:stateListAnimator="@xml/anim_scale" + app:layout_constraintTop_toBottomOf="@+id/view"> + android:focusable="true" + android:stateListAnimator="@xml/anim_scale_large" /> + android:singleLine="true" + android:text="@string/account_state_no_account" + app:use_theme_color="true" /> + android:textSize="11sp" + app:use_theme_color="true" /> - + android:background="@drawable/ic_baseline_list_24" + app:use_theme_color="true" /> + app:use_theme_color="true" /> - + app:use_theme_color="true" /> + app:layout_constraintTop_toBottomOf="@id/view2"> + android:layout_gravity="center" /> + android:singleLine="true" + android:text="@string/version_no_version" + app:use_theme_color="true" /> + android:textSize="11sp" + app:use_theme_color="true" /> - + android:background="@drawable/ic_baseline_list_24" + app:use_theme_color="true" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/view2" /> + android:layout_marginBottom="10dp" + android:text="@string/jar_execute" + app:layout_constraintBottom_toTopOf="@id/launch" + app:ripple="true" /> + android:text="@string/launch" + app:layout_constraintBottom_toBottomOf="parent" + app:ripple="true" /> @@ -307,19 +312,19 @@ android:id="@+id/ui_layout" android:layout_width="0dp" android:layout_height="match_parent" - app:layout_constraintStart_toEndOf="@+id/split_left" - app:layout_constraintEnd_toStartOf="@id/split_right"/> + app:layout_constraintEnd_toStartOf="@id/split_right" + app:layout_constraintStart_toEndOf="@+id/left_menu" /> + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintStart_toStartOf="parent" /> \ No newline at end of file diff --git a/FCL/src/main/res/layout/item_authlib_injector_server.xml b/FCL/src/main/res/layout/item_authlib_injector_server.xml index 264d22ad..da5a35ed 100644 --- a/FCL/src/main/res/layout/item_authlib_injector_server.xml +++ b/FCL/src/main/res/layout/item_authlib_injector_server.xml @@ -1,54 +1,58 @@ + android:layout_height="wrap_content"> + android:padding="10dp" + android:stateListAnimator="@xml/anim_scale" + app:layout_constraintTop_toTopOf="parent"> - + app:layout_constraintVertical_bias="0.5" + app:use_theme_color="true" /> + app:use_theme_color="true" /> + android:textSize="11sp" + app:use_theme_color="true" /> @@ -57,11 +61,12 @@ android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/ic_baseline_close_24" - app:no_padding="true" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintVertical_bias="0.5"/> + app:layout_constraintVertical_bias="0.5" + app:no_padding="true" + app:use_theme_color="true" /> diff --git a/FCL/src/main/res/layout/item_profile.xml b/FCL/src/main/res/layout/item_profile.xml index 1b90d49f..9fd9268d 100644 --- a/FCL/src/main/res/layout/item_profile.xml +++ b/FCL/src/main/res/layout/item_profile.xml @@ -12,7 +12,8 @@ android:clickable="true" android:focusable="true" android:background="@drawable/bg_container_transparent_clickable" - android:padding="10dp"> + android:padding="10dp" + android:stateListAnimator="@xml/anim_scale"> @@ -46,10 +54,12 @@ android:layout_height="20dp" android:src="@drawable/ic_baseline_close_24" app:no_padding="true" + app:use_theme_color="true" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintVertical_bias="0.5"/> + app:layout_constraintVertical_bias="0.5" + android:stateListAnimator="@xml/anim_scale_large"/> diff --git a/FCL/src/main/res/layout/ui_account.xml b/FCL/src/main/res/layout/ui_account.xml index 4ce17412..afe1a607 100644 --- a/FCL/src/main/res/layout/ui_account.xml +++ b/FCL/src/main/res/layout/ui_account.xml @@ -1,121 +1,131 @@ + android:layout_height="match_parent" + android:background="@color/ui_bg_color" + android:padding="10dp"> + app:layout_constraintWidth_percent="0.3"> - - - + + + android:layout_marginStart="10dp" + android:layout_marginTop="5dp" + android:layout_marginEnd="10dp" + android:background="@android:color/darker_gray" /> + android:layout_marginTop="10dp" + android:background="@drawable/bg_container_transparent_clickable" + android:clickable="true" + android:focusable="true" + android:orientation="horizontal" + android:padding="10dp" + android:stateListAnimator="@xml/anim_scale"> - + android:layout_gravity="center" + android:background="@drawable/ic_baseline_person_add_24" + app:use_theme_color="true" /> + android:layout_gravity="center" + android:layout_marginStart="10dp" + android:singleLine="true" + android:text="@string/account_methods_offline" + app:use_theme_color="true" /> + android:background="@drawable/bg_container_transparent_clickable" + android:clickable="true" + android:focusable="true" + android:orientation="horizontal" + android:padding="10dp" + android:stateListAnimator="@xml/anim_scale"> - + android:layout_gravity="center" + android:background="@drawable/ic_baseline_microsoft_24" + app:use_theme_color="true" /> + android:layout_gravity="center" + android:layout_marginStart="10dp" + android:singleLine="true" + android:text="@string/account_methods_microsoft" + app:use_theme_color="true" /> + android:dividerHeight="0dp" /> + android:background="@drawable/bg_container_transparent_clickable" + android:clickable="true" + android:focusable="true" + android:orientation="horizontal" + android:padding="10dp" + android:stateListAnimator="@xml/anim_scale"> - + android:layout_gravity="center" + android:background="@drawable/ic_baseline_add_24" + app:use_theme_color="true" /> + android:layout_gravity="center" + android:layout_marginStart="10dp" + android:singleLine="true" + android:text="@string/account_create_server" + app:use_theme_color="true" /> @@ -123,13 +133,13 @@ + app:layout_constraintWidth_percent="0.7" /> \ No newline at end of file diff --git a/FCLLibrary/build.gradle b/FCLLibrary/build.gradle index 19faa88b..bc76e4cc 100644 --- a/FCLLibrary/build.gradle +++ b/FCLLibrary/build.gradle @@ -1,5 +1,6 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' version '1.9.20' } android { @@ -29,6 +30,9 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + kotlinOptions { + jvmTarget = "1.8" + } } dependencies { diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLImageButton.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLImageButton.java index 1096cf52..946bee9b 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLImageButton.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLImageButton.java @@ -27,6 +27,7 @@ public class FCLImageButton extends AppCompatImageButton { private ObjectProperty image; private boolean autoTint; private boolean noPadding; + private boolean useThemeColor; private BooleanProperty visibilityProperty; private BooleanProperty disableProperty; @@ -64,6 +65,9 @@ public class FCLImageButton extends AppCompatImageButton { if (autoTint) { setImageTintList(new ColorStateList(state, colorSrc)); } + if (useThemeColor && getDrawable() != null) { + getDrawable().setTint(ThemeEngine.getInstance().getTheme().getColor()); + } RippleDrawable drawable = new RippleDrawable(new ColorStateList(state, colorRipple), null, null); drawable.setRadius(ConvertUtils.dip2px(getContext(), noPadding ? 12 : 20)); setBackgroundDrawable(drawable); @@ -94,6 +98,7 @@ public class FCLImageButton extends AppCompatImageButton { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLImageButton); autoTint = typedArray.getBoolean(R.styleable.FCLImageButton_auto_tint, false); noPadding = typedArray.getBoolean(R.styleable.FCLImageButton_no_padding, false); + useThemeColor = typedArray.getBoolean(R.styleable.FCLImageButton_use_theme_color, false); typedArray.recycle(); init(); theme.bind(ThemeEngine.getInstance().getTheme().colorProperty()); @@ -104,6 +109,7 @@ public class FCLImageButton extends AppCompatImageButton { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLImageButton); autoTint = typedArray.getBoolean(R.styleable.FCLImageButton_auto_tint, false); noPadding = typedArray.getBoolean(R.styleable.FCLImageButton_no_padding, false); + useThemeColor = typedArray.getBoolean(R.styleable.FCLImageButton_use_theme_color, false); typedArray.recycle(); init(); theme.bind(ThemeEngine.getInstance().getTheme().colorProperty()); @@ -127,6 +133,15 @@ public class FCLImageButton extends AppCompatImageButton { return noPadding; } + public void setUseThemeColor(boolean useThemeColor) { + this.useThemeColor = useThemeColor; + refreshStyle(); + } + + public boolean isUseThemeColor() { + return useThemeColor; + } + public final void setImage(Drawable drawable) { imageProperty().set(drawable); } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLImageView.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLImageView.java index 1f340879..6ed27964 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLImageView.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLImageView.java @@ -24,6 +24,7 @@ public class FCLImageView extends AppCompatImageView { private ObjectProperty image; private boolean autoTint; + private boolean useThemeColor; private BooleanProperty visibilityProperty; private final IntegerProperty theme = new IntegerPropertyBase() { @@ -42,6 +43,9 @@ public class FCLImageView extends AppCompatImageView { }; setImageTintList(new ColorStateList(state, color)); } + if (useThemeColor && getBackground() != null) { + getBackground().setTint(ThemeEngine.getInstance().getTheme().getColor()); + } } @Override @@ -64,6 +68,7 @@ public class FCLImageView extends AppCompatImageView { super(context, attrs); TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLImageView); autoTint = typedArray.getBoolean(R.styleable.FCLImageView_auto_src_tint, false); + useThemeColor = typedArray.getBoolean(R.styleable.FCLImageView_use_theme_color, false); typedArray.recycle(); theme.bind(ThemeEngine.getInstance().getTheme().colorProperty()); } @@ -72,6 +77,7 @@ public class FCLImageView extends AppCompatImageView { super(context, attrs, defStyleAttr); TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLImageView); autoTint = typedArray.getBoolean(R.styleable.FCLImageView_auto_src_tint, false); + useThemeColor = typedArray.getBoolean(R.styleable.FCLImageView_use_theme_color, false); typedArray.recycle(); theme.bind(ThemeEngine.getInstance().getTheme().colorProperty()); } @@ -84,6 +90,14 @@ public class FCLImageView extends AppCompatImageView { return autoTint; } + public void setUseThemeColor(boolean useThemeColor) { + this.useThemeColor = useThemeColor; + } + + public boolean isUseThemeColor() { + return useThemeColor; + } + public final void setImage(Drawable drawable) { imageProperty().set(drawable); } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLTextView.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLTextView.java index 9c3f4497..70f3f1e1 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLTextView.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLTextView.java @@ -24,6 +24,7 @@ public class FCLTextView extends AppCompatTextView { private boolean autoTint; private boolean autoBackgroundTint; + private boolean useThemeColor; private StringProperty string; private BooleanProperty visibilityProperty; @@ -38,6 +39,9 @@ public class FCLTextView extends AppCompatTextView { if (autoBackgroundTint) { setBackgroundTintList(new ColorStateList(new int[][] { { } }, new int[]{ ThemeEngine.getInstance().getTheme().getColor() })); } + if (useThemeColor) { + setTextColor(ThemeEngine.getInstance().getTheme().getColor()); + } } @Override @@ -63,6 +67,7 @@ public class FCLTextView extends AppCompatTextView { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLTextView); autoTint = typedArray.getBoolean(R.styleable.FCLTextView_auto_text_tint, false); autoBackgroundTint = typedArray.getBoolean(R.styleable.FCLTextView_auto_text_background_tint, false); + useThemeColor = typedArray.getBoolean(R.styleable.FCLTextView_use_theme_color, false); typedArray.recycle(); theme.bind(ThemeEngine.getInstance().getTheme().colorProperty()); } @@ -72,6 +77,7 @@ public class FCLTextView extends AppCompatTextView { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLTextView); autoTint = typedArray.getBoolean(R.styleable.FCLTextView_auto_text_tint, false); autoBackgroundTint = typedArray.getBoolean(R.styleable.FCLTextView_auto_text_background_tint, false); + useThemeColor = typedArray.getBoolean(R.styleable.FCLTextView_use_theme_color, false); typedArray.recycle(); theme.bind(ThemeEngine.getInstance().getTheme().colorProperty()); } @@ -96,6 +102,14 @@ public class FCLTextView extends AppCompatTextView { return autoTint; } + public void setUseThemeColor(boolean useThemeColor) { + this.useThemeColor = useThemeColor; + } + + public boolean isUseThemeColor() { + return useThemeColor; + } + public void setAutoBackgroundTint(boolean autoBackgroundTint) { this.autoBackgroundTint = autoBackgroundTint; } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLView.kt b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLView.kt new file mode 100644 index 00000000..865212d4 --- /dev/null +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/component/view/FCLView.kt @@ -0,0 +1,40 @@ +package com.tungsten.fcllibrary.component.view + +import android.content.Context +import android.util.AttributeSet +import android.view.View +import com.tungsten.fclcore.fakefx.beans.property.IntegerProperty +import com.tungsten.fclcore.fakefx.beans.property.IntegerPropertyBase +import com.tungsten.fcllibrary.R +import com.tungsten.fcllibrary.component.theme.ThemeEngine + +class FCLView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : View(context, attrs, defStyleAttr) { + var useThemeColor = false + private val theme: IntegerProperty = object : IntegerPropertyBase() { + override fun invalidated() { + get() + if (useThemeColor) { + setBackgroundColor(ThemeEngine.getInstance().getTheme().color) + } + } + + override fun getBean(): Any { + return this + } + + override fun getName(): String { + return "theme" + } + } + + init { + val typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLView) + useThemeColor = typedArray.getBoolean(R.styleable.FCLView_use_theme_color, false) + typedArray.recycle() + theme.bind(ThemeEngine.getInstance().getTheme().colorProperty()) + } +} \ No newline at end of file diff --git a/FCLLibrary/src/main/res/values/attrs.xml b/FCLLibrary/src/main/res/values/attrs.xml index e7cb8506..f2020097 100644 --- a/FCLLibrary/src/main/res/values/attrs.xml +++ b/FCLLibrary/src/main/res/values/attrs.xml @@ -1,5 +1,9 @@ + + + + @@ -8,13 +12,16 @@ + + +