|
@@ -1,14 +1,12 @@
|
|
package com.xwkj.sqjw.mvp.ui.activity;
|
|
package com.xwkj.sqjw.mvp.ui.activity;
|
|
|
|
|
|
import android.Manifest;
|
|
import android.Manifest;
|
|
-import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
import android.content.SharedPreferences;
|
|
import android.content.SharedPreferences;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
import android.text.method.HideReturnsTransformationMethod;
|
|
import android.text.method.HideReturnsTransformationMethod;
|
|
import android.text.method.PasswordTransformationMethod;
|
|
import android.text.method.PasswordTransformationMethod;
|
|
-import android.util.Log;
|
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
import android.widget.Button;
|
|
import android.widget.Button;
|
|
@@ -35,32 +33,19 @@ import com.zkjc.common.utils.ApkUtils;
|
|
import com.zkjc.common.utils.DevicesUtils;
|
|
import com.zkjc.common.utils.DevicesUtils;
|
|
import com.zkjc.common.utils.Utils;
|
|
import com.zkjc.common.utils.Utils;
|
|
import com.zkjc.policedemo.R;
|
|
import com.zkjc.policedemo.R;
|
|
-import com.zkjc.policedemo.app.utils.FileUtils;
|
|
|
|
import com.zkjc.policedemo.di.component.DaggerLoginComponent;
|
|
import com.zkjc.policedemo.di.component.DaggerLoginComponent;
|
|
import com.zkjc.policedemo.mvp.contract.LoginContract;
|
|
import com.zkjc.policedemo.mvp.contract.LoginContract;
|
|
import com.zkjc.policedemo.mvp.model.entity.Login;
|
|
import com.zkjc.policedemo.mvp.model.entity.Login;
|
|
import com.zkjc.policedemo.mvp.presenter.LoginPresenter;
|
|
import com.zkjc.policedemo.mvp.presenter.LoginPresenter;
|
|
import com.zkjc.policedemo.mvp.ui.activity.StHomeActivity;
|
|
import com.zkjc.policedemo.mvp.ui.activity.StHomeActivity;
|
|
-import com.zkjc.policedemo.mvp.ui.activity.XlfkActivity;
|
|
|
|
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.xutils.common.util.MD5;
|
|
import org.xutils.common.util.MD5;
|
|
|
|
|
|
-import java.io.File;
|
|
|
|
-import java.io.FileOutputStream;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
-import java.util.zip.ZipEntry;
|
|
|
|
-import java.util.zip.ZipInputStream;
|
|
|
|
|
|
|
|
import butterknife.BindView;
|
|
import butterknife.BindView;
|
|
-import io.reactivex.Observable;
|
|
|
|
-import io.reactivex.ObservableEmitter;
|
|
|
|
-import io.reactivex.ObservableOnSubscribe;
|
|
|
|
-import io.reactivex.Observer;
|
|
|
|
-import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
|
-import io.reactivex.disposables.Disposable;
|
|
|
|
-import io.reactivex.schedulers.Schedulers;
|
|
|
|
|
|
|
|
import static com.jess.arms.utils.Preconditions.checkNotNull;
|
|
import static com.jess.arms.utils.Preconditions.checkNotNull;
|
|
|
|
|
|
@@ -147,43 +132,6 @@ public class SqjwLoginActivity extends ZkjcBaseActivity<LoginPresenter> implemen
|
|
map1.put("password", MD5.md5("123456"));
|
|
map1.put("password", MD5.md5("123456"));
|
|
mPresenter.login(map1);
|
|
mPresenter.login(map1);
|
|
Utils.getInstances().showDialog(SqjwLoginActivity.this, "正在获取数据");
|
|
Utils.getInstances().showDialog(SqjwLoginActivity.this, "正在获取数据");
|
|
- File file = new File(FileUtils.getGdMapFilePath() + "/data_v6/map/a56");
|
|
|
|
- if (file.exists()) {
|
|
|
|
- ArmsUtils.startActivity(XlfkActivity.class);
|
|
|
|
- } else {
|
|
|
|
- Observable.create(new ObservableOnSubscribe<Void>(){
|
|
|
|
- @Override
|
|
|
|
- public void subscribe(ObservableEmitter<Void> emitter) throws Exception {
|
|
|
|
- try {
|
|
|
|
- UnZipAssetsFolder(SqjwLoginActivity.this, "map.zip", FileUtils.getGdMapFilePath() + "/data_v6");
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }).subscribeOn(Schedulers.io())
|
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
- .subscribe(new Observer<Void>() {
|
|
|
|
- @Override
|
|
|
|
- public void onSubscribe(Disposable d) {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void onNext(Void list) {
|
|
|
|
- ArmsUtils.startActivity(XlfkActivity.class);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void onError(Throwable e) {
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void onComplete() {
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
layoutTop.setVisibility(View.VISIBLE);
|
|
layoutTop.setVisibility(View.VISIBLE);
|
|
@@ -244,47 +192,7 @@ public class SqjwLoginActivity extends ZkjcBaseActivity<LoginPresenter> implemen
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- public static void UnZipAssetsFolder(Context context, String zipFileString, String
|
|
|
|
- outPathString) throws Exception {
|
|
|
|
- Log.d("文件路径", context.getAssets().open(zipFileString).toString());
|
|
|
|
- ZipInputStream inPutZip = new ZipInputStream(context.getAssets().open(zipFileString));
|
|
|
|
- ZipEntry zipEntry;
|
|
|
|
- String szName = "";
|
|
|
|
- while ((zipEntry = inPutZip.getNextEntry()) != null) {
|
|
|
|
- Log.d("判断文件是否存在",zipEntry.isDirectory()+"");
|
|
|
|
- szName = zipEntry.getName();
|
|
|
|
- if (zipEntry.isDirectory()) {
|
|
|
|
- szName = szName.substring(0, szName.length() - 1);
|
|
|
|
- File folder = new File(outPathString + File.separator + szName);
|
|
|
|
- //目前判断条件,如果包含解压过的文件就不再解压
|
|
|
|
- if(!folder.exists()){
|
|
|
|
- folder.mkdirs();
|
|
|
|
- }else{
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- Log.e("eee", outPathString + File.separator + szName);
|
|
|
|
- File file = new File(outPathString + File.separator + szName);
|
|
|
|
- if (!file.exists()) {
|
|
|
|
- Log.e("eee", "Create the file:" + outPathString + File.separator + szName);
|
|
|
|
- file.getParentFile().mkdirs();
|
|
|
|
- file.createNewFile();
|
|
|
|
- }
|
|
|
|
- // 获取文件的输出流
|
|
|
|
- FileOutputStream out = new FileOutputStream(file);
|
|
|
|
- int len;
|
|
|
|
- byte[] buffer = new byte[1024];
|
|
|
|
- // 读取(字节)字节到缓冲区
|
|
|
|
- while ((len = inPutZip.read(buffer)) != -1) {
|
|
|
|
- // 从缓冲区(0)位置写入(字节)字节
|
|
|
|
- out.write(buffer, 0, len);
|
|
|
|
- out.flush();
|
|
|
|
- }
|
|
|
|
- out.close();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- inPutZip.close();
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|