[app] Use some of RikkaW's libraries (#117)
* Use rikka's switchBar * Use rikka's recyclerviewkt * Use rikka's insets
This commit is contained in:
parent
9004bf6722
commit
d918f977dd
|
|
@ -70,6 +70,10 @@ dependencies {
|
||||||
implementation 'com.google.android.material:material:1.2.1'
|
implementation 'com.google.android.material:material:1.2.1'
|
||||||
implementation 'com.takisoft.preferencex:preferencex:1.1.0'
|
implementation 'com.takisoft.preferencex:preferencex:1.1.0'
|
||||||
implementation 'com.takisoft.preferencex:preferencex-colorpicker:1.1.0'
|
implementation 'com.takisoft.preferencex:preferencex-colorpicker:1.1.0'
|
||||||
|
implementation 'rikka.insets:insets:1.0.1'
|
||||||
|
implementation 'rikka.recyclerview:recyclerview-utils:1.2.0'
|
||||||
|
implementation "rikka.widget:switchbar:1.0.2"
|
||||||
|
implementation 'rikka.layoutinflater:layoutinflater:1.0.1'
|
||||||
implementation 'tech.rectifier.preferencex-android:preferencex-simplemenu:88f93154b2'
|
implementation 'tech.rectifier.preferencex-android:preferencex-simplemenu:88f93154b2'
|
||||||
implementation 'me.zhanghai.android.appiconloader:appiconloader-glide:1.2.0'
|
implementation 'me.zhanghai.android.appiconloader:appiconloader-glide:1.2.0'
|
||||||
implementation 'me.zhanghai.android.fastscroll:library:1.1.5'
|
implementation 'me.zhanghai.android.fastscroll:library:1.1.5'
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,9 @@ import io.github.lsposed.manager.BuildConfig;
|
||||||
import io.github.lsposed.manager.R;
|
import io.github.lsposed.manager.R;
|
||||||
import io.github.lsposed.manager.ui.activity.AppListActivity;
|
import io.github.lsposed.manager.ui.activity.AppListActivity;
|
||||||
import io.github.lsposed.manager.ui.fragment.CompileDialogFragment;
|
import io.github.lsposed.manager.ui.fragment.CompileDialogFragment;
|
||||||
import io.github.lsposed.manager.ui.widget.MasterSwitch;
|
|
||||||
import io.github.lsposed.manager.util.GlideApp;
|
import io.github.lsposed.manager.util.GlideApp;
|
||||||
import io.github.lsposed.manager.util.ModuleUtil;
|
import io.github.lsposed.manager.util.ModuleUtil;
|
||||||
|
import rikka.widget.switchbar.SwitchBar;
|
||||||
|
|
||||||
import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS;
|
import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS;
|
||||||
|
|
||||||
|
|
@ -64,14 +64,14 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
|
||||||
private final SharedPreferences preferences;
|
private final SharedPreferences preferences;
|
||||||
private final String modulePackageName;
|
private final String modulePackageName;
|
||||||
private final String moduleName;
|
private final String moduleName;
|
||||||
private final MasterSwitch masterSwitch;
|
private final SwitchBar masterSwitch;
|
||||||
private List<PackageInfo> fullList, showList;
|
private List<PackageInfo> fullList, showList;
|
||||||
private List<String> checkedList;
|
private List<String> checkedList;
|
||||||
private final List<String> recommendedList;
|
private final List<String> recommendedList;
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
private ApplicationInfo selectedInfo;
|
private ApplicationInfo selectedInfo;
|
||||||
|
|
||||||
public ScopeAdapter(AppListActivity activity, String moduleName, String modulePackageName, MasterSwitch masterSwitch) {
|
public ScopeAdapter(AppListActivity activity, String moduleName, String modulePackageName, SwitchBar masterSwitch) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
this.moduleName = moduleName;
|
this.moduleName = moduleName;
|
||||||
this.modulePackageName = modulePackageName;
|
this.modulePackageName = modulePackageName;
|
||||||
|
|
@ -80,13 +80,11 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
|
||||||
fullList = showList = Collections.emptyList();
|
fullList = showList = Collections.emptyList();
|
||||||
checkedList = Collections.emptyList();
|
checkedList = Collections.emptyList();
|
||||||
pm = activity.getPackageManager();
|
pm = activity.getPackageManager();
|
||||||
masterSwitch.setOnCheckedChangedListener(new MasterSwitch.OnCheckedChangeListener() {
|
masterSwitch.setOnCheckedChangeListener((view, isChecked) -> {
|
||||||
@Override
|
enabled = isChecked;
|
||||||
public void onCheckedChanged(boolean checked) {
|
ModuleUtil.getInstance().setModuleEnabled(modulePackageName, enabled);
|
||||||
enabled = checked;
|
notifyDataSetChanged();
|
||||||
ModuleUtil.getInstance().setModuleEnabled(modulePackageName, enabled);
|
return true;
|
||||||
notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
ModuleUtil.InstalledModule module = ModuleUtil.getInstance().getModule(modulePackageName);
|
ModuleUtil.InstalledModule module = ModuleUtil.getInstance().getModule(modulePackageName);
|
||||||
recommendedList = module.getScopeList();
|
recommendedList = module.getScopeList();
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ import io.github.lsposed.manager.adapters.ScopeAdapter;
|
||||||
import io.github.lsposed.manager.databinding.ActivityAppListBinding;
|
import io.github.lsposed.manager.databinding.ActivityAppListBinding;
|
||||||
import io.github.lsposed.manager.util.BackupUtils;
|
import io.github.lsposed.manager.util.BackupUtils;
|
||||||
import io.github.lsposed.manager.util.LinearLayoutManagerFix;
|
import io.github.lsposed.manager.util.LinearLayoutManagerFix;
|
||||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder;
|
import rikka.recyclerview.RecyclerViewKt;
|
||||||
|
|
||||||
public class AppListActivity extends BaseActivity {
|
public class AppListActivity extends BaseActivity {
|
||||||
private SearchView searchView;
|
private SearchView searchView;
|
||||||
|
|
@ -63,16 +63,13 @@ public class AppListActivity extends BaseActivity {
|
||||||
scopeAdapter.setHasStableIds(true);
|
scopeAdapter.setHasStableIds(true);
|
||||||
binding.recyclerView.setAdapter(scopeAdapter);
|
binding.recyclerView.setAdapter(scopeAdapter);
|
||||||
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
|
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
|
||||||
setupRecyclerViewInsets(binding.recyclerView, binding.getRoot());
|
RecyclerViewKt.addFastScroller(binding.recyclerView, binding.swipeRefreshLayout);
|
||||||
FastScrollerBuilder fastScrollerBuilder = new FastScrollerBuilder(binding.recyclerView);
|
RecyclerViewKt.fixEdgeEffect(binding.recyclerView, false, true);
|
||||||
if (!preferences.getBoolean("md2", true)) {
|
if (!preferences.getBoolean("md2", true)) {
|
||||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
|
||||||
DividerItemDecoration.VERTICAL);
|
DividerItemDecoration.VERTICAL);
|
||||||
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||||
} else {
|
|
||||||
fastScrollerBuilder.useMd2Style();
|
|
||||||
}
|
}
|
||||||
fastScrollerBuilder.build();
|
|
||||||
handler.postDelayed(runnable, 300);
|
handler.postDelayed(runnable, 300);
|
||||||
binding.swipeRefreshLayout.setOnRefreshListener(scopeAdapter::refresh);
|
binding.swipeRefreshLayout.setOnRefreshListener(scopeAdapter::refresh);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,19 +5,14 @@ import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StyleRes;
|
import androidx.annotation.StyleRes;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.Insets;
|
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.core.view.WindowCompat;
|
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
|
||||||
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
|
|
@ -29,6 +24,7 @@ import io.github.lsposed.manager.Constants;
|
||||||
import io.github.lsposed.manager.R;
|
import io.github.lsposed.manager.R;
|
||||||
import io.github.lsposed.manager.util.CustomThemeColor;
|
import io.github.lsposed.manager.util.CustomThemeColor;
|
||||||
import io.github.lsposed.manager.util.CustomThemeColors;
|
import io.github.lsposed.manager.util.CustomThemeColors;
|
||||||
|
import io.github.lsposed.manager.util.InsetsViewInflater;
|
||||||
import io.github.lsposed.manager.util.NavUtil;
|
import io.github.lsposed.manager.util.NavUtil;
|
||||||
import io.github.lsposed.manager.util.Version;
|
import io.github.lsposed.manager.util.Version;
|
||||||
|
|
||||||
|
|
@ -47,6 +43,10 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
return preferences.getBoolean("black_dark_theme", false);
|
return preferences.getBoolean("black_dark_theme", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onInstallViewFactory(LayoutInflater layoutInflater) {
|
||||||
|
layoutInflater.setFactory2(new InsetsViewInflater(getDelegate()));
|
||||||
|
}
|
||||||
|
|
||||||
public String getTheme(Context context) {
|
public String getTheme(Context context) {
|
||||||
if (isBlackNightTheme()
|
if (isBlackNightTheme()
|
||||||
&& isNightMode(context.getResources().getConfiguration()))
|
&& isNightMode(context.getResources().getConfiguration()))
|
||||||
|
|
@ -98,6 +98,7 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
onInstallViewFactory(LayoutInflater.from(this));
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
AppCompatDelegate.setDefaultNightMode(preferences.getInt("theme", -1));
|
AppCompatDelegate.setDefaultNightMode(preferences.getInt("theme", -1));
|
||||||
theme = getTheme(this) + getCustomTheme() + preferences.getBoolean("md2", true);
|
theme = getTheme(this) + getCustomTheme() + preferences.getBoolean("md2", true);
|
||||||
|
|
@ -120,18 +121,6 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupRecyclerViewInsets(View recyclerView, View root) {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
||||||
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(recyclerView, (v, insets) -> {
|
|
||||||
Insets insets1 = insets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime());
|
|
||||||
root.setPadding(insets1.left, insets1.top, insets1.right, 0);
|
|
||||||
v.setPadding(0, 0, 0, insets1.bottom);
|
|
||||||
return WindowInsetsCompat.CONSUMED;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getThemedColor(int id) {
|
public int getThemedColor(int id) {
|
||||||
TypedArray typedArray = getTheme().obtainStyledAttributes(new int[]{id});
|
TypedArray typedArray = getTheme().obtainStyledAttributes(new int[]{id});
|
||||||
int color = typedArray.getColor(0, 0);
|
int color = typedArray.getColor(0, 0);
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ import io.github.lsposed.manager.databinding.ActivityLogsBinding;
|
||||||
import io.github.lsposed.manager.databinding.DialogInstallWarningBinding;
|
import io.github.lsposed.manager.databinding.DialogInstallWarningBinding;
|
||||||
import io.github.lsposed.manager.databinding.ItemLogBinding;
|
import io.github.lsposed.manager.databinding.ItemLogBinding;
|
||||||
import io.github.lsposed.manager.util.LinearLayoutManagerFix;
|
import io.github.lsposed.manager.util.LinearLayoutManagerFix;
|
||||||
|
import rikka.recyclerview.RecyclerViewKt;
|
||||||
|
|
||||||
public class LogsActivity extends BaseActivity {
|
public class LogsActivity extends BaseActivity {
|
||||||
private int logType = 0;
|
private int logType = 0;
|
||||||
|
|
@ -89,10 +90,10 @@ public class LogsActivity extends BaseActivity {
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
adapter = new LogsAdapter();
|
adapter = new LogsAdapter();
|
||||||
|
RecyclerViewKt.fixEdgeEffect(binding.recyclerView, false, true);
|
||||||
binding.recyclerView.setAdapter(adapter);
|
binding.recyclerView.setAdapter(adapter);
|
||||||
layoutManager = new LinearLayoutManagerFix(this);
|
layoutManager = new LinearLayoutManagerFix(this);
|
||||||
binding.recyclerView.setLayoutManager(layoutManager);
|
binding.recyclerView.setLayoutManager(layoutManager);
|
||||||
setupRecyclerViewInsets(binding.recyclerView, binding.getRoot());
|
|
||||||
try {
|
try {
|
||||||
if (Files.readAllBytes(Paths.get(Constants.getMiscDir(), "disable_verbose_log"))[0] == 49) {
|
if (Files.readAllBytes(Paths.get(Constants.getMiscDir(), "disable_verbose_log"))[0] == 49) {
|
||||||
binding.slidingTabs.setVisibility(View.GONE);
|
binding.slidingTabs.setVisibility(View.GONE);
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,10 @@ package io.github.lsposed.manager.ui.activity;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.Insets;
|
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.core.view.WindowCompat;
|
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
@ -37,17 +32,6 @@ public class MainActivity extends BaseActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(binding.nestedScrollView, (v, insets) -> {
|
|
||||||
Insets insets1 = insets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime());
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
||||||
v.setPadding(insets1.left, insets1.top, insets1.right, insets1.bottom);
|
|
||||||
} else {
|
|
||||||
v.setPadding(0, insets1.top, 0, 0);
|
|
||||||
binding.getRoot().setPadding(insets1.left, 0, insets1.right, insets1.bottom);
|
|
||||||
}
|
|
||||||
return WindowInsetsCompat.CONSUMED;
|
|
||||||
});
|
|
||||||
HolidayHelper.setup(this);
|
HolidayHelper.setup(this);
|
||||||
binding.status.setOnClickListener(v -> {
|
binding.status.setOnClickListener(v -> {
|
||||||
if (Constants.getXposedVersionCode() != -1) {
|
if (Constants.getXposedVersionCode() != -1) {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ import io.github.lsposed.manager.databinding.ActivityAppListBinding;
|
||||||
import io.github.lsposed.manager.util.GlideApp;
|
import io.github.lsposed.manager.util.GlideApp;
|
||||||
import io.github.lsposed.manager.util.LinearLayoutManagerFix;
|
import io.github.lsposed.manager.util.LinearLayoutManagerFix;
|
||||||
import io.github.lsposed.manager.util.ModuleUtil;
|
import io.github.lsposed.manager.util.ModuleUtil;
|
||||||
import me.zhanghai.android.fastscroll.FastScrollerBuilder;
|
import rikka.recyclerview.RecyclerViewKt;
|
||||||
|
|
||||||
import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS;
|
import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS;
|
||||||
|
|
||||||
|
|
@ -81,16 +81,13 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
moduleUtil.addListener(this);
|
moduleUtil.addListener(this);
|
||||||
binding.recyclerView.setAdapter(adapter);
|
binding.recyclerView.setAdapter(adapter);
|
||||||
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
|
binding.recyclerView.setLayoutManager(new LinearLayoutManagerFix(this));
|
||||||
setupRecyclerViewInsets(binding.recyclerView, binding.getRoot());
|
RecyclerViewKt.addFastScroller(binding.recyclerView, binding.swipeRefreshLayout);
|
||||||
FastScrollerBuilder fastScrollerBuilder = new FastScrollerBuilder(binding.recyclerView);
|
RecyclerViewKt.fixEdgeEffect(binding.recyclerView, false, true);
|
||||||
if (!preferences.getBoolean("md2", true)) {
|
if (!preferences.getBoolean("md2", true)) {
|
||||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this,
|
||||||
DividerItemDecoration.VERTICAL);
|
DividerItemDecoration.VERTICAL);
|
||||||
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||||
} else {
|
|
||||||
fastScrollerBuilder.useMd2Style();
|
|
||||||
}
|
}
|
||||||
fastScrollerBuilder.build();
|
|
||||||
binding.swipeRefreshLayout.setOnRefreshListener(() -> adapter.refresh(true));
|
binding.swipeRefreshLayout.setOnRefreshListener(() -> adapter.refresh(true));
|
||||||
mSearchListener = new SearchView.OnQueryTextListener() {
|
mSearchListener = new SearchView.OnQueryTextListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ import io.github.lsposed.manager.R;
|
||||||
import io.github.lsposed.manager.databinding.ActivitySettingsBinding;
|
import io.github.lsposed.manager.databinding.ActivitySettingsBinding;
|
||||||
import io.github.lsposed.manager.ui.fragment.StatusDialogBuilder;
|
import io.github.lsposed.manager.ui.fragment.StatusDialogBuilder;
|
||||||
import io.github.lsposed.manager.ui.widget.IntegerListPreference;
|
import io.github.lsposed.manager.ui.widget.IntegerListPreference;
|
||||||
import io.github.lsposed.manager.ui.widget.RecyclerViewBugFixed;
|
|
||||||
import io.github.lsposed.manager.util.BackupUtils;
|
import io.github.lsposed.manager.util.BackupUtils;
|
||||||
|
import rikka.recyclerview.RecyclerViewKt;
|
||||||
|
|
||||||
public class SettingsActivity extends BaseActivity {
|
public class SettingsActivity extends BaseActivity {
|
||||||
private static final String KEY_PREFIX = SettingsActivity.class.getName() + '.';
|
private static final String KEY_PREFIX = SettingsActivity.class.getName() + '.';
|
||||||
|
|
@ -83,14 +83,6 @@ public class SettingsActivity extends BaseActivity {
|
||||||
getSupportFragmentManager().beginTransaction()
|
getSupportFragmentManager().beginTransaction()
|
||||||
.add(R.id.container, new SettingsFragment()).commit();
|
.add(R.id.container, new SettingsFragment()).commit();
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
||||||
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(binding.getRoot(), (v, insets) -> {
|
|
||||||
Insets insets1 = insets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime());
|
|
||||||
binding.getRoot().setPadding(insets1.left, insets1.top, insets1.right, 0);
|
|
||||||
return insets;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (Constants.getXposedVersion() == null) {
|
if (Constants.getXposedVersion() == null) {
|
||||||
Snackbar.make(binding.snackbar, R.string.lsposed_not_active, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(binding.snackbar, R.string.lsposed_not_active, Snackbar.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
@ -396,7 +388,7 @@ public class SettingsActivity extends BaseActivity {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
RecyclerView recyclerView = getListView();
|
RecyclerView recyclerView = getListView();
|
||||||
recyclerView.setClipToPadding(false);
|
recyclerView.setClipToPadding(false);
|
||||||
recyclerView.setEdgeEffectFactory(new RecyclerViewBugFixed.AlwaysClipToPaddingEdgeEffectFactory());
|
RecyclerViewKt.fixEdgeEffect(recyclerView, false, true);
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(recyclerView, (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(recyclerView, (v, insets) -> {
|
||||||
Insets insets1 = insets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime());
|
Insets insets1 = insets.getInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime());
|
||||||
v.setPadding(0, 0, 0, insets1.bottom);
|
v.setPadding(0, 0, 0, insets1.bottom);
|
||||||
|
|
|
||||||
|
|
@ -1,105 +0,0 @@
|
||||||
package io.github.lsposed.manager.ui.widget;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.graphics.drawable.StateListDrawable;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Checkable;
|
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
|
||||||
|
|
||||||
import io.github.lsposed.manager.R;
|
|
||||||
|
|
||||||
public class MasterSwitch extends FrameLayout implements View.OnClickListener, Checkable {
|
|
||||||
|
|
||||||
private SwitchCompat switchCompat;
|
|
||||||
|
|
||||||
private OnCheckedChangeListener listener;
|
|
||||||
|
|
||||||
private boolean isChecked;
|
|
||||||
|
|
||||||
public MasterSwitch(@NonNull Context context, @Nullable AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
init(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MasterSwitch(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
init(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MasterSwitch(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
|
||||||
init(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init(Context context, AttributeSet attrs) {
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
|
||||||
inflater.inflate(R.layout.master_switch, this, true);
|
|
||||||
|
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MasterSwitch);
|
|
||||||
int colorOn = a.getColor(R.styleable.MasterSwitch_masterSwitchBackgroundOn, 0);
|
|
||||||
int colorOff = a.getColor(R.styleable.MasterSwitch_masterSwitchBackgroundOff, 0);
|
|
||||||
a.recycle();
|
|
||||||
|
|
||||||
StateListDrawable drawable = new StateListDrawable();
|
|
||||||
drawable.addState(new int[]{android.R.attr.state_selected}, new ColorDrawable(colorOn));
|
|
||||||
drawable.addState(new int[]{}, new ColorDrawable(colorOff));
|
|
||||||
setBackground(drawable);
|
|
||||||
|
|
||||||
TextView masterTitle = findViewById(android.R.id.title);
|
|
||||||
masterTitle.setText(R.string.enable_module);
|
|
||||||
switchCompat = findViewById(R.id.switchWidget);
|
|
||||||
|
|
||||||
setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateViews() {
|
|
||||||
if (switchCompat != null) {
|
|
||||||
setSelected(isChecked);
|
|
||||||
switchCompat.setChecked(isChecked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isChecked() {
|
|
||||||
return isChecked;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toggle() {
|
|
||||||
setChecked(!isChecked);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setChecked(boolean checked) {
|
|
||||||
final boolean changed = isChecked != checked;
|
|
||||||
if (changed) {
|
|
||||||
isChecked = checked;
|
|
||||||
updateViews();
|
|
||||||
if (listener != null) {
|
|
||||||
listener.onCheckedChanged(checked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnCheckedChangedListener(OnCheckedChangeListener listener) {
|
|
||||||
this.listener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static abstract class OnCheckedChangeListener {
|
|
||||||
public abstract void onCheckedChanged(boolean checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
toggle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
package io.github.lsposed.manager.ui.widget;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.widget.EdgeEffect;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import me.zhanghai.android.fastscroll.FixItemDecorationRecyclerView;
|
|
||||||
|
|
||||||
public class RecyclerViewBugFixed extends FixItemDecorationRecyclerView {
|
|
||||||
|
|
||||||
|
|
||||||
public RecyclerViewBugFixed(@NonNull Context context) {
|
|
||||||
super(context);
|
|
||||||
setEdgeEffectFactory(getClipToPadding() ? new EdgeEffectFactory() : new AlwaysClipToPaddingEdgeEffectFactory());
|
|
||||||
}
|
|
||||||
|
|
||||||
public RecyclerViewBugFixed(@NonNull Context context, @Nullable AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
setEdgeEffectFactory(getClipToPadding() ? new EdgeEffectFactory() : new AlwaysClipToPaddingEdgeEffectFactory());
|
|
||||||
}
|
|
||||||
|
|
||||||
public RecyclerViewBugFixed(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
setEdgeEffectFactory(getClipToPadding() ? new EdgeEffectFactory() : new AlwaysClipToPaddingEdgeEffectFactory());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class AlwaysClipToPaddingEdgeEffectFactory extends RecyclerView.EdgeEffectFactory {
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected EdgeEffect createEdgeEffect(@NonNull RecyclerView view, int direction) {
|
|
||||||
return new EdgeEffect(view.getContext()) {
|
|
||||||
private boolean ensureSize = false;
|
|
||||||
|
|
||||||
private void ensureSize() {
|
|
||||||
if (ensureSize) return;
|
|
||||||
ensureSize = true;
|
|
||||||
switch (direction) {
|
|
||||||
case DIRECTION_LEFT:
|
|
||||||
case DIRECTION_RIGHT:
|
|
||||||
setSize(view.getMeasuredHeight() - view.getPaddingTop() - view.getPaddingBottom(),
|
|
||||||
view.getMeasuredWidth() - view.getPaddingLeft() - view.getPaddingRight());
|
|
||||||
break;
|
|
||||||
case DIRECTION_TOP:
|
|
||||||
case DIRECTION_BOTTOM:
|
|
||||||
setSize(view.getMeasuredWidth() - view.getPaddingLeft() - view.getPaddingRight(),
|
|
||||||
view.getMeasuredHeight() - view.getPaddingTop() - view.getPaddingBottom());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean draw(Canvas c) {
|
|
||||||
ensureSize();
|
|
||||||
|
|
||||||
int restore = c.save();
|
|
||||||
switch (direction) {
|
|
||||||
case DIRECTION_LEFT:
|
|
||||||
c.translate(view.getPaddingBottom(), 0f);
|
|
||||||
break;
|
|
||||||
case DIRECTION_TOP:
|
|
||||||
c.translate(view.getPaddingLeft(), view.getPaddingTop());
|
|
||||||
break;
|
|
||||||
case DIRECTION_RIGHT:
|
|
||||||
c.translate(-view.getPaddingTop(), 0f);
|
|
||||||
break;
|
|
||||||
case DIRECTION_BOTTOM:
|
|
||||||
c.translate(view.getPaddingRight(), view.getPaddingBottom());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
boolean res = super.draw(c);
|
|
||||||
c.restoreToCount(restore);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* This file is part of EdXposed.
|
||||||
|
*
|
||||||
|
* EdXposed is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* EdXposed is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with EdXposed. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 EdXposed Contributors
|
||||||
|
* Copyright (C) 2021 EdXposed Contributors
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.github.lsposed.manager.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import rikka.insets.WindowInsetsHelper;
|
||||||
|
import rikka.layoutinflater.view.LayoutInflaterFactory;
|
||||||
|
|
||||||
|
public class InsetsViewInflater extends LayoutInflaterFactory {
|
||||||
|
public InsetsViewInflater(@NotNull AppCompatDelegate delegate) {
|
||||||
|
super(delegate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NotNull View view, @Nullable View parent, @NotNull String name, @NotNull Context context, @NotNull AttributeSet attrs) {
|
||||||
|
WindowInsetsHelper.attach(view, attrs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,10 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/snackbar"
|
android:id="@+id/snackbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
app:consumeSystemWindowsInsets="top|start|end"
|
||||||
|
app:edgeToEdge="true"
|
||||||
|
app:fitSystemWindowsInsets="top|start|end">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
@ -27,6 +30,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
|
app:fitSystemWindowsInsets="bottom"
|
||||||
tools:ignore="UseCompoundDrawables,ContentDescription">
|
tools:ignore="UseCompoundDrawables,ContentDescription">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/snackbar"
|
android:id="@+id/snackbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
app:consumeSystemWindowsInsets="top|start|end"
|
||||||
|
app:edgeToEdge="true"
|
||||||
|
app:fitSystemWindowsInsets="top|start|end">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
@ -26,12 +29,12 @@
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<io.github.lsposed.manager.ui.widget.MasterSwitch
|
<rikka.widget.switchbar.SwitchBar
|
||||||
android:id="@+id/master_switch"
|
android:id="@+id/master_switch"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:theme="@style/MasterSwitch"
|
app:switchOnText="@string/enable_module"
|
||||||
android:foreground="?selectableItemBackground" />
|
app:switchOffText="@string/enable_module" />
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
android:id="@+id/swipeRefreshLayout"
|
android:id="@+id/swipeRefreshLayout"
|
||||||
|
|
@ -40,11 +43,12 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<io.github.lsposed.manager.ui.widget.RecyclerViewBugFixed
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false" />
|
android:clipToPadding="false"
|
||||||
|
app:fitSystemWindowsInsets="bottom" />
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/snackbar"
|
android:id="@+id/snackbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
app:consumeSystemWindowsInsets="top|start|end"
|
||||||
|
app:edgeToEdge="true"
|
||||||
|
app:fitSystemWindowsInsets="top|start|end">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
@ -44,11 +47,12 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<io.github.lsposed.manager.ui.widget.RecyclerViewBugFixed
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:clipToPadding="false" />
|
android:clipToPadding="false"
|
||||||
|
app:fitSystemWindowsInsets="bottom" />
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/snackbar"
|
android:id="@+id/snackbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
app:consumeSystemWindowsInsets="start|end"
|
||||||
|
app:edgeToEdge="true"
|
||||||
|
app:fitSystemWindowsInsets="start|end">
|
||||||
|
|
||||||
<com.github.matteobattilana.weather.WeatherView
|
<com.github.matteobattilana.weather.WeatherView
|
||||||
android:id="@+id/weather_view"
|
android:id="@+id/weather_view"
|
||||||
|
|
@ -30,6 +33,7 @@
|
||||||
android:id="@+id/nestedScrollView"
|
android:id="@+id/nestedScrollView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
app:fitSystemWindowsInsets="top|bottom"
|
||||||
android:scrollbars="none">
|
android:scrollbars="none">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/snackbar"
|
android:id="@+id/snackbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
app:consumeSystemWindowsInsets="top|start|end"
|
||||||
|
app:edgeToEdge="true"
|
||||||
|
app:fitSystemWindowsInsets="top|start|end">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/master_switch_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:baselineAligned="false"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:paddingStart="54dp"
|
|
||||||
android:paddingBottom="16dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@android:id/title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:ellipsize="marquee"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textAppearance="?masterSwitchTextAppearance" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@android:id/widget_frame"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="end|center_vertical"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="0dp">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
|
||||||
android:id="@+id/switchWidget"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:clickable="false"
|
|
||||||
android:focusable="false" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</merge>
|
|
||||||
|
|
@ -10,5 +10,9 @@
|
||||||
<item name="listItemBackground">@drawable/item_background_md2</item>
|
<item name="listItemBackground">@drawable/item_background_md2</item>
|
||||||
<item name="roundBackground">@drawable/item_background_md2</item>
|
<item name="roundBackground">@drawable/item_background_md2</item>
|
||||||
<item name="liftOnScroll">true</item>
|
<item name="liftOnScroll">true</item>
|
||||||
|
<item name="switchBarStyle">@style/Widget.SwitchBar</item>
|
||||||
|
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar</item>
|
||||||
|
<item name="switchBarBackgroundNormal">@color/switchbar_background_dark</item>
|
||||||
|
<item name="switchBarBackgroundDisabled">@color/switchbar_background_dark</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -6,11 +6,4 @@
|
||||||
<attr name="actionBarTheme" format="reference" />
|
<attr name="actionBarTheme" format="reference" />
|
||||||
<attr name="actionBarPopupTheme" format="reference" />
|
<attr name="actionBarPopupTheme" format="reference" />
|
||||||
<attr name="tabLayoutTheme" format="reference" />
|
<attr name="tabLayoutTheme" format="reference" />
|
||||||
|
|
||||||
<declare-styleable name="MasterSwitch">
|
|
||||||
<attr name="masterSwitchTextAppearance" format="reference" />
|
|
||||||
<attr name="masterSwitchBackgroundOn" format="color" />
|
|
||||||
<attr name="masterSwitchBackgroundOff" format="color" />
|
|
||||||
<attr name="masterSwitchForeground" format="color" />
|
|
||||||
</declare-styleable>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -21,6 +21,10 @@
|
||||||
</item>
|
</item>
|
||||||
<item name="tabLayoutTheme">@style/Widget.MaterialComponents.TabLayout</item>
|
<item name="tabLayoutTheme">@style/Widget.MaterialComponents.TabLayout</item>
|
||||||
<item name="liftOnScroll">false</item>
|
<item name="liftOnScroll">false</item>
|
||||||
|
<item name="switchBarStyle">@style/Widget.SwitchBar.Light</item>
|
||||||
|
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar</item>
|
||||||
|
<item name="switchBarBackgroundNormal">@color/switchbar_background_light</item>
|
||||||
|
<item name="switchBarBackgroundDisabled">@color/switchbar_background_light</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.MaterialComponents.CompoundButton.CheckBox" parent="Widget.AppCompat.CompoundButton.CheckBox" tools:override="true">
|
<style name="Widget.MaterialComponents.CompoundButton.CheckBox" parent="Widget.AppCompat.CompoundButton.CheckBox" tools:override="true">
|
||||||
|
|
@ -35,23 +39,6 @@
|
||||||
|
|
||||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />
|
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />
|
||||||
|
|
||||||
<style name="MasterSwitch" parent="@style/ThemeOverlay.AppCompat.Dark">
|
|
||||||
<item name="masterSwitchBackgroundOff">#80868b</item>
|
|
||||||
<item name="masterSwitchBackgroundOn">?colorAccent</item>
|
|
||||||
<item name="masterSwitchTextAppearance">@style/MasterSwitch.TextAppearance</item>
|
|
||||||
<item name="switchStyle">@style/MasterSwitch.Switch</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="MasterSwitch.Switch" parent="@style/Widget.AppCompat.CompoundButton.Switch">
|
|
||||||
<item name="trackTint">#33ffffff</item>
|
|
||||||
<item name="thumbTint">@android:color/white</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="MasterSwitch.TextAppearance" parent="@style/TextAppearance.AppCompat.Body2">
|
|
||||||
<item name="android:textSize">18sp</item>
|
|
||||||
<item name="android:textColor">@android:color/white</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="ThemeOverlay" />
|
<style name="ThemeOverlay" />
|
||||||
|
|
||||||
<style name="ThemeOverlay.Md2">
|
<style name="ThemeOverlay.Md2">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue