Skip to content

Commit

Permalink
优化代码结构
Browse files Browse the repository at this point in the history
  • Loading branch information
FuShengPing committed Feb 13, 2024
1 parent 8bc90ff commit f16854c
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

## 下载地址

[最新版本](https://gitee.com/wsfsp4/QingLong/releases/tag/v2.0.4)
[最新版本](https://gitee.com/wsfsp4/QingLong/releases/tag/v2.1.0)

[历史版本](https://gitee.com/wsfsp4/QingLong/releases)

Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "auto.panel"
minSdk 26
targetSdk 32
versionCode 14
versionName "2.0.5"
versionCode 15
versionName "2.1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -20,13 +20,13 @@ android {
release {
minifyEnabled true
shrinkResources true
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

debug {
minifyEnabled false
shrinkResources false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
Expand Down
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 14,
"versionName": "2.0.5",
"versionCode": 15,
"versionName": "2.1.0",
"outputFile": "app-release.apk"
}
],
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<application
android:name=".MyApplication"
android:allowBackup="false"
android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
Expand All @@ -29,7 +30,7 @@
android:screenOrientation="portrait"
android:supportsRtl="true"
android:theme="@style/Theme.App"
tools:ignore="DataExtractionRules"
tools:ignore="DataExtractionRules,HardcodedDebugMode"
tools:replace="android:theme">
<activity
android:name=".ui.activity.AccountActivity"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/auto/panel/bean/app/Account.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public Account(String address, String username, String password,String token) {
this.token = token;
}

public Account(String address, String username, String password,String token,String version) {
this.username = username;
this.password = password;
this.address = address;
this.token = token;
this.version = version;
}

public String getAddress() {
return address;
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/auto/panel/net/NetBaseInterceptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ public class NetBaseInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request originalRequest = chain.request();
LogUnit.log("RetrofitInterceptor");
LogUnit.log("originalRequest:" + originalRequest.url());

Response response = chain.proceed(originalRequest);

LogUnit.log("response:" + response.code());

return response;
}

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/auto/panel/ui/activity/AccountActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ private void netCheckAccountToken(PanelAccount panelAccount, String token) {
@Override
public void onSuccess() {
Account account = new Account(panelAccount.getAddress(), panelAccount.getUsername(), panelAccount.getPassword(), token);
account.setVersion(panelAccount.getVersion());
updateAccount(account);
ActivityUtils.clearAndStartActivity(mActivity, HomeActivity.class);
}
Expand All @@ -180,7 +181,11 @@ private void netLogin(PanelAccount panelAccount) {
auto.panel.net.panel.ApiController.login(panelAccount.getBaseUrl(), panelAccount, new auto.panel.net.panel.ApiController.LoginCallBack() {
@Override
public void onSuccess(String token) {
if(!token.startsWith("Bearer ")){
token = "Bearer " + token;
}
Account account = new Account(panelAccount.getAddress(), panelAccount.getUsername(), panelAccount.getPassword(), token);
account.setVersion(panelAccount.getVersion());
updateAccount(account);
ActivityUtils.clearAndStartActivity(mActivity, HomeActivity.class);
}
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/auto/panel/utils/ToastUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public class ToastUnit {
}

public static void showShort(String content) {
if (content == null || content.isEmpty()) {
return;
}
LogUnit.log(TAG, "showShort: " + content);
mHandler.post(() -> {
cancel();
mToast = Toast.makeText(BaseApplication.getContext(), content, Toast.LENGTH_SHORT);
Expand All @@ -24,6 +28,10 @@ public static void showShort(String content) {
}

public static void showShort(Object content) {
if (content == null) {
return;
}
LogUnit.log(TAG, "showShort: " + content);
mHandler.post(() -> {
cancel();
mToast = Toast.makeText(BaseApplication.getContext(), String.valueOf(content), Toast.LENGTH_SHORT);
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@
android:background="@drawable/style_press_gray"
android:clickable="true"
android:orientation="vertical"
android:paddingHorizontal="@dimen/action_bar_padding_horizontal">
android:paddingHorizontal="@dimen/action_bar_padding_horizontal"
android:visibility="gone">

<TextView
android:layout_width="match_parent"
Expand Down

0 comments on commit f16854c

Please sign in to comment.