修复进度报告

This commit is contained in:
sifacaii 2022-08-25 14:14:17 +08:00
parent 5b2738cfbe
commit 8d2563c069

View File

@ -41,7 +41,12 @@ public class MainActivity extends BaseActivity {
tvLoginOut = findViewById(R.id.tvLoginOut); tvLoginOut = findViewById(R.id.tvLoginOut);
tvContiner = findViewById(R.id.tvItems); tvContiner = findViewById(R.id.tvItems);
getConfigFromSP(); getConfigFromSP();
}
@Override
protected void onResume() {
initView(); initView();
super.onResume();
} }
private void initView() { private void initView() {
@ -61,8 +66,8 @@ public class MainActivity extends BaseActivity {
mActivity.runOnUiThread(new Runnable() { mActivity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
//showLoading("正在加载首页,请稍候…………");
showLoadingDialog("正在加载首页,请稍候…………"); showLoadingDialog("正在加载首页,请稍候…………");
showLogoutBtn();
tvContiner.removeAllViews(); tvContiner.removeAllViews();
} }
}); });
@ -299,7 +304,6 @@ public class MainActivity extends BaseActivity {
* @return * @return
*/ */
private boolean ValidUrl(String url) { private boolean ValidUrl(String url) {
//showLoadingDialog("正在验证服务器地址!");
boolean valid = false; boolean valid = false;
if (url.length() > 0) { if (url.length() > 0) {
if (url.startsWith("http://") || url.startsWith("https://")) { if (url.startsWith("http://") || url.startsWith("https://")) {
@ -321,7 +325,6 @@ public class MainActivity extends BaseActivity {
} }
} }
} }
//dismissLoadingDialog();
return false; return false;
} }
@ -335,7 +338,6 @@ public class MainActivity extends BaseActivity {
private boolean authenticateByName(String username, String password) { private boolean authenticateByName(String username, String password) {
String url = "/Users/authenticatebyname"; String url = "/Users/authenticatebyname";
String reqjson = "{\"Username\":\"" + username + "\",\"Pw\":\"" + password + "\"}"; String reqjson = "{\"Username\":\"" + username + "\",\"Pw\":\"" + password + "\"}";
//showLoadingDialog("正在验证用户名和密码!");
String userinfo = Utils.okhttpSend(url, reqjson); String userinfo = Utils.okhttpSend(url, reqjson);
if (userinfo.length() > 0) { if (userinfo.length() > 0) {
JsonObject userObj = new Gson().fromJson(userinfo, JsonObject.class); JsonObject userObj = new Gson().fromJson(userinfo, JsonObject.class);
@ -347,18 +349,9 @@ public class MainActivity extends BaseActivity {
return true; return true;
} }
} }
//dismissLoadingDialog();
return false; return false;
} }
@Override
protected void onResume() {
if(!Utils.AccessToken.equals("")){
showLogoutBtn();
}
super.onResume();
}
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {