Fix warnings
This commit is contained in:
parent
4782223dea
commit
16f34412fd
|
|
@ -28,13 +28,13 @@ public class BlackListActivity extends BaseActivity implements AppAdapter.Callba
|
||||||
|
|
||||||
private SearchView.OnQueryTextListener searchListener;
|
private SearchView.OnQueryTextListener searchListener;
|
||||||
private ActivityBlackListBinding binding;
|
private ActivityBlackListBinding binding;
|
||||||
private Runnable runnable = new Runnable() {
|
private final Runnable runnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
binding.swipeRefreshLayout.setRefreshing(true);
|
binding.swipeRefreshLayout.setRefreshing(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private Handler handler = new Handler();
|
private final Handler handler = new Handler();
|
||||||
private boolean isCompat;
|
private boolean isCompat;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -129,12 +129,7 @@ public class BlackListActivity extends BaseActivity implements AppAdapter.Callba
|
||||||
handler.removeCallbacks(runnable);
|
handler.removeCallbacks(runnable);
|
||||||
binding.swipeRefreshLayout.setRefreshing(false);
|
binding.swipeRefreshLayout.setRefreshing(false);
|
||||||
String queryStr = searchView != null ? searchView.getQuery().toString() : "";
|
String queryStr = searchView != null ? searchView.getQuery().toString() : "";
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(() -> appAdapter.getFilter().filter(queryStr));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
appAdapter.getFilter().filter(queryStr);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@ public class CompileDialogFragment extends AppCompatDialogFragment {
|
||||||
List<String> stdout = new ArrayList<>();
|
List<String> stdout = new ArrayList<>();
|
||||||
List<String> stderr = new ArrayList<>();
|
List<String> stderr = new ArrayList<>();
|
||||||
Shell.Result result = Shell.su(commands).to(stdout, stderr).exec();
|
Shell.Result result = Shell.su(commands).to(stdout, stderr).exec();
|
||||||
List<String> ret;
|
|
||||||
if (stderr.size() > 0) {
|
if (stderr.size() > 0) {
|
||||||
return "Error: " + TextUtils.join("\n", stderr);
|
return "Error: " + TextUtils.join("\n", stderr);
|
||||||
} else if (!result.isSuccess()) { // they might don't write to stderr
|
} else if (!result.isSuccess()) { // they might don't write to stderr
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
|
||||||
private SearchView searchView;
|
private SearchView searchView;
|
||||||
private SharedPreferences ignoredUpdatesPref;
|
private SharedPreferences ignoredUpdatesPref;
|
||||||
private boolean changed = false;
|
private boolean changed = false;
|
||||||
private BroadcastReceiver connectionListener = new BroadcastReceiver() {
|
private final BroadcastReceiver connectionListener = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (repoLoader != null) {
|
if (repoLoader != null) {
|
||||||
|
|
@ -224,11 +224,11 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DownloadsAdapter extends CursorRecyclerViewAdapter<DownloadsAdapter.ViewHolder> implements StickyRecyclerHeadersAdapter {
|
private class DownloadsAdapter extends CursorRecyclerViewAdapter<DownloadsAdapter.ViewHolder> implements StickyRecyclerHeadersAdapter<DownloadsAdapter.HeaderViewHolder> {
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.SHORT);
|
private final DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.SHORT);
|
||||||
private final SharedPreferences prefs;
|
private final SharedPreferences prefs;
|
||||||
private String[] sectionHeaders;
|
private final String[] sectionHeaders;
|
||||||
|
|
||||||
DownloadsAdapter(Context context, Cursor cursor) {
|
DownloadsAdapter(Context context, Cursor cursor) {
|
||||||
super(cursor);
|
super(cursor);
|
||||||
|
|
@ -288,17 +288,15 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecyclerView.ViewHolder onCreateHeaderViewHolder(ViewGroup parent) {
|
public HeaderViewHolder onCreateHeaderViewHolder(ViewGroup parent) {
|
||||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.sticky_header_download, parent, false);
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.sticky_header_download, parent, false);
|
||||||
return new RecyclerView.ViewHolder(view) {
|
return new HeaderViewHolder(view);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindHeaderViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
|
public void onBindHeaderViewHolder(HeaderViewHolder viewHolder, int position) {
|
||||||
long section = getHeaderId(position);
|
long section = getHeaderId(position);
|
||||||
TextView tv = viewHolder.itemView.findViewById(android.R.id.title);
|
viewHolder.title.setText(sectionHeaders[(int) section]);
|
||||||
tv.setText(sectionHeaders[(int) section]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
|
@ -373,6 +371,15 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
|
||||||
timestamps = binding.timestamps;
|
timestamps = binding.timestamps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class HeaderViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
TextView title;
|
||||||
|
|
||||||
|
HeaderViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
title = findViewById(android.R.id.title);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ public class DownloadDetailsActivity extends BaseActivity implements RepoLoader.
|
||||||
static final String PLAY_STORE_PACKAGE = "com.android.vending";
|
static final String PLAY_STORE_PACKAGE = "com.android.vending";
|
||||||
static final String PLAY_STORE_LINK = "https://play.google.com/store/apps/details?id=%s";
|
static final String PLAY_STORE_LINK = "https://play.google.com/store/apps/details?id=%s";
|
||||||
private static final String TAG = "DownloadDetailsActivity";
|
private static final String TAG = "DownloadDetailsActivity";
|
||||||
private static RepoLoader repoLoader = RepoLoader.getInstance();
|
private static final RepoLoader repoLoader = RepoLoader.getInstance();
|
||||||
private static ModuleUtil moduleUtil = ModuleUtil.getInstance();
|
private static final ModuleUtil moduleUtil = ModuleUtil.getInstance();
|
||||||
private String packageName;
|
private String packageName;
|
||||||
private Module module;
|
private Module module;
|
||||||
private ModuleUtil.InstalledModule installedModule;
|
private ModuleUtil.InstalledModule installedModule;
|
||||||
|
|
@ -179,45 +179,44 @@ public class DownloadDetailsActivity extends BaseActivity implements RepoLoader.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case R.id.menu_refresh:
|
if (itemId == R.id.menu_refresh) {
|
||||||
RepoLoader.getInstance().triggerReload(true);
|
RepoLoader.getInstance().triggerReload(true);
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_share:
|
} else if (itemId == R.id.menu_share) {
|
||||||
String text = module.name + " - ";
|
String text = module.name + " - ";
|
||||||
|
|
||||||
if (isPackageInstalled(packageName, this)) {
|
if (isPackageInstalled(packageName, this)) {
|
||||||
String s = getPackageManager().getInstallerPackageName(packageName);
|
String s = getPackageManager().getInstallerPackageName(packageName);
|
||||||
boolean playStore;
|
boolean playStore;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
playStore = s.equals(PLAY_STORE_PACKAGE);
|
playStore = PLAY_STORE_PACKAGE.equals(s);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
playStore = false;
|
playStore = false;
|
||||||
}
|
|
||||||
|
|
||||||
if (playStore) {
|
|
||||||
text += String.format(PLAY_STORE_LINK, packageName);
|
|
||||||
} else {
|
|
||||||
text += String.format(XPOSED_REPO_LINK, packageName);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
text += String.format(XPOSED_REPO_LINK,
|
|
||||||
packageName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
if (playStore) {
|
||||||
sharingIntent.setType("text/plain");
|
text += String.format(PLAY_STORE_LINK, packageName);
|
||||||
sharingIntent.putExtra(Intent.EXTRA_TEXT, text);
|
} else {
|
||||||
startActivity(Intent.createChooser(sharingIntent, getString(R.string.share)));
|
text += String.format(XPOSED_REPO_LINK, packageName);
|
||||||
return true;
|
}
|
||||||
case R.id.ignoreUpdate:
|
} else {
|
||||||
SharedPreferences prefs = getSharedPreferences("update_ignored", MODE_PRIVATE);
|
text += String.format(XPOSED_REPO_LINK,
|
||||||
|
packageName);
|
||||||
|
}
|
||||||
|
|
||||||
boolean ignored = prefs.getBoolean(module.packageName, false);
|
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
||||||
prefs.edit().putBoolean(module.packageName, !ignored).apply();
|
sharingIntent.setType("text/plain");
|
||||||
item.setChecked(!ignored);
|
sharingIntent.putExtra(Intent.EXTRA_TEXT, text);
|
||||||
break;
|
startActivity(Intent.createChooser(sharingIntent, getString(R.string.share)));
|
||||||
|
return true;
|
||||||
|
} else if (itemId == R.id.ignoreUpdate) {
|
||||||
|
SharedPreferences prefs = getSharedPreferences("update_ignored", MODE_PRIVATE);
|
||||||
|
|
||||||
|
boolean ignored = prefs.getBoolean(module.packageName, false);
|
||||||
|
prefs.edit().putBoolean(module.packageName, !ignored).apply();
|
||||||
|
item.setChecked(!ignored);
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
@ -234,7 +233,7 @@ public class DownloadDetailsActivity extends BaseActivity implements RepoLoader.
|
||||||
|
|
||||||
class SwipeFragmentPagerAdapter extends FragmentPagerAdapter {
|
class SwipeFragmentPagerAdapter extends FragmentPagerAdapter {
|
||||||
final int PAGE_COUNT = 3;
|
final int PAGE_COUNT = 3;
|
||||||
private String[] tabTitles = new String[]{getString(R.string.download_details_page_description), getString(R.string.download_details_page_versions), getString(R.string.download_details_page_settings),};
|
private final String[] tabTitles = new String[]{getString(R.string.download_details_page_description), getString(R.string.download_details_page_versions), getString(R.string.download_details_page_settings),};
|
||||||
|
|
||||||
SwipeFragmentPagerAdapter(FragmentManager fm) {
|
SwipeFragmentPagerAdapter(FragmentManager fm) {
|
||||||
super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,13 @@ import java.util.Scanner;
|
||||||
|
|
||||||
public class LogsActivity extends BaseActivity {
|
public class LogsActivity extends BaseActivity {
|
||||||
private boolean allLog = false;
|
private boolean allLog = false;
|
||||||
private File fileErrorLog = new File(XposedApp.BASE_DIR + "log/error.log");
|
private final File fileErrorLog = new File(XposedApp.BASE_DIR + "log/error.log");
|
||||||
private File fileErrorLogOld = new File(
|
private final File fileErrorLogOld = new File(
|
||||||
XposedApp.BASE_DIR + "log/error.log.old");
|
XposedApp.BASE_DIR + "log/error.log.old");
|
||||||
private File fileAllLog = new File(XposedApp.BASE_DIR + "log/all.log");
|
private final File fileAllLog = new File(XposedApp.BASE_DIR + "log/all.log");
|
||||||
private File fileAllLogOld = new File(XposedApp.BASE_DIR + "log/all.log.old");
|
private final File fileAllLogOld = new File(XposedApp.BASE_DIR + "log/all.log.old");
|
||||||
private LogsAdapter adapter;
|
private LogsAdapter adapter;
|
||||||
private Handler handler = new Handler();
|
private final Handler handler = new Handler();
|
||||||
private ActivityLogsBinding binding;
|
private ActivityLogsBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -115,29 +115,27 @@ public class LogsActivity extends BaseActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case R.id.menu_scroll_top:
|
if (itemId == R.id.menu_scroll_top) {
|
||||||
scrollTop();
|
scrollTop();
|
||||||
break;
|
} else if (itemId == R.id.menu_scroll_down) {
|
||||||
case R.id.menu_scroll_down:
|
scrollDown();
|
||||||
scrollDown();
|
} else if (itemId == R.id.menu_refresh) {
|
||||||
break;
|
reloadErrorLog();
|
||||||
case R.id.menu_refresh:
|
return true;
|
||||||
reloadErrorLog();
|
} else if (itemId == R.id.menu_send) {
|
||||||
return true;
|
try {
|
||||||
case R.id.menu_send:
|
send();
|
||||||
try {
|
} catch (Exception e) {
|
||||||
send();
|
e.printStackTrace();
|
||||||
} catch (Exception e) {
|
}
|
||||||
Snackbar.make(binding.snackbar, e.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();
|
return true;
|
||||||
}
|
} else if (itemId == R.id.menu_save) {
|
||||||
return true;
|
save();
|
||||||
case R.id.menu_save:
|
return true;
|
||||||
save();
|
} else if (itemId == R.id.menu_clear) {
|
||||||
return true;
|
clear();
|
||||||
case R.id.menu_clear:
|
return true;
|
||||||
clear();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +223,7 @@ public class LogsActivity extends BaseActivity {
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
private class LogsReader extends AsyncTask<File, Integer, ArrayList<String>> {
|
private class LogsReader extends AsyncTask<File, Integer, ArrayList<String>> {
|
||||||
private AlertDialog mProgressDialog;
|
private AlertDialog mProgressDialog;
|
||||||
private Runnable mRunnable = new Runnable() {
|
private final Runnable mRunnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mProgressDialog.show();
|
mProgressDialog.show();
|
||||||
|
|
@ -256,7 +254,9 @@ public class LogsActivity extends BaseActivity {
|
||||||
return logs;
|
return logs;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logs.add(LogsActivity.this.getResources().getString(R.string.logs_cannot_read));
|
logs.add(LogsActivity.this.getResources().getString(R.string.logs_cannot_read));
|
||||||
logs.addAll(Arrays.asList(e.getMessage().split("\n")));
|
if (e.getMessage() != null) {
|
||||||
|
logs.addAll(Arrays.asList(e.getMessage().split("\n")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return logs;
|
return logs;
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,11 @@ public class ModuleScopeActivity extends BaseActivity implements AppAdapter.Call
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private final Handler handler = new Handler();
|
private final Handler handler = new Handler();
|
||||||
private String modulePackageName;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
modulePackageName = getIntent().getStringExtra("modulePackageName");
|
String modulePackageName = getIntent().getStringExtra("modulePackageName");
|
||||||
String moduleName = getIntent().getStringExtra("moduleName");
|
String moduleName = getIntent().getStringExtra("moduleName");
|
||||||
binding = ActivityBlackListBinding.inflate(getLayoutInflater());
|
binding = ActivityBlackListBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
cmp = displayNameComparator;
|
cmp = displayNameComparator;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Collections.sort(fullList, (a, b) -> {
|
fullList.sort((a, b) -> {
|
||||||
boolean aChecked = moduleUtil.isModuleEnabled(a.packageName);
|
boolean aChecked = moduleUtil.isModuleEnabled(a.packageName);
|
||||||
boolean bChecked = moduleUtil.isModuleEnabled(b.packageName);
|
boolean bChecked = moduleUtil.isModuleEnabled(b.packageName);
|
||||||
if (aChecked == bChecked) {
|
if (aChecked == bChecked) {
|
||||||
|
|
@ -202,7 +202,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
DividerItemDecoration.VERTICAL);
|
DividerItemDecoration.VERTICAL);
|
||||||
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
binding.recyclerView.addItemDecoration(dividerItemDecoration);
|
||||||
}
|
}
|
||||||
binding.swipeRefreshLayout.setOnRefreshListener(() -> reloadModules.run());
|
binding.swipeRefreshLayout.setOnRefreshListener(reloadModules::run);
|
||||||
reloadModules.run();
|
reloadModules.run();
|
||||||
mSearchListener = new SearchView.OnQueryTextListener() {
|
mSearchListener = new SearchView.OnQueryTextListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -293,38 +293,37 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||||
Intent intent;
|
Intent intent;
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case R.id.export_enabled_modules:
|
if (itemId == R.id.export_enabled_modules) {
|
||||||
if (ModuleUtil.getInstance().getEnabledModules().isEmpty()) {
|
if (ModuleUtil.getInstance().getEnabledModules().isEmpty()) {
|
||||||
Snackbar.make(binding.snackbar, R.string.no_enabled_modules, Snackbar.LENGTH_SHORT).show();
|
Snackbar.make(binding.snackbar, R.string.no_enabled_modules, Snackbar.LENGTH_SHORT).show();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
intent.setType("text/*");
|
intent.setType("text/*");
|
||||||
intent.putExtra(Intent.EXTRA_TITLE, "enabled_modules.list");
|
intent.putExtra(Intent.EXTRA_TITLE, "enabled_modules.list");
|
||||||
startActivityForResult(intent, 42);
|
startActivityForResult(intent, 42);
|
||||||
return true;
|
return true;
|
||||||
case R.id.export_installed_modules:
|
} else if (itemId == R.id.export_installed_modules) {
|
||||||
Map<String, ModuleUtil.InstalledModule> installedModules = ModuleUtil.getInstance().getModules();
|
Map<String, ModuleUtil.InstalledModule> installedModules = ModuleUtil.getInstance().getModules();
|
||||||
|
|
||||||
if (installedModules.isEmpty()) {
|
if (installedModules.isEmpty()) {
|
||||||
Snackbar.make(binding.snackbar, R.string.no_installed_modules, Snackbar.LENGTH_SHORT).show();
|
Snackbar.make(binding.snackbar, R.string.no_installed_modules, Snackbar.LENGTH_SHORT).show();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
intent.setType("text/*");
|
intent.setType("text/*");
|
||||||
intent.putExtra(Intent.EXTRA_TITLE, "installed_modules.list");
|
intent.putExtra(Intent.EXTRA_TITLE, "installed_modules.list");
|
||||||
startActivityForResult(intent, 43);
|
startActivityForResult(intent, 43);
|
||||||
return true;
|
return true;
|
||||||
case R.id.import_installed_modules:
|
} else if (itemId == R.id.import_installed_modules || itemId == R.id.import_enabled_modules) {
|
||||||
case R.id.import_enabled_modules:
|
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||||
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
intent.setType("*/*");
|
||||||
intent.setType("*/*");
|
startActivityForResult(intent, 44);
|
||||||
startActivityForResult(intent, 44);
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
@ -350,7 +349,6 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
br.close();
|
br.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Snackbar.make(binding.snackbar, e.getLocalizedMessage(), Snackbar.LENGTH_SHORT).show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Module m : list) {
|
for (final Module m : list) {
|
||||||
|
|
@ -396,59 +394,54 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextItemSelected(MenuItem item) {
|
public boolean onContextItemSelected(@NonNull MenuItem item) {
|
||||||
ModuleUtil.InstalledModule module = ModuleUtil.getInstance().getModule(selectedPackageName);
|
ModuleUtil.InstalledModule module = ModuleUtil.getInstance().getModule(selectedPackageName);
|
||||||
if (module == null) {
|
if (module == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (item.getItemId()) {
|
int itemId = item.getItemId();
|
||||||
case R.id.menu_launch:
|
if (itemId == R.id.menu_launch) {
|
||||||
String packageName = module.packageName;
|
String packageName = module.packageName;
|
||||||
if (packageName == null) {
|
if (packageName == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Intent launchIntent = getSettingsIntent(packageName);
|
Intent launchIntent = getSettingsIntent(packageName);
|
||||||
if (launchIntent != null) {
|
if (launchIntent != null) {
|
||||||
startActivity(launchIntent);
|
startActivity(launchIntent);
|
||||||
} else {
|
} else {
|
||||||
Snackbar.make(binding.snackbar, R.string.module_no_ui, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(binding.snackbar, R.string.module_no_ui, Snackbar.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
} else if (itemId == R.id.menu_download_updates) {
|
||||||
case R.id.menu_download_updates:
|
Intent detailsIntent = new Intent(this, DownloadDetailsActivity.class);
|
||||||
Intent detailsIntent = new Intent(this, DownloadDetailsActivity.class);
|
detailsIntent.setData(Uri.fromParts("package", module.packageName, null));
|
||||||
detailsIntent.setData(Uri.fromParts("package", module.packageName, null));
|
startActivity(detailsIntent);
|
||||||
startActivity(detailsIntent);
|
return true;
|
||||||
return true;
|
} else if (itemId == R.id.menu_support) {
|
||||||
|
NavUtil.startURL(this, Uri.parse(RepoDb.getModuleSupport(module.packageName)));
|
||||||
case R.id.menu_support:
|
return true;
|
||||||
NavUtil.startURL(this, Uri.parse(RepoDb.getModuleSupport(module.packageName)));
|
} else if (itemId == R.id.menu_app_store) {
|
||||||
return true;
|
Uri uri = Uri.parse("market://details?id=" + module.packageName);
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
case R.id.menu_app_store:
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
Uri uri = Uri.parse("market://details?id=" + module.packageName);
|
try {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
startActivity(intent);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
} catch (Exception ex) {
|
||||||
try {
|
ex.printStackTrace();
|
||||||
startActivity(intent);
|
}
|
||||||
} catch (Exception ex) {
|
return true;
|
||||||
ex.printStackTrace();
|
} else if (itemId == R.id.menu_app_info) {
|
||||||
}
|
startActivity(new Intent(ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", module.packageName, null)));
|
||||||
return true;
|
return true;
|
||||||
|
} else if (itemId == R.id.menu_uninstall) {
|
||||||
case R.id.menu_app_info:
|
startActivity(new Intent(Intent.ACTION_UNINSTALL_PACKAGE, Uri.fromParts("package", module.packageName, null)));
|
||||||
startActivity(new Intent(ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", module.packageName, null)));
|
return true;
|
||||||
return true;
|
} else if (itemId == R.id.menu_scope) {
|
||||||
|
Intent scopeIntent = new Intent(this, ModuleScopeActivity.class);
|
||||||
case R.id.menu_uninstall:
|
scopeIntent.putExtra("modulePackageName", module.packageName);
|
||||||
startActivity(new Intent(Intent.ACTION_UNINSTALL_PACKAGE, Uri.fromParts("package", module.packageName, null)));
|
scopeIntent.putExtra("moduleName", module.getAppName());
|
||||||
return true;
|
startActivity(scopeIntent);
|
||||||
case R.id.menu_scope:
|
return true;
|
||||||
Intent scopeIntent = new Intent(this, ModuleScopeActivity.class);
|
|
||||||
scopeIntent.putExtra("modulePackageName", module.packageName);
|
|
||||||
scopeIntent.putExtra("moduleName", module.getAppName());
|
|
||||||
startActivity(scopeIntent);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return super.onContextItemSelected(item);
|
return super.onContextItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,14 @@ public class StatusInstallerFragment extends Fragment {
|
||||||
String propState = (String) m.invoke(null, "ro.boot.verifiedbootstate", "");
|
String propState = (String) m.invoke(null, "ro.boot.verifiedbootstate", "");
|
||||||
File fileDmVerityModule = new File("/sys/module/dm_verity");
|
File fileDmVerityModule = new File("/sys/module/dm_verity");
|
||||||
|
|
||||||
boolean verified = !propSystemVerified.equals("0");
|
boolean verified = false;
|
||||||
boolean detected = !propState.isEmpty() || fileDmVerityModule.exists();
|
if (propSystemVerified != null) {
|
||||||
|
verified = !propSystemVerified.equals("0");
|
||||||
|
}
|
||||||
|
boolean detected = false;
|
||||||
|
if (propState != null) {
|
||||||
|
detected = !propState.isEmpty() || fileDmVerityModule.exists();
|
||||||
|
}
|
||||||
|
|
||||||
if (verified) {
|
if (verified) {
|
||||||
binding.dmverity.setText(R.string.verified_boot_active);
|
binding.dmverity.setText(R.string.verified_boot_active);
|
||||||
|
|
|
||||||
|
|
@ -269,48 +269,40 @@ public class AppHelper {
|
||||||
PopupMenu appMenu = new PopupMenu(context, anchor);
|
PopupMenu appMenu = new PopupMenu(context, anchor);
|
||||||
appMenu.inflate(R.menu.menu_app_item);
|
appMenu.inflate(R.menu.menu_app_item);
|
||||||
appMenu.setOnMenuItemClickListener(menuItem -> {
|
appMenu.setOnMenuItemClickListener(menuItem -> {
|
||||||
switch (menuItem.getItemId()) {
|
int itemId = menuItem.getItemId();
|
||||||
case R.id.app_menu_launch:
|
if (itemId == R.id.app_menu_launch) {
|
||||||
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(info.packageName);
|
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(info.packageName);
|
||||||
if (launchIntent != null) {
|
if (launchIntent != null) {
|
||||||
context.startActivity(launchIntent);
|
context.startActivity(launchIntent);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(context, context.getString(R.string.module_no_ui), Toast.LENGTH_LONG).show();
|
Toast.makeText(context, context.getString(R.string.module_no_ui), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
break;
|
} else if (itemId == R.id.app_menu_stop) {
|
||||||
case R.id.app_menu_stop:
|
try {
|
||||||
try {
|
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
Objects.requireNonNull(manager).killBackgroundProcesses(info.packageName);
|
||||||
Objects.requireNonNull(manager).killBackgroundProcesses(info.packageName);
|
} catch (Exception ex) {
|
||||||
} catch (Exception ex) {
|
ex.printStackTrace();
|
||||||
ex.printStackTrace();
|
}
|
||||||
}
|
} else if (itemId == R.id.app_menu_compile_speed) {
|
||||||
break;
|
CompileUtil.compileSpeed(context, fragmentManager, info);
|
||||||
case R.id.app_menu_compile_speed:
|
} else if (itemId == R.id.app_menu_compile_dexopt) {
|
||||||
CompileUtil.compileSpeed(context, fragmentManager, info);
|
CompileUtil.compileDexopt(context, fragmentManager, info);
|
||||||
break;
|
} else if (itemId == R.id.app_menu_compile_reset) {
|
||||||
case R.id.app_menu_compile_dexopt:
|
CompileUtil.reset(context, fragmentManager, info);
|
||||||
CompileUtil.compileDexopt(context, fragmentManager, info);
|
} else if (itemId == R.id.app_menu_store) {
|
||||||
break;
|
Uri uri = Uri.parse("market://details?id=" + info.packageName);
|
||||||
case R.id.app_menu_compile_reset:
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
CompileUtil.reset(context, fragmentManager, info);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
break;
|
try {
|
||||||
case R.id.app_menu_store:
|
context.startActivity(intent);
|
||||||
Uri uri = Uri.parse("market://details?id=" + info.packageName);
|
} catch (Exception ex) {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
ex.printStackTrace();
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
}
|
||||||
try {
|
} else if (itemId == R.id.app_menu_info) {
|
||||||
context.startActivity(intent);
|
context.startActivity(new Intent(ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", info.packageName, null)));
|
||||||
} catch (Exception ex) {
|
} else if (itemId == R.id.app_menu_uninstall) {
|
||||||
ex.printStackTrace();
|
context.startActivity(new Intent(Intent.ACTION_UNINSTALL_PACKAGE, Uri.fromParts("package", info.packageName, null)));
|
||||||
}
|
|
||||||
break;
|
|
||||||
case R.id.app_menu_info:
|
|
||||||
context.startActivity(new Intent(ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", info.packageName, null)));
|
|
||||||
break;
|
|
||||||
case R.id.app_menu_uninstall:
|
|
||||||
context.startActivity(new Intent(Intent.ACTION_UNINSTALL_PACKAGE, Uri.fromParts("package", info.packageName, null)));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
@ -358,6 +350,7 @@ public class AppHelper {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("WorldReadableFiles")
|
||||||
static boolean saveScopeList(String modulePackageName, List<String> list) {
|
static boolean saveScopeList(String modulePackageName, List<String> list) {
|
||||||
File file = new File(BASE_PATH + String.format(SCOPE_LIST_PATH, modulePackageName));
|
File file = new File(BASE_PATH + String.format(SCOPE_LIST_PATH, modulePackageName));
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class BlackListAdapter extends AppAdapter {
|
public class BlackListAdapter extends AppAdapter {
|
||||||
|
|
||||||
private volatile boolean isWhiteListMode;
|
private final boolean isWhiteListMode;
|
||||||
private List<String> checkedList;
|
private List<String> checkedList;
|
||||||
|
|
||||||
public BlackListAdapter(Context context, boolean isWhiteListMode) {
|
public BlackListAdapter(Context context, boolean isWhiteListMode) {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ public abstract class CursorRecyclerViewAdapter<VH extends RecyclerView.ViewHold
|
||||||
|
|
||||||
private int rowIdColumn;
|
private int rowIdColumn;
|
||||||
|
|
||||||
private DataSetObserver dataSetObserver;
|
private final DataSetObserver dataSetObserver;
|
||||||
|
|
||||||
public CursorRecyclerViewAdapter(Cursor cursor) {
|
public CursorRecyclerViewAdapter(Cursor cursor) {
|
||||||
this.cursor = cursor;
|
this.cursor = cursor;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ public final class RepoDb extends SQLiteOpenHelper {
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
private static Context context;
|
private static Context context;
|
||||||
private static SQLiteDatabase db;
|
private static final SQLiteDatabase db;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
RepoDb instance = new RepoDb(XposedApp.getInstance());
|
RepoDb instance = new RepoDb(XposedApp.getInstance());
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class RepoParser {
|
||||||
public final static String TAG = XposedApp.TAG;
|
public final static String TAG = XposedApp.TAG;
|
||||||
private final static String NS = null;
|
private final static String NS = null;
|
||||||
private final XmlPullParser parser;
|
private final XmlPullParser parser;
|
||||||
private RepoParserCallback callback;
|
private final RepoParserCallback callback;
|
||||||
private boolean mRepoEventTriggered = false;
|
private boolean mRepoEventTriggered = false;
|
||||||
|
|
||||||
private RepoParser(InputStream is, RepoParserCallback callback) throws XmlPullParserException, IOException {
|
private RepoParser(InputStream is, RepoParserCallback callback) throws XmlPullParserException, IOException {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,10 @@ public class RepoLoader {
|
||||||
private static RepoLoader instance = null;
|
private static RepoLoader instance = null;
|
||||||
private final List<RepoListener> listeners = new CopyOnWriteArrayList<>();
|
private final List<RepoListener> listeners = new CopyOnWriteArrayList<>();
|
||||||
private final Map<String, ReleaseType> localReleaseTypesCache = new HashMap<>();
|
private final Map<String, ReleaseType> localReleaseTypesCache = new HashMap<>();
|
||||||
private XposedApp app;
|
private final XposedApp app;
|
||||||
private SharedPreferences pref;
|
private final SharedPreferences pref;
|
||||||
private SharedPreferences modulePref;
|
private final SharedPreferences modulePref;
|
||||||
private ConnectivityManager conMgr;
|
private final ConnectivityManager conMgr;
|
||||||
private boolean isLoading = false;
|
private boolean isLoading = false;
|
||||||
private boolean reloadTriggeredOnce = false;
|
private boolean reloadTriggeredOnce = false;
|
||||||
private Map<Long, Repository> repositories = null;
|
private Map<Long, Repository> repositories = null;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import org.meowcat.edxposed.manager.util.NavUtil;
|
||||||
*/
|
*/
|
||||||
public class CustomTabsURLSpan extends URLSpan {
|
public class CustomTabsURLSpan extends URLSpan {
|
||||||
|
|
||||||
private BaseActivity activity;
|
private final BaseActivity activity;
|
||||||
|
|
||||||
CustomTabsURLSpan(BaseActivity activity, String url) {
|
CustomTabsURLSpan(BaseActivity activity, String url) {
|
||||||
super(url);
|
super(url);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import org.meowcat.edxposed.manager.BaseActivity;
|
||||||
*/
|
*/
|
||||||
public class LinkTransformationMethod implements TransformationMethod {
|
public class LinkTransformationMethod implements TransformationMethod {
|
||||||
|
|
||||||
private BaseActivity activity;
|
private final BaseActivity activity;
|
||||||
|
|
||||||
public LinkTransformationMethod(BaseActivity activity) {
|
public LinkTransformationMethod(BaseActivity activity) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public class DownloadView extends LinearLayout {
|
||||||
public Fragment fragment;
|
public Fragment fragment;
|
||||||
private String mUrl = null;
|
private String mUrl = null;
|
||||||
private String mTitle = null;
|
private String mTitle = null;
|
||||||
private DownloadViewBinding binding;
|
private final DownloadViewBinding binding;
|
||||||
|
|
||||||
public DownloadView(Context context, final AttributeSet attrs) {
|
public DownloadView(Context context, final AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
|
@ -38,7 +38,7 @@ public class DownloadView extends LinearLayout {
|
||||||
if (mUrl != null) {
|
if (mUrl != null) {
|
||||||
binding.btnDownload.setVisibility(View.VISIBLE);
|
binding.btnDownload.setVisibility(View.VISIBLE);
|
||||||
binding.txtInfo.setVisibility(View.GONE);
|
binding.txtInfo.setVisibility(View.GONE);
|
||||||
}else {
|
} else {
|
||||||
binding.btnDownload.setVisibility(View.GONE);
|
binding.btnDownload.setVisibility(View.GONE);
|
||||||
binding.txtInfo.setVisibility(View.VISIBLE);
|
binding.txtInfo.setVisibility(View.VISIBLE);
|
||||||
binding.txtInfo.setText(R.string.download_view_no_url);
|
binding.txtInfo.setText(R.string.download_view_no_url);
|
||||||
|
|
|
||||||
|
|
@ -310,4 +310,5 @@
|
||||||
<string name="settings_summary_hide_edxposed_manager">防止软件检测到 EdXposed Manager\n注:模块可能无法正常打开 EdXposed Manager 界面,系统中关于 EdXposed Manager 的一些功能可能无法正常使用</string>
|
<string name="settings_summary_hide_edxposed_manager">防止软件检测到 EdXposed Manager\n注:模块可能无法正常打开 EdXposed Manager 界面,系统中关于 EdXposed Manager 的一些功能可能无法正常使用</string>
|
||||||
<string name="settings_title_disable_hidden_api_bypass">禁用绕过隐藏 API 的限制</string>
|
<string name="settings_title_disable_hidden_api_bypass">禁用绕过隐藏 API 的限制</string>
|
||||||
<string name="settings_summary_disable_hidden_api_bypass">禁用绕过隐藏 API 的限制将会通过某些检测(如Snapchat)\n<b>警告:</b> 启用此选项可能会使某些功能无法正常工作,或出现一些其他问题</string>
|
<string name="settings_summary_disable_hidden_api_bypass">禁用绕过隐藏 API 的限制将会通过某些检测(如Snapchat)\n<b>警告:</b> 启用此选项可能会使某些功能无法正常工作,或出现一些其他问题</string>
|
||||||
|
<string name="menu_scope">作用域</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue