diff --git a/app/src/full/java/com/topjohnwu/magisk/AboutActivity.java b/app/src/full/java/com/topjohnwu/magisk/AboutActivity.java index 790bc6d65..368e5e671 100644 --- a/app/src/full/java/com/topjohnwu/magisk/AboutActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/AboutActivity.java @@ -11,14 +11,14 @@ import android.view.View; import com.topjohnwu.magisk.asyncs.MarkDownWindow; import com.topjohnwu.magisk.components.AboutCardRow; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; import java.util.Locale; import butterknife.BindView; import butterknife.ButterKnife; -public class AboutActivity extends Activity { +public class AboutActivity extends BaseActivity { @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.app_version_info) AboutCardRow appVersionInfo; diff --git a/app/src/full/java/com/topjohnwu/magisk/FlashActivity.java b/app/src/full/java/com/topjohnwu/magisk/FlashActivity.java index b6e2ac21f..ab45565e2 100644 --- a/app/src/full/java/com/topjohnwu/magisk/FlashActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/FlashActivity.java @@ -16,7 +16,7 @@ import android.widget.Toast; import com.topjohnwu.magisk.asyncs.FlashZip; import com.topjohnwu.magisk.asyncs.InstallMagisk; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.utils.Download; import com.topjohnwu.magisk.utils.RootUtils; import com.topjohnwu.magisk.utils.Utils; @@ -35,7 +35,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class FlashActivity extends Activity { +public class FlashActivity extends BaseActivity { @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.txtLog) TextView flashLogs; @@ -139,7 +139,7 @@ public class FlashActivity extends Activity { private static class UninstallMagisk extends FlashZip { - private UninstallMagisk(Activity context, Uri uri, List console, List logs) { + private UninstallMagisk(BaseActivity context, Uri uri, List console, List logs) { super(context, uri, console, logs); } diff --git a/app/src/full/java/com/topjohnwu/magisk/LogFragment.java b/app/src/full/java/com/topjohnwu/magisk/LogFragment.java index 3cb8de5e3..c2839c24f 100644 --- a/app/src/full/java/com/topjohnwu/magisk/LogFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/LogFragment.java @@ -9,13 +9,13 @@ import android.view.View; import android.view.ViewGroup; import com.topjohnwu.magisk.adapters.TabFragmentAdapter; -import com.topjohnwu.magisk.components.Fragment; +import com.topjohnwu.magisk.components.BaseFragment; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; -public class LogFragment extends Fragment { +public class LogFragment extends BaseFragment { private Unbinder unbinder; diff --git a/app/src/full/java/com/topjohnwu/magisk/MagiskFragment.java b/app/src/full/java/com/topjohnwu/magisk/MagiskFragment.java index 87e927d33..4b0bccd3d 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MagiskFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/MagiskFragment.java @@ -21,11 +21,11 @@ import android.widget.TextView; import com.topjohnwu.magisk.asyncs.CheckSafetyNet; import com.topjohnwu.magisk.asyncs.CheckUpdates; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; +import com.topjohnwu.magisk.components.BaseFragment; import com.topjohnwu.magisk.components.CustomAlertDialog; import com.topjohnwu.magisk.components.EnvFixDialog; import com.topjohnwu.magisk.components.ExpandableView; -import com.topjohnwu.magisk.components.Fragment; import com.topjohnwu.magisk.components.MagiskInstallDialog; import com.topjohnwu.magisk.components.ManagerInstallDialog; import com.topjohnwu.magisk.components.UninstallDialog; @@ -41,7 +41,7 @@ import butterknife.ButterKnife; import butterknife.OnClick; import butterknife.Unbinder; -public class MagiskFragment extends Fragment +public class MagiskFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener, ExpandableView, Topic.Subscriber { private Container expandableContainer = new Container(); @@ -117,12 +117,12 @@ public class MagiskFragment extends Fragment // Show Manager update first if (Data.remoteManagerVersionCode > BuildConfig.VERSION_CODE) { - new ManagerInstallDialog((Activity) requireActivity()).show(); + new ManagerInstallDialog((BaseActivity) requireActivity()).show(); return; } ((NotificationManager) mm.getSystemService(Context.NOTIFICATION_SERVICE)).cancelAll(); - new MagiskInstallDialog((Activity) getActivity()).show(); + new MagiskInstallDialog((BaseActivity) getActivity()).show(); } @OnClick(R.id.uninstall_button) diff --git a/app/src/full/java/com/topjohnwu/magisk/MagiskHideFragment.java b/app/src/full/java/com/topjohnwu/magisk/MagiskHideFragment.java index cf30d6b05..326dfb659 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MagiskHideFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/MagiskHideFragment.java @@ -13,14 +13,14 @@ import android.view.ViewGroup; import android.widget.SearchView; import com.topjohnwu.magisk.adapters.ApplicationAdapter; -import com.topjohnwu.magisk.components.Fragment; +import com.topjohnwu.magisk.components.BaseFragment; import com.topjohnwu.magisk.utils.Topic; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; -public class MagiskHideFragment extends Fragment implements Topic.Subscriber { +public class MagiskHideFragment extends BaseFragment implements Topic.Subscriber { private Unbinder unbinder; @BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout; diff --git a/app/src/full/java/com/topjohnwu/magisk/MagiskLogFragment.java b/app/src/full/java/com/topjohnwu/magisk/MagiskLogFragment.java index f4f4edc14..4be68540b 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MagiskLogFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/MagiskLogFragment.java @@ -16,7 +16,7 @@ import android.widget.ProgressBar; import android.widget.ScrollView; import android.widget.TextView; -import com.topjohnwu.magisk.components.Fragment; +import com.topjohnwu.magisk.components.BaseFragment; import com.topjohnwu.magisk.components.SnackbarMaker; import com.topjohnwu.magisk.utils.Download; import com.topjohnwu.magisk.utils.Utils; @@ -30,7 +30,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; -public class MagiskLogFragment extends Fragment { +public class MagiskLogFragment extends BaseFragment { private Unbinder unbinder; diff --git a/app/src/full/java/com/topjohnwu/magisk/MainActivity.java b/app/src/full/java/com/topjohnwu/magisk/MainActivity.java index e71db135d..ea8e56c9b 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MainActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/MainActivity.java @@ -14,7 +14,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.utils.Download; import com.topjohnwu.magisk.utils.Topic; import com.topjohnwu.superuser.Shell; @@ -22,7 +22,7 @@ import com.topjohnwu.superuser.Shell; import butterknife.BindView; import butterknife.ButterKnife; -public class MainActivity extends Activity +public class MainActivity extends BaseActivity implements NavigationView.OnNavigationItemSelectedListener, Topic.Subscriber { private final Handler mDrawerHandler = new Handler(); diff --git a/app/src/full/java/com/topjohnwu/magisk/ModulesFragment.java b/app/src/full/java/com/topjohnwu/magisk/ModulesFragment.java index e10915bc1..7ed391ad9 100644 --- a/app/src/full/java/com/topjohnwu/magisk/ModulesFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/ModulesFragment.java @@ -18,7 +18,7 @@ import android.widget.TextView; import com.topjohnwu.magisk.adapters.ModulesAdapter; import com.topjohnwu.magisk.asyncs.LoadModules; -import com.topjohnwu.magisk.components.Fragment; +import com.topjohnwu.magisk.components.BaseFragment; import com.topjohnwu.magisk.container.Module; import com.topjohnwu.magisk.utils.Topic; import com.topjohnwu.superuser.Shell; @@ -31,7 +31,7 @@ import butterknife.ButterKnife; import butterknife.OnClick; import butterknife.Unbinder; -public class ModulesFragment extends Fragment implements Topic.Subscriber { +public class ModulesFragment extends BaseFragment implements Topic.Subscriber { private Unbinder unbinder; @BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout; diff --git a/app/src/full/java/com/topjohnwu/magisk/NoUIActivity.java b/app/src/full/java/com/topjohnwu/magisk/NoUIActivity.java index 6a9685cbc..c2527b002 100644 --- a/app/src/full/java/com/topjohnwu/magisk/NoUIActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/NoUIActivity.java @@ -2,9 +2,9 @@ package com.topjohnwu.magisk; import android.support.annotation.NonNull; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; -public class NoUIActivity extends Activity { +public class NoUIActivity extends BaseActivity { @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); diff --git a/app/src/full/java/com/topjohnwu/magisk/ReposFragment.java b/app/src/full/java/com/topjohnwu/magisk/ReposFragment.java index e1c3aa34e..164edbb53 100644 --- a/app/src/full/java/com/topjohnwu/magisk/ReposFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/ReposFragment.java @@ -16,14 +16,14 @@ import android.widget.TextView; import com.topjohnwu.magisk.adapters.ReposAdapter; import com.topjohnwu.magisk.asyncs.UpdateRepos; -import com.topjohnwu.magisk.components.Fragment; +import com.topjohnwu.magisk.components.BaseFragment; import com.topjohnwu.magisk.utils.Topic; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; -public class ReposFragment extends Fragment implements Topic.Subscriber { +public class ReposFragment extends BaseFragment implements Topic.Subscriber { private Unbinder unbinder; @BindView(R.id.recyclerView) RecyclerView recyclerView; diff --git a/app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java b/app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java index e4cafa0c6..11a87e1e4 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/SettingsActivity.java @@ -22,7 +22,7 @@ import android.widget.Toast; import com.topjohnwu.magisk.asyncs.CheckUpdates; import com.topjohnwu.magisk.asyncs.HideManager; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.receivers.DownloadReceiver; import com.topjohnwu.magisk.utils.Download; import com.topjohnwu.magisk.utils.FingerprintHelper; @@ -39,7 +39,7 @@ import java.util.Locale; import butterknife.BindView; import butterknife.ButterKnife; -public class SettingsActivity extends Activity implements Topic.Subscriber { +public class SettingsActivity extends BaseActivity implements Topic.Subscriber { @BindView(R.id.toolbar) Toolbar toolbar; diff --git a/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java b/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java index 5289d2fe3..59a9c94c1 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/SplashActivity.java @@ -9,7 +9,7 @@ import android.os.Bundle; import com.topjohnwu.magisk.asyncs.CheckUpdates; import com.topjohnwu.magisk.asyncs.LoadModules; import com.topjohnwu.magisk.asyncs.UpdateRepos; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.database.RepoDatabaseHelper; import com.topjohnwu.magisk.receivers.ShortcutReceiver; import com.topjohnwu.magisk.utils.Download; @@ -17,7 +17,7 @@ import com.topjohnwu.magisk.utils.LocaleManager; import com.topjohnwu.magisk.utils.Utils; import com.topjohnwu.superuser.Shell; -public class SplashActivity extends Activity { +public class SplashActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { @@ -66,7 +66,7 @@ public class SplashActivity extends Activity { Intent intent = new Intent(this, MainActivity.class); intent.putExtra(Const.Key.OPEN_SECTION, getIntent().getStringExtra(Const.Key.OPEN_SECTION)); - intent.putExtra(Activity.INTENT_PERM, getIntent().getStringExtra(Activity.INTENT_PERM)); + intent.putExtra(BaseActivity.INTENT_PERM, getIntent().getStringExtra(BaseActivity.INTENT_PERM)); startActivity(intent); finish(); } diff --git a/app/src/full/java/com/topjohnwu/magisk/SuLogFragment.java b/app/src/full/java/com/topjohnwu/magisk/SuLogFragment.java index ec7ec826a..4294e611c 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SuLogFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/SuLogFragment.java @@ -12,13 +12,13 @@ import android.view.ViewGroup; import android.widget.TextView; import com.topjohnwu.magisk.adapters.SuLogAdapter; -import com.topjohnwu.magisk.components.Fragment; +import com.topjohnwu.magisk.components.BaseFragment; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; -public class SuLogFragment extends Fragment { +public class SuLogFragment extends BaseFragment { @BindView(R.id.empty_rv) TextView emptyRv; @BindView(R.id.recyclerView) RecyclerView recyclerView; diff --git a/app/src/full/java/com/topjohnwu/magisk/SuperuserFragment.java b/app/src/full/java/com/topjohnwu/magisk/SuperuserFragment.java index bfb522d48..f48606e21 100644 --- a/app/src/full/java/com/topjohnwu/magisk/SuperuserFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/SuperuserFragment.java @@ -10,7 +10,7 @@ import android.view.ViewGroup; import android.widget.TextView; import com.topjohnwu.magisk.adapters.PolicyAdapter; -import com.topjohnwu.magisk.components.Fragment; +import com.topjohnwu.magisk.components.BaseFragment; import com.topjohnwu.magisk.container.Policy; import java.util.List; @@ -19,7 +19,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; -public class SuperuserFragment extends Fragment { +public class SuperuserFragment extends BaseFragment { private Unbinder unbinder; private PackageManager pm; diff --git a/app/src/full/java/com/topjohnwu/magisk/adapters/ReposAdapter.java b/app/src/full/java/com/topjohnwu/magisk/adapters/ReposAdapter.java index fe11e80e2..fc337462d 100644 --- a/app/src/full/java/com/topjohnwu/magisk/adapters/ReposAdapter.java +++ b/app/src/full/java/com/topjohnwu/magisk/adapters/ReposAdapter.java @@ -15,7 +15,7 @@ import android.widget.TextView; import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.asyncs.MarkDownWindow; import com.topjohnwu.magisk.asyncs.ProcessRepoZip; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.components.CustomAlertDialog; import com.topjohnwu.magisk.container.Module; import com.topjohnwu.magisk.container.Repo; @@ -97,19 +97,19 @@ public class ReposAdapter extends SectionedAdapter - new MarkDownWindow((Activity) context, null, repo.getDetailUrl()).exec()); + new MarkDownWindow((BaseActivity) context, null, repo.getDetailUrl()).exec()); holder.downloadImage.setOnClickListener(v -> { String filename = repo.getName() + "-" + repo.getVersion() + ".zip"; - new CustomAlertDialog((Activity) context) + new CustomAlertDialog((BaseActivity) context) .setTitle(context.getString(R.string.repo_install_title, repo.getName())) .setMessage(context.getString(R.string.repo_install_msg, filename)) .setCancelable(true) .setPositiveButton(R.string.install, (d, i) -> - new ProcessRepoZip((Activity) context, repo.getZipUrl(), filename, true).exec() + new ProcessRepoZip((BaseActivity) context, repo.getZipUrl(), filename, true).exec() ) .setNeutralButton(R.string.download, (d, i) -> - new ProcessRepoZip((Activity) context, repo.getZipUrl(), filename, false).exec()) + new ProcessRepoZip((BaseActivity) context, repo.getZipUrl(), filename, false).exec()) .setNegativeButton(R.string.no_thanks, null) .show(); }); diff --git a/app/src/full/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java b/app/src/full/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java index a8aec362c..a54233174 100644 --- a/app/src/full/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java +++ b/app/src/full/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java @@ -11,7 +11,7 @@ import android.widget.Toast; import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.FlashActivity; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.components.SnackbarMaker; import com.topjohnwu.magisk.utils.Download; import com.topjohnwu.magisk.utils.Utils; @@ -43,7 +43,7 @@ public class ProcessRepoZip extends ParallelTask { private int progress = 0, total = -1; private Handler mHandler; - public ProcessRepoZip(Activity context, String link, String filename, boolean install) { + public ProcessRepoZip(BaseActivity context, String link, String filename, boolean install) { super(context); mLink = link; mFile = new File(Download.EXTERNAL_PATH, Download.getLegalFilename(filename)); @@ -76,20 +76,20 @@ public class ProcessRepoZip extends ParallelTask { } @Override - protected Activity getActivity() { - return (Activity) super.getActivity(); + protected BaseActivity getActivity() { + return (BaseActivity) super.getActivity(); } @Override protected void onPreExecute() { - Activity activity = getActivity(); + BaseActivity activity = getActivity(); mFile.getParentFile().mkdirs(); progressDialog = ProgressDialog.show(activity, activity.getString(R.string.zip_download_title), activity.getString(R.string.zip_download_msg, 0)); } @Override protected Boolean doInBackground(Void... params) { - Activity activity = getActivity(); + BaseActivity activity = getActivity(); if (activity == null) return null; try { // Request zip from Internet @@ -135,7 +135,7 @@ public class ProcessRepoZip extends ParallelTask { @Override protected void onPostExecute(Boolean result) { - Activity activity = getActivity(); + BaseActivity activity = getActivity(); if (activity == null) return; progressDialog.dismiss(); if (result) { diff --git a/app/src/full/java/com/topjohnwu/magisk/components/Fragment.java b/app/src/full/java/com/topjohnwu/magisk/components/BaseFragment.java similarity index 70% rename from app/src/full/java/com/topjohnwu/magisk/components/Fragment.java rename to app/src/full/java/com/topjohnwu/magisk/components/BaseFragment.java index d32b7c009..c5582ad45 100644 --- a/app/src/full/java/com/topjohnwu/magisk/components/Fragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/components/BaseFragment.java @@ -1,16 +1,17 @@ package com.topjohnwu.magisk.components; import android.content.Intent; +import android.support.v4.app.Fragment; import com.topjohnwu.magisk.Data; import com.topjohnwu.magisk.MagiskManager; import com.topjohnwu.magisk.utils.Topic; -public class Fragment extends android.support.v4.app.Fragment implements Topic.AutoSubscriber { +public class BaseFragment extends Fragment implements Topic.AutoSubscriber { public MagiskManager mm; - public Fragment() { + public BaseFragment() { mm = Data.MM(); } @@ -31,12 +32,12 @@ public class Fragment extends android.support.v4.app.Fragment implements Topic.A startActivityForResult(intent, requestCode, this::onActivityResult); } - public void startActivityForResult(Intent intent, int requestCode, Activity.ActivityResultListener listener) { - ((Activity) requireActivity()).startActivityForResult(intent, requestCode, listener); + public void startActivityForResult(Intent intent, int requestCode, BaseActivity.ActivityResultListener listener) { + ((BaseActivity) requireActivity()).startActivityForResult(intent, requestCode, listener); } public void runWithPermission(String[] permissions, Runnable callback) { - ((Activity) requireActivity()).runWithPermission(permissions,callback); + ((BaseActivity) requireActivity()).runWithPermission(permissions,callback); } @Override diff --git a/app/src/full/java/com/topjohnwu/magisk/components/InstallMethodDialog.java b/app/src/full/java/com/topjohnwu/magisk/components/InstallMethodDialog.java index aaae7cc8b..8502ebb8a 100644 --- a/app/src/full/java/com/topjohnwu/magisk/components/InstallMethodDialog.java +++ b/app/src/full/java/com/topjohnwu/magisk/components/InstallMethodDialog.java @@ -19,7 +19,7 @@ import java.util.List; class InstallMethodDialog extends AlertDialog.Builder { - InstallMethodDialog(Activity activity, List options, String filename) { + InstallMethodDialog(BaseActivity activity, List options, String filename) { super(activity); setTitle(R.string.select_method); setItems(options.toArray(new String [0]), (dialog, idx) -> { @@ -36,7 +36,7 @@ class InstallMethodDialog extends AlertDialog.Builder { activity.startActivityForResult(intent, Const.ID.SELECT_BOOT, (requestCode, resultCode, data) -> { if (requestCode == Const.ID.SELECT_BOOT && - resultCode == Activity.RESULT_OK && data != null) { + resultCode == BaseActivity.RESULT_OK && data != null) { Intent i = new Intent(activity, FlashActivity.class) .putExtra(Const.Key.FLASH_SET_BOOT, data.getData()) .putExtra(Const.Key.FLASH_ACTION, Const.Value.PATCH_BOOT); diff --git a/app/src/full/java/com/topjohnwu/magisk/components/MagiskInstallDialog.java b/app/src/full/java/com/topjohnwu/magisk/components/MagiskInstallDialog.java index 393482a34..3b130266b 100644 --- a/app/src/full/java/com/topjohnwu/magisk/components/MagiskInstallDialog.java +++ b/app/src/full/java/com/topjohnwu/magisk/components/MagiskInstallDialog.java @@ -16,7 +16,7 @@ import java.util.ArrayList; import java.util.List; public class MagiskInstallDialog extends CustomAlertDialog { - public MagiskInstallDialog(Activity activity) { + public MagiskInstallDialog(BaseActivity activity) { super(activity); MagiskManager mm = Data.MM(); String filename = Utils.fmt("Magisk-v%s(%d).zip", diff --git a/app/src/full/java/com/topjohnwu/magisk/components/ManagerInstallDialog.java b/app/src/full/java/com/topjohnwu/magisk/components/ManagerInstallDialog.java index 6f4accf78..fe8cd6747 100644 --- a/app/src/full/java/com/topjohnwu/magisk/components/ManagerInstallDialog.java +++ b/app/src/full/java/com/topjohnwu/magisk/components/ManagerInstallDialog.java @@ -15,7 +15,7 @@ import com.topjohnwu.magisk.utils.Utils; public class ManagerInstallDialog extends CustomAlertDialog { - public ManagerInstallDialog(@NonNull Activity activity) { + public ManagerInstallDialog(@NonNull BaseActivity activity) { super(activity); MagiskManager mm = Data.MM(); String filename = Utils.fmt("MagiskManager-v%s(%d).apk", diff --git a/app/src/full/java/com/topjohnwu/magisk/superuser/RequestActivity.java b/app/src/full/java/com/topjohnwu/magisk/superuser/RequestActivity.java index 8de972cee..737024357 100644 --- a/app/src/full/java/com/topjohnwu/magisk/superuser/RequestActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/superuser/RequestActivity.java @@ -23,7 +23,7 @@ import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.Data; import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.asyncs.ParallelTask; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.container.Policy; import com.topjohnwu.magisk.utils.FingerprintHelper; @@ -33,7 +33,7 @@ import java.io.IOException; import butterknife.BindView; import butterknife.ButterKnife; -public class RequestActivity extends Activity { +public class RequestActivity extends BaseActivity { @BindView(R.id.su_popup) LinearLayout suPopup; @BindView(R.id.timeout) Spinner timeout; @@ -237,7 +237,7 @@ public class RequestActivity extends Activity { private class SocketManager extends ParallelTask { - SocketManager(Activity context) { + SocketManager(BaseActivity context) { super(context); } diff --git a/app/src/main/java/com/topjohnwu/magisk/components/Activity.java b/app/src/main/java/com/topjohnwu/magisk/components/BaseActivity.java similarity index 92% rename from app/src/main/java/com/topjohnwu/magisk/components/Activity.java rename to app/src/main/java/com/topjohnwu/magisk/components/BaseActivity.java index 2b44c36cc..acbffdd18 100644 --- a/app/src/main/java/com/topjohnwu/magisk/components/Activity.java +++ b/app/src/main/java/com/topjohnwu/magisk/components/BaseActivity.java @@ -13,7 +13,7 @@ import android.widget.Toast; import com.topjohnwu.magisk.NoUIActivity; import com.topjohnwu.magisk.R; -public abstract class Activity extends FlavorActivity { +public abstract class BaseActivity extends FlavorActivity { public static final String INTENT_PERM = "perm_dialog"; @@ -30,14 +30,14 @@ public abstract class Activity extends FlavorActivity { } else { // Passed in context should be an activity if not granted, need to show dialog! permissionGrantCallback = callback; - if (!(context instanceof Activity)) { + if (!(context instanceof BaseActivity)) { // Start activity to show dialog Intent intent = new Intent(context, NoUIActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(INTENT_PERM, permissions); context.startActivity(intent); } else { - ActivityCompat.requestPermissions((Activity) context, permissions, 0); + ActivityCompat.requestPermissions((BaseActivity) context, permissions, 0); } } } diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Download.java b/app/src/main/java/com/topjohnwu/magisk/utils/Download.java index dfe12f13e..498c713ca 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Download.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Download.java @@ -11,7 +11,7 @@ import android.os.Environment; import android.widget.Toast; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.receivers.DownloadReceiver; import java.io.File; @@ -27,7 +27,7 @@ public class Download { if (isDownloading) return; - Activity.runWithPermission(context, + BaseActivity.runWithPermission(context, new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, () -> { File file = new File(EXTERNAL_PATH, getLegalFilename(filename)); diff --git a/app/src/stub/java/com/topjohnwu/magisk/NoUIActivity.java b/app/src/stub/java/com/topjohnwu/magisk/NoUIActivity.java index cf22ae35c..200b0cb27 100644 --- a/app/src/stub/java/com/topjohnwu/magisk/NoUIActivity.java +++ b/app/src/stub/java/com/topjohnwu/magisk/NoUIActivity.java @@ -5,7 +5,7 @@ import android.app.AlertDialog; import android.os.AsyncTask; import android.os.Bundle; -import com.topjohnwu.magisk.components.Activity; +import com.topjohnwu.magisk.components.BaseActivity; import com.topjohnwu.magisk.receivers.ManagerInstall; import com.topjohnwu.magisk.utils.Download; import com.topjohnwu.magisk.utils.WebService; @@ -15,7 +15,7 @@ import org.json.JSONObject; import java.util.Locale; -public class NoUIActivity extends Activity { +public class NoUIActivity extends BaseActivity { private String apkLink; private String version;