Fix warnings

This commit is contained in:
NekoInverter 2020-11-21 21:21:43 +08:00
parent 4782223dea
commit 16f34412fd
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
19 changed files with 218 additions and 227 deletions

View File

@ -28,13 +28,13 @@ public class BlackListActivity extends BaseActivity implements AppAdapter.Callba
private SearchView.OnQueryTextListener searchListener;
private ActivityBlackListBinding binding;
private Runnable runnable = new Runnable() {
private final Runnable runnable = new Runnable() {
@Override
public void run() {
binding.swipeRefreshLayout.setRefreshing(true);
}
};
private Handler handler = new Handler();
private final Handler handler = new Handler();
private boolean isCompat;
@Override
@ -129,12 +129,7 @@ public class BlackListActivity extends BaseActivity implements AppAdapter.Callba
handler.removeCallbacks(runnable);
binding.swipeRefreshLayout.setRefreshing(false);
String queryStr = searchView != null ? searchView.getQuery().toString() : "";
runOnUiThread(new Runnable() {
@Override
public void run() {
appAdapter.getFilter().filter(queryStr);
}
});
runOnUiThread(() -> appAdapter.getFilter().filter(queryStr));
}
@Override

View File

@ -110,7 +110,6 @@ public class CompileDialogFragment extends AppCompatDialogFragment {
List<String> stdout = new ArrayList<>();
List<String> stderr = new ArrayList<>();
Shell.Result result = Shell.su(commands).to(stdout, stderr).exec();
List<String> ret;
if (stderr.size() > 0) {
return "Error: " + TextUtils.join("\n", stderr);
} else if (!result.isSuccess()) { // they might don't write to stderr

View File

@ -50,7 +50,7 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
private SearchView searchView;
private SharedPreferences ignoredUpdatesPref;
private boolean changed = false;
private BroadcastReceiver connectionListener = new BroadcastReceiver() {
private final BroadcastReceiver connectionListener = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
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 DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.SHORT);
private final SharedPreferences prefs;
private String[] sectionHeaders;
private final String[] sectionHeaders;
DownloadsAdapter(Context context, Cursor cursor) {
super(cursor);
@ -288,17 +288,15 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
}
@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);
return new RecyclerView.ViewHolder(view) {
};
return new HeaderViewHolder(view);
}
@Override
public void onBindHeaderViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
public void onBindHeaderViewHolder(HeaderViewHolder viewHolder, int position) {
long section = getHeaderId(position);
TextView tv = viewHolder.itemView.findViewById(android.R.id.title);
tv.setText(sectionHeaders[(int) section]);
viewHolder.title.setText(sectionHeaders[(int) section]);
}
@NonNull
@ -373,6 +371,15 @@ public class DownloadActivity extends BaseActivity implements RepoLoader.RepoLis
timestamps = binding.timestamps;
}
}
class HeaderViewHolder extends RecyclerView.ViewHolder {
TextView title;
HeaderViewHolder(View view) {
super(view);
title = findViewById(android.R.id.title);
}
}
}
}

View File

@ -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_LINK = "https://play.google.com/store/apps/details?id=%s";
private static final String TAG = "DownloadDetailsActivity";
private static RepoLoader repoLoader = RepoLoader.getInstance();
private static ModuleUtil moduleUtil = ModuleUtil.getInstance();
private static final RepoLoader repoLoader = RepoLoader.getInstance();
private static final ModuleUtil moduleUtil = ModuleUtil.getInstance();
private String packageName;
private Module module;
private ModuleUtil.InstalledModule installedModule;
@ -179,45 +179,44 @@ public class DownloadDetailsActivity extends BaseActivity implements RepoLoader.
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_refresh:
RepoLoader.getInstance().triggerReload(true);
return true;
case R.id.menu_share:
String text = module.name + " - ";
int itemId = item.getItemId();
if (itemId == R.id.menu_refresh) {
RepoLoader.getInstance().triggerReload(true);
return true;
} else if (itemId == R.id.menu_share) {
String text = module.name + " - ";
if (isPackageInstalled(packageName, this)) {
String s = getPackageManager().getInstallerPackageName(packageName);
boolean playStore;
if (isPackageInstalled(packageName, this)) {
String s = getPackageManager().getInstallerPackageName(packageName);
boolean playStore;
try {
playStore = s.equals(PLAY_STORE_PACKAGE);
} catch (NullPointerException e) {
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);
try {
playStore = PLAY_STORE_PACKAGE.equals(s);
} catch (NullPointerException e) {
playStore = false;
}
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_TEXT, text);
startActivity(Intent.createChooser(sharingIntent, getString(R.string.share)));
return true;
case R.id.ignoreUpdate:
SharedPreferences prefs = getSharedPreferences("update_ignored", MODE_PRIVATE);
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);
}
boolean ignored = prefs.getBoolean(module.packageName, false);
prefs.edit().putBoolean(module.packageName, !ignored).apply();
item.setChecked(!ignored);
break;
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_TEXT, text);
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);
}
@ -234,7 +233,7 @@ public class DownloadDetailsActivity extends BaseActivity implements RepoLoader.
class SwipeFragmentPagerAdapter extends FragmentPagerAdapter {
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) {
super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);

