diff --git a/app/src/main/java/com/sevtinge/hyperceiler/data/LocationData.java b/app/src/main/java/com/sevtinge/hyperceiler/data/LocationData.java index 161c00ef5a..38f4e1c16f 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/data/LocationData.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/data/LocationData.java @@ -109,6 +109,6 @@ public void setRemarks(String remarks) { } public String toString() { - return String.valueOf(Latitude) + "," + String.valueOf(Longitude) + "," + String.valueOf(Offset) + "," + String.valueOf(RegionCode) + "," + String.valueOf(BaseStationCode) + "," + Remarks; + return Latitude + "," + Longitude + "," + Offset + "," + RegionCode + "," + BaseStationCode + "," + Remarks; } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/data/adapter/AppDataAdapter.java b/app/src/main/java/com/sevtinge/hyperceiler/data/adapter/AppDataAdapter.java index 400bab8bbc..ad3194bac7 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/data/adapter/AppDataAdapter.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/data/adapter/AppDataAdapter.java @@ -75,7 +75,7 @@ public View getView(int position, @Nullable View convertView, @NonNull ViewGroup assert appInfo != null; if (mMode == AppPicker.INPUT_MODE) { String edit = getEdit(appInfo.packageName); - if (!edit.equals("")) { + if (!edit.isEmpty()) { appName.setText(edit); } else { appName.setText(appInfo.label); @@ -105,7 +105,7 @@ public String getEdit(String packageName) { } } } - if (string2 != null && !string2.equals("")) { + if (string2 != null && !string2.isEmpty()) { for (int i = 0; i < appLists.size(); i++) { AppArrayList arrayList = appLists.get(i); if (arrayList.mPackageName.equals(packageName)) { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/base/tool/HookTool.java b/app/src/main/java/com/sevtinge/hyperceiler/module/base/tool/HookTool.java index b39912a864..9649ea0aa2 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/base/tool/HookTool.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/base/tool/HookTool.java @@ -271,7 +271,7 @@ public boolean hookAllMethodsBoolean(String className, String methodName, Method try { Class hookClass = findClassIfExists(className); if (hookClass != null) { - return XposedBridge.hookAllMethods(hookClass, methodName, callback).size() > 0; + return !XposedBridge.hookAllMethods(hookClass, methodName, callback).isEmpty(); } } catch (Throwable ignored) { return false; @@ -282,7 +282,7 @@ public boolean hookAllMethodsBoolean(String className, String methodName, Method public boolean hookAllMethodsBoolean(Class hookClass, String methodName, MethodHook callback) { try { if (hookClass != null) { - return XposedBridge.hookAllMethods(hookClass, methodName, callback).size() > 0; + return !XposedBridge.hookAllMethods(hookClass, methodName, callback).isEmpty(); } return false; } catch (Throwable t) { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/calendar/UnlockSubscription.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/calendar/UnlockSubscription.java index 34272236e0..5c33db7691 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/calendar/UnlockSubscription.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/calendar/UnlockSubscription.java @@ -1,11 +1,5 @@ package com.sevtinge.hyperceiler.module.hook.calendar; -import static de.robv.android.xposed.XposedHelpers.callStaticMethod; - -import android.content.Context; -import android.content.SharedPreferences; -import android.preference.PreferenceManager; - import com.sevtinge.hyperceiler.module.base.BaseHook; import com.sevtinge.hyperceiler.module.base.dexkit.DexKit; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/contentextension/LinkOpenMode.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/contentextension/LinkOpenMode.java index d03c1e1dbb..9c12e26d76 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/contentextension/LinkOpenMode.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/contentextension/LinkOpenMode.java @@ -88,7 +88,7 @@ private String getDefaultBrowserApp(Context context) { Uri uri = Uri.parse("http://"); intent.setDataAndType(uri, null); List resolveInfoList = context.getPackageManager().queryIntentActivities(intent, PackageManager.GET_INTENT_FILTERS); - if (resolveInfoList.size() > 0) { + if (!resolveInfoList.isEmpty()) { ActivityInfo activityInfo = resolveInfoList.get(0).activityInfo; return activityInfo.packageName; } else { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/gallery/UnPrivacyWatermark.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/gallery/UnPrivacyWatermark.java index 3b8cf39a71..e24765f810 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/gallery/UnPrivacyWatermark.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/gallery/UnPrivacyWatermark.java @@ -84,9 +84,8 @@ public void drawWatermark(Canvas canvas, String text, int mWidth, int mHeight, i float max = (float) ((Math.max(i6 / mHeight, mHeight / i6) * Math.sin(abs)) + 1.0d); if (angle != 90) { if (angle == 180) { - float f3 = mHeight; - i4 = (int) (max * f3); - canvas.translate(i6 - height2, f3 - height3); + i4 = (int) (max * (float) mHeight); + canvas.translate(i6 - height2, (float) mHeight - height3); } else if (angle == 270) { float f4 = i6; i4 = (int) (max * f4); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/title/IconTitleCustomization.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/title/IconTitleCustomization.java index cf9fe30592..bb305d9f22 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/title/IconTitleCustomization.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/home/title/IconTitleCustomization.java @@ -162,7 +162,7 @@ public void modifyTitle(Object thisObject) { // String actName = (String) XposedHelpers.callMethod(thisObject, "getClassName"); // UserHandle user = (UserHandle) XposedHelpers.getObjectField(thisObject, "user"); String newTitle = (String) getAppName(pkgName); - if (newTitle != null && !newTitle.equals("")) + if (newTitle != null && !newTitle.isEmpty()) XposedHelpers.setObjectField(thisObject, "mLabel", newTitle); } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/AddSideBarExpandReceiver.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/AddSideBarExpandReceiver.java index 657953eb71..cf821b869b 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/AddSideBarExpandReceiver.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/sidebar/AddSideBarExpandReceiver.java @@ -60,7 +60,6 @@ protected void after(MethodHookParam param) throws Throwable { View view = (View) param.args[0]; if (originDockLocation == -1) { originDockLocation = view.getContext().getSharedPreferences("sp_video_box", 0).getInt("dock_line_location", 0); - ; } BroadcastReceiver showReceiver = new BroadcastReceiver() { @Override diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/VolumeSeparateControl.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/VolumeSeparateControl.java index 84bf9c3b6d..4d6d73de53 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/VolumeSeparateControl.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/VolumeSeparateControl.java @@ -70,11 +70,10 @@ protected void before(MethodHookParam param) throws Throwable { Set DEVICE_OUT_ALL = (Set) XposedHelpers.getStaticObjectField(audioSystem, "DEVICE_OUT_ALL_SET"); int DEVICE_OUT_DEFAULT = XposedHelpers.getStaticIntField(audioSystem, "DEVICE_OUT_DEFAULT"); int[] DEFAULT_STREAM_VOLUME = (int[]) XposedHelpers.getStaticObjectField(audioSystem, "DEFAULT_STREAM_VOLUME"); - Set remainingDevices = DEVICE_OUT_ALL; Object mContentResolver = XposedHelpers.getObjectField(XposedHelpers.getSurroundingThis(param.thisObject), "mContentResolver"); SparseIntArray mIndexMap = (SparseIntArray) XposedHelpers.getObjectField(param.thisObject, "mIndexMap"); - for (Integer deviceType : remainingDevices) { + for (Integer deviceType : DEVICE_OUT_ALL) { int device = deviceType; String name = (String) XposedHelpers.callMethod(param.thisObject, "getSettingNameForDevice", device); int index = (int) XposedHelpers.callStaticMethod(Settings.System.class, "getIntForUser", mContentResolver, name, device == DEVICE_OUT_DEFAULT ? DEFAULT_STREAM_VOLUME[mStreamType] : -1, -2); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/display/ToastTime.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/display/ToastTime.java index 38c987b705..fddbaa8e54 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/display/ToastTime.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemframework/display/ToastTime.java @@ -41,7 +41,7 @@ protected void after(MethodHookParam param) { Context mContext = (Context) XposedHelpers.callMethod(param.thisObject, "getContext"); Handler mHandler = (Handler) XposedHelpers.getObjectField(param.thisObject, "mHandler"); ArrayList mToastQueue = (ArrayList) XposedHelpers.getObjectField(param.thisObject, "mToastQueue"); - if (mContext == null || mHandler == null || mToastQueue == null || mToastQueue.size() == 0) + if (mContext == null || mHandler == null || mToastQueue == null || mToastQueue.isEmpty()) return; int mod = (PrefsUtils.getSharedIntPrefs(mContext, "system_ui_display_toast_times", 0) - 4) * 1000; for (Object record : mToastQueue) diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/QSGridLabels.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/QSGridLabels.java index ab6a6e7c64..62276dd0d2 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/QSGridLabels.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/controlcenter/QSGridLabels.java @@ -47,7 +47,7 @@ protected void before(MethodHookParam param) throws Throwable { ArrayList mPages = (ArrayList) XposedHelpers.getObjectField(param.thisObject, "mPages"); if (mPages == null) return; int mRows = 0; - if (mPages.size() > 0) mRows = XposedHelpers.getIntField(mPages.get(0), "mRows"); + if (!mPages.isEmpty()) mRows = XposedHelpers.getIntField(mPages.get(0), "mRows"); updateLabelsVisibility(param.args[0], mRows, ((ViewGroup) param.thisObject).getResources().getConfiguration().orientation); } }); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/statusbar/model/DualRowSignalHook.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/statusbar/model/DualRowSignalHook.java index 7eb466bc14..9f47e81523 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/statusbar/model/DualRowSignalHook.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/statusbar/model/DualRowSignalHook.java @@ -74,14 +74,14 @@ protected void after(MethodHookParam param) throws Throwable { for (int slot = 1; slot <= 2; slot++) { for (int lvl = 0; lvl <= 5; lvl++) { for (String colorMode : colorModeList) { - String colorModeEq = !colorMode.equals("") ? ("_" + colorMode) : ""; + String colorModeEq = !colorMode.isEmpty() ? ("_" + colorMode) : ""; if (selectedIconTheme == 1) { String dualIconResName = "statusbar_signal_classic_" + slot + "_" + lvl + colorModeEq; int iconResId = modRes.getIdentifier(dualIconResName, "drawable", ProjectApi.mAppModulePkg); dualSignalResMap.put(dualIconResName, iconResId); } else if (selectedIconTheme == 2) { if (!selectedIconStyle.equals("theme") || !colorMode.equals("tint")) { - String dualIconResName = "statusbar_signal_oa_" + slot + "_" + lvl + colorModeEq + (!selectedIconStyle.equals("") ? ("_" + selectedIconStyle) : ""); + String dualIconResName = "statusbar_signal_oa_" + slot + "_" + lvl + colorModeEq + (!selectedIconStyle.isEmpty() ? ("_" + selectedIconStyle) : ""); int iconResId = modRes.getIdentifier(dualIconResName, "drawable", ProjectApi.mAppModulePkg); dualSignalResMap.put(dualIconResName, iconResId); } @@ -231,7 +231,7 @@ protected void before(final MethodHookParam param) { colorMode = "_dark"; } String iconStyle = ""; - if (!selectedIconStyle.equals("")) { + if (!selectedIconStyle.isEmpty()) { iconStyle = "_" + selectedIconStyle; } String sim1IconId; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/various/ClipboardList.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/various/ClipboardList.java index 86877b50fc..2279d0862d 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/various/ClipboardList.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/various/ClipboardList.java @@ -104,7 +104,7 @@ protected void before(MethodHookParam param) { /*获取原始list数据内容*/ ArrayList jsonToBean = jsonToBean((String) param.args[1], classLoader); // logE(TAG, "get: " + listToJson(jsonToBean)); - if (jsonToBean.size() == 0) { + if (jsonToBean.isEmpty()) { /*防止在数据为空时误删数据库数据*/ // resetFile(); lastArray = new ArrayList<>(); @@ -321,11 +321,10 @@ public JSONArray readFile(String path) { builder.append(line); } String jsonString = builder.toString(); - if ("".equals(jsonString)) { + if (jsonString.isEmpty()) { jsonString = "[]"; } - JSONArray jsonArray = new JSONArray(jsonString); - return jsonArray; + return new JSONArray(jsonString); } catch (IOException | JSONException e) { logE(TAG, "readFile: " + e); } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/prefs/RecommendPreference.java b/app/src/main/java/com/sevtinge/hyperceiler/prefs/RecommendPreference.java index 1ee2d96df8..5aa42f9342 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/prefs/RecommendPreference.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/prefs/RecommendPreference.java @@ -4,12 +4,10 @@ import android.content.Intent; import android.graphics.Color; import android.os.Bundle; -import android.text.SpannableString; import android.text.TextUtils; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/safe/CrashReportActivity.java b/app/src/main/java/com/sevtinge/hyperceiler/safe/CrashReportActivity.java index f9f09e9bbe..e4a3530f8a 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/safe/CrashReportActivity.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/safe/CrashReportActivity.java @@ -18,7 +18,6 @@ import java.util.Arrays; import java.util.HashMap; -import moralnorm.appcompat.app.AlertDialog; import moralnorm.appcompat.app.AppCompatActivity; public class CrashReportActivity extends AppCompatActivity { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/MainActivityContextHelper.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/MainActivityContextHelper.java index 25048c32c9..0230ae7eae 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/MainActivityContextHelper.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/MainActivityContextHelper.java @@ -18,28 +18,19 @@ */ package com.sevtinge.hyperceiler.ui; -import static com.sevtinge.hyperceiler.utils.devicesdk.DeviceSDKKt.getLanguage; -import static com.sevtinge.hyperceiler.utils.log.XposedLogUtils.logE; - import android.annotation.SuppressLint; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import android.content.res.AssetManager; import android.provider.Settings; import com.sevtinge.hyperceiler.R; -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; -import java.util.List; import java.util.Locale; -import java.util.Random; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/home/HomeTitleSettings.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/home/HomeTitleSettings.java index 51d9d31d67..9edd301d6c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/home/HomeTitleSettings.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/home/HomeTitleSettings.java @@ -30,8 +30,6 @@ import com.sevtinge.hyperceiler.ui.SubPickerActivity; import com.sevtinge.hyperceiler.ui.base.BaseSettingsActivity; import com.sevtinge.hyperceiler.ui.fragment.base.SettingsPreferenceFragment; -import com.sevtinge.hyperceiler.ui.fragment.helper.CantSeeAppsFragment; -import com.sevtinge.hyperceiler.ui.fragment.helper.HomepageEntrance; import com.sevtinge.hyperceiler.ui.fragment.sub.AppPicker; import moralnorm.preference.Preference; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/settings/development/DevelopmentKillFragment.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/settings/development/DevelopmentKillFragment.java index 07a077bac4..6c7959a3d3 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/settings/development/DevelopmentKillFragment.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/settings/development/DevelopmentKillFragment.java @@ -94,7 +94,7 @@ public void onInputReceived(String userInput) { pkg = appData1.packageName; } } - if (!(pkg == null || pkg.equals(""))) { + if (!(pkg == null || pkg.isEmpty())) { showOutDialog(listToString("PID: Process:\n", pidAndPkg(pkg))); return; @@ -107,18 +107,18 @@ public void onInputReceived(String userInput) { showInDialog(new EditDialogCallback() { @Override public void onInputReceived(String userInput) { - if (!userInput.equals("")) { + if (!userInput.isEmpty()) { String pkg = ""; for (AppData appData1 : appData) { if (appData1.packageName.equalsIgnoreCase(userInput)) { pkg = appData1.packageName; } } - if (pkg.equals("")) { + if (pkg.isEmpty()) { showOutDialog("包名错误或不存在,请查证后输入!\n" + "\"" + userInput + "\""); return; } - if (pidAndPkg(pkg).size() != 0) { + if (!pidAndPkg(pkg).isEmpty()) { String result = listToString("成功 Kill:\n", pidAndPkg(pkg)); if (killPackage(pkg)) { showOutDialog(result); @@ -136,15 +136,15 @@ public void onInputReceived(String userInput) { showInDialog(new EditDialogCallback() { @Override public void onInputReceived(String userInput) { - if (!userInput.equals("")) { + if (!userInput.isEmpty()) { String pkg = ""; for (AppData appData1 : appData) { if (appData1.label.equalsIgnoreCase(userInput)) { pkg = appData1.packageName; } } - if (!(pkg == null || pkg.equals(""))) { - if (pidAndPkg(pkg).size() != 0) { + if (!(pkg == null || pkg.isEmpty())) { + if (!pidAndPkg(pkg).isEmpty()) { String result = listToString("成功 Kill:\n", pidAndPkg(pkg)); if (killPackage(pkg)) { showOutDialog(result); @@ -172,7 +172,7 @@ private ArrayList pidAndPkg(String pkg) { .add(" ps -A -o PID,ARGS=CMD | grep \"" + pkg + "\" | grep -v \"grep\"") .add("fi").over().sync(); ArrayList pid = mShell.getOutPut(); - if (pid.size() == 0) { + if (pid.isEmpty()) { return new ArrayList<>(); } if (pid.get(0).equals("No Find Pid!")) { @@ -233,7 +233,7 @@ private void showInDialog(EditDialogCallback callback) { .setCancelable(false) .setPositiveButton(android.R.string.ok, (dialog, which) -> { String userInput = input.getText().toString(); - if (userInput.equals("")) { + if (userInput.isEmpty()) { dialog.dismiss(); showInDialog(callback); return; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/settings/development/DevelopmentPrefsFragment.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/settings/development/DevelopmentPrefsFragment.java index 3c3777fa89..62d789c17d 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/settings/development/DevelopmentPrefsFragment.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/settings/development/DevelopmentPrefsFragment.java @@ -147,7 +147,7 @@ private void showInDialog(EditDialogCallback callback) { .setCancelable(false) .setPositiveButton(android.R.string.ok, (dialog, which) -> { String userInput = input.getText().toString(); - if (userInput.equals("")) { + if (userInput.isEmpty()) { dialog.dismiss(); showInDialog(callback); return; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/sub/MultiActionSettings.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/sub/MultiActionSettings.java index eeced5c08e..8e34d2d959 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/sub/MultiActionSettings.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/sub/MultiActionSettings.java @@ -160,9 +160,9 @@ public static String getAppName(Context context, String pkgActName, boolean forc if (!pkgActName.equals(notSelected)) { if (pkgActArray.length >= 1 && pkgActArray[0] != null) try { - if (!forcePkg && pkgActArray.length >= 2 && pkgActArray[1] != null && !pkgActArray[1].trim().equals("")) { + if (!forcePkg && pkgActArray.length >= 2 && pkgActArray[1] != null && !pkgActArray[1].trim().isEmpty()) { return pm.getActivityInfo(new ComponentName(pkgActArray[0], pkgActArray[1]), 0).loadLabel(pm).toString(); - } else if (!pkgActArray[0].trim().equals("")) { + } else if (!pkgActArray[0].trim().isEmpty()) { ai = pm.getApplicationInfo(pkgActArray[0], 0); return pm.getApplicationLabel(ai).toString(); } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/StatusBarSettings.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/StatusBarSettings.java index 36af6204da..baa8b93dbf 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/StatusBarSettings.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/systemui/StatusBarSettings.java @@ -28,7 +28,6 @@ import com.sevtinge.hyperceiler.R; import com.sevtinge.hyperceiler.prefs.RecommendPreference; import com.sevtinge.hyperceiler.ui.base.BaseSettingsActivity; -import com.sevtinge.hyperceiler.ui.fragment.MiSettingsFragment; import com.sevtinge.hyperceiler.ui.fragment.base.SettingsPreferenceFragment; import moralnorm.preference.Preference; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/various/LocationDataActivity.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/various/LocationDataActivity.java index a0e4c27d57..69fe4344d0 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/various/LocationDataActivity.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/various/LocationDataActivity.java @@ -178,7 +178,7 @@ public boolean onContextItemSelected(@NonNull MenuItem item) { builder.setView(view); builder.setPositiveButton(android.R.string.ok, (dialog, which) -> { String n = n(editText.getText().toString()); - if (n.equals("") || !e(n)) { + if (n.isEmpty() || !e(n)) { ToastHelper.makeText(this, "格式错误"); return; } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/utils/Helpers.java b/app/src/main/java/com/sevtinge/hyperceiler/utils/Helpers.java index bc7ce5c8c1..66eff4e8aa 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/utils/Helpers.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/utils/Helpers.java @@ -228,9 +228,8 @@ public static String getPackageVersionName(XC_LoadPackage.LoadPackageParam lppar Object parser = parserCls.newInstance(); File apkPath = new File(lpparam.appInfo.sourceDir); Object pkg = XposedHelpers.callMethod(parser, "parsePackage", apkPath, 0); - String versionName = (String) XposedHelpers.getObjectField(pkg, "mVersionName"); //XposedLogUtils.logI("getPackageVersionName", lpparam.packageName + " versionName is " + versionName); - return versionName; + return (String) XposedHelpers.getObjectField(pkg, "mVersionName"); } catch (Throwable e) { //XposedLogUtils.logW("getPackageVersionName", e); return "null"; @@ -243,9 +242,8 @@ public static int getPackageVersionCode(XC_LoadPackage.LoadPackageParam lpparam) Object parser = parserCls.newInstance(); File apkPath = new File(lpparam.appInfo.sourceDir); Object pkg = XposedHelpers.callMethod(parser, "parsePackage", apkPath, 0); - int versionCode = XposedHelpers.getIntField(pkg, "mVersionCode"); //XposedLogUtils.logI("getPackageVersionCode", lpparam.packageName + " versionCode is " + versionCode); - return versionCode; + return XposedHelpers.getIntField(pkg, "mVersionCode"); } catch (Throwable e) { //XposedLogUtils.logW("getPackageVersionCode", e); return -1; diff --git a/app/src/main/java/com/sevtinge/hyperceiler/utils/LogcatHelper.java b/app/src/main/java/com/sevtinge/hyperceiler/utils/LogcatHelper.java index d8b951f21b..7aa65ce378 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/utils/LogcatHelper.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/utils/LogcatHelper.java @@ -127,7 +127,7 @@ public void run() { if (!mRunning) { break; } - if (line.length() == 0) { + if (line.isEmpty()) { continue; } if (out != null && line.contains(mPID)) { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/utils/shell/ShellExec.java b/app/src/main/java/com/sevtinge/hyperceiler/utils/shell/ShellExec.java index c8096d717e..2fc1e12127 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/utils/shell/ShellExec.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/utils/shell/ShellExec.java @@ -148,7 +148,7 @@ public ShellExec(String command, boolean root, boolean result, @Nullable IResult Error.setOutputListen(listen); Check.setOutputListen(listen); this.result = result; - boolean need = command != null && !("".equals(command)); + boolean need = command != null && !(command.isEmpty()); process = Runtime.getRuntime().exec(root ? "su" : "sh"); // 注意处理 if (root) {