Revert "fix some potential bug"

This reverts commit a6323818c8.
This commit is contained in:
Tungstend 2022-11-26 04:21:17 +08:00
parent dcd69ecb9a
commit 37ced479ac
15 changed files with 99 additions and 149 deletions

View File

@ -127,6 +127,7 @@ public class MainActivity extends FCLActivity implements FCLMenuView.OnSelectLis
home.setSelected(true);
ready = true;
refresh(null).start();
});
});
}

View File

@ -14,7 +14,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatButton;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.R;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
import com.tungsten.fcllibrary.util.ConvertUtils;
@ -85,15 +84,12 @@ public class FCLButton extends AppCompatButton {
public FCLButton(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> {
init(false, GradientDrawable.RECTANGLE, true);
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLButton(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLButton);
boolean ripple = typedArray.getBoolean(R.styleable.FCLButton_ripple, false);
int shape = typedArray.getInteger(R.styleable.FCLButton_shape, GradientDrawable.RECTANGLE);
@ -101,12 +97,10 @@ public class FCLButton extends AppCompatButton {
init(ripple, shape, autoPadding);
typedArray.recycle();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLButton(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLButton);
boolean ripple = typedArray.getBoolean(R.styleable.FCLButton_ripple, false);
int shape = typedArray.getInteger(R.styleable.FCLButton_shape, GradientDrawable.RECTANGLE);
@ -114,7 +108,6 @@ public class FCLButton extends AppCompatButton {
init(ripple, shape, autoPadding);
typedArray.recycle();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
@Override

View File

@ -9,7 +9,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatCheckBox;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
public class FCLCheckBox extends AppCompatCheckBox {
@ -32,16 +31,16 @@ public class FCLCheckBox extends AppCompatCheckBox {
public FCLCheckBox(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLCheckBox(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLCheckBox(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
}

View File

@ -12,7 +12,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.anim.DynamicIslandAnim;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
import com.tungsten.fcllibrary.util.ConvertUtils;
@ -69,26 +68,20 @@ public class FCLDynamicIsland extends AppCompatTextView {
public FCLDynamicIsland(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> {
init();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLDynamicIsland(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> {
init();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLDynamicIsland(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> {
init();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
@SuppressLint("DrawAllocation")

View File

@ -10,7 +10,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatEditText;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
public class FCLEditText extends AppCompatEditText {
@ -36,16 +35,16 @@ public class FCLEditText extends AppCompatEditText {
public FCLEditText(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLEditText(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLEditText(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
}

View File

@ -10,7 +10,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageButton;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.R;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
import com.tungsten.fcllibrary.util.ConvertUtils;
@ -51,32 +50,26 @@ public class FCLImageButton extends AppCompatImageButton {
public FCLImageButton(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> {
init();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLImageButton(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLImageButton);
autoTint = typedArray.getBoolean(R.styleable.FCLImageButton_auto_tint, false);
typedArray.recycle();
init();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLImageButton(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLImageButton);
autoTint = typedArray.getBoolean(R.styleable.FCLImageButton_auto_tint, false);
typedArray.recycle();
init();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public void setAutoTint(boolean autoTint) {

View File

@ -37,27 +37,23 @@ public class FCLImageView extends AppCompatImageView {
public FCLImageView(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLImageView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> {
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);
Schedulers.androidUIThread().execute(() -> {
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) {

View File

@ -9,7 +9,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageButton;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
import com.tungsten.fcllibrary.util.ConvertUtils;
@ -83,26 +82,20 @@ public class FCLMenuView extends AppCompatImageButton {
public FCLMenuView(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> {
init();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLMenuView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> {
init();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLMenuView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> {
init();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public interface OnSelectListener {

View File

@ -5,7 +5,6 @@ import android.content.res.ColorStateList;
import android.util.AttributeSet;
import android.widget.ProgressBar;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
public class FCLProgressBar extends ProgressBar {
@ -25,21 +24,21 @@ public class FCLProgressBar extends ProgressBar {
public FCLProgressBar(Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLProgressBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
}

View File

@ -8,7 +8,6 @@ import android.util.AttributeSet;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatRadioButton;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
public class FCLRadioButton extends AppCompatRadioButton {
@ -31,17 +30,17 @@ public class FCLRadioButton extends AppCompatRadioButton {
public FCLRadioButton(Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLRadioButton(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLRadioButton(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
}

View File

@ -8,7 +8,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatSeekBar;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
public class FCLSeekBar extends AppCompatSeekBar {
@ -28,16 +27,16 @@ public class FCLSeekBar extends AppCompatSeekBar {
public FCLSeekBar(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLSeekBar(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLSeekBar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
}

View File

@ -9,7 +9,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
public class FCLSwitch extends SwitchCompat {
@ -37,16 +36,16 @@ public class FCLSwitch extends SwitchCompat {
public FCLSwitch(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLSwitch(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLSwitch(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
}

View File

@ -9,7 +9,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.tabs.TabLayout;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
public class FCLTabLayout extends TabLayout {
@ -34,16 +33,16 @@ public class FCLTabLayout extends TabLayout {
public FCLTabLayout(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLTabLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLTabLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
}

View File

@ -9,7 +9,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.R;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
@ -25,27 +24,23 @@ public class FCLTextView extends AppCompatTextView {
public FCLTextView(@NonNull Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> ThemeEngine.getInstance().registerEvent(this, runnable));
ThemeEngine.getInstance().registerEvent(this, runnable);
}
public FCLTextView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLTextView);
autoTint = typedArray.getBoolean(R.styleable.FCLTextView_auto_text_tint, false);
typedArray.recycle();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLTextView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLTextView);
autoTint = typedArray.getBoolean(R.styleable.FCLTextView_auto_text_tint, false);
typedArray.recycle();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public void alert() {

View File

@ -10,7 +10,6 @@ import android.view.View;
import androidx.annotation.Nullable;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.R;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
import com.tungsten.fcllibrary.util.ConvertUtils;
@ -62,15 +61,12 @@ public class FCLTitleView extends View {
public FCLTitleView(Context context) {
super(context);
Schedulers.androidUIThread().execute(() -> {
init("");
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLTitleView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Schedulers.androidUIThread().execute(() -> {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLTitleView);
String title = typedArray.getString(R.styleable.FCLTitleView_title);
if (title == null) {
@ -79,12 +75,10 @@ public class FCLTitleView extends View {
init(title);
typedArray.recycle();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
public FCLTitleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Schedulers.androidUIThread().execute(() -> {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.FCLTitleView);
String title = typedArray.getString(R.styleable.FCLTitleView_title);
if (title == null) {
@ -93,7 +87,6 @@ public class FCLTitleView extends View {
init(title);
typedArray.recycle();
ThemeEngine.getInstance().registerEvent(this, runnable);
});
}
@Override