|
|
|
@ -13,7 +13,9 @@ import android.util.Log;
|
|
|
|
import android.view.KeyEvent;
|
|
|
|
import android.view.KeyEvent;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.WindowManager;
|
|
|
|
import android.view.WindowManager;
|
|
|
|
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.GridView;
|
|
|
|
import android.widget.GridView;
|
|
|
|
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.Toast;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
@ -40,6 +42,7 @@ import com.rehome.bhdxj.utils.NohttpUtils;
|
|
|
|
import com.rehome.bhdxj.utils.OAToolbar;
|
|
|
|
import com.rehome.bhdxj.utils.OAToolbar;
|
|
|
|
import com.rehome.bhdxj.utils.SPUtils;
|
|
|
|
import com.rehome.bhdxj.utils.SPUtils;
|
|
|
|
import com.rehome.bhdxj.utils.StatusBarUtil;
|
|
|
|
import com.rehome.bhdxj.utils.StatusBarUtil;
|
|
|
|
|
|
|
|
import com.rehome.bhdxj.weight.AuditDialog;
|
|
|
|
import com.rehome.bhdxj.weight.toastviewbymyself;
|
|
|
|
import com.rehome.bhdxj.weight.toastviewbymyself;
|
|
|
|
import com.yolanda.nohttp.NoHttp;
|
|
|
|
import com.yolanda.nohttp.NoHttp;
|
|
|
|
import com.yolanda.nohttp.RequestMethod;
|
|
|
|
import com.yolanda.nohttp.RequestMethod;
|
|
|
|
@ -59,6 +62,9 @@ import java.util.TimerTask;
|
|
|
|
|
|
|
|
|
|
|
|
public class MainActivity extends BaseActivity3 {
|
|
|
|
public class MainActivity extends BaseActivity3 {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Button btnLogout;
|
|
|
|
|
|
|
|
TextView tvLoginUser;
|
|
|
|
|
|
|
|
|
|
|
|
OAToolbar toolbar;
|
|
|
|
OAToolbar toolbar;
|
|
|
|
GridView gv;
|
|
|
|
GridView gv;
|
|
|
|
|
|
|
|
|
|
|
|
@ -84,12 +90,19 @@ public class MainActivity extends BaseActivity3 {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void initView() {
|
|
|
|
public void initView() {
|
|
|
|
toolbar = findViewById(R.id.toolbar);
|
|
|
|
toolbar = findViewById(R.id.toolbar);
|
|
|
|
|
|
|
|
btnLogout = findViewById(R.id.btn_logout);
|
|
|
|
|
|
|
|
tvLoginUser = findViewById(R.id.tv_login_user);
|
|
|
|
gv = findViewById(R.id.gv);
|
|
|
|
gv = findViewById(R.id.gv);
|
|
|
|
toolbar.setBackgroundColor(Color.parseColor("#00000000"));
|
|
|
|
toolbar.setBackgroundColor(Color.parseColor("#00000000"));
|
|
|
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);//设置透明状态栏
|
|
|
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);//设置透明状态栏
|
|
|
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);//设置透明导航栏
|
|
|
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);//设置透明导航栏
|
|
|
|
StatusBarUtil.transparencyBar(MainActivity.this);//设置透明状态栏
|
|
|
|
StatusBarUtil.transparencyBar(MainActivity.this);//设置透明状态栏
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String username = (String) SPUtils.get(MainActivity.this, Contans.USERNAME, String.valueOf(""));
|
|
|
|
|
|
|
|
if (username != null) {
|
|
|
|
|
|
|
|
tvLoginUser.setText("登录用户:" + username);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (NetworkUtil.canNetWorkConnect(context)) {
|
|
|
|
if (NetworkUtil.canNetWorkConnect(context)) {
|
|
|
|
Log.i("app", "有网络");
|
|
|
|
Log.i("app", "有网络");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -102,6 +115,38 @@ public class MainActivity extends BaseActivity3 {
|
|
|
|
if(NetworkUtil.canNetWorkConnect(context)&& NetworkUtil.isWifiNetWorkConnect(context)){
|
|
|
|
if(NetworkUtil.canNetWorkConnect(context)&& NetworkUtil.isWifiNetWorkConnect(context)){
|
|
|
|
Log.i("app", "wifi网络");
|
|
|
|
Log.i("app", "wifi网络");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btnLogout.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
AuditDialog auditDialog = new AuditDialog(context, "确定要退出登录吗?", new AuditDialog.AuditDialogListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void confirm() {
|
|
|
|
|
|
|
|
SPUtils.remove(MainActivity.this,"save");
|
|
|
|
|
|
|
|
//SPUtils.remove(MainActivity.this,Contans.USERID);
|
|
|
|
|
|
|
|
//SPUtils.remove(MainActivity.this,Contans.USERPWD);
|
|
|
|
|
|
|
|
SPUtils.remove(MainActivity.this,Contans.USERNAME);
|
|
|
|
|
|
|
|
SPUtils.remove(MainActivity.this,Contans.BZBH);
|
|
|
|
|
|
|
|
SPUtils.remove(MainActivity.this,Contans.BZMC);
|
|
|
|
|
|
|
|
SPUtils.remove(MainActivity.this,Contans.PERMISSIONSRESULT);
|
|
|
|
|
|
|
|
SPUtils.remove(MainActivity.this,Contans.NFCBM);
|
|
|
|
|
|
|
|
SPUtils.remove(MainActivity.this,Contans.LASTLOGINDATE);
|
|
|
|
|
|
|
|
//SPUtils.clear(MainActivity.this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
|
|
|
|
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
|
|
|
|
|
|
startActivity(intent);
|
|
|
|
|
|
|
|
finish();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void cancel() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
auditDialog.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|