Remove boilderplate
This commit is contained in:
parent
8574a14ed2
commit
a2544768a0
@ -45,8 +45,6 @@ public class MagiskFragment extends Fragment
|
|||||||
implements SwipeRefreshLayout.OnRefreshListener, ExpandableView, Topic.Subscriber {
|
implements SwipeRefreshLayout.OnRefreshListener, ExpandableView, Topic.Subscriber {
|
||||||
|
|
||||||
private Container expandableContainer = new Container();
|
private Container expandableContainer = new Container();
|
||||||
|
|
||||||
private MagiskManager mm;
|
|
||||||
private Unbinder unbinder;
|
private Unbinder unbinder;
|
||||||
private static boolean shownDialog = false;
|
private static boolean shownDialog = false;
|
||||||
|
|
||||||
@ -140,8 +138,6 @@ public class MagiskFragment extends Fragment
|
|||||||
unbinder = ButterKnife.bind(this, v);
|
unbinder = ButterKnife.bind(this, v);
|
||||||
requireActivity().setTitle(R.string.magisk);
|
requireActivity().setTitle(R.string.magisk);
|
||||||
|
|
||||||
mm = getApplication();
|
|
||||||
|
|
||||||
expandableContainer.expandLayout = expandLayout;
|
expandableContainer.expandLayout = expandLayout;
|
||||||
setupExpandable();
|
setupExpandable();
|
||||||
|
|
||||||
|
@ -42,9 +42,6 @@ public class MainActivity extends Activity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
|
|
||||||
MagiskManager mm = getMagiskManager();
|
|
||||||
|
|
||||||
if (!mm.hasInit) {
|
if (!mm.hasInit) {
|
||||||
Intent intent = new Intent(this, SplashActivity.class);
|
Intent intent = new Intent(this, SplashActivity.class);
|
||||||
String section = getIntent().getStringExtra(Const.Key.OPEN_SECTION);
|
String section = getIntent().getStringExtra(Const.Key.OPEN_SECTION);
|
||||||
@ -121,7 +118,6 @@ public class MainActivity extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkHideSection() {
|
public void checkHideSection() {
|
||||||
MagiskManager mm = getMagiskManager();
|
|
||||||
Menu menu = navigationView.getMenu();
|
Menu menu = navigationView.getMenu();
|
||||||
menu.findItem(R.id.magiskhide).setVisible(
|
menu.findItem(R.id.magiskhide).setVisible(
|
||||||
Shell.rootAccess() && Data.magiskVersionCode >= Const.MAGISK_VER.UNIFIED
|
Shell.rootAccess() && Data.magiskVersionCode >= Const.MAGISK_VER.UNIFIED
|
||||||
|
@ -130,7 +130,7 @@ public class ModulesFragment extends Fragment implements Topic.Subscriber {
|
|||||||
|
|
||||||
private void updateUI() {
|
private void updateUI() {
|
||||||
listModules.clear();
|
listModules.clear();
|
||||||
listModules.addAll(getApplication().moduleMap.values());
|
listModules.addAll(mm.moduleMap.values());
|
||||||
if (listModules.size() == 0) {
|
if (listModules.size() == 0) {
|
||||||
emptyRv.setVisibility(View.VISIBLE);
|
emptyRv.setVisibility(View.VISIBLE);
|
||||||
recyclerView.setVisibility(View.GONE);
|
recyclerView.setVisibility(View.GONE);
|
||||||
|
@ -26,7 +26,6 @@ import butterknife.Unbinder;
|
|||||||
public class ReposFragment extends Fragment implements Topic.Subscriber {
|
public class ReposFragment extends Fragment implements Topic.Subscriber {
|
||||||
|
|
||||||
private Unbinder unbinder;
|
private Unbinder unbinder;
|
||||||
private MagiskManager mm;
|
|
||||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||||
@BindView(R.id.empty_rv) TextView emptyRv;
|
@BindView(R.id.empty_rv) TextView emptyRv;
|
||||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
@ -44,7 +43,6 @@ public class ReposFragment extends Fragment implements Topic.Subscriber {
|
|||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.fragment_repos, container, false);
|
View view = inflater.inflate(R.layout.fragment_repos, container, false);
|
||||||
unbinder = ButterKnife.bind(this, view);
|
unbinder = ButterKnife.bind(this, view);
|
||||||
mm = getApplication();
|
|
||||||
|
|
||||||
mSwipeRefreshLayout.setRefreshing(true);
|
mSwipeRefreshLayout.setRefreshing(true);
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
setPreferencesFromResource(R.xml.app_settings, rootKey);
|
setPreferencesFromResource(R.xml.app_settings, rootKey);
|
||||||
mm = Utils.getMagiskManager(getActivity());
|
mm = Data.MM();
|
||||||
prefs = mm.prefs;
|
prefs = mm.prefs;
|
||||||
prefScreen = getPreferenceScreen();
|
prefScreen = getPreferenceScreen();
|
||||||
|
|
||||||
@ -126,10 +126,10 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
|
|||||||
updateChannel.setOnPreferenceChangeListener((pref, o) -> {
|
updateChannel.setOnPreferenceChangeListener((pref, o) -> {
|
||||||
Data.updateChannel = Integer.parseInt((String) o);
|
Data.updateChannel = Integer.parseInt((String) o);
|
||||||
if (Data.updateChannel == Const.Value.CUSTOM_CHANNEL) {
|
if (Data.updateChannel == Const.Value.CUSTOM_CHANNEL) {
|
||||||
View v = LayoutInflater.from(getActivity()).inflate(R.layout.custom_channel_dialog, null);
|
View v = LayoutInflater.from(requireActivity()).inflate(R.layout.custom_channel_dialog, null);
|
||||||
EditText url = v.findViewById(R.id.custom_url);
|
EditText url = v.findViewById(R.id.custom_url);
|
||||||
url.setText(mm.prefs.getString(Const.Key.CUSTOM_CHANNEL, ""));
|
url.setText(mm.prefs.getString(Const.Key.CUSTOM_CHANNEL, ""));
|
||||||
new AlertDialog.Builder(getActivity())
|
new AlertDialog.Builder(requireActivity())
|
||||||
.setTitle(R.string.settings_update_custom)
|
.setTitle(R.string.settings_update_custom)
|
||||||
.setView(v)
|
.setView(v)
|
||||||
.setPositiveButton(R.string.ok, (d, i) ->
|
.setPositiveButton(R.string.ok, (d, i) ->
|
||||||
|
@ -23,7 +23,6 @@ public class SplashActivity extends Activity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
MagiskManager mm = getMagiskManager();
|
|
||||||
// Force create a shell if not created yet
|
// Force create a shell if not created yet
|
||||||
boolean root = Shell.rootAccess();
|
boolean root = Shell.rootAccess();
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ public class SuLogFragment extends Fragment {
|
|||||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||||
|
|
||||||
private Unbinder unbinder;
|
private Unbinder unbinder;
|
||||||
private MagiskManager mm;
|
|
||||||
private SuLogAdapter adapter;
|
private SuLogAdapter adapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,7 +44,6 @@ public class SuLogFragment extends Fragment {
|
|||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View v = inflater.inflate(R.layout.fragment_su_log, container, false);
|
View v = inflater.inflate(R.layout.fragment_su_log, container, false);
|
||||||
unbinder = ButterKnife.bind(this, v);
|
unbinder = ButterKnife.bind(this, v);
|
||||||
mm = getApplication();
|
|
||||||
adapter = new SuLogAdapter(mm.mDB);
|
adapter = new SuLogAdapter(mm.mDB);
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ public class SuperuserFragment extends Fragment {
|
|||||||
|
|
||||||
private Unbinder unbinder;
|
private Unbinder unbinder;
|
||||||
private PackageManager pm;
|
private PackageManager pm;
|
||||||
private MagiskManager mm;
|
|
||||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
||||||
@BindView(R.id.empty_rv) TextView emptyRv;
|
@BindView(R.id.empty_rv) TextView emptyRv;
|
||||||
|
|
||||||
@ -34,14 +33,13 @@ public class SuperuserFragment extends Fragment {
|
|||||||
unbinder = ButterKnife.bind(this, view);
|
unbinder = ButterKnife.bind(this, view);
|
||||||
|
|
||||||
pm = getActivity().getPackageManager();
|
pm = getActivity().getPackageManager();
|
||||||
mm = getApplication();
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
getActivity().setTitle(getString(R.string.superuser));
|
requireActivity().setTitle(getString(R.string.superuser));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,6 +19,7 @@ public abstract class FlavorActivity extends AppCompatActivity implements Topic.
|
|||||||
|
|
||||||
private ActivityResultListener activityResultListener;
|
private ActivityResultListener activityResultListener;
|
||||||
static int[] EMPTY_INT_ARRAY = new int[0];
|
static int[] EMPTY_INT_ARRAY = new int[0];
|
||||||
|
public MagiskManager mm;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context base) {
|
protected void attachBaseContext(Context base) {
|
||||||
@ -26,6 +27,7 @@ public abstract class FlavorActivity extends AppCompatActivity implements Topic.
|
|||||||
Configuration config = base.getResources().getConfiguration();
|
Configuration config = base.getResources().getConfiguration();
|
||||||
config.setLocale(LocaleManager.locale);
|
config.setLocale(LocaleManager.locale);
|
||||||
applyOverrideConfiguration(config);
|
applyOverrideConfiguration(config);
|
||||||
|
mm = Data.MM();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,10 +40,6 @@ public abstract class FlavorActivity extends AppCompatActivity implements Topic.
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MagiskManager getMagiskManager() {
|
|
||||||
return (MagiskManager) super.getApplication();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -2,14 +2,16 @@ package com.topjohnwu.magisk.components;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
|
import com.topjohnwu.magisk.Data;
|
||||||
import com.topjohnwu.magisk.MagiskManager;
|
import com.topjohnwu.magisk.MagiskManager;
|
||||||
import com.topjohnwu.magisk.utils.Topic;
|
import com.topjohnwu.magisk.utils.Topic;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
|
||||||
|
|
||||||
public class Fragment extends android.support.v4.app.Fragment implements Topic.AutoSubscriber {
|
public class Fragment extends android.support.v4.app.Fragment implements Topic.AutoSubscriber {
|
||||||
|
|
||||||
public MagiskManager getApplication() {
|
public MagiskManager mm;
|
||||||
return Utils.getMagiskManager(getActivity());
|
|
||||||
|
public Fragment() {
|
||||||
|
mm = Data.MM();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,7 +10,6 @@ import android.widget.Toast;
|
|||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.Data;
|
import com.topjohnwu.magisk.Data;
|
||||||
import com.topjohnwu.magisk.FlashActivity;
|
import com.topjohnwu.magisk.FlashActivity;
|
||||||
import com.topjohnwu.magisk.MagiskManager;
|
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
||||||
import com.topjohnwu.magisk.utils.Download;
|
import com.topjohnwu.magisk.utils.Download;
|
||||||
@ -22,7 +21,6 @@ class InstallMethodDialog extends AlertDialog.Builder {
|
|||||||
|
|
||||||
InstallMethodDialog(Activity activity, List<String> options, String filename) {
|
InstallMethodDialog(Activity activity, List<String> options, String filename) {
|
||||||
super(activity);
|
super(activity);
|
||||||
MagiskManager mm = Utils.getMagiskManager(activity);
|
|
||||||
setTitle(R.string.select_method);
|
setTitle(R.string.select_method);
|
||||||
setItems(options.toArray(new String [0]), (dialog, idx) -> {
|
setItems(options.toArray(new String [0]), (dialog, idx) -> {
|
||||||
Intent intent;
|
Intent intent;
|
||||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||||||
public class MagiskInstallDialog extends CustomAlertDialog {
|
public class MagiskInstallDialog extends CustomAlertDialog {
|
||||||
public MagiskInstallDialog(Activity activity) {
|
public MagiskInstallDialog(Activity activity) {
|
||||||
super(activity);
|
super(activity);
|
||||||
MagiskManager mm = Utils.getMagiskManager(activity);
|
MagiskManager mm = Data.MM();
|
||||||
String filename = Utils.fmt("Magisk-v%s(%d).zip",
|
String filename = Utils.fmt("Magisk-v%s(%d).zip",
|
||||||
Data.remoteMagiskVersionString, Data.remoteMagiskVersionCode);
|
Data.remoteMagiskVersionString, Data.remoteMagiskVersionCode);
|
||||||
setTitle(mm.getString(R.string.repo_install_title, mm.getString(R.string.magisk)));
|
setTitle(mm.getString(R.string.repo_install_title, mm.getString(R.string.magisk)));
|
||||||
|
@ -17,7 +17,7 @@ public class ManagerInstallDialog extends CustomAlertDialog {
|
|||||||
|
|
||||||
public ManagerInstallDialog(@NonNull Activity activity) {
|
public ManagerInstallDialog(@NonNull Activity activity) {
|
||||||
super(activity);
|
super(activity);
|
||||||
MagiskManager mm = Utils.getMagiskManager(activity);
|
MagiskManager mm = Data.MM();
|
||||||
String filename = Utils.fmt("MagiskManager-v%s(%d).apk",
|
String filename = Utils.fmt("MagiskManager-v%s(%d).apk",
|
||||||
Data.remoteManagerVersionString, Data.remoteManagerVersionCode);
|
Data.remoteManagerVersionString, Data.remoteManagerVersionCode);
|
||||||
setTitle(mm.getString(R.string.repo_install_title, mm.getString(R.string.app_name)));
|
setTitle(mm.getString(R.string.repo_install_title, mm.getString(R.string.app_name)));
|
||||||
|
@ -15,13 +15,12 @@ import com.topjohnwu.magisk.R;
|
|||||||
import com.topjohnwu.magisk.asyncs.RestoreImages;
|
import com.topjohnwu.magisk.asyncs.RestoreImages;
|
||||||
import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
||||||
import com.topjohnwu.magisk.utils.Download;
|
import com.topjohnwu.magisk.utils.Download;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
|
||||||
|
|
||||||
public class UninstallDialog extends CustomAlertDialog {
|
public class UninstallDialog extends CustomAlertDialog {
|
||||||
|
|
||||||
public UninstallDialog(@NonNull Activity activity) {
|
public UninstallDialog(@NonNull Activity activity) {
|
||||||
super(activity);
|
super(activity);
|
||||||
MagiskManager mm = Utils.getMagiskManager(activity);
|
MagiskManager mm = Data.MM();
|
||||||
setTitle(R.string.uninstall_magisk_title);
|
setTitle(R.string.uninstall_magisk_title);
|
||||||
setMessage(R.string.uninstall_magisk_msg);
|
setMessage(R.string.uninstall_magisk_msg);
|
||||||
setNeutralButton(R.string.restore_img, (d, i) -> new RestoreImages(activity).exec());
|
setNeutralButton(R.string.restore_img, (d, i) -> new RestoreImages(activity).exec());
|
||||||
|
@ -9,7 +9,6 @@ import com.topjohnwu.magisk.Const;
|
|||||||
import com.topjohnwu.magisk.Data;
|
import com.topjohnwu.magisk.Data;
|
||||||
import com.topjohnwu.magisk.MagiskManager;
|
import com.topjohnwu.magisk.MagiskManager;
|
||||||
import com.topjohnwu.magisk.container.Repo;
|
import com.topjohnwu.magisk.container.Repo;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -24,7 +23,7 @@ public class RepoDatabaseHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
public RepoDatabaseHelper(Context context) {
|
public RepoDatabaseHelper(Context context) {
|
||||||
super(context, "repo.db", null, DATABASE_VER);
|
super(context, "repo.db", null, DATABASE_VER);
|
||||||
mm = Utils.getMagiskManager(context);
|
mm = Data.MM();
|
||||||
mDb = getWritableDatabase();
|
mDb = getWritableDatabase();
|
||||||
|
|
||||||
// Remove outdated repos
|
// Remove outdated repos
|
||||||
|
@ -5,14 +5,14 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
|
import com.topjohnwu.magisk.Data;
|
||||||
import com.topjohnwu.magisk.MagiskManager;
|
import com.topjohnwu.magisk.MagiskManager;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
|
|
||||||
public class PackageReceiver extends BroadcastReceiver {
|
public class PackageReceiver extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
MagiskManager mm = Utils.getMagiskManager(context);
|
MagiskManager mm = Data.MM();
|
||||||
|
|
||||||
String pkg = intent.getData().getEncodedSchemeSpecificPart();
|
String pkg = intent.getData().getEncodedSchemeSpecificPart();
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ import com.topjohnwu.magisk.Data;
|
|||||||
import com.topjohnwu.magisk.MagiskManager;
|
import com.topjohnwu.magisk.MagiskManager;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.SplashActivity;
|
import com.topjohnwu.magisk.SplashActivity;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
|
||||||
import com.topjohnwu.superuser.Shell;
|
import com.topjohnwu.superuser.Shell;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -23,7 +22,7 @@ public class ShortcutReceiver extends BroadcastReceiver {
|
|||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||||
MagiskManager mm = Utils.getMagiskManager(context);
|
MagiskManager mm = Data.MM();
|
||||||
ShortcutManager manager = context.getSystemService(ShortcutManager.class);
|
ShortcutManager manager = context.getSystemService(ShortcutManager.class);
|
||||||
manager.setDynamicShortcuts(getShortCuts(mm));
|
manager.setDynamicShortcuts(getShortCuts(mm));
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,11 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.Data;
|
import com.topjohnwu.magisk.Data;
|
||||||
import com.topjohnwu.magisk.MagiskManager;
|
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.asyncs.ParallelTask;
|
import com.topjohnwu.magisk.asyncs.ParallelTask;
|
||||||
import com.topjohnwu.magisk.components.Activity;
|
import com.topjohnwu.magisk.components.Activity;
|
||||||
import com.topjohnwu.magisk.container.Policy;
|
import com.topjohnwu.magisk.container.Policy;
|
||||||
import com.topjohnwu.magisk.utils.FingerprintHelper;
|
import com.topjohnwu.magisk.utils.FingerprintHelper;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -50,7 +48,6 @@ public class RequestActivity extends Activity {
|
|||||||
private String socketPath;
|
private String socketPath;
|
||||||
private LocalSocket socket;
|
private LocalSocket socket;
|
||||||
private PackageManager pm;
|
private PackageManager pm;
|
||||||
private MagiskManager mm;
|
|
||||||
|
|
||||||
private boolean hasTimeout;
|
private boolean hasTimeout;
|
||||||
private Policy policy;
|
private Policy policy;
|
||||||
@ -68,7 +65,6 @@ public class RequestActivity extends Activity {
|
|||||||
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
|
||||||
pm = getPackageManager();
|
pm = getPackageManager();
|
||||||
mm = Utils.getMagiskManager(this);
|
|
||||||
mm.mDB.clearOutdated();
|
mm.mDB.clearOutdated();
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
@ -27,10 +27,6 @@ public class Utils {
|
|||||||
return getPrefsInt(prefs, key, 0);
|
return getPrefsInt(prefs, key, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MagiskManager getMagiskManager(Context context) {
|
|
||||||
return (MagiskManager) context.getApplicationContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getNameFromUri(Context context, Uri uri) {
|
public static String getNameFromUri(Context context, Uri uri) {
|
||||||
String name = null;
|
String name = null;
|
||||||
try (Cursor c = context.getContentResolver().query(uri, null, null, null, null)) {
|
try (Cursor c = context.getContentResolver().query(uri, null, null, null, null)) {
|
||||||
@ -50,8 +46,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int dpInPx(int dp) {
|
public static int dpInPx(int dp) {
|
||||||
Context context = Data.MM();
|
float scale = Data.MM().getResources().getDisplayMetrics().density;
|
||||||
float scale = context.getResources().getDisplayMetrics().density;
|
|
||||||
return (int) (dp * scale + 0.5);
|
return (int) (dp * scale + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user