mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Switch to butterknife
Finally support AndroidX and obfuscation
This commit is contained in:
parent
190cdaddf8
commit
a4f0fbf8b7
@ -79,4 +79,12 @@ dependencies {
|
||||
fullImplementation 'com.github.topjohnwu:libsu:2.0.2'
|
||||
fullImplementation 'com.atlassian.commonmark:commonmark:0.11.0'
|
||||
fullImplementation 'org.kamranzafar:jtar:2.3'
|
||||
|
||||
def butterKnifeVersion = '9.0.0-rc1'
|
||||
if (properties.containsKey('android.injected.invoked.from.ide')) {
|
||||
fullImplementation "com.jakewharton:butterknife-reflect:${butterKnifeVersion}"
|
||||
} else {
|
||||
fullImplementation "com.jakewharton:butterknife-runtime:${butterKnifeVersion}"
|
||||
fullAnnotationProcessor "com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
|
||||
}
|
||||
}
|
||||
|
@ -15,16 +15,17 @@ import java.util.Locale;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class AboutActivity extends BaseActivity {
|
||||
|
||||
Toolbar toolbar;
|
||||
AboutCardRow appVersionInfo;
|
||||
AboutCardRow appChangelog;
|
||||
AboutCardRow appTranslators;
|
||||
AboutCardRow appSourceCode;
|
||||
AboutCardRow supportThread;
|
||||
AboutCardRow twitter;
|
||||
@BindView(R.id.toolbar) Toolbar toolbar;
|
||||
@BindView(R.id.app_version_info) AboutCardRow appVersionInfo;
|
||||
@BindView(R.id.app_changelog) AboutCardRow appChangelog;
|
||||
@BindView(R.id.app_translators) AboutCardRow appTranslators;
|
||||
@BindView(R.id.app_source_code) AboutCardRow appSourceCode;
|
||||
@BindView(R.id.support_thread) AboutCardRow supportThread;
|
||||
@BindView(R.id.follow_twitter) AboutCardRow twitter;
|
||||
|
||||
@Override
|
||||
public int getDarkTheme() {
|
||||
@ -35,7 +36,7 @@ public class AboutActivity extends BaseActivity {
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_about);
|
||||
ViewBinder.bind(this);
|
||||
new AboutActivity_ViewBinding(this);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
toolbar.setNavigationOnClickListener(view -> finish());
|
||||
|
@ -10,12 +10,13 @@ import com.topjohnwu.magisk.utils.Utils;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class DonationActivity extends BaseActivity {
|
||||
|
||||
Toolbar toolbar;
|
||||
AboutCardRow paypal;
|
||||
AboutCardRow patreon;
|
||||
@BindView(R.id.toolbar) Toolbar toolbar;
|
||||
@BindView(R.id.paypal) AboutCardRow paypal;
|
||||
@BindView(R.id.patreon) AboutCardRow patreon;
|
||||
|
||||
@Override
|
||||
public int getDarkTheme() {
|
||||
@ -26,7 +27,7 @@ public class DonationActivity extends BaseActivity {
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_donation);
|
||||
ViewBinder.bind(this);
|
||||
new DonationActivity_ViewBinding(this);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
toolbar.setNavigationOnClickListener(view -> finish());
|
||||
|
@ -31,21 +31,25 @@ import java.util.Locale;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class FlashActivity extends BaseActivity {
|
||||
|
||||
Toolbar toolbar;
|
||||
TextView flashLogs;
|
||||
public LinearLayout buttonPanel;
|
||||
public Button reboot;
|
||||
ScrollView sv;
|
||||
@BindView(R.id.toolbar) Toolbar toolbar;
|
||||
@BindView(R.id.txtLog) TextView flashLogs;
|
||||
@BindView(R.id.button_panel) public LinearLayout buttonPanel;
|
||||
@BindView(R.id.reboot) public Button reboot;
|
||||
@BindView(R.id.scrollView) ScrollView sv;
|
||||
|
||||
private List<String> logs;
|
||||
|
||||
@OnClick(R.id.reboot)
|
||||
void reboot() {
|
||||
Shell.su("/system/bin/reboot").submit();
|
||||
}
|
||||
|
||||
@OnClick(R.id.save_logs)
|
||||
void saveLogs() {
|
||||
runWithPermission(new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, () -> {
|
||||
Calendar now = Calendar.getInstance();
|
||||
@ -78,7 +82,8 @@ public class FlashActivity extends BaseActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_flash);
|
||||
ViewBinder.bind(this);
|
||||
new FlashActivity_ViewBinding(this);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
ActionBar ab = getSupportActionBar();
|
||||
if (ab != null) {
|
||||
|
@ -26,6 +26,7 @@ import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class MainActivity extends BaseActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener, Topic.Subscriber {
|
||||
@ -34,9 +35,9 @@ public class MainActivity extends BaseActivity
|
||||
private int mDrawerItem;
|
||||
private static boolean fromShortcut = false;
|
||||
|
||||
public Toolbar toolbar;
|
||||
DrawerLayout drawer;
|
||||
NavigationView navigationView;
|
||||
@BindView(R.id.toolbar) public Toolbar toolbar;
|
||||
@BindView(R.id.drawer_layout) DrawerLayout drawer;
|
||||
@BindView(R.id.nav_view) NavigationView navigationView;
|
||||
|
||||
private float toolbarElevation;
|
||||
|
||||
@ -54,7 +55,7 @@ public class MainActivity extends BaseActivity
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
ViewBinder.bind(this);
|
||||
new MainActivity_ViewBinding(this);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
|
@ -27,17 +27,18 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class SuRequestActivity extends BaseActivity {
|
||||
LinearLayout suPopup;
|
||||
Spinner timeout;
|
||||
ImageView appIcon;
|
||||
TextView appNameView;
|
||||
TextView packageNameView;
|
||||
Button grant_btn;
|
||||
Button deny_btn;
|
||||
ImageView fingerprintImg;
|
||||
TextView warning;
|
||||
@BindView(R.id.su_popup) LinearLayout suPopup;
|
||||
@BindView(R.id.timeout) Spinner timeout;
|
||||
@BindView(R.id.app_icon) ImageView appIcon;
|
||||
@BindView(R.id.app_name) TextView appNameView;
|
||||
@BindView(R.id.package_name) TextView packageNameView;
|
||||
@BindView(R.id.grant_btn) Button grant_btn;
|
||||
@BindView(R.id.deny_btn) Button deny_btn;
|
||||
@BindView(R.id.fingerprint) ImageView fingerprintImg;
|
||||
@BindView(R.id.warning) TextView warning;
|
||||
|
||||
private SuConnector connector;
|
||||
private Policy policy;
|
||||
@ -157,7 +158,7 @@ public class SuRequestActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
setContentView(R.layout.activity_request);
|
||||
ViewBinder.bind(this);
|
||||
new SuRequestActivity_ViewBinding(this);
|
||||
|
||||
appIcon.setImageDrawable(policy.info.loadIcon(pm));
|
||||
appNameView.setText(policy.appName);
|
||||
|
@ -1,293 +0,0 @@
|
||||
package com.topjohnwu.magisk;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import com.topjohnwu.magisk.adapters.ApplicationAdapter;
|
||||
import com.topjohnwu.magisk.adapters.ModulesAdapter;
|
||||
import com.topjohnwu.magisk.adapters.PolicyAdapter;
|
||||
import com.topjohnwu.magisk.adapters.ReposAdapter;
|
||||
import com.topjohnwu.magisk.adapters.SuLogAdapter;
|
||||
import com.topjohnwu.magisk.components.AboutCardRow;
|
||||
import com.topjohnwu.magisk.components.CustomAlertDialog;
|
||||
import com.topjohnwu.magisk.fragments.LogFragment;
|
||||
import com.topjohnwu.magisk.fragments.MagiskFragment;
|
||||
import com.topjohnwu.magisk.fragments.MagiskHideFragment;
|
||||
import com.topjohnwu.magisk.fragments.MagiskLogFragment;
|
||||
import com.topjohnwu.magisk.fragments.ModulesFragment;
|
||||
import com.topjohnwu.magisk.fragments.ReposFragment;
|
||||
import com.topjohnwu.magisk.fragments.SuLogFragment;
|
||||
import com.topjohnwu.magisk.fragments.SuperuserFragment;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
public class ViewBinder {
|
||||
|
||||
public static void bind(MainActivity target) {
|
||||
target.drawer = target.findViewById(R.id.drawer_layout);
|
||||
target.toolbar = target.findViewById(R.id.toolbar);
|
||||
target.navigationView = target.findViewById(R.id.nav_view);
|
||||
}
|
||||
|
||||
public static void bind(AboutActivity target) {
|
||||
target.toolbar = target.findViewById(R.id.toolbar);
|
||||
target.appVersionInfo = target.findViewById(R.id.app_version_info);
|
||||
target.appChangelog = target.findViewById(R.id.app_changelog);
|
||||
target.appTranslators = target.findViewById(R.id.app_translators);
|
||||
target.appSourceCode = target.findViewById(R.id.app_source_code);
|
||||
target.supportThread = target.findViewById(R.id.support_thread);
|
||||
target.twitter = target.findViewById(R.id.follow_twitter);
|
||||
}
|
||||
|
||||
public static void bind(DonationActivity target) {
|
||||
target.toolbar = target.findViewById(R.id.toolbar);
|
||||
target.paypal = target.findViewById(R.id.paypal);
|
||||
target.patreon = target.findViewById(R.id.patreon);
|
||||
}
|
||||
|
||||
public static void bind(FlashActivity target) {
|
||||
target.toolbar = target.findViewById(R.id.toolbar);
|
||||
target.flashLogs = target.findViewById(R.id.txtLog);
|
||||
target.buttonPanel = target.findViewById(R.id.button_panel);
|
||||
target.sv = target.findViewById(R.id.scrollView);
|
||||
target.reboot = target.findViewById(R.id.reboot);
|
||||
target.reboot.setOnClickListener(v -> target.reboot());
|
||||
target.findViewById(R.id.close).setOnClickListener(v -> target.finish());
|
||||
target.findViewById(R.id.save_logs).setOnClickListener(v -> target.saveLogs());
|
||||
}
|
||||
|
||||
public static void bind(SuRequestActivity target) {
|
||||
target.suPopup = target.findViewById(R.id.su_popup);
|
||||
target.timeout = target.findViewById(R.id.timeout);
|
||||
target.appIcon = target.findViewById(R.id.app_icon);
|
||||
target.appNameView = target.findViewById(R.id.app_name);
|
||||
target.packageNameView = target.findViewById(R.id.package_name);
|
||||
target.grant_btn = target.findViewById(R.id.grant_btn);
|
||||
target.deny_btn = target.findViewById(R.id.deny_btn);
|
||||
target.fingerprintImg = target.findViewById(R.id.fingerprint);
|
||||
target.warning = target.findViewById(R.id.warning);
|
||||
}
|
||||
|
||||
public static void bind(LogFragment target, View v) {
|
||||
target.viewPager = v.findViewById(R.id.container);
|
||||
target.tab = v.findViewById(R.id.tab);
|
||||
}
|
||||
|
||||
public static void unbind(LogFragment target) {
|
||||
target.viewPager = null;
|
||||
target.tab = null;
|
||||
}
|
||||
|
||||
public static void bind(MagiskFragment target, View v) {
|
||||
target.mSwipeRefreshLayout = v.findViewById(R.id.swipeRefreshLayout);
|
||||
target.coreOnlyNotice = v.findViewById(R.id.core_only_notice);
|
||||
target.magiskUpdate = v.findViewById(R.id.magisk_update);
|
||||
target.magiskUpdateIcon = v.findViewById(R.id.magisk_update_icon);
|
||||
target.magiskUpdateText = v.findViewById(R.id.magisk_update_status);
|
||||
target.magiskUpdateProgress = v.findViewById(R.id.magisk_update_progress);
|
||||
target.magiskStatusIcon = v.findViewById(R.id.magisk_status_icon);
|
||||
target.magiskVersionText = v.findViewById(R.id.magisk_version);
|
||||
target.safetyNetCard = v.findViewById(R.id.safetyNet_card);
|
||||
target.safetyNetRefreshIcon = v.findViewById(R.id.safetyNet_refresh);
|
||||
target.safetyNetStatusText = v.findViewById(R.id.safetyNet_status);
|
||||
target.safetyNetProgress = v.findViewById(R.id.safetyNet_check_progress);
|
||||
target.expandLayout = v.findViewById(R.id.expand_layout);
|
||||
target.ctsStatusIcon = v.findViewById(R.id.cts_status_icon);
|
||||
target.ctsStatusText = v.findViewById(R.id.cts_status);
|
||||
target.basicStatusIcon = v.findViewById(R.id.basic_status_icon);
|
||||
target.basicStatusText = v.findViewById(R.id.basic_status);
|
||||
target.installOptionCard = v.findViewById(R.id.install_option_card);
|
||||
target.keepEncChkbox = v.findViewById(R.id.keep_force_enc);
|
||||
target.keepVerityChkbox = v.findViewById(R.id.keep_verity);
|
||||
target.installButton = v.findViewById(R.id.install_button);
|
||||
target.installText = v.findViewById(R.id.install_text);
|
||||
target.uninstallButton = v.findViewById(R.id.uninstall_button);
|
||||
|
||||
v.findViewById(R.id.safetyNet_title).setOnClickListener(v1 -> target.safetyNet());
|
||||
v.findViewById(R.id.install_button).setOnClickListener(v1 -> target.install());
|
||||
v.findViewById(R.id.uninstall_button).setOnClickListener(v1 -> target.uninstall());
|
||||
|
||||
Context ctx = target.getContext();
|
||||
target.colorBad = ContextCompat.getColor(ctx, R.color.red500);
|
||||
target.colorOK = ContextCompat.getColor(ctx, R.color.green500);
|
||||
target.colorWarn = ContextCompat.getColor(ctx, R.color.yellow500);
|
||||
target.colorNeutral = ContextCompat.getColor(ctx, R.color.grey500);
|
||||
target.colorInfo = ContextCompat.getColor(ctx, R.color.blue500);
|
||||
}
|
||||
|
||||
public static void unbind(MagiskFragment target) {
|
||||
target.mSwipeRefreshLayout = null;
|
||||
target.coreOnlyNotice = null;
|
||||
target.magiskUpdate = null;
|
||||
target.magiskUpdateIcon = null;
|
||||
target.magiskUpdateText = null;
|
||||
target.magiskUpdateProgress = null;
|
||||
target.magiskStatusIcon = null;
|
||||
target.magiskVersionText = null;
|
||||
target.safetyNetCard = null;
|
||||
target.safetyNetRefreshIcon = null;
|
||||
target.safetyNetStatusText = null;
|
||||
target.safetyNetProgress = null;
|
||||
target.expandLayout = null;
|
||||
target.ctsStatusIcon = null;
|
||||
target.ctsStatusText = null;
|
||||
target.basicStatusIcon = null;
|
||||
target.basicStatusText = null;
|
||||
target.installOptionCard = null;
|
||||
target.keepEncChkbox = null;
|
||||
target.keepVerityChkbox = null;
|
||||
target.installButton = null;
|
||||
target.installText = null;
|
||||
target.uninstallButton = null;
|
||||
|
||||
View v = target.getView();
|
||||
v.findViewById(R.id.safetyNet_title).setOnClickListener(null);
|
||||
v.findViewById(R.id.install_button).setOnClickListener(null);
|
||||
v.findViewById(R.id.uninstall_button).setOnClickListener(null);
|
||||
}
|
||||
|
||||
public static void bind(MagiskHideFragment target, View v) {
|
||||
target.mSwipeRefreshLayout = v.findViewById(R.id.swipeRefreshLayout);
|
||||
target.recyclerView = v.findViewById(R.id.recyclerView);
|
||||
}
|
||||
|
||||
public static void unbind(MagiskHideFragment target) {
|
||||
target.mSwipeRefreshLayout = null;
|
||||
target.recyclerView = null;
|
||||
}
|
||||
|
||||
public static void bind(MagiskLogFragment target, View v) {
|
||||
target.txtLog = v.findViewById(R.id.txtLog);
|
||||
target.svLog = v.findViewById(R.id.svLog);
|
||||
target.hsvLog = v.findViewById(R.id.hsvLog);
|
||||
target.progressBar = v.findViewById(R.id.progressBar);
|
||||
}
|
||||
|
||||
public static void unbind(MagiskLogFragment target) {
|
||||
target.txtLog = null;
|
||||
target.svLog = null;
|
||||
target.hsvLog = null;
|
||||
target.progressBar = null;
|
||||
}
|
||||
|
||||
public static void bind(ModulesFragment target, View v) {
|
||||
target.mSwipeRefreshLayout = v.findViewById(R.id.swipeRefreshLayout);
|
||||
target.recyclerView = v.findViewById(R.id.recyclerView);
|
||||
target.emptyRv = v.findViewById(R.id.empty_rv);
|
||||
v.findViewById(R.id.fab).setOnClickListener(v1 -> target.selectFile());
|
||||
}
|
||||
|
||||
public static void unbind(ModulesFragment target) {
|
||||
target.mSwipeRefreshLayout = null;
|
||||
target.recyclerView = null;
|
||||
target.emptyRv = null;
|
||||
View v = target.getView();
|
||||
v.findViewById(R.id.fab).setOnClickListener(null);
|
||||
}
|
||||
|
||||
public static void bind(ReposFragment target, View source) {
|
||||
target.recyclerView = source.findViewById(R.id.recyclerView);
|
||||
target.emptyRv = source.findViewById(R.id.empty_rv);
|
||||
target.mSwipeRefreshLayout = source.findViewById(R.id.swipeRefreshLayout);
|
||||
}
|
||||
|
||||
public static void unbind(ReposFragment target) {
|
||||
target.recyclerView = null;
|
||||
target.emptyRv = null;
|
||||
target.mSwipeRefreshLayout = null;
|
||||
}
|
||||
|
||||
public static void bind(SuLogFragment target, View source) {
|
||||
target.emptyRv = source.findViewById(R.id.empty_rv);
|
||||
target.recyclerView = source.findViewById(R.id.recyclerView);
|
||||
}
|
||||
|
||||
public static void unbind(SuLogFragment target) {
|
||||
target.emptyRv = null;
|
||||
target.recyclerView = null;
|
||||
}
|
||||
|
||||
public static void bind(SuperuserFragment target, View source) {
|
||||
target.recyclerView = source.findViewById(R.id.recyclerView);
|
||||
target.emptyRv = source.findViewById(R.id.empty_rv);
|
||||
}
|
||||
|
||||
public static void unbind(SuperuserFragment target) {
|
||||
target.emptyRv = null;
|
||||
target.recyclerView = null;
|
||||
}
|
||||
|
||||
public static void bind(CustomAlertDialog.ViewHolder target, View source) {
|
||||
target.dialogLayout = source.findViewById(R.id.dialog_layout);
|
||||
target.buttons = source.findViewById(R.id.button_panel);
|
||||
target.messageView = source.findViewById(R.id.message);
|
||||
target.negative = source.findViewById(R.id.negative);
|
||||
target.positive = source.findViewById(R.id.positive);
|
||||
target.neutral = source.findViewById(R.id.neutral);
|
||||
}
|
||||
|
||||
public static void bind(AboutCardRow target, View source) {
|
||||
target.mTitle = source.findViewById(android.R.id.title);
|
||||
target.mSummary = source.findViewById(android.R.id.summary);
|
||||
target.mIcon = source.findViewById(android.R.id.icon);
|
||||
target.mView = source.findViewById(R.id.container);
|
||||
}
|
||||
|
||||
public static void bind(ApplicationAdapter.ViewHolder target, View source) {
|
||||
target.appIcon = source.findViewById(R.id.app_icon);
|
||||
target.appName = source.findViewById(R.id.app_name);
|
||||
target.appPackage = source.findViewById(R.id.package_name);
|
||||
target.checkBox = source.findViewById(R.id.checkbox);
|
||||
}
|
||||
|
||||
public static void bind(ModulesAdapter.ViewHolder target, View source) {
|
||||
target.title = source.findViewById(R.id.title);
|
||||
target.versionName = source.findViewById(R.id.version_name);
|
||||
target.description = source.findViewById(R.id.description);
|
||||
target.notice = source.findViewById(R.id.notice);
|
||||
target.checkBox = source.findViewById(R.id.checkbox);
|
||||
target.author = source.findViewById(R.id.author);
|
||||
target.delete = source.findViewById(R.id.delete);
|
||||
}
|
||||
|
||||
public static void bind(PolicyAdapter.ViewHolder target, View source) {
|
||||
target.appName = source.findViewById(R.id.app_name);
|
||||
target.packageName = source.findViewById(R.id.package_name);
|
||||
target.appIcon = source.findViewById(R.id.app_icon);
|
||||
target.masterSwitch = source.findViewById(R.id.master_switch);
|
||||
target.notificationSwitch = source.findViewById(R.id.notification_switch);
|
||||
target.loggingSwitch = source.findViewById(R.id.logging_switch);
|
||||
target.expandLayout = source.findViewById(R.id.expand_layout);
|
||||
target.delete = source.findViewById(R.id.delete);
|
||||
target.moreInfo = source.findViewById(R.id.more_info);
|
||||
}
|
||||
|
||||
public static void bind(ReposAdapter.SectionHolder target, View source) {
|
||||
target.sectionText = source.findViewById(R.id.section_text);
|
||||
}
|
||||
|
||||
public static void bind(ReposAdapter.RepoHolder target, View source) {
|
||||
target.title = source.findViewById(R.id.title);
|
||||
target.versionName = source.findViewById(R.id.version_name);
|
||||
target.description = source.findViewById(R.id.description);
|
||||
target.author = source.findViewById(R.id.author);
|
||||
target.infoLayout = source.findViewById(R.id.info_layout);
|
||||
target.downloadImage = source.findViewById(R.id.download);
|
||||
target.updateTime = source.findViewById(R.id.update_time);
|
||||
}
|
||||
|
||||
public static void bind(SuLogAdapter.SectionHolder target, View source) {
|
||||
target.date = source.findViewById(R.id.date);
|
||||
target.arrow = source.findViewById(R.id.arrow);
|
||||
}
|
||||
|
||||
public static void bind(SuLogAdapter.LogViewHolder target, View source) {
|
||||
target.appName = source.findViewById(R.id.app_name);
|
||||
target.action = source.findViewById(R.id.action);
|
||||
target.time = source.findViewById(R.id.time);
|
||||
target.fromPid = source.findViewById(R.id.fromPid);
|
||||
target.toUid = source.findViewById(R.id.toUid);
|
||||
target.command = source.findViewById(R.id.command);
|
||||
target.expandLayout = source.findViewById(R.id.expand_layout);
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@ import android.widget.TextView;
|
||||
|
||||
import com.topjohnwu.magisk.Const;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.utils.LocaleManager;
|
||||
import com.topjohnwu.magisk.utils.Topic;
|
||||
import com.topjohnwu.superuser.Shell;
|
||||
@ -29,6 +28,7 @@ import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.ViewHolder> {
|
||||
|
||||
@ -122,20 +122,20 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
|
||||
AsyncTask.THREAD_POOL_EXECUTOR.execute(this::loadApps);
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public ImageView appIcon;
|
||||
public TextView appName;
|
||||
public TextView appPackage;
|
||||
public CheckBox checkBox;
|
||||
@BindView(R.id.app_icon) ImageView appIcon;
|
||||
@BindView(R.id.app_name) TextView appName;
|
||||
@BindView(R.id.package_name) TextView appPackage;
|
||||
@BindView(R.id.checkbox) CheckBox checkBox;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ViewBinder.bind(this, itemView);
|
||||
new ApplicationAdapter$ViewHolder_ViewBinding(this, itemView);
|
||||
}
|
||||
}
|
||||
|
||||
private class ApplicationFilter extends Filter {
|
||||
class ApplicationFilter extends Filter {
|
||||
|
||||
private boolean lowercaseContains(String s, CharSequence filter) {
|
||||
return !TextUtils.isEmpty(s) && s.toLowerCase().contains(filter);
|
||||
|
@ -11,14 +11,15 @@ import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.components.SnackbarMaker;
|
||||
import com.topjohnwu.magisk.container.Module;
|
||||
import com.topjohnwu.superuser.Shell;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHolder> {
|
||||
|
||||
@ -28,6 +29,7 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
|
||||
mList = list;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_module, parent, false);
|
||||
@ -101,19 +103,19 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public TextView title;
|
||||
public TextView versionName;
|
||||
public TextView description;
|
||||
public TextView notice;
|
||||
public CheckBox checkBox;
|
||||
public TextView author;
|
||||
public ImageView delete;
|
||||
@BindView(R.id.title) TextView title;
|
||||
@BindView(R.id.version_name) TextView versionName;
|
||||
@BindView(R.id.description) TextView description;
|
||||
@BindView(R.id.notice) TextView notice;
|
||||
@BindView(R.id.checkbox) CheckBox checkBox;
|
||||
@BindView(R.id.author) TextView author;
|
||||
@BindView(R.id.delete) ImageView delete;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ViewBinder.bind(this, itemView);
|
||||
new ModulesAdapter$ViewHolder_ViewBinding(this, itemView);
|
||||
|
||||
if (!Shell.rootAccess()) {
|
||||
checkBox.setEnabled(false);
|
||||
|
@ -12,7 +12,6 @@ import android.widget.TextView;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.topjohnwu.magisk.Data;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.components.CustomAlertDialog;
|
||||
import com.topjohnwu.magisk.components.ExpandableView;
|
||||
import com.topjohnwu.magisk.components.SnackbarMaker;
|
||||
@ -24,7 +23,9 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder> {
|
||||
|
||||
@ -39,6 +40,7 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
|
||||
this.pm = pm;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_policy, parent, false);
|
||||
@ -138,24 +140,24 @@ public class PolicyAdapter extends RecyclerView.Adapter<PolicyAdapter.ViewHolder
|
||||
return policyList.size();
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder implements ExpandableView {
|
||||
static class ViewHolder extends RecyclerView.ViewHolder implements ExpandableView {
|
||||
|
||||
public TextView appName;
|
||||
public TextView packageName;
|
||||
public ImageView appIcon;
|
||||
public Switch masterSwitch;
|
||||
public Switch notificationSwitch;
|
||||
public Switch loggingSwitch;
|
||||
public ViewGroup expandLayout;
|
||||
@BindView(R.id.app_name) TextView appName;
|
||||
@BindView(R.id.package_name) TextView packageName;
|
||||
@BindView(R.id.app_icon) ImageView appIcon;
|
||||
@BindView(R.id.master_switch) Switch masterSwitch;
|
||||
@BindView(R.id.notification_switch) Switch notificationSwitch;
|
||||
@BindView(R.id.logging_switch) Switch loggingSwitch;
|
||||
@BindView(R.id.expand_layout) ViewGroup expandLayout;
|
||||
|
||||
public ImageView delete;
|
||||
public ImageView moreInfo;
|
||||
@BindView(R.id.delete) ImageView delete;
|
||||
@BindView(R.id.more_info) ImageView moreInfo;
|
||||
|
||||
private Container container = new Container();
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ViewBinder.bind(this, itemView);
|
||||
new PolicyAdapter$ViewHolder_ViewBinding(this, itemView);
|
||||
container.expandLayout = expandLayout;
|
||||
setupExpandable();
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.asyncs.MarkDownWindow;
|
||||
import com.topjohnwu.magisk.asyncs.ProcessRepoZip;
|
||||
import com.topjohnwu.magisk.components.BaseActivity;
|
||||
@ -26,6 +25,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class ReposAdapter extends SectionedAdapter<ReposAdapter.SectionHolder, ReposAdapter.RepoHolder> {
|
||||
|
||||
@ -163,29 +163,29 @@ public class ReposAdapter extends SectionedAdapter<ReposAdapter.SectionHolder, R
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public static class SectionHolder extends RecyclerView.ViewHolder {
|
||||
static class SectionHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public TextView sectionText;
|
||||
@BindView(R.id.section_text) TextView sectionText;
|
||||
|
||||
SectionHolder(View itemView) {
|
||||
super(itemView);
|
||||
ViewBinder.bind(this, itemView);
|
||||
new ReposAdapter$SectionHolder_ViewBinding(this, itemView);
|
||||
}
|
||||
}
|
||||
|
||||
public static class RepoHolder extends RecyclerView.ViewHolder {
|
||||
static class RepoHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public TextView title;
|
||||
public TextView versionName;
|
||||
public TextView description;
|
||||
public TextView author;
|
||||
public LinearLayout infoLayout;
|
||||
public ImageView downloadImage;
|
||||
public TextView updateTime;
|
||||
@BindView(R.id.title) TextView title;
|
||||
@BindView(R.id.version_name) TextView versionName;
|
||||
@BindView(R.id.description) TextView description;
|
||||
@BindView(R.id.author) TextView author;
|
||||
@BindView(R.id.info_layout) LinearLayout infoLayout;
|
||||
@BindView(R.id.download) ImageView downloadImage;
|
||||
@BindView(R.id.update_time) TextView updateTime;
|
||||
|
||||
RepoHolder(View itemView) {
|
||||
super(itemView);
|
||||
ViewBinder.bind(this, itemView);
|
||||
new ReposAdapter$RepoHolder_ViewBinding(this, itemView);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.components.ExpandableView;
|
||||
import com.topjohnwu.magisk.container.SuLogEntry;
|
||||
import com.topjohnwu.magisk.database.MagiskDatabaseHelper;
|
||||
@ -21,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class SuLogAdapter extends SectionedAdapter<SuLogAdapter.SectionHolder, SuLogAdapter.LogViewHolder> {
|
||||
|
||||
@ -116,32 +116,32 @@ public class SuLogAdapter extends SectionedAdapter<SuLogAdapter.SectionHolder, S
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public static class SectionHolder extends RecyclerView.ViewHolder {
|
||||
static class SectionHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public TextView date;
|
||||
public ImageView arrow;
|
||||
@BindView(R.id.date) TextView date;
|
||||
@BindView(R.id.arrow) ImageView arrow;
|
||||
|
||||
SectionHolder(View itemView) {
|
||||
super(itemView);
|
||||
ViewBinder.bind(this, itemView);
|
||||
new SuLogAdapter$SectionHolder_ViewBinding(this, itemView);
|
||||
}
|
||||
}
|
||||
|
||||
public static class LogViewHolder extends RecyclerView.ViewHolder implements ExpandableView {
|
||||
static class LogViewHolder extends RecyclerView.ViewHolder implements ExpandableView {
|
||||
|
||||
public TextView appName;
|
||||
public TextView action;
|
||||
public TextView time;
|
||||
public TextView fromPid;
|
||||
public TextView toUid;
|
||||
public TextView command;
|
||||
public ViewGroup expandLayout;
|
||||
@BindView(R.id.app_name) TextView appName;
|
||||
@BindView(R.id.action) TextView action;
|
||||
@BindView(R.id.time) TextView time;
|
||||
@BindView(R.id.fromPid) TextView fromPid;
|
||||
@BindView(R.id.toUid) TextView toUid;
|
||||
@BindView(R.id.command) TextView command;
|
||||
@BindView(R.id.expand_layout) ViewGroup expandLayout;
|
||||
|
||||
private Container container = new Container();
|
||||
|
||||
LogViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ViewBinder.bind(this, itemView);
|
||||
new SuLogAdapter$LogViewHolder_ViewBinding(this, itemView);
|
||||
container.expandLayout = expandLayout;
|
||||
setupExpandable();
|
||||
}
|
||||
|
@ -27,17 +27,18 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
/**
|
||||
* @author dvdandroid
|
||||
*/
|
||||
public class AboutCardRow extends LinearLayout {
|
||||
|
||||
public TextView mTitle;
|
||||
public TextView mSummary;
|
||||
public ImageView mIcon;
|
||||
public View mView;
|
||||
@BindView(android.R.id.title) TextView mTitle;
|
||||
@BindView(android.R.id.summary) TextView mSummary;
|
||||
@BindView(android.R.id.icon) ImageView mIcon;
|
||||
@BindView(R.id.container) View mView;
|
||||
|
||||
public AboutCardRow(Context context) {
|
||||
this(context, null);
|
||||
@ -50,7 +51,7 @@ public class AboutCardRow extends LinearLayout {
|
||||
public AboutCardRow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
LayoutInflater.from(context).inflate(R.layout.info_item_row, this);
|
||||
ViewBinder.bind(this, this);
|
||||
new AboutCardRow_ViewBinding(this, this);
|
||||
|
||||
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AboutCardRow, 0, 0);
|
||||
String title;
|
||||
|
@ -7,10 +7,12 @@ import com.topjohnwu.magisk.MagiskManager;
|
||||
import com.topjohnwu.magisk.utils.Topic;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
public class BaseFragment extends Fragment implements Topic.AutoSubscriber {
|
||||
|
||||
public MagiskManager mm;
|
||||
protected Unbinder unbinder = null;
|
||||
|
||||
public BaseFragment() {
|
||||
mm = Data.MM();
|
||||
@ -28,6 +30,13 @@ public class BaseFragment extends Fragment implements Topic.AutoSubscriber {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (unbinder != null)
|
||||
unbinder.unbind();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivityForResult(Intent intent, int requestCode) {
|
||||
startActivityForResult(intent, requestCode, this::onActivityResult);
|
||||
|
@ -9,13 +9,13 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class CustomAlertDialog extends AlertDialog.Builder {
|
||||
|
||||
@ -27,16 +27,16 @@ public class CustomAlertDialog extends AlertDialog.Builder {
|
||||
private ViewHolder vh;
|
||||
|
||||
public class ViewHolder {
|
||||
public LinearLayout dialogLayout;
|
||||
public LinearLayout buttons;
|
||||
@BindView(R.id.dialog_layout) public LinearLayout dialogLayout;
|
||||
@BindView(R.id.button_panel) public LinearLayout buttons;
|
||||
|
||||
public TextView messageView;
|
||||
public Button negative;
|
||||
public Button positive;
|
||||
public Button neutral;
|
||||
@BindView(R.id.message) public TextView messageView;
|
||||
@BindView(R.id.negative) public Button negative;
|
||||
@BindView(R.id.positive) public Button positive;
|
||||
@BindView(R.id.neutral) public Button neutral;
|
||||
|
||||
ViewHolder(View v) {
|
||||
ViewBinder.bind(this, v);
|
||||
new CustomAlertDialog$ViewHolder_ViewBinding(this, v);
|
||||
messageView.setVisibility(View.GONE);
|
||||
negative.setVisibility(View.GONE);
|
||||
positive.setVisibility(View.GONE);
|
||||
|
@ -11,23 +11,23 @@ import com.topjohnwu.magisk.Const;
|
||||
import com.topjohnwu.magisk.Data;
|
||||
import com.topjohnwu.magisk.MainActivity;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.adapters.TabFragmentAdapter;
|
||||
import com.topjohnwu.magisk.components.BaseFragment;
|
||||
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class LogFragment extends BaseFragment {
|
||||
|
||||
public ViewPager viewPager;
|
||||
public TabLayout tab;
|
||||
@BindView(R.id.container) ViewPager viewPager;
|
||||
@BindView(R.id.tab) TabLayout tab;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View v = inflater.inflate(R.layout.fragment_log, container, false);
|
||||
ViewBinder.bind(this, v);
|
||||
unbinder = new LogFragment_ViewBinding(this, v);
|
||||
|
||||
((MainActivity) requireActivity()).toolbar.setElevation(0);
|
||||
|
||||
@ -44,10 +44,4 @@ public class LogFragment extends BaseFragment {
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
ViewBinder.unbind(this);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import com.topjohnwu.magisk.Const;
|
||||
import com.topjohnwu.magisk.Data;
|
||||
import com.topjohnwu.magisk.MainActivity;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.asyncs.CheckSafetyNet;
|
||||
import com.topjohnwu.magisk.asyncs.CheckUpdates;
|
||||
import com.topjohnwu.magisk.components.BaseActivity;
|
||||
@ -42,6 +41,9 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import butterknife.BindColor;
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class MagiskFragment extends BaseFragment
|
||||
implements SwipeRefreshLayout.OnRefreshListener, ExpandableView, Topic.Subscriber {
|
||||
@ -49,41 +51,42 @@ public class MagiskFragment extends BaseFragment
|
||||
private Container expandableContainer = new Container();
|
||||
private static boolean shownDialog = false;
|
||||
|
||||
public SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
@BindView(R.id.swipeRefreshLayout) public SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
|
||||
public CardView coreOnlyNotice;
|
||||
@BindView(R.id.core_only_notice) CardView coreOnlyNotice;
|
||||
|
||||
public RelativeLayout magiskUpdate;
|
||||
public ImageView magiskUpdateIcon;
|
||||
public TextView magiskUpdateText;
|
||||
public ProgressBar magiskUpdateProgress;
|
||||
public ImageView magiskStatusIcon;
|
||||
public TextView magiskVersionText;
|
||||
@BindView(R.id.magisk_update) RelativeLayout magiskUpdate;
|
||||
@BindView(R.id.magisk_update_icon) ImageView magiskUpdateIcon;
|
||||
@BindView(R.id.magisk_update_status) TextView magiskUpdateText;
|
||||
@BindView(R.id.magisk_update_progress) ProgressBar magiskUpdateProgress;
|
||||
@BindView(R.id.magisk_status_icon) ImageView magiskStatusIcon;
|
||||
@BindView(R.id.magisk_version) TextView magiskVersionText;
|
||||
|
||||
public CardView safetyNetCard;
|
||||
public ImageView safetyNetRefreshIcon;
|
||||
public TextView safetyNetStatusText;
|
||||
public ProgressBar safetyNetProgress;
|
||||
public LinearLayout expandLayout;
|
||||
public ImageView ctsStatusIcon;
|
||||
public TextView ctsStatusText;
|
||||
public ImageView basicStatusIcon;
|
||||
public TextView basicStatusText;
|
||||
@BindView(R.id.safetyNet_card) CardView safetyNetCard;
|
||||
@BindView(R.id.safetyNet_refresh) ImageView safetyNetRefreshIcon;
|
||||
@BindView(R.id.safetyNet_status) TextView safetyNetStatusText;
|
||||
@BindView(R.id.safetyNet_check_progress) ProgressBar safetyNetProgress;
|
||||
@BindView(R.id.expand_layout) LinearLayout expandLayout;
|
||||
@BindView(R.id.cts_status_icon) ImageView ctsStatusIcon;
|
||||
@BindView(R.id.cts_status) TextView ctsStatusText;
|
||||
@BindView(R.id.basic_status_icon) ImageView basicStatusIcon;
|
||||
@BindView(R.id.basic_status) TextView basicStatusText;
|
||||
|
||||
public CardView installOptionCard;
|
||||
public CheckBox keepEncChkbox;
|
||||
public CheckBox keepVerityChkbox;
|
||||
public CardView installButton;
|
||||
public TextView installText;
|
||||
public CardView uninstallButton;
|
||||
@BindView(R.id.install_option_card) CardView installOptionCard;
|
||||
@BindView(R.id.keep_force_enc) CheckBox keepEncChkbox;
|
||||
@BindView(R.id.keep_verity) CheckBox keepVerityChkbox;
|
||||
@BindView(R.id.install_button) CardView installButton;
|
||||
@BindView(R.id.install_text) TextView installText;
|
||||
@BindView(R.id.uninstall_button) CardView uninstallButton;
|
||||
|
||||
public int colorBad;
|
||||
public int colorOK;
|
||||
public int colorWarn;
|
||||
public int colorNeutral;
|
||||
public int colorInfo;
|
||||
@BindColor(R.color.red500) int colorBad;
|
||||
@BindColor(R.color.green500) int colorOK;
|
||||
@BindColor(R.color.yellow500) int colorWarn;
|
||||
@BindColor(R.color.green500) int colorNeutral;
|
||||
@BindColor(R.color.blue500) int colorInfo;
|
||||
|
||||
public void safetyNet() {
|
||||
@OnClick(R.id.safetyNet_title)
|
||||
void safetyNet() {
|
||||
Runnable task = () -> {
|
||||
safetyNetProgress.setVisibility(View.VISIBLE);
|
||||
safetyNetRefreshIcon.setVisibility(View.GONE);
|
||||
@ -106,7 +109,8 @@ public class MagiskFragment extends BaseFragment
|
||||
|
||||
}
|
||||
|
||||
public void install() {
|
||||
@OnClick(R.id.install_button)
|
||||
void install() {
|
||||
shownDialog = true;
|
||||
|
||||
// Show Manager update first
|
||||
@ -119,7 +123,8 @@ public class MagiskFragment extends BaseFragment
|
||||
new MagiskInstallDialog((BaseActivity) getActivity()).show();
|
||||
}
|
||||
|
||||
public void uninstall() {
|
||||
@OnClick(R.id.uninstall_button)
|
||||
void uninstall() {
|
||||
new UninstallDialog(requireActivity()).show();
|
||||
}
|
||||
|
||||
@ -128,7 +133,7 @@ public class MagiskFragment extends BaseFragment
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.fragment_magisk, container, false);
|
||||
ViewBinder.bind(this, v);
|
||||
unbinder = new MagiskFragment_ViewBinding(this, v);
|
||||
requireActivity().setTitle(R.string.magisk);
|
||||
|
||||
expandableContainer.expandLayout = expandLayout;
|
||||
@ -145,12 +150,6 @@ public class MagiskFragment extends BaseFragment
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
ViewBinder.unbind(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
Data.loadMagiskInfo();
|
||||
|
@ -9,7 +9,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.SearchView;
|
||||
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.adapters.ApplicationAdapter;
|
||||
import com.topjohnwu.magisk.components.BaseFragment;
|
||||
import com.topjohnwu.magisk.utils.Topic;
|
||||
@ -18,11 +17,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class MagiskHideFragment extends BaseFragment implements Topic.Subscriber {
|
||||
|
||||
public SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
public RecyclerView recyclerView;
|
||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||
SearchView search;
|
||||
|
||||
private ApplicationAdapter appAdapter;
|
||||
@ -39,7 +39,7 @@ public class MagiskHideFragment extends BaseFragment implements Topic.Subscriber
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_magisk_hide, container, false);
|
||||
ViewBinder.bind(this, view);
|
||||
unbinder = new MagiskHideFragment_ViewBinding(this, view);
|
||||
|
||||
appAdapter = new ApplicationAdapter(requireActivity());
|
||||
recyclerView.setAdapter(appAdapter);
|
||||
@ -73,12 +73,6 @@ public class MagiskHideFragment extends BaseFragment implements Topic.Subscriber
|
||||
search.setOnQueryTextListener(searchListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
ViewBinder.unbind(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSubscribedTopics() {
|
||||
return new int[] {Topic.MAGISK_HIDE_DONE};
|
||||
|
@ -17,7 +17,6 @@ import android.widget.TextView;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.topjohnwu.magisk.Const;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.components.BaseFragment;
|
||||
import com.topjohnwu.magisk.components.SnackbarMaker;
|
||||
import com.topjohnwu.magisk.utils.Download;
|
||||
@ -29,19 +28,20 @@ import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class MagiskLogFragment extends BaseFragment {
|
||||
|
||||
public TextView txtLog;
|
||||
public ScrollView svLog;
|
||||
public HorizontalScrollView hsvLog;
|
||||
public ProgressBar progressBar;
|
||||
@BindView(R.id.txtLog) TextView txtLog;
|
||||
@BindView(R.id.svLog) ScrollView svLog;
|
||||
@BindView(R.id.hsvLog) HorizontalScrollView hsvLog;
|
||||
@BindView(R.id.progressBar) ProgressBar progressBar;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_magisk_log, container, false);
|
||||
ViewBinder.bind(this, view);
|
||||
unbinder = new MagiskLogFragment_ViewBinding(this, view);
|
||||
setHasOptionsMenu(true);
|
||||
txtLog.setTextIsSelectable(true);
|
||||
return view;
|
||||
@ -59,12 +59,6 @@ public class MagiskLogFragment extends BaseFragment {
|
||||
readLogs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
ViewBinder.unbind(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.menu_log, menu);
|
||||
@ -87,7 +81,7 @@ public class MagiskLogFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public void readLogs() {
|
||||
private void readLogs() {
|
||||
Shell.su("cat " + Const.MAGISK_LOG + " | tail -n 5000").submit(result -> {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
if (result.getOut().isEmpty())
|
||||
@ -99,7 +93,7 @@ public class MagiskLogFragment extends BaseFragment {
|
||||
});
|
||||
}
|
||||
|
||||
public void saveLogs() {
|
||||
private void saveLogs() {
|
||||
Calendar now = Calendar.getInstance();
|
||||
String filename = Utils.fmt("magisk_log_%04d%02d%02d_%02d%02d%02d.log",
|
||||
now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,
|
||||
@ -117,7 +111,7 @@ public class MagiskLogFragment extends BaseFragment {
|
||||
SnackbarMaker.make(txtLog, logFile.getPath(), Snackbar.LENGTH_SHORT).show());
|
||||
}
|
||||
|
||||
public void clearLogs() {
|
||||
private void clearLogs() {
|
||||
Shell.su("echo -n > " + Const.MAGISK_LOG).submit();
|
||||
txtLog.setText(R.string.log_is_empty);
|
||||
SnackbarMaker.make(txtLog, R.string.logs_cleared, Snackbar.LENGTH_SHORT).show();
|
||||
|
@ -16,7 +16,6 @@ import com.topjohnwu.magisk.Const;
|
||||
import com.topjohnwu.magisk.Data;
|
||||
import com.topjohnwu.magisk.FlashActivity;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.adapters.ModulesAdapter;
|
||||
import com.topjohnwu.magisk.components.BaseFragment;
|
||||
import com.topjohnwu.magisk.container.Module;
|
||||
@ -32,14 +31,17 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class ModulesFragment extends BaseFragment implements Topic.Subscriber {
|
||||
|
||||
public SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
public RecyclerView recyclerView;
|
||||
public TextView emptyRv;
|
||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||
@BindView(R.id.empty_rv) TextView emptyRv;
|
||||
|
||||
public void selectFile() {
|
||||
@OnClick(R.id.fab)
|
||||
void selectFile() {
|
||||
runWithPermission(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, () -> {
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.setType("application/zip");
|
||||
@ -53,7 +55,7 @@ public class ModulesFragment extends BaseFragment implements Topic.Subscriber {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_modules, container, false);
|
||||
ViewBinder.bind(this, view);
|
||||
unbinder = new ModulesFragment_ViewBinding(this, view);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
mSwipeRefreshLayout.setOnRefreshListener(() -> {
|
||||
@ -98,12 +100,6 @@ public class ModulesFragment extends BaseFragment implements Topic.Subscriber {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
ViewBinder.unbind(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.menu_reboot, menu);
|
||||
|
@ -14,7 +14,6 @@ import android.widget.TextView;
|
||||
import com.topjohnwu.magisk.Const;
|
||||
import com.topjohnwu.magisk.Data;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.adapters.ReposAdapter;
|
||||
import com.topjohnwu.magisk.asyncs.UpdateRepos;
|
||||
import com.topjohnwu.magisk.components.BaseFragment;
|
||||
@ -27,12 +26,13 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class ReposFragment extends BaseFragment implements Topic.Subscriber {
|
||||
|
||||
public RecyclerView recyclerView;
|
||||
public TextView emptyRv;
|
||||
public SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||
@BindView(R.id.empty_rv) TextView emptyRv;
|
||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
|
||||
private ReposAdapter adapter;
|
||||
|
||||
@ -46,7 +46,7 @@ public class ReposFragment extends BaseFragment implements Topic.Subscriber {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_repos, container, false);
|
||||
ViewBinder.bind(this, view);
|
||||
unbinder = new ReposFragment_ViewBinding(this, view);
|
||||
|
||||
mSwipeRefreshLayout.setRefreshing(true);
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
@ -120,6 +120,5 @@ public class ReposFragment extends BaseFragment implements Topic.Subscriber {
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
mm.repoDB.unregisterAdapter();
|
||||
ViewBinder.unbind(this);
|
||||
}
|
||||
}
|
||||
|
@ -10,17 +10,17 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.adapters.SuLogAdapter;
|
||||
import com.topjohnwu.magisk.components.BaseFragment;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class SuLogFragment extends BaseFragment {
|
||||
|
||||
public TextView emptyRv;
|
||||
public RecyclerView recyclerView;
|
||||
@BindView(R.id.empty_rv) TextView emptyRv;
|
||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||
|
||||
private SuLogAdapter adapter;
|
||||
|
||||
@ -41,7 +41,7 @@ public class SuLogFragment extends BaseFragment {
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View v = inflater.inflate(R.layout.fragment_su_log, container, false);
|
||||
ViewBinder.bind(this, v);
|
||||
unbinder = new SuLogFragment_ViewBinding(this, v);
|
||||
adapter = new SuLogAdapter(mm.mDB);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
@ -76,10 +76,4 @@ public class SuLogFragment extends BaseFragment {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
ViewBinder.unbind(this);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.ViewBinder;
|
||||
import com.topjohnwu.magisk.adapters.PolicyAdapter;
|
||||
import com.topjohnwu.magisk.components.BaseFragment;
|
||||
import com.topjohnwu.magisk.container.Policy;
|
||||
@ -17,11 +16,12 @@ import java.util.List;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
|
||||
public class SuperuserFragment extends BaseFragment {
|
||||
|
||||
public RecyclerView recyclerView;
|
||||
public TextView emptyRv;
|
||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||
@BindView(R.id.empty_rv) TextView emptyRv;
|
||||
|
||||
private PackageManager pm;
|
||||
|
||||
@ -29,7 +29,7 @@ public class SuperuserFragment extends BaseFragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_superuser, container, false);
|
||||
ViewBinder.bind(this, view);
|
||||
unbinder = new SuperuserFragment_ViewBinding(this, view);
|
||||
|
||||
pm = getActivity().getPackageManager();
|
||||
return view;
|
||||
@ -47,12 +47,6 @@ public class SuperuserFragment extends BaseFragment {
|
||||
displayPolicyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
ViewBinder.unbind(this);
|
||||
}
|
||||
|
||||
private void displayPolicyList() {
|
||||
List<Policy> policyList = mm.mDB.getPolicyList(pm);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user