Skip to content

Commit

Permalink
Make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsummer233 committed Mar 31, 2024
1 parent 62d864e commit 0212beb
Show file tree
Hide file tree
Showing 25 changed files with 35 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private String getDefaultBrowserApp(Context context) {
Uri uri = Uri.parse("http://");
intent.setDataAndType(uri, null);
List<ResolveInfo> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ protected void before(MethodHookParam param) throws Throwable {
Set<Integer> DEVICE_OUT_ALL = (Set<Integer>) 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<Integer> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object> mToastQueue = (ArrayList<Object>) 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void before(MethodHookParam param) throws Throwable {
ArrayList<Object> mPages = (ArrayList<Object>) 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);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -231,7 +231,7 @@ protected void before(final MethodHookParam param) {
colorMode = "_dark";
}
String iconStyle = "";
if (!selectedIconStyle.equals("")) {
if (!selectedIconStyle.isEmpty()) {
iconStyle = "_" + selectedIconStyle;
}
String sim1IconId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -172,7 +172,7 @@ private ArrayList<String> pidAndPkg(String pkg) {
.add(" ps -A -o PID,ARGS=CMD | grep \"" + pkg + "\" | grep -v \"grep\"")
.add("fi").over().sync();
ArrayList<String> pid = mShell.getOutPut();
if (pid.size() == 0) {
if (pid.isEmpty()) {
return new ArrayList<>();
}
if (pid.get(0).equals("No Find Pid!")) {
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/com/sevtinge/hyperceiler/utils/Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
Expand Down
Loading

0 comments on commit 0212beb

Please sign in to comment.