Skip to content

Commit

Permalink
删除无用代码,简化包体积
Browse files Browse the repository at this point in the history
  • Loading branch information
maning0303 committed May 8, 2021
1 parent b570e8a commit e764109
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 252 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ android {
// 设置MultiDex可用
multiDexEnabled true
flavorDimensions "gank"
javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
}

signingConfigs {//签名信息
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,49 @@ public abstract class CommonHttpCallback<T> implements Callback<T> {
@Override
public void onResponse(Call<T> call, Response<T> response) {
onFinish();
if (200 == response.code()) {
T body = response.body();
if (body instanceof Gank2BaseBean) {
//gankio
Gank2BaseBean baseBean = (Gank2BaseBean) response.body();
if (baseBean.getStatus() == 100) {
onSuccess(response.body());
try {
if (200 == response.code()) {
T body = response.body();
if (body instanceof Gank2BaseBean) {
//gankio
Gank2BaseBean baseBean = (Gank2BaseBean) response.body();
if (baseBean.getStatus() == 100) {
onSuccess(response.body());
} else {
onFail(baseBean.getStatus(), baseBean.getMsg());
}
} else if (body instanceof CaiyunWeatherBaseBean) {
//彩云天气
CaiyunWeatherBaseBean baseBean = (CaiyunWeatherBaseBean) response.body();
String status = baseBean.getStatus();
String api_status = baseBean.getApi_status();
if ("ok".equals(status) && "active".equals(api_status)) {
onSuccess(response.body());
} else {
onFail(1000, "彩云天气接口出错啦~~~");
}
} else if (body instanceof ZhixinBaseBean) {
ZhixinBaseBean baseBean = (ZhixinBaseBean) response.body();
if (TextUtils.isEmpty(baseBean.getStatus())) {
onSuccess(response.body());
} else {
onFail(1000, baseBean.getStatus());
}
} else if (body instanceof RollToolsBaseBean) {
RollToolsBaseBean baseBean = (RollToolsBaseBean) response.body();
if (baseBean.getCode() == 1) {
onSuccess(response.body());
} else {
onFail(baseBean.getCode(), baseBean.getMsg());
}
} else {
onFail(baseBean.getStatus(), baseBean.getMsg());
}
} else if (body instanceof CaiyunWeatherBaseBean) {
//彩云天气
CaiyunWeatherBaseBean baseBean = (CaiyunWeatherBaseBean) response.body();
String status = baseBean.getStatus();
String api_status = baseBean.getApi_status();
if ("ok".equals(status) && "active".equals(api_status)) {
onSuccess(response.body());
} else {
onFail(1000, "彩云天气接口出错啦~~~");
}
} else if (body instanceof ZhixinBaseBean) {
ZhixinBaseBean baseBean = (ZhixinBaseBean) response.body();
if (TextUtils.isEmpty(baseBean.getStatus())) {
onSuccess(response.body());
} else {
onFail(1000, baseBean.getStatus());
}
} else if (body instanceof RollToolsBaseBean) {
RollToolsBaseBean baseBean = (RollToolsBaseBean) response.body();
if (baseBean.getCode() == 1) {
onSuccess(response.body());
} else {
onFail(baseBean.getCode(), baseBean.getMsg());
onSuccess(body);
}
} else {
onSuccess(body);
onFail(response.code(), HttpErrorConstants.ERR_NETEXCEPTION_ERROR);
}
} else {
onFail(response.code(), HttpErrorConstants.ERR_NETEXCEPTION_ERROR);
} catch (Exception e) {
onFail(HttpErrorConstants.ERR_HTTPRESPONSE_JSONPARSE_ERROR_CODE, HttpErrorConstants.ERR_HTTPRESPONSE_JSONPARSE_ERROR);
}
}

Expand Down
36 changes: 0 additions & 36 deletions app/src/main/java/com/maning/gankmm/http/callback/MyCallBack.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import android.text.TextUtils;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

import androidx.appcompat.widget.Toolbar;

import com.afollestad.materialdialogs.MaterialDialog;
import com.bigkoo.pickerview.TimePickerView;
import com.bumptech.glide.Glide;
Expand All @@ -19,7 +20,6 @@
import com.luck.picture.lib.entity.LocalMedia;
import com.maning.gankmm.R;
import com.maning.gankmm.bean.mob.MobUserInfo;
import com.maning.gankmm.http.callback.MyCallBack;
import com.maning.gankmm.skin.SkinManager;
import com.maning.gankmm.ui.base.BaseActivity;
import com.maning.gankmm.utils.AppDateMgr;
Expand Down Expand Up @@ -261,54 +261,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}

private MyCallBack httpCallBack = new MyCallBack() {
@Override
public void onSuccess(int what, Object result) {
dissmissProgressDialog();
if (what == 0x001) {
//保存成功
MySnackbar.makeSnackBarGreen(mToolbar, "数据更新成功");

} else if (what == 0x002) {
String userBaseInfo = (String) result;
if (TextUtils.isEmpty(userBaseInfo)) {
return;
}
KLog.i("userBaseInfo:" + userBaseInfo);
String[] values = userBaseInfo.split("&");
if (values.length > 2) {
String sex = values[0];
String birth = values[1];
String signature = values[2];

//本地数据更新
// MobUserInfo userCache = UserUtils.getUserCache();
// userCache.setSex(sex);
// userCache.setBirth(birth);
// userCache.setSignature(signature);
// //保存用户信息
// UserUtils.saveUserCache(userCache);
//刷新界面
initDatas();
}

}
}

@Override
public void onSuccessList(int what, List results) {

}

@Override
public void onFail(int what, String result) {
dissmissProgressDialog();
if (what == 0x001) {
MySnackbar.makeSnackBarRed(mToolbar, result);
}
}
};

private void updateUserInfo() {
showProgressDialog("正在更新...");
//信息拼接: 性别&出生年月&个性签名
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@

import android.os.Bundle;
import android.os.CountDownTimer;
import androidx.appcompat.widget.Toolbar;
import android.text.TextUtils;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

import androidx.appcompat.widget.Toolbar;

import com.maning.gankmm.R;
import com.maning.gankmm.app.MyApplication;
import com.maning.gankmm.http.callback.MyCallBack;
import com.maning.gankmm.skin.SkinManager;
import com.maning.gankmm.ui.base.BaseActivity;
import com.maning.gankmm.utils.KeyboardUtils;
import com.maning.gankmm.utils.MySnackbar;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
Expand Down Expand Up @@ -183,40 +180,4 @@ private void resetBtn() {
mBtnGetCode.setBackgroundColor(mContext.getResources().getColor(R.color.main_color));
}


private MyCallBack httpCallBack = new MyCallBack() {
@Override
public void onSuccess(int what, Object result) {
dissmissProgressDialog();
if (what == 0x001) {
MySnackbar.makeSnackBarGreen(mToolbar, "密码追回的验证码已发送到您的邮箱,请到邮箱查看!");
} else {
showProgressSuccess("密码修改成功,请返回重新登录!");

MyApplication.getHandler().postDelayed(new Runnable() {
@Override
public void run() {
onBackPressed();
}
}, 500);
}
}

@Override
public void onSuccessList(int what, List results) {

}

@Override
public void onFail(int what, String result) {
dissmissProgressDialog();
MySnackbar.makeSnackBarRed(mToolbar, result);
if (what == 0x001) {
//重置按钮
mMyCountDownTimer.cancel();
mMyCountDownTimer.onFinish();
}
}
};

}
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
package com.maning.gankmm.ui.activity.login;

import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import android.text.TextUtils;
import android.view.MenuItem;
import android.widget.EditText;

import androidx.appcompat.widget.Toolbar;

import com.maning.gankmm.R;
import com.maning.gankmm.app.MyApplication;
import com.maning.gankmm.http.callback.MyCallBack;
import com.maning.gankmm.skin.SkinManager;
import com.maning.gankmm.ui.base.BaseActivity;
import com.maning.gankmm.utils.AppValidationMgr;
import com.maning.gankmm.utils.KeyboardUtils;
import com.maning.gankmm.utils.MySnackbar;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
Expand Down Expand Up @@ -104,33 +101,6 @@ public void btn_register() {
}


private MyCallBack mMyCallBack = new MyCallBack() {
@Override
public void onSuccess(int what, Object result) {
dissmissProgressDialog();
showProgressSuccess("注册成功,即将关闭页面!");

//关闭页面
MyApplication.getHandler().postDelayed(new Runnable() {
@Override
public void run() {
closeActivity();
}
}, 1000);
}

@Override
public void onSuccessList(int what, List results) {

}

@Override
public void onFail(int what, String result) {
dissmissProgressDialog();
MySnackbar.makeSnackBarRed(mToolbar, result);
}
};

private void closeActivity() {
this.finish();
}
Expand Down
Loading

0 comments on commit e764109

Please sign in to comment.