Add configuration files and remove redundant code
Added IntelliJ IDEA project configuration, lint baseline, and inspection profiles for consistency and static analysis. Removed redundant null-check for intent in `MainActivity` to simplify logic and improve readability.
This commit is contained in:
parent
1d65b8c5aa
commit
8b079e8115
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GoogleJavaFormatSettings">
|
||||
<option name="enabled" value="false" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="UsePropertyAccessSyntax" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
|
@ -1,4 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,179 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<issues format="6" by="lint 8.10.0" type="baseline" client="gradle" dependencies="false" name="AGP (8.10.0)" variant="all" version="8.10.0">
|
||||
|
||||
<issue
|
||||
id="ScopedStorage"
|
||||
message="The Google Play store has a policy that limits usage of MANAGE_EXTERNAL_STORAGE"
|
||||
errorLine1="<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/AndroidManifest.xml"
|
||||
line="10"
|
||||
column="32"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="OldTargetApi"
|
||||
message="Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the `android.os.Build.VERSION_CODES` javadoc for details."
|
||||
errorLine1=" targetSdk 35"
|
||||
errorLine2=" ~~~~~~~~~~~~">
|
||||
<location
|
||||
file="build.gradle"
|
||||
line="12"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="HighSamplingRate"
|
||||
message="Most apps don't need access to high sensor sampling rate."
|
||||
errorLine1=" <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/AndroidManifest.xml"
|
||||
line="15"
|
||||
column="36"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="ProtectedPermissions"
|
||||
message="Permission is only granted to system apps"
|
||||
errorLine1="<uses-permission android:name="android.permission.BIND_VPN_SERVICE" />"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/AndroidManifest.xml"
|
||||
line="11"
|
||||
column="18"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="ObsoleteLayoutParam"
|
||||
message="Invalid layout param in a `LinearLayout`: `layout_centerInParent`"
|
||||
errorLine1=" android:layout_centerInParent="true"/>"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/res/layout/activity_main.xml"
|
||||
line="20"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="Overdraw"
|
||||
message="Possible overdraw: Root element paints background `@drawable/background` with a theme that also paints a background (inferred theme is `@style/Theme.StudyApp`)"
|
||||
errorLine1=" android:background="@drawable/background">"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/res/layout/activity_main.xml"
|
||||
line="12"
|
||||
column="5"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UnusedResources"
|
||||
message="The resource `R.color.black` appears to be unused"
|
||||
errorLine1=" <color name="black">#FF000000</color>"
|
||||
errorLine2=" ~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/res/values/colors.xml"
|
||||
line="3"
|
||||
column="12"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UnusedResources"
|
||||
message="The resource `R.color.white` appears to be unused"
|
||||
errorLine1=" <color name="white">#FFFFFFFF</color>"
|
||||
errorLine2=" ~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/res/values/colors.xml"
|
||||
line="4"
|
||||
column="12"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UnusedResources"
|
||||
message="The resource `R.mipmap.ic_launcher` appears to be unused">
|
||||
<location
|
||||
file="src/main/res/mipmap-hdpi/ic_launcher.webp"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UnusedResources"
|
||||
message="The resource `R.string.app_name` appears to be unused"
|
||||
errorLine1=" <string name="app_name">study.App</string>"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/res/values/strings.xml"
|
||||
line="2"
|
||||
column="13"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="IconLauncherShape"
|
||||
message="Launcher icons should not fill every pixel of their square region; see the design guide for details">
|
||||
<location
|
||||
file="src/main/res/mipmap-hdpi/box.png"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="IconLocation"
|
||||
message="Found bitmap drawable `res/drawable/background.jpg` in densityless folder">
|
||||
<location
|
||||
file="src/main/res/drawable/background.jpg"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UseTomlInstead"
|
||||
message="Use version catalog instead"
|
||||
errorLine1=" implementation 'com.squareup.retrofit2:retrofit:2.9.0'"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="build.gradle"
|
||||
line="41"
|
||||
column="20"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UseTomlInstead"
|
||||
message="Use version catalog instead"
|
||||
errorLine1=" implementation 'com.squareup.retrofit2:converter-gson:2.9.0'"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="build.gradle"
|
||||
line="44"
|
||||
column="20"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="UseTomlInstead"
|
||||
message="Use version catalog instead"
|
||||
errorLine1=" implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'"
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="build.gradle"
|
||||
line="47"
|
||||
column="20"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="HardcodedText"
|
||||
message="Hardcoded string "点击开始运行", should use `@string` resource"
|
||||
errorLine1=" android:text="点击开始运行""
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/res/layout/activity_main.xml"
|
||||
line="18"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
<issue
|
||||
id="HardcodedText"
|
||||
message="Hardcoded string "运行脚本按钮", should use `@string` resource"
|
||||
errorLine1=" android:contentDescription="运行脚本按钮""
|
||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||
<location
|
||||
file="src/main/res/layout/activity_main.xml"
|
||||
line="19"
|
||||
column="9"/>
|
||||
</issue>
|
||||
|
||||
</issues>
|
|
@ -247,12 +247,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
|
||||
intent = new Intent(this, CustomVpnService.class);
|
||||
|
||||
if (intent == null) {
|
||||
Log.e("handleVpnPermissionResult", "Intent is null. Cannot start service.");
|
||||
showToastOnUiThread(this, "Failed to start VPN service due to null intent.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(intent);
|
||||
|
|
Loading…
Reference in New Issue