getAccenedColorStateList
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
package ru.vtosters.lite.themes.hooks;
|
||||
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toolbar;
|
||||
|
||||
public class ToolbarHook implements BaseHook {
|
||||
@Override
|
||||
public void inject(View view, int i, boolean z) {
|
||||
if (view instanceof Toolbar) {
|
||||
if (view instanceof MenuItem) {
|
||||
// wtf?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import androidx.preference.PreferenceCategory;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
import com.vtosters.lite.ui.MaterialSwitchPreference;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class PreferencesUtil {
|
||||
|
||||
@@ -231,7 +232,7 @@ public class PreferencesUtil {
|
||||
editText.setTextColor(getTextAttr());
|
||||
editText.setHintTextColor(getSTextAttr());
|
||||
|
||||
editText.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
editText.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
|
||||
linearLayout.addView(editText);
|
||||
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
|
||||
@@ -50,6 +50,7 @@ import ru.vtosters.lite.music.LastFMScrobbler;
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
@@ -57,7 +58,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
public static void download(Context ctx) {
|
||||
final EditText input = new EditText(ctx);
|
||||
input.setTextColor(getTextAttr());
|
||||
input.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
input.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
|
||||
var lp = new FrameLayout.LayoutParams(-1, -2);
|
||||
lp.leftMargin = AndroidUtils.dp2px(16);
|
||||
@@ -175,7 +176,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
fn.setHint(R.string.lastfm_login);
|
||||
fn.setTextColor(getTextAttr());
|
||||
fn.setHintTextColor(getSTextAttr());
|
||||
fn.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
fn.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
linearLayout.addView(fn);
|
||||
fn.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) fn.getLayoutParams());
|
||||
@@ -186,7 +187,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
ln.setHint(R.string.lastfm_password);
|
||||
ln.setTextColor(getTextAttr());
|
||||
ln.setHintTextColor(getSTextAttr());
|
||||
ln.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
ln.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
linearLayout.addView(ln);
|
||||
ln.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ln.setLayoutParams(margin);
|
||||
|
||||
@@ -46,6 +46,7 @@ import ru.vtosters.lite.ui.adapters.StickerPackAdapter;
|
||||
import ru.vtosters.lite.ui.components.StickerTouchHelperCallback;
|
||||
import ru.vtosters.lite.ui.fragments.BaseToolbarFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class StickersFragment extends BaseToolbarFragment {
|
||||
public final static String ACTION_RELOAD = "com.vtosters.lite.action.RELOAD_TGS_LIST";
|
||||
@@ -132,7 +133,7 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
|
||||
FloatingActionButton mAddStickerPack = new FloatingActionButton(getContext());
|
||||
mAddStickerPack.setImageResource(R.drawable.ic_add_24);
|
||||
mAddStickerPack.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
mAddStickerPack.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
mAddStickerPack.setOnClickListener(v2 -> fabClick());
|
||||
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-2, -2);
|
||||
@@ -173,7 +174,7 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
|
||||
final EditText editText = new EditText(getContext());
|
||||
editText.setHintTextColor(getSTextAttr());
|
||||
editText.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
editText.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
|
||||
linearLayout.addView(editText);
|
||||
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
@@ -231,7 +232,7 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
|
||||
final EditText editText = new EditText(getContext());
|
||||
editText.setHintTextColor(getSTextAttr());
|
||||
editText.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
editText.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
|
||||
linearLayout.addView(editText);
|
||||
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
|
||||
@@ -153,7 +153,7 @@ public class RenameTool {
|
||||
fn.setHint(R.string.vk_auth_sign_up_first_name);
|
||||
fn.setTextColor(getTextAttr());
|
||||
fn.setHintTextColor(getSTextAttr());
|
||||
fn.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
fn.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
linearLayout.addView(fn);
|
||||
fn.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) fn.getLayoutParams());
|
||||
@@ -164,7 +164,7 @@ public class RenameTool {
|
||||
ln.setHint(R.string.vk_auth_sign_up_last_name);
|
||||
ln.setTextColor(getTextAttr());
|
||||
ln.setHintTextColor(getSTextAttr());
|
||||
ln.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
ln.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
linearLayout.addView(ln);
|
||||
ln.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ln.setLayoutParams(margin);
|
||||
@@ -235,7 +235,7 @@ public class RenameTool {
|
||||
fn.setHint(R.string.vk_auth_sign_up_first_name);
|
||||
fn.setHintTextColor(getSTextAttr());
|
||||
fn.setTextColor(getTextAttr());
|
||||
fn.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
fn.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
||||
linearLayout.addView(fn);
|
||||
fn.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) fn.getLayoutParams());
|
||||
|
||||
@@ -48,6 +48,10 @@ public class ThemesUtils {
|
||||
}
|
||||
} // Apply VKTheme and ImTheme (hard applying without dynamic theme changing)
|
||||
|
||||
public static ColorStateList getAccenedColorStateList() {
|
||||
return ColorStateList.valueOf(getAccentColor());
|
||||
}
|
||||
|
||||
public static int getSystemModeTheme() {
|
||||
return AppCompatDelegate.getDefaultNightMode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user