View File

@ -41,13 +41,13 @@ import java.util.Scanner;
public class LogsActivity extends BaseActivity {
private boolean allLog = false;
private File fileErrorLog = new File(XposedApp.BASE_DIR + "log/error.log");
private File fileErrorLogOld = new File(
private final File fileErrorLog = new File(XposedApp.BASE_DIR + "log/error.log");
private final File fileErrorLogOld = new File(
XposedApp.BASE_DIR + "log/error.log.old");
private 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 fileAllLog = new File(XposedApp.BASE_DIR + "log/all.log");
private final File fileAllLogOld = new File(XposedApp.BASE_DIR + "log/all.log.old");
private LogsAdapter adapter;
private Handler handler = new Handler();
private final Handler handler = new Handler();
private ActivityLogsBinding binding;
@Override
@ -115,29 +115,27 @@ public class LogsActivity extends BaseActivity {
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_scroll_top:
scrollTop();
break;
case R.id.menu_scroll_down:
scrollDown();
break;
case R.id.menu_refresh:
reloadErrorLog();
return true;
case R.id.menu_send:
try {
send();
} catch (Exception e) {
Snackbar.make(binding.snackbar, e.getLocalizedMessage(), Snackbar.LENGTH_LONG).show();
}
return true;
case R.id.menu_save:
save();
return true;
case R.id.menu_clear:
clear();
return true;
int itemId = item.getItemId();
if (itemId == R.id.menu_scroll_top) {
scrollTop();
} else if (itemId == R.id.menu_scroll_down) {
scrollDown();
} else if (itemId == R.id.menu_refresh) {
reloadErrorLog();
return true;
} else if (itemId == R.id.menu_send) {
try {
send();
} catch (Exception e) {
e.printStackTrace();
}
return true;
} else if (itemId == R.id.menu_save) {
save();
return true;
} else if (itemId == R.id.menu_clear) {
clear();
return true;
}
return super.onOptionsItemSelected(item);
}
@ -225,7 +223,7 @@ public class LogsActivity extends BaseActivity {
@SuppressLint("StaticFieldLeak")
private class LogsReader extends AsyncTask<File, Integer, ArrayList<String>> {
private AlertDialog mProgressDialog;
private Runnable mRunnable = new Runnable() {
private final Runnable mRunnable = new Runnable() {
@Override
public void run() {
mProgressDialog.show();
@ -256,7 +254,9 @@ public class LogsActivity extends BaseActivity {
return logs;
} catch (IOException e) {
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;

View File

@ -31,12 +31,11 @@ public class ModuleScopeActivity extends BaseActivity implements AppAdapter.Call
}
};
private final Handler handler = new Handler();
private String modulePackageName;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
modulePackageName = getIntent().getStringExtra("modulePackageName");
String modulePackageName = getIntent().getStringExtra("modulePackageName");
String moduleName = getIntent().getStringExtra("moduleName");
binding = ActivityBlackListBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());

View File

@ -144,7 +144,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
cmp = displayNameComparator;
break;
}
Collections.sort(fullList, (a, b) -> {
fullList.sort((a, b) -> {
boolean aChecked = moduleUtil.isModuleEnabled(a.packageName);
boolean bChecked = moduleUtil.isModuleEnabled(b.packageName);
if (aChecked == bChecked) {
@ -202,7 +202,7 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
DividerItemDecoration.VERTICAL);
binding.recyclerView.addItemDecoration(dividerItemDecoration);
}
binding.swipeRefreshLayout.setOnRefreshListener(() -> reloadModules.run());
binding.swipeRefreshLayout.setOnRefreshListener(reloadModules::run);
reloadModules.run();
mSearchListener = new SearchView.OnQueryTextListener() {
@Override
@ -293,38 +293,37 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
Intent intent;
switch (item.getItemId()) {
case R.id.export_enabled_modules:
if (ModuleUtil.getInstance().getEnabledModules().isEmpty()) {
Snackbar.make(binding.snackbar, R.string.no_enabled_modules, Snackbar.LENGTH_SHORT).show();
return false;
}
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("text/*");
intent.putExtra(Intent.EXTRA_TITLE, "enabled_modules.list");
startActivityForResult(intent, 42);
return true;
case R.id.export_installed_modules:
Map<String, ModuleUtil.InstalledModule> installedModules = ModuleUtil.getInstance().getModules();
int itemId = item.getItemId();
if (itemId == R.id.export_enabled_modules) {
if (ModuleUtil.getInstance().getEnabledModules().isEmpty()) {
Snackbar.make(binding.snackbar, R.string.no_enabled_modules, Snackbar.LENGTH_SHORT).show();
return false;
}
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("text/*");
intent.putExtra(Intent.EXTRA_TITLE, "enabled_modules.list");
startActivityForResult(intent, 42);
return true;
} else if (itemId == R.id.export_installed_modules) {
Map<String, ModuleUtil.InstalledModule> installedModules = ModuleUtil.getInstance().getModules();
if (installedModules.isEmpty()) {
Snackbar.make(binding.snackbar, R.string.no_installed_modules, Snackbar.LENGTH_SHORT).show();
return false;
}
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("text/*");
intent.putExtra(Intent.EXTRA_TITLE, "installed_modules.list");
startActivityForResult(intent, 43);
return true;
case R.id.import_installed_modules:
case R.id.import_enabled_modules:
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(intent, 44);
return true;
if (installedModules.isEmpty()) {
Snackbar.make(binding.snackbar, R.string.no_installed_modules, Snackbar.LENGTH_SHORT).show();
return false;
}
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("text/*");
intent.putExtra(Intent.EXTRA_TITLE, "installed_modules.list");
startActivityForResult(intent, 43);
return true;
} else if (itemId == R.id.import_installed_modules || itemId == R.id.import_enabled_modules) {
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(intent, 44);
return true;
}
return super.onOptionsItemSelected(item);
}
@ -350,7 +349,6 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
br.close();
} catch (Exception e) {
e.printStackTrace();
Snackbar.make(binding.snackbar, e.getLocalizedMessage(), Snackbar.LENGTH_SHORT).show();
}
for (final Module m : list) {
@ -396,59 +394,54 @@ public class ModulesActivity extends BaseActivity implements ModuleUtil.ModuleLi
}
@Override
public boolean onContextItemSelected(MenuItem item) {
public boolean onContextItemSelected(@NonNull MenuItem item) {
ModuleUtil.InstalledModule module = ModuleUtil.getInstance().getModule(selectedPackageName);
if (module == null) {
return false;
}
switch (item.getItemId()) {
case R.id.menu_launch:
String packageName = module.packageName;
if (packageName == null) {
return false;
}
Intent launchIntent = getSettingsIntent(packageName);
if (launchIntent != null) {
startActivity(launchIntent);
} else {
Snackbar.make(binding.snackbar, R.string.module_no_ui, Snackbar.LENGTH_LONG).show();
}
return true;
case R.id.menu_download_updates:
Intent detailsIntent = new Intent(this, DownloadDetailsActivity.class);
detailsIntent.setData(Uri.fromParts("package", module.packageName, null));
startActivity(detailsIntent);
return true;
case R.id.menu_support:
NavUtil.startURL(this, Uri.parse(RepoDb.getModuleSupport(module.packageName)));
return true;
case R.id.menu_app_store:
Uri uri = Uri.parse("market://details?id=" + module.packageName);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
startActivity(intent);
} catch (Exception ex) {
ex.printStackTrace();
}
return true;
case R.id.menu_app_info:
startActivity(new Intent(ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", module.packageName, null)));
return true;
case R.id.menu_uninstall:
startActivity(new Intent(Intent.ACTION_UNINSTALL_PACKAGE, Uri.fromParts("package", module.packageName, null)));
return true;
case R.id.menu_scope:
Intent scopeIntent = new Intent(this, ModuleScopeActivity.class);
scopeIntent.putExtra("modulePackageName", module.packageName);
scopeIntent.putExtra("moduleName", module.getAppName());
startActivity(scopeIntent);
return true;
int itemId = item.getItemId();
if (itemId == R.id.menu_launch) {
String packageName = module.packageName;
if (packageName == null) {
return false;
}
Intent launchIntent = getSettingsIntent(packageName);
if (launchIntent != null) {
startActivity(launchIntent);
} else {
Snackbar.make(binding.snackbar, R.string.module_no_ui, Snackbar.LENGTH_LONG).show();
}
return true;
} else if (itemId == R.id.menu_download_updates) {
Intent detailsIntent = new Intent(this, DownloadDetailsActivity.class);
detailsIntent.setData(Uri.fromParts("package", module.packageName, null));
startActivity(detailsIntent);
return true;
} else if (itemId == R.id.menu_support) {
NavUtil.startURL(this, Uri.parse(RepoDb.getModuleSupport(module.packageName)));
return true;
} else if (itemId == R.id.menu_app_store) {
Uri uri = Uri.parse("market://details?id=" + module.packageName);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
startActivity(intent);
} catch (Exception ex) {
ex.printStackTrace();
}
return true;
} else if (itemId == R.id.menu_app_info) {
startActivity(new Intent(ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", module.packageName, null)));
return true;
} else if (itemId == R.id.menu_uninstall) {
startActivity(new Intent(Intent.ACTION_UNINSTALL_PACKAGE, Uri.fromParts("package", module.packageName, null)));
return true;
} else if (itemId == R.id.menu_scope) {
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);
}

View File

@ -135,8 +135,14 @@ public class StatusInstallerFragment extends Fragment {
String propState = (String) m.invoke(null, "ro.boot.verifiedbootstate", "");
File fileDmVerityModule = new File("/sys/module/dm_verity");
boolean verified = !propSystemVerified.equals("0");
boolean detected = !propState.isEmpty() || fileDmVerityModule.exists();
boolean verified = false;
if (propSystemVerified != null) {
verified = !propSystemVerified.equals("0");
}
boolean detected = false;
if (propState != null) {
detected = !propState.isEmpty() || fileDmVerityModule.exists();
}
if (verified) {
binding.dmverity.setText(R.string.verified_boot_active);

View File

@ -269,48 +269,40 @@ public class AppHelper {
PopupMenu appMenu = new PopupMenu(context, anchor);
appMenu.inflate(R.menu.menu_app_item);
appMenu.setOnMenuItemClickListener(menuItem -> {
switch (menuItem.getItemId()) {
case R.id.app_menu_launch:
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(info.packageName);
if (launchIntent != null) {
context.startActivity(launchIntent);
} else {
Toast.makeText(context, context.getString(R.string.module_no_ui), Toast.LENGTH_LONG).show();
}
break;
case R.id.app_menu_stop:
try {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
Objects.requireNonNull(manager).killBackgroundProcesses(info.packageName);
} catch (Exception ex) {
ex.printStackTrace();
}
break;
case R.id.app_menu_compile_speed:
CompileUtil.compileSpeed(context, fragmentManager, info);
break;
case R.id.app_menu_compile_dexopt:
CompileUtil.compileDexopt(context, fragmentManager, info);
break;
case R.id.app_menu_compile_reset:
CompileUtil.reset(context, fragmentManager, info);
break;
case R.id.app_menu_store:
Uri uri = Uri.parse("market://details?id=" + info.packageName);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
context.startActivity(intent);
} catch (Exception ex) {
ex.printStackTrace();
}
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;
int itemId = menuItem.getItemId();
if (itemId == R.id.app_menu_launch) {
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(info.packageName);
if (launchIntent != null) {
context.startActivity(launchIntent);
} else {
Toast.makeText(context, context.getString(R.string.module_no_ui), Toast.LENGTH_LONG).show();
}
} else if (itemId == R.id.app_menu_stop) {
try {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
Objects.requireNonNull(manager).killBackgroundProcesses(info.packageName);
} catch (Exception ex) {
ex.printStackTrace();
}
} else if (itemId == R.id.app_menu_compile_speed) {
CompileUtil.compileSpeed(context, fragmentManager, info);
} else if (itemId == R.id.app_menu_compile_dexopt) {
CompileUtil.compileDexopt(context, fragmentManager, info);
} else if (itemId == R.id.app_menu_compile_reset) {
CompileUtil.reset(context, fragmentManager, info);
} else if (itemId == R.id.app_menu_store) {
Uri uri = Uri.parse("market://details?id=" + info.packageName);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
context.startActivity(intent);
} catch (Exception ex) {
ex.printStackTrace();
}
} else if (itemId == R.id.app_menu_info) {
context.startActivity(new Intent(ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", info.packageName, null)));
} else if (itemId == R.id.app_menu_uninstall) {
context.startActivity(new Intent(Intent.ACTION_UNINSTALL_PACKAGE, Uri.fromParts("package", info.packageName, null)));
}
return true;
});
@ -358,6 +350,7 @@ public class AppHelper {
return s;
}
@SuppressLint("WorldReadableFiles")
static boolean saveScopeList(String modulePackageName, List<String> list) {
File file = new File(BASE_PATH + String.format(SCOPE_LIST_PATH, modulePackageName));
try {

View File

@ -15,7 +15,7 @@ import java.util.List;
public class BlackListAdapter extends AppAdapter {
private volatile boolean isWhiteListMode;
private final boolean isWhiteListMode;
private List<String> checkedList;
public BlackListAdapter(Context context, boolean isWhiteListMode) {

View File

@ -14,7 +14,7 @@ public abstract class CursorRecyclerViewAdapter<VH extends RecyclerView.ViewHold
private int rowIdColumn;
private DataSetObserver dataSetObserver;
private final DataSetObserver dataSetObserver;
public CursorRecyclerViewAdapter(Cursor cursor) {
this.cursor = cursor;

View File

@ -37,7 +37,7 @@ public final class RepoDb extends SQLiteOpenHelper {
@SuppressLint("StaticFieldLeak")
private static Context context;
private static SQLiteDatabase db;
private static final SQLiteDatabase db;
static {
RepoDb instance = new RepoDb(XposedApp.getInstance());

View File

@ -33,7 +33,7 @@ public class RepoParser {
public final static String TAG = XposedApp.TAG;
private final static String NS = null;
private final XmlPullParser parser;
private RepoParserCallback callback;
private final RepoParserCallback callback;
private boolean mRepoEventTriggered = false;
private RepoParser(InputStream is, RepoParserCallback callback) throws XmlPullParserException, IOException {

View File

@ -7,7 +7,6 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.Log;
import android.widget.Toast;

View File

@ -49,10 +49,10 @@ public class RepoLoader {
private static RepoLoader instance = null;
private final List<RepoListener> listeners = new CopyOnWriteArrayList<>();
private final Map<String, ReleaseType> localReleaseTypesCache = new HashMap<>();
private XposedApp app;
private SharedPreferences pref;
private SharedPreferences modulePref;
private ConnectivityManager conMgr;
private final XposedApp app;
private final SharedPreferences pref;
private final SharedPreferences modulePref;
private final ConnectivityManager conMgr;
private boolean isLoading = false;
private boolean reloadTriggeredOnce = false;
private Map<Long, Repository> repositories = null;

View File

@ -11,7 +11,7 @@ import org.meowcat.edxposed.manager.util.NavUtil;
*/
public class CustomTabsURLSpan extends URLSpan {
private BaseActivity activity;
private final BaseActivity activity;
CustomTabsURLSpan(BaseActivity activity, String url) {
super(url);

View File

@ -16,7 +16,7 @@ import org.meowcat.edxposed.manager.BaseActivity;
*/
public class LinkTransformationMethod implements TransformationMethod {
private BaseActivity activity;
private final BaseActivity activity;
public LinkTransformationMethod(BaseActivity activity) {
this.activity = activity;

View File

@ -17,7 +17,7 @@ public class DownloadView extends LinearLayout {
public Fragment fragment;
private String mUrl = null;
private String mTitle = null;
private DownloadViewBinding binding;
private final DownloadViewBinding binding;
public DownloadView(Context context, final AttributeSet attrs) {
super(context, attrs);
@ -38,7 +38,7 @@ public class DownloadView extends LinearLayout {
if (mUrl != null) {
binding.btnDownload.setVisibility(View.VISIBLE);
binding.txtInfo.setVisibility(View.GONE);
}else {
} else {
binding.btnDownload.setVisibility(View.GONE);
binding.txtInfo.setVisibility(View.VISIBLE);
binding.txtInfo.setText(R.string.download_view_no_url);

View File

@ -310,4 +310,5 @@
<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_summary_disable_hidden_api_bypass">禁用绕过隐藏 API 的限制将会通过某些检测如Snapchat\n<b>警告:</b> 启用此选项可能会使某些功能无法正常工作,或出现一些其他问题</string>
<string name="menu_scope">作用域</string>
</resources>