commit 8fa28066f6510a496eb785d794e4a3a618c9d3ef Author: lianlilong <409813353@qq.com> Date: Mon Apr 29 21:39:49 2024 +0800 基本框架搭建,原APP数据套餐模块迁移 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d4c3a57 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties +/.idea/ diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..2c18264 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,59 @@ +plugins { + alias(libs.plugins.androidApplication) +} + +android { + namespace 'com.police.union' + compileSdk 34 + + defaultConfig { + applicationId "com.police.policedatasystem" + minSdk 24 + targetSdk 34 + versionCode 10000 + versionName "1.0" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + buildFeatures { + compose true + viewBinding true + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0' + implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4' + implementation 'androidx.recyclerview:recyclerview:1.3.2' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' +// implementation 'com.squareup.retrofit2:adapter-okhttp3:2.9.0' // OkHttp适配器 + implementation 'com.scwang.smart:refresh-layout-kernel:2.0.3' + implementation 'com.scwang.smart:refresh-footer-classics:2.0.3'//经典刷新脚部局 + implementation 'com.scwang.smart:refresh-header-classics:2.0.3'//经典刷新头布局 +// implementation 'io.reactivex:rxjava:1.3.8' +// implementation 'io.reactivex:rxandroid:1.2.1' + implementation 'com.squareup.retrofit2:retrofit:2.9.0' // 根据需要选择合适的版本 + implementation 'com.squareup.retrofit2:converter-gson:2.9.0' // 如果你使用 Gson 进行 JSON 转换 + implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2' +// implementation 'com.squareup.okhttp3:okhttp:4.8.1' // OkHttp库 + implementation 'com.github.bumptech.glide:glide:4.16.0' + implementation 'com.google.android.material:material:1.8.0' + implementation 'androidx.navigation:navigation-fragment:2.5.3' + implementation 'androidx.navigation:navigation-ui:2.5.3' + implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1' + implementation libs.activity + implementation project(':base') + implementation project(':network') + implementation project(':utils') +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..cec13f4 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/police/union/MainActivity.java b/app/src/main/java/com/police/union/MainActivity.java new file mode 100644 index 0000000..79c7131 --- /dev/null +++ b/app/src/main/java/com/police/union/MainActivity.java @@ -0,0 +1,118 @@ +package com.police.union; + +import static com.police.network.UaCredentialApi.ACTION_SUFFIX_UA_LOGIN; +import static com.police.network.UaCredentialApi.ACTION_UA_LOGOUT; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Bundle; +import android.text.TextUtils; + +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; + +import com.police.base.BaseActivity; +import com.police.network.Constants; +import com.police.union.chat.fragment.ChatFragment; +import com.police.union.databinding.ActivityMainBinding; +import com.police.union.home.fragment.HomeFragment; +import com.police.union.personal.fragment.MineFragment; + +public class MainActivity extends BaseActivity { + private ActivityMainBinding binding; + + private final Fragment[] fragments = {new ChatFragment(), new HomeFragment(), new MineFragment()}; + private RequestClient requestClient; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivityMainBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + initView(); + requestClient = RequestClient.instance(); + registerBroadcastReceiver(); + requestClient.init(() -> { + binding.wmWm.setTextSize(50); + binding.wmWm.setText(Constants.SFZH); + }); + } + + private void initView() { + changeFragment(fragments[0]); + binding.llChat.setOnClickListener(view -> { + changeSelectView(0); + changeFragment(fragments[0]); + }); + binding.llHome.setOnClickListener(view -> { + changeSelectView(1); + changeFragment(fragments[1]); + }); + binding.llPerson.setOnClickListener(view -> { + changeSelectView(2); + changeFragment(fragments[2]); + }); + } + + private void changeSelectView(int index) { + binding.ivChat.setImageResource(index == 0 ? R.mipmap.icon_chat_selected : R.mipmap.icon_chat_normal); + binding.tvChat.setTextColor(getColor(index == 0 ? R.color.main_color : R.color.normal_color)); + binding.ivHome.setImageResource(index == 1 ? R.mipmap.icon_home_selected : R.mipmap.icon_home_normal); + binding.tvHome.setTextColor(getColor(index == 1 ? R.color.main_color : R.color.normal_color)); + binding.ivPerson.setImageResource(index == 2 ? R.mipmap.icon_personal_selected : R.mipmap.icon_personal_normal); + binding.tvPerson.setTextColor(getColor(index == 2 ? R.color.main_color : R.color.normal_color)); + } + + private void changeFragment(Fragment newFragment) { + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + transaction.replace(binding.fcView.getId(), newFragment); + transaction.commit(); + } + + private void registerBroadcastReceiver() { + IntentFilter intentFilter = new IntentFilter(); + String pkgName = getPackageName(); + /**添加登录成功事件监听 + * 当第一次登录,调用【IF-UA-SDK-01】接口可能返回"票据不存在",此时需要注册监听此事件, + * 当登录成功后,接收到此事件即可重新调用【IF-UA-SDK-01】获取相关票据 + * */ + intentFilter.addAction(pkgName + ACTION_SUFFIX_UA_LOGIN); + + /**增加登出事件监听 + * 当UA主动账户退出时会发送该事件,此时已经登录应用可以根据自身业务实施退出 + * */ + intentFilter.addAction(pkgName + ACTION_UA_LOGOUT); + registerReceiver(uaLoginInReceiver, intentFilter); + } + + private final BroadcastReceiver uaLoginInReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if (TextUtils.isEmpty(action)) { + return; + } + if (action.contains(ACTION_SUFFIX_UA_LOGIN)) { + //再次获取票据 + if (requestClient != null) { + requestClient.init(() -> { + }); + } + return; + } + if (action.contains(ACTION_UA_LOGOUT)) { + //程序退出 + startActivity(new Intent(MainActivity.this, MainActivity.class)); + finish(); + } + } + }; + + @Override + protected void onDestroy() { + super.onDestroy(); + unregisterReceiver(uaLoginInReceiver); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/RequestClient.java b/app/src/main/java/com/police/union/RequestClient.java new file mode 100644 index 0000000..b40262c --- /dev/null +++ b/app/src/main/java/com/police/union/RequestClient.java @@ -0,0 +1,466 @@ +package com.police.union; + +import androidx.annotation.NonNull; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.police.network.BaseRequestClient; +import com.police.network.Constants; +import com.police.network.CustomCallBack; +import com.police.network.requestparams.GetKeyPersonDetailParams; +import com.police.network.requestparams.GetKeyPersonListParams; +import com.police.network.requestparams.GetKeyPersonMessageCountParams; +import com.police.network.requestparams.GetOrgKeyPersonListParams; +import com.police.network.requestparams.GetPoliceEmergencyDetailParams; +import com.police.network.requestparams.GetPoliceEmergencyListParams; +import com.police.union.home.model.Apply; +import com.police.union.home.model.ApplyDept; +import com.police.union.home.model.ApplyDetail; +import com.police.union.home.model.ApplyPerson; +import com.police.union.home.model.ApplyType; +import com.police.union.home.model.DataCount; +import com.police.union.home.model.DetailQueryResult; +import com.police.union.home.model.KeyPerson; +import com.police.union.home.model.KeyPersonDetail; +import com.police.union.home.model.PoliceEmergency; +import com.police.union.home.model.PoliceEmergencyDetail; + +import java.util.HashMap; +import java.util.List; + +import okhttp3.Call; + +public class RequestClient extends BaseRequestClient { + + private RequestClient() { + } + + private static final class RequestClientHolder { + static final RequestClient requestClient = new RequestClient(); + } + + public static RequestClient instance() { + return RequestClientHolder.requestClient; + } + + /** + * 获取重点人 + * + * @param params 参数对象 + * @param callback 回调函数 + */ + public void getKeyPerson(GetKeyPersonListParams params, CustomCallBack> callback) { + params.setJybh(Constants.USER_ID); + params.setSfhm(Constants.SFZH); + params.setPageSize(Constants.PAGE_SIZE + ""); + request(Constants.KEY_PERSON_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callback.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List keyPersonList = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callback.onSuccess(keyPersonList); + } + }); + } + + /** + * 获取组织重点人数据 + * + * @param params 搜索关键字姓名 + */ + public void getOrgKeyPerson(GetOrgKeyPersonListParams params, CustomCallBack> callback) { + params.setSfhm(Constants.SFZH); + params.setDept(Constants.USER_ORG_ID); + params.setPageSize(Constants.PAGE_SIZE + ""); + request(Constants.ORG_KEY_PERSON_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callback.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List keyPersonList = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callback.onSuccess(keyPersonList); + } + }); + } + + + /** + * 获取重点人详情数据 + * + * @param str 身份证号 + */ + public void keyPersonDetail(String str, CustomCallBack callBack) { + GetKeyPersonDetailParams params = new GetKeyPersonDetailParams(); + params.setSfzh(str);// params.setSfzh("220104197307276911"); + params.setSfhm(Constants.SFZH); + request(Constants.KEY_PERSON_DETAIL_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + KeyPersonDetail keyPersonList = new Gson().fromJson(value, new TypeToken() { + }.getType()); + callBack.onSuccess(keyPersonList); + } + }); + } + + /** + * 获取警情列表数据 + * + * @param params 参数 + * @param callBack 回调函数 + */ + public void getPoliceEmergency(GetPoliceEmergencyListParams params, CustomCallBack> callBack) { + params.setSfhm(Constants.SFZH); + params.setPageSize(Constants.PAGE_SIZE + ""); + request(Constants.POLICE_EMERGENCY_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List keyPersonList = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callBack.onSuccess(keyPersonList); + } + }); + } + + + /** + * 获取重点人详情数据 + * + * @param str 身份证号 + */ + public void getPoliceEmergencyDetail(String str, CustomCallBack callBack) { + GetPoliceEmergencyDetailParams params = new GetPoliceEmergencyDetailParams(); + params.setJcjbh(str);// params.setSfzh("220104197307276911"); + params.setSfhm(Constants.SFZH); + request(Constants.POLICE_EMERGENCY_DETAIL_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + PoliceEmergencyDetail keyPersonDetail = new Gson().fromJson(value, PoliceEmergencyDetail.class); + callBack.onSuccess(keyPersonDetail); + } + }); + } + + /** + * 获取重点人数据统计 + */ + public void getKeyPersonMessageCount(CustomCallBack callBack) { + GetKeyPersonMessageCountParams params = new GetKeyPersonMessageCountParams(); + params.setSfhm(Constants.SFZH); + params.setJybh(Constants.USER_ID); + params.setDept(Constants.USER_ORG_ID); +// params.setSfhm("220183197210264653"); +// params.setJybh("106222"); +// params.setDept("220183210000"); + request(Constants.KEY_PERSON_MESSAGE_COUNT_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + DataCount dataCount = new Gson().fromJson(value, DataCount.class); + callBack.onSuccess(dataCount); + } + }); + } + + /** + * 获取申请支援类型 + */ + public void getApplyType(CustomCallBack> callBack) { + HashMap params = new HashMap<>(); + params.put("type", "1"); + params.put("deptId", Constants.USER_ORG_ID); + params.put("sfhm", Constants.SFZH); + request(Constants.APPLY_TYPE_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List applyTypes = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callBack.onSuccess(applyTypes); + } + }); + } + + /** + * 获取申请部门 + */ + public void getApplyDept(CustomCallBack> callBack) { + HashMap params = new HashMap<>(); + params.put("type", "2"); + params.put("deptId", Constants.USER_ORG_ID); + params.put("sfhm", Constants.SFZH); + request(Constants.APPLY_TYPE_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List applyTypes = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callBack.onSuccess(applyTypes); + } + }); + } + + /** + * 获取申请支援审批人 + */ + public void getApplyPerson(String deptId, CustomCallBack> callBack) { + HashMap params = new HashMap<>(); + params.put("type", "3"); + params.put("deptId", deptId); + params.put("sfhm", Constants.SFZH); + request(Constants.APPLY_TYPE_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List applyTypes = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callBack.onSuccess(applyTypes); + } + }); + } + + /** + * 获取申请支援-消息来源 + */ + public void getApplyXXLY(CustomCallBack> callBack) { + HashMap params = new HashMap<>(); + params.put("type", "4"); + params.put("deptId", Constants.USER_ORG_ID); + params.put("sfhm", Constants.SFZH); + request(Constants.APPLY_TYPE_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List applyTypes = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callBack.onSuccess(applyTypes); + } + }); + } + + /** + * 获取申请支援-警务类型 + */ + public void getApplyJWLX(CustomCallBack> callBack) { + HashMap params = new HashMap<>(); + params.put("type", "5"); + params.put("deptId", Constants.USER_ORG_ID); + params.put("sfhm", Constants.SFZH); + request(Constants.APPLY_TYPE_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List applyTypes = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callBack.onSuccess(applyTypes); + } + }); + } + + /** + * 获取我的赋能-办理状态 + */ + public void getMineBLZT(CustomCallBack> callBack) { + HashMap params = new HashMap<>(); + params.put("type", "6"); + params.put("deptId", Constants.USER_ORG_ID); + params.put("sfhm", Constants.SFZH); + request(Constants.APPLY_TYPE_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List applyTypes = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callBack.onSuccess(applyTypes); + } + }); + } + + + /** + * 获取我的赋能-信息来源 + */ + public void getMineXXLY(CustomCallBack> callBack) { + HashMap params = new HashMap<>(); + params.put("type", "7"); + params.put("deptId", Constants.USER_ORG_ID); + params.put("sfhm", Constants.SFZH); + request(Constants.APPLY_TYPE_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List applyTypes = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callBack.onSuccess(applyTypes); + } + }); + } + + /** + * 申请赋能-提交申请 + */ + public void addApply(HashMap params, CustomCallBack callBack) { + params.put("sfhm", Constants.SFZH); + request(Constants.APPLY_COMMIT_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + callBack.onSuccess(null); + } + }); + } + + /** + * 我的赋能-查询我申请的赋能{ + * "sfhm": "220104199208240015", + * "sqsj": "", + * "sy": "", + * "ly": "", + * "spzt": "", + * "fnbh": "" + * } + */ + public void getApplyList(HashMap params, CustomCallBack> callBack) { + params.put("sfhm", "220183197210264653"); + request(Constants.MINE_LIST_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + List applyTypes = new Gson().fromJson(value, new TypeToken>() { + }.getType()); + callBack.onSuccess(applyTypes); + } + }); + } + + /** + * 我的赋能详情 + */ + public void getApplyDetail(String fnbh, CustomCallBack callBack) { + HashMap params = new HashMap<>(); + params.put("sfhm", Constants.SFZH); + params.put("fnbh", fnbh); + params.put("deptId", Constants.USER_ORG_ID); + request(Constants.MINE_DETAIL_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + ApplyDetail applyDetail = new Gson().fromJson(value, ApplyDetail.class); + callBack.onSuccess(applyDetail); + } + }); + } + + /** + * 警情详情跳转到我的赋能详情 + */ + public void jumpApplyDetail(String jqbh, CustomCallBack callBack) { + HashMap params = new HashMap<>(); + params.put("sfhm", Constants.SFZH); + params.put("sfzh", Constants.SFZH); + params.put("jqbh", jqbh); + params.put("deptId", Constants.USER_ORG_ID); + request(Constants.MINE_DETAIL_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + ApplyDetail applyDetail = new Gson().fromJson(value, ApplyDetail.class); + callBack.onSuccess(applyDetail); + } + }); + } + + /** + * 我的赋能详情 + */ + public void policeEmergencyDetailQuery(int type, String content, CustomCallBack callBack) { + HashMap params = new HashMap<>(); + params.put("sfhm", Constants.SFZH); + params.put("type", type + ""); + params.put("condi", content); + request(Constants.SELF_QUERY_ID, new Gson().toJson(params), new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + callBack.onError(call, e); + } + + @Override + public void onSuccess(String value) { + DetailQueryResult applyDetail = new Gson().fromJson(value, DetailQueryResult.class); + callBack.onSuccess(applyDetail); + } + }); + } +} diff --git a/app/src/main/java/com/police/union/chat/fragment/ChatFragment.java b/app/src/main/java/com/police/union/chat/fragment/ChatFragment.java new file mode 100644 index 0000000..c65c50d --- /dev/null +++ b/app/src/main/java/com/police/union/chat/fragment/ChatFragment.java @@ -0,0 +1,23 @@ +package com.police.union.chat.fragment; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.police.base.BaseFragment; +import com.police.union.databinding.FragmentChatBinding; + +public class ChatFragment extends BaseFragment { + private FragmentChatBinding binding; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + binding = FragmentChatBinding.inflate(inflater); + return binding.getRoot(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/activity/ApplyActivity.java b/app/src/main/java/com/police/union/home/activity/ApplyActivity.java new file mode 100644 index 0000000..1516c74 --- /dev/null +++ b/app/src/main/java/com/police/union/home/activity/ApplyActivity.java @@ -0,0 +1,293 @@ +package com.police.union.home.activity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.chad.library.adapter.base.BaseQuickAdapter; +import com.chad.library.adapter.base.viewholder.BaseViewHolder; +import com.police.base.BaseActivity; +import com.police.union.R; +import com.police.union.RequestClient; +import com.police.union.databinding.ActivityApplyBinding; +import com.police.union.databinding.DialogDeptSelectorBinding; +import com.police.union.databinding.DialogSelectorBinding; +import com.police.union.home.model.ApplyDept; +import com.police.union.home.model.ApplyPerson; +import com.police.union.home.viewmodel.ApplyPostViewModel; +import com.police.utils.UiUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +public class ApplyActivity extends BaseActivity { + + private ApplyPostViewModel viewModel; + public List applyDept; + public List applyPeople; + public RequestClient requestClient; + + private ActivityApplyBinding binding; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivityApplyBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + requestClient = RequestClient.instance(); + binding.ivBack.setOnClickListener(view -> finish()); + initView(); + } + + private void initView() { + viewModel = new ApplyPostViewModel(this); + binding.includeApply.tvCommitBtn.setOnClickListener(view -> addApply()); + binding.rlLoading.setOnClickListener(view -> { + }); + binding.includeApply.tvQueryOrg.setOnClickListener(view -> showDeptDialog((TextView) view, "选择部门", applyDept)); + binding.includeApply.tvQueryName.setOnClickListener(view -> showPerson(applyPeople)); + viewModel.getApplyDept(); + binding.includeApply.tvQueryOrg.setOnClickListener(view -> showDept(applyDept)); + binding.includeApply.etSearchTitle.setText(getIntent().getStringExtra("jqbh")); +// binding.includeApply.tvQueryName2.setOnClickListener(view -> { +// //打开相册选择一张图片 +// openAlbum(); +// }); + } + + + private void openAlbum() { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType("image/*"); + startActivityForResult(intent, 250); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { + super.onActivityResult(requestCode, resultCode, data); + //相册 + if (requestCode == 250 && resultCode == RESULT_OK && data != null) { + nrFj = UiUtils.uriToBase64(this, data.getData()); +// binding.includeApply.tvQueryName2.setText(data.getData().toString()); + } + } + + private String nrFj = ""; + + public void showDept(List applyDept) { + if (applyDept == null || applyDept.isEmpty()) { + Toast.makeText(this, "暂无归属部门", Toast.LENGTH_SHORT).show(); + return; + } + showDeptDialog(binding.includeApply.tvQueryOrg, "选择归属部门", applyDept); + } + + public void showPerson(List applyPeople) { + if (applyPeople == null || applyPeople.isEmpty()) { + Toast.makeText(this, "暂无审批人", Toast.LENGTH_SHORT).show(); + return; + } + List names = applyPeople.stream().map(ApplyPerson::getUserName).collect(Collectors.toList()); + showDialog(binding.includeApply.tvQueryName, "选择审批人", names); + } + + public void showDialog(TextView textView, String title, List items) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + DialogSelectorBinding selectorBinding = DialogSelectorBinding.inflate(getLayoutInflater()); + View dialogView = selectorBinding.getRoot(); + selectorBinding.tvDialogTitle.setText(title); + RecyclerView recyclerView = selectorBinding.rcv; + recyclerView.setLayoutManager(new LinearLayoutManager(this)); + BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_dialog_selector, items) { + @Override + protected void convert(@NonNull BaseViewHolder baseViewHolder, String s) { + baseViewHolder.setText(R.id.tv_item_text, s); + } + }; + recyclerView.setAdapter(adapter); + builder.setView(dialogView); + AlertDialog dialog = builder.create(); + adapter.setOnItemClickListener((adapter1, view, position) -> { + textView.setText(items.get(position)); + dialog.dismiss(); + }); + dialog.show(); + } + + public void showDeptDialog(TextView textView, String title, List items) { + AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.TransparentAlertDialog); + DialogDeptSelectorBinding selectorBinding = DialogDeptSelectorBinding.inflate(getLayoutInflater()); + View dialogView = selectorBinding.getRoot(); + selectorBinding.tvDialogTitle.setText(title); + RecyclerView recyclerView = selectorBinding.rcv; + recyclerView.setLayoutManager(new LinearLayoutManager(this)); + List data = new ArrayList<>(); + for (ApplyDept item : items) { + if ("0".equals(item.getpId())) { + data.add(item); + break; + } + } + BaseQuickAdapter adapter = new BaseQuickAdapter(R.layout.item_select_dept, data) { + @Override + protected void convert(@NonNull BaseViewHolder baseViewHolder, ApplyDept s) { + baseViewHolder.setText(R.id.tv_title, s.getName()); + boolean hasChild = false; + for (ApplyDept item : items) { + if (s.getId().equals(item.getpId())) { + hasChild = true; + break; + } + } + baseViewHolder.setVisible(R.id.iv_sanjiao, hasChild); + if (s.isOpen()) { + baseViewHolder.setImageResource(R.id.iv_sanjiao, R.mipmap.icon_down_sanjiao); + baseViewHolder.setImageResource(R.id.iv_box, R.mipmap.icon_selected); + baseViewHolder.setTextColor(R.id.tv_title, getResources().getColor(R.color.main_color)); + baseViewHolder.setBackgroundColor(R.id.tv_title, getResources().getColor(R.color.selected_bg_color)); + } else { + baseViewHolder.setImageResource(R.id.iv_sanjiao, R.mipmap.icon_right_sanjiao); + baseViewHolder.setImageResource(R.id.iv_box, R.mipmap.icon_unselected); + baseViewHolder.setTextColor(R.id.tv_title, getResources().getColor(R.color.color_666)); + baseViewHolder.setBackgroundColor(R.id.tv_title, getResources().getColor(R.color.white)); + } + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < s.getLevel(); i++) { + sb.append(" "); + } + baseViewHolder.setText(R.id.v_level, sb); + } + }; + recyclerView.setAdapter(adapter); + builder.setView(dialogView); + AlertDialog dialog = builder.create(); + adapter.setOnItemClickListener((adapter1, view, position) -> { + ApplyDept dept = data.get(position); + boolean open = dept.isOpen(); + int addCount = 1; + for (ApplyDept item : items) { + if (item.getpId().equals(dept.getId())) { + if (open) { + removeItem(data, item); + } else { + item.setLevel(dept.getLevel() + 1); + data.add(position + addCount, item); + addCount += 1; + } + } + } + if (open) { + cancelSelected(dept); + } else { + enterSelected(data, dept); + } + adapter.setList(data); + selectorBinding.tvEnter.setOnClickListener(view1 -> { + long selectId = -1; + ApplyDept selectDept = null; + for (ApplyDept item : applyDept) { + if (item.isOpen()) { + item.setOpen(false); + if (selectId < Long.parseLong(item.getId())) { + selectId = Long.parseLong(item.getId()); + selectDept = item; + } + } + } + if (selectId >= 0) { + textView.setText(selectDept.getTitle()); + viewModel.getApplyPerson(selectId + ""); + dialog.dismiss(); + } else { + Toast.makeText(this, "请选择一个归属部门", Toast.LENGTH_SHORT).show(); + } + + }); + }); + dialog.show(); + } + + private void removeItem(List data, ApplyDept dept) { + data.remove(dept); + for (int i = 0; i < data.size(); i++) { + if (data.get(i).getpId().equals(dept.getId())) { + removeItem(data, data.get(i)); + } + } + } + + /** + * 发送成功,跳转到成功页面 + */ + public void sendSuccess() { + Toast.makeText(this, "提交成功!", Toast.LENGTH_SHORT).show(); + finish(); + } + + /** + * 取消勾选 + */ + private void cancelSelected(ApplyDept dept) { + dept.setOpen(false); + for (ApplyDept item : applyDept) { + if (item.getpId().equals(dept.getId())) { + cancelSelected(item); + } + } + } + + /** + * 选择勾选 + */ + private void enterSelected(List data, ApplyDept dept) { + for (ApplyDept item : applyDept) { + if (item.getpId().equals(dept.getpId()) && !item.equals(dept)) { + cancelSelected(item); + for (ApplyDept i : applyDept) { + if (i.getpId().equals(item.getId())) { + removeItem(data, i); + } + } + } + } + dept.setOpen(true); + } + + /** + * 提交 + */ + private void addApply() { + HashMap params = new HashMap<>(); + params.put("jqbh", binding.includeApply.etSearchTitle.getText().toString()); + params.put("sy", "7"); + params.put("sqnr", binding.includeApply.etQueryBody.getText().toString()); + params.put("nrFj", nrFj); + params.put("shrName", binding.includeApply.tvQueryName.getText().toString()); + for (ApplyPerson item : applyPeople) { + if (item.getUserName().equals(binding.includeApply.tvQueryName.getText().toString())) { + params.put("shrSfhm", item.getLoginName()); + break; + } + } + viewModel.addApply(params); + } + + public void loadingShow() { + binding.rlLoading.setVisibility(View.VISIBLE); + } + + public void loadingNone() { + binding.rlLoading.setVisibility(View.GONE); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/activity/ApplyDetailActivity.java b/app/src/main/java/com/police/union/home/activity/ApplyDetailActivity.java new file mode 100644 index 0000000..3470e7e --- /dev/null +++ b/app/src/main/java/com/police/union/home/activity/ApplyDetailActivity.java @@ -0,0 +1,71 @@ +package com.police.union.home.activity; + +import android.os.Bundle; +import android.util.Base64; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; + +import androidx.appcompat.app.AppCompatActivity; + +import com.github.barteksc.pdfviewer.PDFView; +import com.police.union.databinding.ActivityApplyDetailBinding; +import com.police.union.home.model.ApplyDetail; +import com.police.union.home.viewmodel.DetailViewModel; +import com.police.utils.UiUtils; + + +public class ApplyDetailActivity extends AppCompatActivity { + + private ActivityApplyDetailBinding binding; + private DetailViewModel viewModel; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivityApplyDetailBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + binding.ivBack.setOnClickListener(view -> finish()); + binding.rlLoading.setOnClickListener(view -> { + + }); + viewModel = new DetailViewModel(this); +// if (getIntent().getStringExtra("applyDetail") == null) { +//// viewModel.jumpApplyDetail(getIntent().getStringExtra("jqbh")); +// } else { + viewModel.getApplyDetail(getIntent().getStringExtra("applyDetail")); +// } + + } + + public void applyDetail(ApplyDetail detail) { + binding.tvDetailFnbh.setText(detail.getBh()); + binding.tvDetailSqsy.setText(detail.getSy()); + binding.tvDetailSqsj.setText(detail.getCreateTimeStr()); + binding.tvDetailJwlx.setText(detail.getLy()); + binding.tvDetailShzt.setText(detail.getSpzt()); +// binding.tvDetailFnxq.setText(detail.getFj()); + // 加载PDF文件 +// File file = new File("/path/to/your/pdf/file.pdf"); // 替换为你的PDF文件路径 + if (detail.getFj() != null && !detail.getFj().isEmpty()) { + for (String item : detail.getFj()) { + PDFView pdfView = new PDFView(this, null); + pdfView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, UiUtils.dp2Px(500))); + pdfView.fromBytes(Base64.decode(item, Base64.DEFAULT)) + .enableSwipe(true) // 允许滑动翻页 + .enableDoubletap(true) // 允许双击缩放 + .enableAnnotationRendering(true) // 允许渲染注释 + .load(); + binding.llGroup.addView(pdfView); + } + } + } + + public void loadingShow() { + binding.rlLoading.setVisibility(View.VISIBLE); + } + + public void loadingNone() { + binding.rlLoading.setVisibility(View.GONE); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/activity/DataActivity.java b/app/src/main/java/com/police/union/home/activity/DataActivity.java new file mode 100644 index 0000000..c431e9f --- /dev/null +++ b/app/src/main/java/com/police/union/home/activity/DataActivity.java @@ -0,0 +1,382 @@ +package com.police.union.home.activity; + +import android.content.Context; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.LinearLayout; +import android.widget.PopupWindow; +import android.widget.TextView; + +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.chad.library.adapter.base.BaseQuickAdapter; +import com.police.base.App; +import com.police.base.BaseActivity; +import com.police.union.R; +import com.police.union.RequestClient; +import com.police.union.databinding.ActivityDataBinding; +import com.police.union.home.adapter.KeyPersonAdapter; +import com.police.union.home.adapter.PoliceEmergencyAdapter; +import com.police.union.home.model.KeyPerson; +import com.police.union.home.model.PoliceEmergency; +import com.police.union.home.viewmodel.DataViewModel; +import com.scwang.smart.refresh.footer.ClassicsFooter; +import com.scwang.smart.refresh.header.ClassicsHeader; + +import java.util.ArrayList; +import java.util.List; + +public class DataActivity extends BaseActivity { + + public ActivityDataBinding binding; + private DataViewModel viewModel; + private PopupWindow popupWindow; + private PopupWindow popupWindow2; + private PopupWindow popupWindow3; + public final List personList = new ArrayList<>(); + public final List policeList = new ArrayList<>(); + public BaseQuickAdapter adapter; + private int currentTabBar = 1; + private int currentTab = 1; + public int filterType = 0; + public RequestClient requestClient; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivityDataBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + requestClient = RequestClient.instance(); + viewModel = new DataViewModel(this); + initView(); + initData(); + } + + private void initView() { + binding.refreshLayout.setRefreshHeader(new ClassicsHeader(this)); + binding.refreshLayout.setRefreshFooter(new ClassicsFooter(this)); + binding.rvGroup.setLayoutManager(new LinearLayoutManager(this)); + keyPersonInitAdapter(); + setPopupWindow(); + setPopupWindow2(); + setPopupWindow3(); + } + + private void initData() { + viewModel.keyPersonInit(); +// viewModel.getKeyPersonMessageCount(); + initListener(); + } + + private void initListener() { + //重点人,案情,案件,点击事件 + binding.llKeyPerson.setOnClickListener(view -> tabBarOnClick(1)); + binding.llPoliceEmergency.setOnClickListener(view -> tabBarOnClick(2)); + binding.llCaseDetails.setOnClickListener(view -> tabBarOnClick(3)); + //搜索按钮添加点击事件 + binding.tvSearchBtn.setOnClickListener(view -> { + if (!App.getApp().findAddress) return; + if (currentTabBar == 1) { + if (currentTab == 1) { + viewModel.keyPersonInit(); + } else { + viewModel.orgKeyPersonInit(); + } + } else if (currentTabBar == 2) { + viewModel.policeEmergencyInit(); + } + }); + //我的重点人与区域重点人tab点击切换事件 + binding.llMyKeyPerson.setOnClickListener(view -> tabOnClick(1)); + binding.llAreaKeyPerson.setOnClickListener(view -> tabOnClick(2)); + //loading视图设置空的点击事件 + binding.rlLoading.setOnClickListener(view -> { + }); + //筛选文字下拉菜单按钮点击事件 + binding.typeGroup.setOnClickListener(view -> { + if (!App.getApp().findAddress) return; + if (currentTabBar == 1) { + popupWindow.showAsDropDown(binding.typeGroup); + } else if (currentTabBar == 2) { + popupWindow2.showAsDropDown(binding.typeGroup); + } else { + popupWindow3.showAsDropDown(binding.typeGroup); + } + + }); + //重点人列表条目点击事件 + adapter.setOnItemClickListener((adapter1, view, position) -> viewModel.keyPersonDetail(personList.get(position).getSfzh())); + //刷新列表 + binding.refreshLayout.setOnRefreshListener(refreshlayout -> { + if (currentTabBar == 1) { + if (currentTab == 1) { + viewModel.keyPersonRefresh(); + } else { + viewModel.orgKeyPersonRefresh(); + } + return; + } + if (currentTabBar == 2) { + viewModel.policeEmergencyRefresh(); + return; + } + if (currentTabBar == 3) { + if (currentTab == 1) { + viewModel.keyPersonRefresh(); + } else { + viewModel.orgKeyPersonRefresh(); + } + } + }); + //加载更多 + binding.refreshLayout.setOnLoadMoreListener(refreshlayout -> { + if (currentTabBar == 1) { + if (currentTab == 1) { + viewModel.keyPersonLoadMore(); + } else { + viewModel.orgKeyPersonLoadMore(); + } + return; + } + if (currentTabBar == 2) { + viewModel.policeEmergencyLoadMore(); + } + }); + } + + private void keyPersonInitAdapter() { + adapter = new KeyPersonAdapter(); + adapter.setNewInstance(personList); + binding.rvGroup.setAdapter(adapter); + adapter.setOnItemClickListener((adapter1, view, position) -> viewModel.keyPersonDetail(personList.get(position).getSfzh())); + } + + private void policeEmergencyInitAdapter() { + adapter = new PoliceEmergencyAdapter(); + adapter.setNewInstance(policeList); + binding.rvGroup.setAdapter(adapter); + adapter.setOnItemClickListener((adapter1, view, position) -> viewModel.policeEmergencyDetail(policeList.get(position).getJcjbh())); + } + + /** + * tab按钮点击切换 + * + * @param i + */ + private void tabOnClick(int i) { + //如果点击tab与当前的一致,当前点击事件无效. + if (currentTab == i) return; + currentTab = i; + //清空搜索框内容 + binding.etInput.setText(""); + //切换效果设置 + binding.tvAreaKeyPerson.setTextColor(getResources().getColor(i != 1 ? R.color.selected_color : R.color.color_666)); + binding.selectAreaKeyPerson.setBackgroundColor(getResources().getColor(i != 1 ? R.color.selected_color : R.color.transparent_color)); + binding.tvMyKeyPerson.setTextColor(getResources().getColor(i == 1 ? R.color.selected_color : R.color.color_666)); + binding.selectMyKeyPerson.setBackgroundColor(getResources().getColor(i == 1 ? R.color.selected_color : R.color.transparent_color)); + if (currentTabBar == 1) { + if (currentTab == 1) { + //加载我的重点人 + viewModel.keyPersonInit(); + } else { + viewModel.orgKeyPersonInit(); + } + } + } + + /** + * 顶部tabBar切换 + * + * @param i + */ + private void tabBarOnClick(int i) { + if (currentTabBar == i) return; + currentTabBar = i; + binding.etInput.setText(""); + binding.iconKeyPerson.setBackgroundResource(i == 1 ? R.mipmap.key_person_icon_selected : R.mipmap.key_person_icon_normal); + binding.tvKeyPerson.setTextColor(getResources().getColor(i == 1 ? R.color.selected_color : R.color.black)); + binding.selectKeyPerson.setBackgroundColor(getResources().getColor(i == 1 ? R.color.selected_color : R.color.white)); + binding.iconPoliceEmergency.setBackgroundResource(i == 2 ? R.mipmap.icon_jq_selected : R.mipmap.icon_jq_normal); + binding.tvPoliceEmergency.setTextColor(getResources().getColor(i == 2 ? R.color.selected_color : R.color.black)); + binding.selectPoliceEmergency.setBackgroundColor(getResources().getColor(i == 2 ? R.color.selected_color : R.color.white)); + binding.iconCaseDetails.setBackgroundResource(i == 3 ? R.mipmap.wenjianjia : R.mipmap.wenjianjia_icon); + binding.tvCaseDetails.setTextColor(getResources().getColor(i == 3 ? R.color.selected_color : R.color.black)); + binding.selectCaseDetails.setBackgroundColor(getResources().getColor(i == 3 ? R.color.selected_color : R.color.white)); + filterType = 0; + switch (i) { + case 1: + binding.tvSearchTitle.setText("姓名"); + keyPersonInitAdapter(); + if (currentTab == 1) { + viewModel.keyPersonInit(); + } else { + viewModel.orgKeyPersonInit(); + } + binding.tvMyKeyPerson.setText("我的重点人"); + binding.tvAreaKeyPerson.setText("辖区(警种)重点人"); + binding.tabGroup.setVisibility(View.VISIBLE); + break; + case 2: + binding.tvSearchTitle.setText("警情编号"); + policeEmergencyInitAdapter(); + viewModel.policeEmergencyInit(); + binding.tabGroup.setVisibility(View.GONE); + break; + default: + binding.tvSearchTitle.setText("案件编号"); + binding.tvMyKeyPerson.setText("在办案件"); + binding.tvAreaKeyPerson.setText("历史案件"); + binding.tabGroup.setVisibility(View.GONE); + loadCase(new ArrayList<>()); + } + } + + /** + * 加载案情布局 + */ + public void loadCase(List data) { + KeyPersonAdapter adapter = new KeyPersonAdapter(); + adapter.setNewInstance(data); + binding.rvGroup.setLayoutManager(new LinearLayoutManager(this)); + binding.rvGroup.setAdapter(adapter); + adapter.setOnItemClickListener((adapter1, view, position) -> viewModel.keyPersonDetail(data.get(position).getSfzh())); + } + + public void loadingShow() { + App.getHandler().post(() -> binding.rlLoading.setVisibility(View.VISIBLE)); + + } + + public void loadingNone() { + App.getHandler().post(() -> binding.rlLoading.setVisibility(View.GONE)); + } + + private void setPopupWindow() { + // 初始化 PopupWindow + popupWindow = new PopupWindow(this); + // 加载自定义布局 + LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View contentView = inflater.inflate(R.layout.dropdown_layout, null); + // 设置 PopupWindow 的宽高 + popupWindow.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT); + popupWindow.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT); + // 设置 PopupWindow 的背景 + popupWindow.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); + // 设置 PopupWindow 显示的位置(相对于按钮) + popupWindow.showAtLocation(binding.typeGroup, Gravity.NO_GRAVITY, 0, 0); + // 为每个菜单项设置点击事件 + TextView textView1 = contentView.findViewById(R.id.textView1); // 假设这是菜单项1的ID + TextView textView2 = contentView.findViewById(R.id.textView2); // 假设这是菜单项2的ID + textView1.setOnClickListener(v -> { + // 处理菜单项 1 的点击事件 + binding.tvSearchTitle.setText("姓名"); + filterType = 0; + popupWindow.dismiss(); // 关闭 PopupWindow + }); + textView2.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvSearchTitle.setText("身份证号"); + filterType = 1; + popupWindow.dismiss(); // 关闭 PopupWindow + }); + // 将自定义布局设置为 PopupWindow 的内容视图 + popupWindow.setContentView(contentView); + // 设置 PopupWindow 的焦点 + popupWindow.setFocusable(true); + popupWindow.setOutsideTouchable(true); // 设置点击 PopupWindow 外部区域使其消失 + } + + private void setPopupWindow2() { + // 初始化 PopupWindow + popupWindow2 = new PopupWindow(this); + // 加载自定义布局 + LayoutInflater inflater2 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View contentView2 = inflater2.inflate(R.layout.dropdown_layout2, null); + // 设置 PopupWindow 的宽高 + popupWindow2.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT); + popupWindow2.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT); + // 设置 PopupWindow 的背景 + popupWindow2.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); + // 设置 PopupWindow 显示的位置(相对于按钮) + popupWindow2.showAtLocation(binding.typeGroup, Gravity.NO_GRAVITY, 0, 0); + // 为每个菜单项设置点击事件 + TextView textView3 = contentView2.findViewById(R.id.textView3); // 假设这是菜单项1的ID + TextView textView4 = contentView2.findViewById(R.id.textView4); // 假设这是菜单项2的ID + TextView textView5 = contentView2.findViewById(R.id.textView5); // 假设这是菜单项2的ID + textView3.setOnClickListener(v -> { + // 处理菜单项 1 的点击事件 + binding.tvSearchTitle.setText("警情编号"); + filterType = 0; + popupWindow2.dismiss(); // 关闭 PopupWindow + }); + textView4.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvSearchTitle.setText("报警内容"); + filterType = 1; + popupWindow2.dismiss(); // 关闭 PopupWindow + }); + textView5.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvSearchTitle.setText("报警电话"); + filterType = 2; + popupWindow2.dismiss(); // 关闭 PopupWindow + }); + // 将自定义布局设置为 PopupWindow 的内容视图 + popupWindow2.setContentView(contentView2); + // 设置 PopupWindow 的焦点 + popupWindow2.setFocusable(true); + popupWindow2.setOutsideTouchable(true); // 设置点击 PopupWindow 外部区域使其消失 + } + + private void setPopupWindow3() { + // 初始化 PopupWindow + popupWindow3 = new PopupWindow(this); + // 加载自定义布局 + LayoutInflater inflater2 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View contentView2 = inflater2.inflate(R.layout.dropdown_layout3, null); + // 设置 PopupWindow 的宽高 + popupWindow3.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT); + popupWindow3.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT); + // 设置 PopupWindow 的背景 + popupWindow3.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); + // 设置 PopupWindow 显示的位置(相对于按钮) + popupWindow3.showAtLocation(binding.typeGroup, Gravity.NO_GRAVITY, 0, 0); + // 为每个菜单项设置点击事件 + TextView textView6 = contentView2.findViewById(R.id.textView6); // 假设这是菜单项1的ID + TextView textView7 = contentView2.findViewById(R.id.textView7); // 假设这是菜单项2的ID + TextView textView8 = contentView2.findViewById(R.id.textView8); // 假设这是菜单项2的ID + TextView textView9 = contentView2.findViewById(R.id.textView9); // 假设这是菜单项2的ID + textView6.setOnClickListener(v -> { + // 处理菜单项 1 的点击事件 + binding.tvSearchTitle.setText("案件编号"); + filterType = 0; + popupWindow3.dismiss(); // 关闭 PopupWindow + }); + textView7.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvSearchTitle.setText("案件名称"); + filterType = 1; + popupWindow3.dismiss(); // 关闭 PopupWindow + }); + textView8.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvSearchTitle.setText("嫌疑人姓名"); + filterType = 3; + popupWindow3.dismiss(); // 关闭 PopupWindow + }); + textView9.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvSearchTitle.setText("受害人姓名"); + filterType = 4; + popupWindow3.dismiss(); // 关闭 PopupWindow + }); + // 将自定义布局设置为 PopupWindow 的内容视图 + popupWindow3.setContentView(contentView2); + // 设置 PopupWindow 的焦点 + popupWindow3.setFocusable(true); + popupWindow3.setOutsideTouchable(true); // 设置点击 PopupWindow 外部区域使其消失 + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/activity/KeyPersonDetailActivity.java b/app/src/main/java/com/police/union/home/activity/KeyPersonDetailActivity.java new file mode 100644 index 0000000..18f70a2 --- /dev/null +++ b/app/src/main/java/com/police/union/home/activity/KeyPersonDetailActivity.java @@ -0,0 +1,173 @@ +package com.police.union.home.activity; + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import com.bumptech.glide.Glide; +import com.google.gson.Gson; +import com.police.base.BaseActivity; +import com.police.network.Constants; +import com.police.union.databinding.ActivityKeyPersonDetailBinding; +import com.police.union.home.model.KeyPersonDetail; +import com.police.utils.UiUtils; + +public class KeyPersonDetailActivity extends BaseActivity { + private ActivityKeyPersonDetailBinding binding; + private KeyPersonDetail keyPersonDetail; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivityKeyPersonDetailBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + initListener(); + String sfzh = getIntent().getStringExtra("sfzh"); + keyPersonDetail = new Gson().fromJson(sfzh, KeyPersonDetail.class); + binding.wm.setTextSize(50); + binding.wm.setText(Constants.SFZH); + showData(); + } + + private void showData() { + /** + * 基本信息数据显示 + */ + binding.tvName.setText(keyPersonDetail.getXm()); + binding.tvSex.setText(keyPersonDetail.getXb()); + if (UiUtils.isNotEmpty(keyPersonDetail.getHypo())) { + binding.tvMarital.setVisibility(View.VISIBLE); + binding.tvMarital.setText("已婚"); + } + if (UiUtils.isNotEmpty(keyPersonDetail.getBq())) { + binding.tvBq.setText(keyPersonDetail.getBq()); + binding.tvBq.setVisibility(View.VISIBLE); + } + setText(binding.tvNation, keyPersonDetail.getMz()); + setText(binding.detailSfzh, keyPersonDetail.getGmsfhm()); + if (UiUtils.isNotEmpty(keyPersonDetail.getJzdhhm())) { + String[] split = keyPersonDetail.getJzdhhm().split(","); + binding.detailSjh.setText(split[0]);//手机号 + } + setText(binding.detailHj, keyPersonDetail.getJg()); + setText(binding.detailGldz, keyPersonDetail.getHjdz()); + setText(binding.detailFwcs, keyPersonDetail.getFwcs()); + if (UiUtils.isNotEmpty(keyPersonDetail.getDjchphm())) { + binding.detailClxx.setText(keyPersonDetail.getDjchphm());//车辆信息 + } + + /** + * 位置信息数据显示 + */ + + if (UiUtils.isNotEmpty(keyPersonDetail.getSjgj())) { + setText(binding.tvBodyLastLocationPhone, sCountSp(keyPersonDetail.getSjgj()));//手机基站位置信息 + setText(binding.tvBodyLastLocationPhoneTime, UiUtils.formatTime(keyPersonDetail.getSjgj().split(",")[1]));//手机最后定位时间 + } + if (UiUtils.isNotEmpty(keyPersonDetail.getClzhwz())) { + setText(binding.tvBodyLastLocation, sCountSp(keyPersonDetail.getClzhwz()));//车辆最后位置 + setText(binding.tvBodyLastTime, UiUtils.formatTime(keyPersonDetail.getClzhwz().split(",")[1]));//车辆最后定位时间 + } + if (UiUtils.isNotEmpty(keyPersonDetail.getHcdp())) { + setText(binding.tvBodyTrainInfo, keyPersonDetail.getHcdp().split(",")[3] + "," + keyPersonDetail.getHcdp().split(",")[4] + " - " + keyPersonDetail.getHcdp().split(",")[5]);//火车订票 + setText(binding.tvBodyTrainTime, UiUtils.formatTime(keyPersonDetail.getHcdp().split(",")[2]));//火车发车时间 + } + if (UiUtils.isNotEmpty(keyPersonDetail.getKcdp())) { + setText(binding.tvBodyBusInfo, keyPersonDetail.getKcdp().split(",")[7] + "," + keyPersonDetail.getKcdp().split(",")[2] + " - " + keyPersonDetail.getKcdp().split(",")[6]);//客车订票、、 tCount(keyPersonDetail.getKcdp()) + setText(binding.tvBodyBusTime, UiUtils.formatTime(keyPersonDetail.getKcdp().split(",")[4]));//客车发车时间 + } + if (UiUtils.isNotEmpty(keyPersonDetail.getFjdp())) { + setText(binding.tvBodyFlyInfo, keyPersonDetail.getFjdp().split(",")[4] + "," + keyPersonDetail.getFjdp().split(",")[6] + " - " + keyPersonDetail.getFjdp().split(",")[9]);//飞机订票 + setText(binding.tvBodyFlyTime, UiUtils.formatTime(keyPersonDetail.getFjdp().split(",")[7]));//飞机起飞时间 + } + if (UiUtils.isNotEmpty(keyPersonDetail.getZjzs())) { + setText(binding.tvBodyRestInfo, tCount(keyPersonDetail.getZjzs()));//最近住宿 + } + if (keyPersonDetail.getZp() != null) { + loadBase64Image(binding.ivPhoto, keyPersonDetail.getZp()); + } + + /** + * 列控数据信息显示 + */ + if (keyPersonDetail.getLsajcs() > 0) { + setText(binding.tvBodyCtrlLevel, keyPersonDetail.getZdryLkxxList().get(0).getGklb());//管理级别 + setText(binding.tvBodyCtrlType, keyPersonDetail.getZdryLkxxList().get(0).getQtlb());//列管级别 + setText(binding.tvBodyCtrlTag, keyPersonDetail.getZdryLkxxList().get(0).getLkjz());//列控警种 + setText(binding.tvBodyCtrlTime, UiUtils.formatTime(keyPersonDetail.getZdryLkxxList().get(0).getLksj()));//列控时间 + setText(binding.tvBodyCtrlCause, keyPersonDetail.getZdryLkxxList().get(0).getLkyy());//列控原因 + setText(binding.tvBodyCtrlPerson, keyPersonDetail.getZdryLkxxList().get(0).getZrdw());//责任单位 + setText(binding.tvBodyCtrlPolice, keyPersonDetail.getZdryLkxxList().get(0).getZrmj());//责任民警 + } + + } + + public void loadBase64Image(ImageView imageView, String base64Str) { + Glide.with(imageView.getContext()) + .asBitmap() + .load(base64Str) + .into(imageView); + } + + /** + * 第3次索引 + * + * @param str + * @return + */ + private String tCount(String str) { + String c = ","; + int firstIndex = str.indexOf(c); + int secondIndex = str.indexOf(c, firstIndex + 1); + int thirdIndex = str.indexOf(c, secondIndex + 1); + return str.substring(thirdIndex + 1, str.length()); + } + + /** + * 第2个索引 + * + * @param str + * @return + */ + private String sCount(String str) { + String c = ","; + int firstIndex = str.indexOf(c); + int secondIndex = str.indexOf(c, firstIndex + 1); + return str.substring(secondIndex + 1, str.length()); + } + + /** + * 第2个索引 + * + * @param str + * @return + */ + private String sCountSp(String str) { + try { + return str.split(",")[3]; + } catch (Exception e) { + return ""; + } + } + + private void initListener() { + binding.ivBack.setOnClickListener(view -> finish()); + } + + public static void startAction(Context context, String num) { + Intent intent = new Intent(context, KeyPersonDetailActivity.class); + intent.putExtra("sfzh", num); + context.startActivity(intent); + } + + private void setText(TextView view, String str) { + if (UiUtils.isNotEmpty(str)) { + view.setText(str); + } else { + view.setText("无"); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/activity/PoliceEmergencyDetailActivity.java b/app/src/main/java/com/police/union/home/activity/PoliceEmergencyDetailActivity.java new file mode 100644 index 0000000..677e0cc --- /dev/null +++ b/app/src/main/java/com/police/union/home/activity/PoliceEmergencyDetailActivity.java @@ -0,0 +1,217 @@ +package com.police.union.home.activity; + +import android.Manifest; +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.os.Bundle; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + +import com.bumptech.glide.Glide; +import com.google.gson.Gson; +import com.police.base.App; +import com.police.network.Constants; +import com.police.network.CustomCallBack; +import com.police.union.R; +import com.police.union.RequestClient; +import com.police.union.databinding.ActivityPoliceEmergencyDetailBinding; +import com.police.union.home.model.ApplyType; +import com.police.union.home.model.DetailQueryResult; +import com.police.union.home.model.PoliceEmergencyDetail; +import com.police.utils.UiUtils; + +import java.util.List; + +import okhttp3.Call; + +/** + * 警情详情页面 + */ +public class PoliceEmergencyDetailActivity extends Activity { + + private ActivityPoliceEmergencyDetailBinding binding; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivityPoliceEmergencyDetailBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + binding.wm.setTextSize(50); + binding.wm.setText(Constants.SFZH); + binding.ivBack.setOnClickListener(view -> finish()); + PoliceEmergencyDetail detail = new Gson().fromJson(getIntent().getStringExtra("param"), PoliceEmergencyDetail.class); + if (UiUtils.isNotEmpty(detail.getZp())) { + Glide.with(App.getApp()).asBitmap().load(detail.getZp()).into(binding.includePersonInfo.ivZp); + } + setText(binding.includeBaseInfo.tvJcjbh, detail.getJcjbh());//报警编号 + setText(binding.includeBaseInfo.tvBjjyqk, detail.getBjjyqk());//报警内容 + setText(binding.includeBaseInfo.tvBjrlxdh, detail.getBjrlxdh());//报警电话 + setText(binding.includeBaseInfo.tvJjsj, UiUtils.formatTime(detail.getJjsj()));//报警时间 + setText(binding.includeBaseInfo.tvAsjfsdddzmc, detail.getAsjfsdddzmc());//报警位置 + setText(binding.includeBaseInfo.tvCjdwgajgjgdm, detail.getCjdwgajgjgdm());//出警单位 + setText(binding.includeBaseInfo.tvCjrxm, detail.getCjrxm());//出警民警 + setText(binding.includeBaseInfo.tvJqlb, detail.getJqlb());//警情类别 + setText(binding.includeBaseInfo.tvCllb, detail.getCllx());//处理类型 + setText(binding.includeBaseInfo.tvCljg, detail.getCljg());//处理结果 + + setText(binding.includePersonInfo.tvBq, detail.getBq());//标签 + setText(binding.includePersonInfo.tvJg, detail.getJg());//籍贯 + setText(binding.includePersonInfo.tvXm, detail.getXm());//姓名 + setText(binding.includePersonInfo.tvXb, detail.getXb());//性别 + setText(binding.includePersonInfo.tvMz, detail.getMz());//民族 + setText(binding.includePersonInfo.tvHyzk, detail.getHyzk());//婚姻状况 + setText(binding.includePersonInfo.tvSfzh, detail.getBjrzjhm());//身份证号 + setText(binding.includePersonInfo.tvNl, detail.getNl());//年龄 + setText(binding.includePersonInfo.tvFwcs, detail.getFwcs());//服务场所 + setText(binding.includePersonInfo.tvLsbjcs, detail.getLsbjcs());//历史报警次数 + + setText(binding.includeCjyaInfo.tvContent, detail.getLsbjcs());//todo 处警预案 + + binding.includeQueryInfo.tvQueryType1.setOnClickListener(view -> { + queryType = 1; + changeView(); + }); + binding.includeQueryInfo.tvQueryType2.setOnClickListener(view -> { + queryType = 2; + changeView(); + }); + binding.includeQueryInfo.tvQueryType3.setOnClickListener(view -> { + queryType = 3; + changeView(); + }); + binding.includeQueryInfo.tvQueryBtn.setOnClickListener(view -> { + sendQuery(); + }); + binding.includeApplyInfo.tvQueryResult.setOnClickListener(view -> { + //跳转到赋能详情 + jumpApplyDetail(detail.getJcjbh()); + }); + binding.includeApplyInfo.tvGoApply.setOnClickListener(view -> { + jumpApplyFragment(detail.getJcjbh()); + }); + binding.includeApplyInfo.tvMakeCall.setOnClickListener(view -> { + //拨打电话660110 + makeCall(); + }); + } + + private void jumpApplyFragment(String jqbh) { + RequestClient.instance().getApplyType(new CustomCallBack>() { + @Override + public void onError(Call call, @NonNull Exception e) { + + } + + @Override + public void onSuccess(List value) { + if (value.isEmpty()) { + Toast.makeText(PoliceEmergencyDetailActivity.this, "用户未在大数据实战赋能系统登记,无法填写工单", Toast.LENGTH_SHORT).show(); + } else { + Intent intent = new Intent(PoliceEmergencyDetailActivity.this, ApplyActivity.class); + intent.putExtra("jqbh", jqbh); + startActivity(intent); + } + } + }); + + } + + private void jumpApplyDetail(String jqbh) { + RequestClient.instance().getApplyType(new CustomCallBack>() { + @Override + public void onError(Call call, @NonNull Exception e) { + + } + + @Override + public void onSuccess(List value) { + if (value.isEmpty()) { + Toast.makeText(PoliceEmergencyDetailActivity.this, "用户未在大数据实战赋能系统登记,无法查看结果", Toast.LENGTH_SHORT).show(); + } else { + Intent intent = new Intent(PoliceEmergencyDetailActivity.this, QueryApplyResultActivity.class); + intent.putExtra("jqbh", jqbh); + startActivity(intent); + } + } + }); + } + + private void makeCall() { + if (ContextCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) + != PackageManager.PERMISSION_GRANTED) { + // 权限尚未被授予 + ActivityCompat.requestPermissions(this, + new String[]{Manifest.permission.CALL_PHONE}, + 500); + UiUtils.toast("电话权限未被授予,请打开电话权限"); + } else { + // 权限已经被授予,可以拨打电话 + Intent intent = new Intent(Intent.ACTION_CALL); + intent.setData(Uri.parse("tel:660110")); + if (intent.resolveActivity(getPackageManager()) != null) { + startActivity(intent); + } + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { + if (requestCode == 500) { + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + // 权限被授予,可以拨打电话 + makeCall(); + } + } + } + + private void sendQuery() { + String str = binding.includeQueryInfo.etInput.getText().toString(); + if (str.isEmpty()) { + Toast.makeText(this, "请输入查询内容", Toast.LENGTH_SHORT).show(); + return; + } + RequestClient.instance().policeEmergencyDetailQuery(queryType, str, new CustomCallBack() { + @Override + public void onError(Call call, @NonNull Exception e) { + Toast.makeText(PoliceEmergencyDetailActivity.this, "查询失败", Toast.LENGTH_SHORT).show(); + } + + @Override + public void onSuccess(DetailQueryResult value) { + binding.includeQueryInfo.tvQueryResult.setText(value.getGOBACK()); + } + }); + } + + private int queryType = 1; + + private void changeView() { + binding.includeQueryInfo.tvQueryType1.setTextColor(queryType == 1 ? getColor(R.color.white) : getColor(R.color.color_999)); + binding.includeQueryInfo.tvQueryType2.setTextColor(queryType == 2 ? getColor(R.color.white) : getColor(R.color.color_999)); + binding.includeQueryInfo.tvQueryType3.setTextColor(queryType == 3 ? getColor(R.color.white) : getColor(R.color.color_999)); + binding.includeQueryInfo.tvQueryType1.setBackgroundResource(queryType == 1 ? R.drawable.all_7_main_bg : R.drawable.all_7_999_border_bg); + binding.includeQueryInfo.tvQueryType2.setBackgroundResource(queryType == 2 ? R.drawable.all_7_main_bg : R.drawable.all_7_999_border_bg); + binding.includeQueryInfo.tvQueryType3.setBackgroundResource(queryType == 3 ? R.drawable.all_7_main_bg : R.drawable.all_7_999_border_bg); + } + + public static void startAction(Context context, String num) { + Intent intent = new Intent(context, PoliceEmergencyDetailActivity.class); + intent.putExtra("param", num); + context.startActivity(intent); + } + + private void setText(TextView view, String str) { + if (UiUtils.isNotEmpty(str)) { + view.setText(str); + } else { + view.setText("无"); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/activity/QueryApplyResultActivity.java b/app/src/main/java/com/police/union/home/activity/QueryApplyResultActivity.java new file mode 100644 index 0000000..6d8da48 --- /dev/null +++ b/app/src/main/java/com/police/union/home/activity/QueryApplyResultActivity.java @@ -0,0 +1,58 @@ +package com.police.union.home.activity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; + + +import com.police.union.databinding.ActivityQueryApplyResultBinding; +import com.police.union.home.adapter.MineApplyListAdapter; +import com.police.union.home.model.Apply; +import com.police.union.home.viewmodel.ApplyResultViewModel; + +import java.util.List; + +public class QueryApplyResultActivity extends AppCompatActivity { + + private ActivityQueryApplyResultBinding binding; + private MineApplyListAdapter adapter; + private List applyList; + private ApplyResultViewModel viewModel; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivityQueryApplyResultBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + viewModel = new ApplyResultViewModel(this); + binding.ivBack.setOnClickListener(view -> finish()); + binding.mineRvGroup.setLayoutManager(new LinearLayoutManager(this)); + adapter = new MineApplyListAdapter(); + binding.mineRvGroup.setAdapter(adapter); + adapter.setOnItemClickListener((adapter1, view, position) -> applyDetail(applyList.get(position).getBh())); + viewModel.getApplyList(getIntent().getStringExtra("jqbh")); +// viewModel.getApplyList("22010020240411234457000018"); + } + + public void applyList(List list) { + applyList = list; + adapter.setList(list); + } + + public void applyDetail(String applyDetail) { + Intent intent = new Intent(this, ApplyDetailActivity.class); + intent.putExtra("applyDetail", applyDetail); + startActivity(intent); + } + + public void loadingShow() { + binding.rlLoading.setVisibility(View.VISIBLE); + } + + public void loadingNone() { + binding.rlLoading.setVisibility(View.GONE); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/adapter/KeyPersonAdapter.java b/app/src/main/java/com/police/union/home/adapter/KeyPersonAdapter.java new file mode 100644 index 0000000..7cdb137 --- /dev/null +++ b/app/src/main/java/com/police/union/home/adapter/KeyPersonAdapter.java @@ -0,0 +1,35 @@ +package com.police.union.home.adapter; + +import android.widget.ImageView; + +import com.bumptech.glide.Glide; +import com.chad.library.adapter.base.BaseQuickAdapter; +import com.chad.library.adapter.base.viewholder.BaseViewHolder; +import com.police.base.App; +import com.police.union.R; +import com.police.union.home.model.KeyPerson; +import com.police.utils.UiUtils; + +public class KeyPersonAdapter extends BaseQuickAdapter { + + public KeyPersonAdapter() { + super(R.layout.item_key_person); // 指定列表项的布局 + } + + @Override + protected void convert(BaseViewHolder helper, KeyPerson item) { + helper.setText(R.id.item_name, item.getXm()); + helper.setText(R.id.item_sfzh, item.getSfzh()); + helper.setText(R.id.item_gklb, item.getGklb()); + helper.setText(R.id.item_qtlb, item.getQtlb()); + helper.setText(R.id.item_zrmj, item.getZrmj()); + if (UiUtils.isNotEmpty(item.getZp())) { + Glide.with(App.getApp()) + .asBitmap() + .load(item.getZp()) + .into((ImageView) helper.getView(R.id.iv_photo)); + } else { + helper.setImageResource(R.id.iv_photo, R.mipmap.photo); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/adapter/MineApplyListAdapter.java b/app/src/main/java/com/police/union/home/adapter/MineApplyListAdapter.java new file mode 100644 index 0000000..d3c661a --- /dev/null +++ b/app/src/main/java/com/police/union/home/adapter/MineApplyListAdapter.java @@ -0,0 +1,22 @@ +package com.police.union.home.adapter; + +import com.chad.library.adapter.base.BaseQuickAdapter; +import com.chad.library.adapter.base.viewholder.BaseViewHolder; +import com.police.union.R; +import com.police.union.home.model.Apply; + +public class MineApplyListAdapter extends BaseQuickAdapter { + + public MineApplyListAdapter() { + super(R.layout.item_mine_apply); // 指定列表项的布局 + } + + @Override + protected void convert(BaseViewHolder helper, Apply item) { + helper.setText(R.id.tv_fnbh, item.getBh()); + helper.setText(R.id.tv_sqsy, item.getSy()); + helper.setText(R.id.tv_sqsj, item.getCreateTimeStr()); + helper.setText(R.id.tv_xxly, item.getLy()); + helper.setText(R.id.tv_blzt, item.getSpzt()); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/adapter/PoliceEmergencyAdapter.java b/app/src/main/java/com/police/union/home/adapter/PoliceEmergencyAdapter.java new file mode 100644 index 0000000..bf1739d --- /dev/null +++ b/app/src/main/java/com/police/union/home/adapter/PoliceEmergencyAdapter.java @@ -0,0 +1,23 @@ +package com.police.union.home.adapter; + +import com.chad.library.adapter.base.BaseQuickAdapter; +import com.chad.library.adapter.base.viewholder.BaseViewHolder; +import com.police.union.R; +import com.police.union.home.model.PoliceEmergency; +import com.police.utils.UiUtils; + +public class PoliceEmergencyAdapter extends BaseQuickAdapter { + + public PoliceEmergencyAdapter() { + super(R.layout.item_police_emergency); // 指定列表项的布局 + } + + @Override + protected void convert(BaseViewHolder helper, PoliceEmergency item) { + helper.setText(R.id.tv_police_num_title, "警情编号:"+item.getJcjbh());//警情编号 + helper.setText(R.id.item_content, item.getBjjyqk());//报警内容 + helper.setText(R.id.tv_police_tel, item.getBjrlxdh());//报警电话 + helper.setText(R.id.tv_police_time, UiUtils.formatTime(item.getJjsj()));//报警时间 + helper.setText(R.id.tv_police_loc, item.getAsjfsdddzmc());//报警地址 + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/fragment/HomeFragment.java b/app/src/main/java/com/police/union/home/fragment/HomeFragment.java new file mode 100644 index 0000000..d510e55 --- /dev/null +++ b/app/src/main/java/com/police/union/home/fragment/HomeFragment.java @@ -0,0 +1,31 @@ +package com.police.union.home.fragment; + +import android.content.Intent; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.police.base.BaseFragment; +import com.police.union.databinding.FragmentHomeBinding; +import com.police.union.home.activity.DataActivity; + +public class HomeFragment extends BaseFragment { + private FragmentHomeBinding binding; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + binding = FragmentHomeBinding.inflate(inflater); + initView(); + return binding.getRoot(); + } + + + private void initView() { + binding.llData.setOnClickListener(view -> startActivity(new Intent(getActivity(), DataActivity.class))); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/model/Apply.java b/app/src/main/java/com/police/union/home/model/Apply.java new file mode 100644 index 0000000..f8b1ceb --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/Apply.java @@ -0,0 +1,61 @@ +package com.police.union.home.model; + +import java.io.Serializable; + +/** + * { + * "bh": "JL0100002016", + * "createTimeStr": "2024-03-13 09:05:39.0", + * "ly": "PC", + * "params": {}, + * "spzt": "审批驳回", + * "sy": "处置警情" + * } + */ +public class Apply implements Serializable { + private String bh;//赋能编号 + private String sy;//申请事由 + private String createTimeStr;//申请时间 + private String ly;//信息来源 + private String spzt;//办理状态 + + public String getBh() { + return bh; + } + + public void setBh(String bh) { + this.bh = bh; + } + + public String getSy() { + return sy; + } + + public void setSy(String sy) { + this.sy = sy; + } + + public String getCreateTimeStr() { + return createTimeStr; + } + + public void setCreateTimeStr(String createTimeStr) { + this.createTimeStr = createTimeStr; + } + + public String getLy() { + return ly; + } + + public void setLy(String ly) { + this.ly = ly; + } + + public String getSpzt() { + return spzt; + } + + public void setSpzt(String spzt) { + this.spzt = spzt; + } +} diff --git a/app/src/main/java/com/police/union/home/model/ApplyDept.java b/app/src/main/java/com/police/union/home/model/ApplyDept.java new file mode 100644 index 0000000..1e82dca --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/ApplyDept.java @@ -0,0 +1,81 @@ +package com.police.union.home.model; + +import java.io.Serializable; + +/** + * {\"checked\":false,\"id\":\"220000000000\",\"name\":\"吉林省公安厅\",\"nocheck\":false,\"open\":false,\"pId\":\"0\",\"title\":\"吉林省公安厅\"} + */ +public class ApplyDept implements Serializable { + private boolean checked; + private String id; + private String name; + private String pId; + private String title; + private int level = 0; + private boolean open; + private boolean nocheck; + + public boolean isChecked() { + return checked; + } + + public void setChecked(boolean checked) { + this.checked = checked; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public void setName(String name) { + this.name = name; + } + + public String getpId() { + return pId; + } + + public void setpId(String pId) { + this.pId = pId; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public boolean isOpen() { + return open; + } + + public void setOpen(boolean open) { + this.open = open; + } + + public boolean isNocheck() { + return nocheck; + } + + public void setNocheck(boolean nocheck) { + this.nocheck = nocheck; + } +} diff --git a/app/src/main/java/com/police/union/home/model/ApplyDetail.java b/app/src/main/java/com/police/union/home/model/ApplyDetail.java new file mode 100644 index 0000000..2a7c2ed --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/ApplyDetail.java @@ -0,0 +1,71 @@ +package com.police.union.home.model; + +import java.io.Serializable; +import java.util.List; + +/** + * { + * "bh": "JL0100002016", + * "createTimeStr": "2024-03-13 09:05:39.0", + * "ly": "PC", + * "params": {}, + * "spzt": "审批驳回", + * "sy": "处置警情" + * } + */ +public class ApplyDetail implements Serializable { + private String bh;//赋能编号 + private String sy;//申请事由 + private String createTimeStr;//申请时间 + private String ly;//信息来源 + private String spzt;//办理状态 + private List fj;//附件 + + public List getFj() { + return fj; + } + + public void setFj(List fj) { + this.fj = fj; + } + + public String getBh() { + return bh; + } + + public void setBh(String bh) { + this.bh = bh; + } + + public String getSy() { + return sy; + } + + public void setSy(String sy) { + this.sy = sy; + } + + public String getCreateTimeStr() { + return createTimeStr; + } + + public void setCreateTimeStr(String createTimeStr) { + this.createTimeStr = createTimeStr; + } + + public String getLy() { + return ly; + } + + public void setLy(String ly) { + this.ly = ly; + } + + public String getSpzt() { + return spzt; + } + + public void setSpzt(String spzt) { + this.spzt = spzt; + } +} diff --git a/app/src/main/java/com/police/union/home/model/ApplyPerson.java b/app/src/main/java/com/police/union/home/model/ApplyPerson.java new file mode 100644 index 0000000..7e4dc72 --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/ApplyPerson.java @@ -0,0 +1,24 @@ +package com.police.union.home.model; + +import java.io.Serializable; + +public class ApplyPerson implements Serializable { + private String loginName; + private String userName; + + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } +} diff --git a/app/src/main/java/com/police/union/home/model/ApplyType.java b/app/src/main/java/com/police/union/home/model/ApplyType.java new file mode 100644 index 0000000..0f9bbf5 --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/ApplyType.java @@ -0,0 +1,33 @@ +package com.police.union.home.model; + +import java.io.Serializable; + +public class ApplyType implements Serializable { + private String dictLabel; + private String dictSort; + private String dictValue; + + public String getDictLabel() { + return dictLabel; + } + + public void setDictLabel(String dictLabel) { + this.dictLabel = dictLabel; + } + + public String getDictSort() { + return dictSort; + } + + public void setDictSort(String dictSort) { + this.dictSort = dictSort; + } + + public String getDictValue() { + return dictValue; + } + + public void setDictValue(String dictValue) { + this.dictValue = dictValue; + } +} diff --git a/app/src/main/java/com/police/union/home/model/DataCount.java b/app/src/main/java/com/police/union/home/model/DataCount.java new file mode 100644 index 0000000..129a28b --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/DataCount.java @@ -0,0 +1,49 @@ +package com.police.union.home.model; + +import java.io.Serializable; + +/** + * + */ +public class DataCount implements Serializable { + //重点人 + private String zdryCount = "0"; + //警情 + private String jqCount = "0"; + //案情 + private String aqCount = "0"; + //辖区 + private String zdryDeptCount = "0"; + + public String getZdryCount() { + return zdryCount; + } + + public void setZdryCount(String zdryCount) { + this.zdryCount = zdryCount; + } + + public String getJqCount() { + return jqCount; + } + + public void setJqCount(String jqCount) { + this.jqCount = jqCount; + } + + public String getAqCount() { + return aqCount; + } + + public void setAqCount(String aqCount) { + this.aqCount = aqCount; + } + + public String getZdryDeptCount() { + return zdryDeptCount; + } + + public void setZdryDeptCount(String zdryDeptCount) { + this.zdryDeptCount = zdryDeptCount; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/model/DetailQueryResult.java b/app/src/main/java/com/police/union/home/model/DetailQueryResult.java new file mode 100644 index 0000000..25eaba1 --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/DetailQueryResult.java @@ -0,0 +1,15 @@ +package com.police.union.home.model; + +import java.io.Serializable; + +public class DetailQueryResult implements Serializable { + private String GOBACK; + + public String getGOBACK() { + return GOBACK; + } + + public void setGOBACK(String GOBACK) { + this.GOBACK = GOBACK; + } +} diff --git a/app/src/main/java/com/police/union/home/model/KeyPerson.java b/app/src/main/java/com/police/union/home/model/KeyPerson.java new file mode 100644 index 0000000..7a0805e --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/KeyPerson.java @@ -0,0 +1,86 @@ +package com.police.union.home.model; + +import java.io.Serializable; + +public class KeyPerson implements Serializable { + //姓名 + private String xm; + //管控类别 + private String gklb; + //群体列表 + private String qtlb; + //责任民警姓名 + private String zrmj; + //身份证号码 + private String sfzh; + //照片base64 + private String zp; + //有效期 + private String yxq; + public String getXm() { + return xm; + } + + public void setXm(String xm) { + this.xm = xm; + } + + public String getGklb() { + return gklb; + } + + public void setGklb(String gklb) { + this.gklb = gklb; + } + + public String getQtlb() { + return qtlb; + } + + public void setQtlb(String qtlb) { + this.qtlb = qtlb; + } + + public String getZrmj() { + return zrmj; + } + + public void setZrmj(String zrmj) { + this.zrmj = zrmj; + } + + public String getSfzh() { + return sfzh; + } + + public void setSfzh(String sfzh) { + this.sfzh = sfzh; + } + + public String getZp() { + return zp; + } + + public void setZp(String zp) { + this.zp = zp; + } + + public String getYxq() { + return yxq; + } + + public void setYxq(String yxq) { + this.yxq = yxq; + } + + @Override + public String toString() { + return "KeyPerson{" + + "xm='" + xm + '\'' + + ", gklb='" + gklb + '\'' + + ", qtlb='" + qtlb + '\'' + + ", zrmj='" + zrmj + '\'' + + ", sfzh='" + sfzh + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/model/KeyPersonDetail.java b/app/src/main/java/com/police/union/home/model/KeyPersonDetail.java new file mode 100644 index 0000000..9f2ec7a --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/KeyPersonDetail.java @@ -0,0 +1,289 @@ +package com.police.union.home.model; + +import java.io.Serializable; +import java.util.List; + +/** + * 重点人详情 + */ +public class KeyPersonDetail implements Serializable { + private String fwcs;//服务场所 + private String gmsfhm;//身份证号码 + private String hcdp;//火车订票信息 + private String hjdz;//户籍地址 + private String jg;//籍贯 + private String kcdp;//客车订票信息 + private String fjdp;//飞机订票信息 + private String mz;//民族 + private String xb;//性别 + private String xm;//姓名 + private String zjzs;//最近住宿 + private String zp;//照片 + private String djchphm;//机动车牌号 + private String jzdhhm;//手机号 + private String hypo;//婚姻 + private String sjgj;//手机轨迹 + private String clzhwz;//车辆最后位置 + private String bq;//标签 + + public String getBq() { + return bq; + } + + public void setBq(String bq) { + this.bq = bq; + } + + public String getClzhwz() { + return clzhwz; + } + + public void setClzhwz(String clzhwz) { + this.clzhwz = clzhwz; + } + + public String getSjgj() { + return sjgj; + } + + public String getFjdp() { + return fjdp; + } + + public void setFjdp(String fjdp) { + this.fjdp = fjdp; + } + + public void setSjgj(String sjgj) { + this.sjgj = sjgj; + } + + public String getHypo() { + return hypo; + } + + public void setHypo(String hypo) { + this.hypo = hypo; + } + + public String getJzdhhm() { + return jzdhhm; + } + + + public void setJzdhhm(String jzdhhm) { + this.jzdhhm = jzdhhm; + } + + public String getDjchphm() { + return djchphm; + } + + public void setDjchphm(String djchphm) { + this.djchphm = djchphm; + } + + public String getZp() { + return zp; + } + + public void setZp(String zp) { + this.zp = zp; + } + + private List zdryLkxxList;//姓名 + + public String getFwcs() { + return fwcs; + } + + public void setFwcs(String fwcs) { + this.fwcs = fwcs; + } + + public String getGmsfhm() { + return gmsfhm; + } + + public void setGmsfhm(String gmsfhm) { + this.gmsfhm = gmsfhm; + } + + public String getHcdp() { + return hcdp; + } + + public void setHcdp(String hcdp) { + this.hcdp = hcdp; + } + + public String getHjdz() { + return hjdz; + } + + public void setHjdz(String hjdz) { + this.hjdz = hjdz; + } + + public String getJg() { + return jg; + } + + public void setJg(String jg) { + this.jg = jg; + } + + public String getKcdp() { + return kcdp; + } + + public void setKcdp(String kcdp) { + this.kcdp = kcdp; + } + + public String getMz() { + return mz; + } + + public void setMz(String mz) { + this.mz = mz; + } + + public String getXb() { + return xb; + } + + public void setXb(String xb) { + this.xb = xb; + } + + public String getXm() { + return xm; + } + + public void setXm(String xm) { + this.xm = xm; + } + + public String getZjzs() { + return zjzs; + } + + public void setZjzs(String zjzs) { + this.zjzs = zjzs; + } + + public List getZdryLkxxList() { + return zdryLkxxList; + } + + public void setZdryLkxxList(List zdryLkxxList) { + this.zdryLkxxList = zdryLkxxList; + } + + /** + * 历史案件次数 + * + * @return + */ + public int getLsajcs() { + if (zdryLkxxList!=null){ + return zdryLkxxList.size(); + }else{ + return 0; + } + } + + public static class Lkxx implements Serializable { + private String gklb;//管控类别 + private String qtlb;//列管级别 + private String lkjz;//列控警种 + private String lksj;//列控时间 + private String lkyy;//列控原因 + private String zrdw;//责任单位 + private String zrmj;//责任民警 + private String yxq;//有效期 + private String gkjb;//管控级别 + private String zp;//照片 + + public String getQtlb() { + return qtlb; + } + + public void setQtlb(String qtlb) { + this.qtlb = qtlb; + } + + public String getZp() { + return zp; + } + + public void setZp(String zp) { + this.zp = zp; + } + + public String getGklb() { + return gklb; + } + + public void setGklb(String gklb) { + this.gklb = gklb; + } + + public String getLkjz() { + return lkjz; + } + + public void setLkjz(String lkjz) { + this.lkjz = lkjz; + } + + public String getLksj() { + return lksj; + } + + public void setLksj(String lksj) { + this.lksj = lksj; + } + + public String getLkyy() { + return lkyy; + } + + public void setLkyy(String lkyy) { + this.lkyy = lkyy; + } + + public String getZrdw() { + return zrdw; + } + + public void setZrdw(String zrdw) { + this.zrdw = zrdw; + } + + public String getZrmj() { + return zrmj; + } + + public void setZrmj(String zrmj) { + this.zrmj = zrmj; + } + + public String getYxq() { + return yxq; + } + + public void setYxq(String yxq) { + this.yxq = yxq; + } + + public String getGkjb() { + return gkjb; + } + + public void setGkjb(String gkjb) { + this.gkjb = gkjb; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/model/PoliceEmergency.java b/app/src/main/java/com/police/union/home/model/PoliceEmergency.java new file mode 100644 index 0000000..c0041f1 --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/PoliceEmergency.java @@ -0,0 +1,56 @@ +package com.police.union.home.model; + +import java.io.Serializable; + +public class PoliceEmergency implements Serializable { + //警情编号 + private String jcjbh; + //报警内容 + private String bjjyqk; + //报警电话 + private String bjrlxdh; + //报警时间 + private String jjsj; + //报警地址 + private String asjfsdddzmc; + + public String getJcjbh() { + return jcjbh; + } + + public void setJcjbh(String jcjbh) { + this.jcjbh = jcjbh; + } + + public String getBjjyqk() { + return bjjyqk; + } + + public void setBjjyqk(String bjjyqk) { + this.bjjyqk = bjjyqk; + } + + public String getBjrlxdh() { + return bjrlxdh; + } + + public void setBjrlxdh(String bjrlxdh) { + this.bjrlxdh = bjrlxdh; + } + + public String getJjsj() { + return jjsj; + } + + public void setJjsj(String jjsj) { + this.jjsj = jjsj; + } + + public String getAsjfsdddzmc() { + return asjfsdddzmc; + } + + public void setAsjfsdddzmc(String asjfsdddzmc) { + this.asjfsdddzmc = asjfsdddzmc; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/model/PoliceEmergencyDetail.java b/app/src/main/java/com/police/union/home/model/PoliceEmergencyDetail.java new file mode 100644 index 0000000..05d0475 --- /dev/null +++ b/app/src/main/java/com/police/union/home/model/PoliceEmergencyDetail.java @@ -0,0 +1,267 @@ +package com.police.union.home.model; + +import java.io.Serializable; + +/** + * 警情详情 + * "asjfsdddzmc":"绿地中央公馆c6-204", + * "bjjyqk":"报警称:有人冒充民航工作人员骗取其10000元", + * "bjrlxdh":"13944800721", + * "bjrzjhm":"220104199807011310", + * "cjrxm":"肖映辉,张方贵", + * "jcjbh":"ST220120240200000046174", + * "jjsj":"20240223165000", + * "lsbjcs":"3", + * "mz":"汉族", + * "xb":"男", + * "xm":"徐瑞", + * "zp":"" + */ +public class PoliceEmergencyDetail implements Serializable { + //警情编号 + private String jcjbh; + //报警内容 + private String bjjyqk; + /*报警时间*/ + private String jjsj; + /*报警电话*/ + private String bjrlxdh; + /*报警位置*/ + private String asjfsdddzmc; + /*出境单位*/ + private String cjdwgajgjgdm; + /*出警民警*/ + private String cjrxm; + /*报警人身份证号*/ + private String bjrzjhm; + /*照片*/ + private String zp; + /*姓名*/ + private String xm; + /*性别*/ + private String xb; + /*民族*/ + private String mz; + /*年龄*/ + private String nl; + private String jg; + /*标签*/ + private String bq; + /*刑事案件前科*/ + private String xsajqk; + /*治安(行政)案件前科*/ + private String zaajqk; + /*精神病人*/ + private String jsbr; + /*残疾人*/ + private String cjr; + /*服务场所*/ + private String fwcs; + /*婚姻状况*/ + private String hyzk; + /*历史报警次数*/ + private String lsbjcs; + private String jqlb;//警情类别 + private String cllx;//处理类型 + private String cljg;//处理结果 + + public String getJqlb() { + return jqlb; + } + + public void setJqlb(String jqlb) { + this.jqlb = jqlb; + } + + public String getCllx() { + return cllx; + } + + public void setCllx(String cllx) { + this.cllx = cllx; + } + + public String getCljg() { + return cljg; + } + + public void setCljg(String cljg) { + this.cljg = cljg; + } + + public String getJcjbh() { + return jcjbh; + } + + public String getJg() { + return jg; + } + + public void setJg(String jg) { + this.jg = jg; + } + + public void setJcjbh(String jcjbh) { + this.jcjbh = jcjbh; + } + + public String getBjjyqk() { + return bjjyqk; + } + + public void setBjjyqk(String bjjyqk) { + this.bjjyqk = bjjyqk; + } + + public String getJjsj() { + return jjsj; + } + + public void setJjsj(String jjsj) { + this.jjsj = jjsj; + } + + public String getBjrlxdh() { + return bjrlxdh; + } + + public void setBjrlxdh(String bjrlxdh) { + this.bjrlxdh = bjrlxdh; + } + + public String getAsjfsdddzmc() { + return asjfsdddzmc; + } + + public void setAsjfsdddzmc(String asjfsdddzmc) { + this.asjfsdddzmc = asjfsdddzmc; + } + + public String getCjdwgajgjgdm() { + return cjdwgajgjgdm; + } + + public void setCjdwgajgjgdm(String cjdwgajgjgdm) { + this.cjdwgajgjgdm = cjdwgajgjgdm; + } + + public String getCjrxm() { + return cjrxm; + } + + public void setCjrxm(String cjrxm) { + this.cjrxm = cjrxm; + } + + public String getBjrzjhm() { + return bjrzjhm; + } + + public void setBjrzjhm(String bjrzjhm) { + this.bjrzjhm = bjrzjhm; + } + + public String getZp() { + return zp; + } + + public void setZp(String zp) { + this.zp = zp; + } + + public String getXm() { + return xm; + } + + public void setXm(String xm) { + this.xm = xm; + } + + public String getXb() { + return xb; + } + + public void setXb(String xb) { + this.xb = xb; + } + + public String getMz() { + return mz; + } + + public void setMz(String mz) { + this.mz = mz; + } + + public String getNl() { + return nl; + } + + public void setNl(String nl) { + this.nl = nl; + } + + public String getBq() { + return bq; + } + + public void setBq(String bq) { + this.bq = bq; + } + + public String getXsajqk() { + return xsajqk; + } + + public void setXsajqk(String xsajqk) { + this.xsajqk = xsajqk; + } + + public String getZaajqk() { + return zaajqk; + } + + public void setZaajqk(String zaajqk) { + this.zaajqk = zaajqk; + } + + public String getJsbr() { + return jsbr; + } + + public void setJsbr(String jsbr) { + this.jsbr = jsbr; + } + + public String getCjr() { + return cjr; + } + + public void setCjr(String cjr) { + this.cjr = cjr; + } + + public String getFwcs() { + return fwcs; + } + + public void setFwcs(String fwcs) { + this.fwcs = fwcs; + } + + public String getHyzk() { + return hyzk; + } + + public void setHyzk(String hyzk) { + this.hyzk = hyzk; + } + + public String getLsbjcs() { + return lsbjcs; + } + + public void setLsbjcs(String lsbjcs) { + this.lsbjcs = lsbjcs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/home/viewmodel/ApplyPostViewModel.java b/app/src/main/java/com/police/union/home/viewmodel/ApplyPostViewModel.java new file mode 100644 index 0000000..59dc391 --- /dev/null +++ b/app/src/main/java/com/police/union/home/viewmodel/ApplyPostViewModel.java @@ -0,0 +1,109 @@ +package com.police.union.home.viewmodel; + +import androidx.annotation.NonNull; + + +import com.police.network.CustomCallBack; +import com.police.union.home.activity.ApplyActivity; +import com.police.union.home.model.ApplyDept; +import com.police.union.home.model.ApplyPerson; +import com.police.utils.UiUtils; + +import java.util.HashMap; +import java.util.List; + +import okhttp3.Call; + +public class ApplyPostViewModel { + public ApplyActivity activity; + + public ApplyPostViewModel(ApplyActivity activity) { + this.activity = activity; + } + + + public void getApplyDept() { + activity.loadingShow(); + activity.requestClient.getApplyDept(new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { + activity.applyDept = value; + activity.loadingNone(); + } + }); + } + + public void getApplyPerson(String deptId) { + activity.loadingShow(); + activity.requestClient.getApplyPerson(deptId, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { + activity.applyPeople = value; + activity.loadingNone(); + } + }); + } +// +// public void getApplyJWLX() { +// activity.loadingShow(); +// activity.requestClient.getApplyJWLX(new CustomCallBack>() { +// @Override +// public void onError(@NonNull Call call, @NonNull Exception e) { +// UiUtils.toast(e.getMessage()); +// activity.loadingNone(); +// } +// +// @Override +// public void onSuccess(List value) { +// activity.applyJWLX = value; +// activity.loadingNone(); +// } +// }); +// } +// +// public void getApplyXXLY() { +// activity.loadingShow(); +// activity.requestClient.getApplyXXLY(new CustomCallBack>() { +// @Override +// public void onError(@NonNull Call call, @NonNull Exception e) { +// UiUtils.toast(e.getMessage()); +// activity.loadingNone(); +// } +// +// @Override +// public void onSuccess(List value) { +// activity.applyXXLY = value; +// activity.loadingNone(); +// } +// }); +// } + + public void addApply(HashMap map) { + activity.loadingShow(); + activity.requestClient.addApply(map, new CustomCallBack() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(Object value) { + activity.sendSuccess(); + activity.loadingNone(); + } + }); + } +} diff --git a/app/src/main/java/com/police/union/home/viewmodel/ApplyResultViewModel.java b/app/src/main/java/com/police/union/home/viewmodel/ApplyResultViewModel.java new file mode 100644 index 0000000..1ca1713 --- /dev/null +++ b/app/src/main/java/com/police/union/home/viewmodel/ApplyResultViewModel.java @@ -0,0 +1,43 @@ +package com.police.union.home.viewmodel; + +import androidx.annotation.NonNull; + + +import com.police.network.CustomCallBack; +import com.police.union.RequestClient; +import com.police.union.home.activity.QueryApplyResultActivity; +import com.police.union.home.model.Apply; +import com.police.utils.UiUtils; + +import java.util.HashMap; +import java.util.List; + +import okhttp3.Call; + +public class ApplyResultViewModel { + public QueryApplyResultActivity activity; + + public ApplyResultViewModel(QueryApplyResultActivity activity) { + this.activity = activity; + } + + public void getApplyList(String fnbh) { + activity.loadingShow(); + HashMap map = new HashMap<>(); + map.put("jqbh", fnbh); +// map.put("sfhm", "220283197910023151"); + RequestClient.instance().getApplyList(map, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { + activity.applyList(value); + activity.loadingNone(); + } + }); + } +} diff --git a/app/src/main/java/com/police/union/home/viewmodel/ApplyViewModel.java b/app/src/main/java/com/police/union/home/viewmodel/ApplyViewModel.java new file mode 100644 index 0000000..884eb09 --- /dev/null +++ b/app/src/main/java/com/police/union/home/viewmodel/ApplyViewModel.java @@ -0,0 +1,127 @@ +package com.police.union.home.viewmodel; + +import androidx.annotation.NonNull; + +import com.police.network.CustomCallBack; +import com.police.union.home.activity.ApplyActivity; +import com.police.union.home.model.ApplyDept; +import com.police.union.home.model.ApplyPerson; +import com.police.union.home.model.ApplyType; +import com.police.utils.UiUtils; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; + +import okhttp3.Call; + +public class ApplyViewModel { + public ApplyActivity activity; + + public ApplyViewModel( ApplyActivity activity) { + this.activity = activity; + } + + public void getApplyType() { + activity.loadingShow(); + activity.requestClient.getApplyType(new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { + value.sort(Comparator.comparing(ApplyType::getDictSort)); +// activity.setPopupWindow(value); + activity.loadingNone(); + } + }); + } + + public void getApplyDept() { + activity.loadingShow(); + activity.requestClient.getApplyDept(new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { + activity.applyDept = value; + activity.loadingNone(); + } + }); + } + + public void getApplyPerson(String deptId) { + activity.loadingShow(); + activity.requestClient.getApplyPerson(deptId,new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { + activity.applyPeople = value; + activity.loadingNone(); + } + }); + } + + public void getApplyJWLX() { + activity.loadingShow(); + activity.requestClient.getApplyJWLX(new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { +// activity.applyJWLX = value; + activity.loadingNone(); + } + }); + } + + public void getApplyXXLY() { + activity.loadingShow(); + activity.requestClient.getApplyXXLY(new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { +// activity.applyXXLY = value; + activity.loadingNone(); + } + }); + } + + public void addApply(HashMap map) { + activity.loadingShow(); + activity.requestClient.addApply(map, new CustomCallBack() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(Object value) { + activity.sendSuccess(); + activity.loadingNone(); + } + }); + } +} diff --git a/app/src/main/java/com/police/union/home/viewmodel/DataViewModel.java b/app/src/main/java/com/police/union/home/viewmodel/DataViewModel.java new file mode 100644 index 0000000..3e6038f --- /dev/null +++ b/app/src/main/java/com/police/union/home/viewmodel/DataViewModel.java @@ -0,0 +1,357 @@ +package com.police.union.home.viewmodel; + +import androidx.annotation.NonNull; + +import com.google.gson.Gson; +import com.police.network.Constants; +import com.police.network.CustomCallBack; +import com.police.network.requestparams.GetKeyPersonListParams; +import com.police.network.requestparams.GetOrgKeyPersonListParams; +import com.police.network.requestparams.GetPoliceEmergencyListParams; +import com.police.union.home.activity.DataActivity; +import com.police.union.home.activity.KeyPersonDetailActivity; +import com.police.union.home.activity.PoliceEmergencyDetailActivity; +import com.police.union.home.model.DataCount; +import com.police.union.home.model.KeyPerson; +import com.police.union.home.model.KeyPersonDetail; +import com.police.union.home.model.PoliceEmergency; +import com.police.union.home.model.PoliceEmergencyDetail; +import com.police.utils.UiUtils; + +import java.util.List; + +import okhttp3.Call; + +public class DataViewModel { + public int pageNum = 1; + public DataActivity activity; + + public DataViewModel(DataActivity activity) { + this.activity = activity; + } + + public void keyPersonInit() { + activity.loadingShow(); + pageNum = 1; + activity.personList.clear(); + //加载数据 + GetKeyPersonListParams params = new GetKeyPersonListParams(); + params.setPageNum(pageNum + ""); + if (activity.filterType == 0) { + params.setXm(activity.binding.etInput.getText().toString()); + } else { + params.setSfzh(activity.binding.etInput.getText().toString()); + } + activity.requestClient.getKeyPerson(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { + activity.loadingNone(); + if (value != null) { + activity.personList.addAll(value); + } + activity.adapter.notifyDataSetChanged(); + } + }); + } + + public void orgKeyPersonInit() { + activity.loadingShow(); + pageNum = 1; + activity.personList.clear(); + //加载数据 + GetOrgKeyPersonListParams params = new GetOrgKeyPersonListParams(); + params.setPageNum(pageNum + ""); + if (activity.filterType == 0) { + params.setXm(activity.binding.etInput.getText().toString()); + } else { + params.setSfzh(activity.binding.etInput.getText().toString()); + } + activity.requestClient.getOrgKeyPerson(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + activity.loadingNone(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + activity.loadingNone(); + if (value != null) { + activity.personList.addAll(value); + } + activity.adapter.notifyDataSetChanged(); + } + }); + } + + public void keyPersonLoadMore() { + activity.loadingShow(); + //加载数据 + GetKeyPersonListParams params = new GetKeyPersonListParams(); + pageNum++; + params.setPageNum(pageNum + ""); + activity.requestClient.getKeyPerson(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + activity.loadingNone(); + activity.binding.refreshLayout.finishLoadMore(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + activity.loadingNone(); + if (value == null || value.size() < Constants.PAGE_SIZE) { + activity.binding.refreshLayout.setNoMoreData(true); + } + if (value != null) { + activity.personList.addAll(value); + } + activity.adapter.notifyDataSetChanged(); + activity.binding.refreshLayout.finishLoadMore(); + } + }); + } + + public void keyPersonRefresh() { + activity.loadingShow(); + activity.personList.clear(); + pageNum = 1; + //加载数据 + GetKeyPersonListParams params = new GetKeyPersonListParams(); + params.setPageNum(pageNum + ""); + activity.requestClient.getKeyPerson(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + activity.loadingNone(); + activity.binding.refreshLayout.finishRefresh(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + activity.loadingNone(); + if (value != null) { + activity.personList.addAll(value); + } + activity.adapter.notifyDataSetChanged(); + activity.binding.refreshLayout.finishRefresh(); + } + }); + } + + public void orgKeyPersonLoadMore() { + activity.loadingShow(); + //加载数据 + GetOrgKeyPersonListParams params = new GetOrgKeyPersonListParams(); + pageNum++; + params.setPageNum(pageNum + ""); + activity.requestClient.getOrgKeyPerson(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + activity.loadingNone(); + activity.binding.refreshLayout.finishLoadMore(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + activity.loadingNone(); + if (value == null || value.size() < Constants.PAGE_SIZE) { + activity.binding.refreshLayout.setNoMoreData(true); + } + if (value != null) { + activity.personList.addAll(value); + } + activity.adapter.notifyDataSetChanged(); + activity.binding.refreshLayout.finishLoadMore(); + } + }); + } + + public void orgKeyPersonRefresh() { + activity.loadingShow(); + activity.personList.clear(); + pageNum = 1; + //加载数据 + GetOrgKeyPersonListParams params = new GetOrgKeyPersonListParams(); + params.setPageNum(pageNum + ""); + activity.requestClient.getOrgKeyPerson(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + activity.loadingNone(); + activity.binding.refreshLayout.finishRefresh(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + activity.loadingNone(); + if (value != null) { + activity.personList.addAll(value); + } + activity.adapter.notifyDataSetChanged(); + activity.binding.refreshLayout.finishRefresh(); + } + }); + } + + public void keyPersonDetail(String sfzh) { + activity.loadingShow(); + activity.requestClient.keyPersonDetail(sfzh, new CustomCallBack() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + activity.loadingNone(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(KeyPersonDetail value) { + activity.loadingNone(); + KeyPersonDetailActivity.startAction(activity, new Gson().toJson(value)); + } + }); + } + + /** + * 警情数据初始化 + */ + public void policeEmergencyInit() { + activity.loadingShow(); + pageNum = 1; + activity.policeList.clear(); + //加载数据 + GetPoliceEmergencyListParams params = new GetPoliceEmergencyListParams(); + params.setPageNum(pageNum + ""); + if (activity.filterType == 0) { + params.setJcjbh(activity.binding.etInput.getText().toString()); + } else if (activity.filterType == 1) { + params.setBjjyqk(activity.binding.etInput.getText().toString()); + } else { + params.setBjrlxdh(activity.binding.etInput.getText().toString()); + } + activity.requestClient.getPoliceEmergency(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { + activity.loadingNone(); + if (value != null) { + activity.policeList.addAll(value); + } + activity.adapter.notifyDataSetChanged(); + } + }); + } + + public void policeEmergencyRefresh() { + activity.loadingShow(); + pageNum = 1; + activity.policeList.clear(); + //加载数据 + GetPoliceEmergencyListParams params = new GetPoliceEmergencyListParams(); + params.setPageNum(pageNum + ""); + if (activity.filterType == 0) { + params.setJcjbh(activity.binding.etInput.getText().toString()); + } else if (activity.filterType == 1) { + params.setBjjyqk(activity.binding.etInput.getText().toString()); + } else { + params.setBjrlxdh(activity.binding.etInput.getText().toString()); + } + activity.requestClient.getPoliceEmergency(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + activity.binding.refreshLayout.finishRefresh(); + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(List value) { + activity.binding.refreshLayout.finishRefresh(); + activity.loadingNone(); + if (value != null) { + activity.policeList.addAll(value); + } + activity.adapter.notifyDataSetChanged(); + } + }); + } + + public void policeEmergencyLoadMore() { + activity.loadingShow(); + //加载数据 + GetPoliceEmergencyListParams params = new GetPoliceEmergencyListParams(); + pageNum++; + params.setPageNum(pageNum + ""); + activity.requestClient.getPoliceEmergency(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + activity.loadingNone(); + activity.binding.refreshLayout.finishLoadMore(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + activity.loadingNone(); + if (value == null || value.size() < Constants.PAGE_SIZE) { + activity.binding.refreshLayout.setNoMoreData(true); + } + if (value != null) { + activity.policeList.addAll(value); + } + activity.adapter.notifyDataSetChanged(); + activity.binding.refreshLayout.finishLoadMore(); + } + }); + } + + public void policeEmergencyDetail(String jcjbh) { + activity.loadingShow(); + activity.requestClient.getPoliceEmergencyDetail(jcjbh, new CustomCallBack() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + activity.loadingNone(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(PoliceEmergencyDetail value) { + activity.loadingNone(); + PoliceEmergencyDetailActivity.startAction(activity, new Gson().toJson(value)); + } + }); + } + + public void getKeyPersonMessageCount() { + activity.loadingShow(); + activity.requestClient.getKeyPersonMessageCount(new CustomCallBack() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + activity.loadingNone(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(DataCount value) { + activity.loadingNone(); + activity.binding.tvKeyPersonCount.setText(value.getZdryCount()); + activity.binding.tvPoliceEmergencyCount.setText(value.getJqCount()); + activity.binding.tvCaseDetailsCount.setText(value.getAqCount()); + activity.binding.tvKeyPersonTabCount.setText(value.getZdryCount()); + activity.binding.tvAreaKeyTabCount.setText(value.getZdryDeptCount()); + } + }); + } +} diff --git a/app/src/main/java/com/police/union/home/viewmodel/DetailViewModel.java b/app/src/main/java/com/police/union/home/viewmodel/DetailViewModel.java new file mode 100644 index 0000000..19eb2d5 --- /dev/null +++ b/app/src/main/java/com/police/union/home/viewmodel/DetailViewModel.java @@ -0,0 +1,54 @@ +package com.police.union.home.viewmodel; + +import androidx.annotation.NonNull; + + +import com.police.network.CustomCallBack; +import com.police.union.RequestClient; +import com.police.union.home.activity.ApplyDetailActivity; +import com.police.union.home.model.ApplyDetail; +import com.police.utils.UiUtils; + +import okhttp3.Call; + +public class DetailViewModel { + public ApplyDetailActivity activity; + public RequestClient requestClient = RequestClient.instance(); + + public DetailViewModel(ApplyDetailActivity activity) { + this.activity = activity; + } + + public void getApplyDetail(String fnbh) { + activity.loadingShow(); + requestClient.getApplyDetail(fnbh, new CustomCallBack() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + activity.loadingNone(); + } + + @Override + public void onSuccess(ApplyDetail value) { + activity.applyDetail(value); + activity.loadingNone(); + } + }); + } +// public void jumpApplyDetail(String fnbh) { +// activity.loadingShow(); +// requestClient.jumpApplyDetail(fnbh, new CustomCallBack() { +// @Override +// public void onError(@NonNull Call call, @NonNull Exception e) { +// UiUtils.toast(e.getMessage()); +// activity.loadingNone(); +// } +// +// @Override +// public void onSuccess(ApplyDetail value) { +// activity.applyDetail(value); +// activity.loadingNone(); +// } +// }); +// } +} diff --git a/app/src/main/java/com/police/union/personal/fragment/MineFragment.java b/app/src/main/java/com/police/union/personal/fragment/MineFragment.java new file mode 100644 index 0000000..2d10108 --- /dev/null +++ b/app/src/main/java/com/police/union/personal/fragment/MineFragment.java @@ -0,0 +1,33 @@ +package com.police.union.personal.fragment; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.police.base.BaseFragment; +import com.police.network.Constants; +import com.police.union.databinding.FragmentMineBinding; + +public class MineFragment extends BaseFragment { + private FragmentMineBinding binding; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + binding = FragmentMineBinding.inflate(inflater); + initView(); + return binding.getRoot(); + } + + private void initView() { + binding.tvUserName.setText(Constants.XM); + binding.tvUserPhone.setText(Constants.USER_ID); + binding.ivMineQuery.setOnClickListener(view -> { + //点击了切换所属组织功能 + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/widget/WaterMarkInfo.java b/app/src/main/java/com/police/union/widget/WaterMarkInfo.java new file mode 100644 index 0000000..b6cc943 --- /dev/null +++ b/app/src/main/java/com/police/union/widget/WaterMarkInfo.java @@ -0,0 +1,208 @@ +package com.police.union.widget; + +import android.graphics.Color; +import android.graphics.Paint; + +/** + * @author Leon (wshk729@163.com) + * @date 2018/8/24 + *

+ */ +public class WaterMarkInfo { + + private int mDegrees; + private int mTextColor; + private int mTextSize; + private boolean mTextBold; + private int mDx; + private int mDy; + private Paint.Align mAlign; + + private WaterMarkInfo(int degrees, int textColor, int textSize, boolean textBold, int dx, int dy, Paint.Align align) { + mDegrees = degrees; + mTextColor = textColor; + mTextSize = textSize; + mTextBold = textBold; + mDx = dx; + mDy = dy; + mAlign = align; + } + + public int getDegrees() { + return mDegrees; + } + + public int getTextColor() { + return mTextColor; + } + + public int getTextSize() { + return mTextSize; + } + + public int getDx() { + return mDx; + } + + public int getDy() { + return mDy; + } + + public Paint.Align getAlign() { + return mAlign; + } + + public int getAlignInt() { + switch (mAlign) { + case LEFT: + return 0; + case RIGHT: + return 2; + default: + return 1; + } + } + + public boolean isTextBold() { + return mTextBold; + } + + void setDegrees(int degrees) { + mDegrees = degrees; + } + + void setTextColor(int textColor) { + mTextColor = textColor; + } + + void setTextSize(int textSize) { + mTextSize = textSize; + } + + void setTextBold(boolean textBold) { + mTextBold = textBold; + } + + void setDx(int dx) { + mDx = dx; + } + + void setDy(int dy) { + mDy = dy; + } + + void setAlign(Paint.Align align) { + this.mAlign = align; + } + + public static Builder create() { + return new Builder(); + } + + public static class Builder { + private int mDegrees; + private int mTextColor; + private int mTextSize; + private boolean mTextBold; + private int mDx; + private int mDy; + private Paint.Align mAlign; + + private Builder() { + mDegrees = -30; + mTextColor = Color.parseColor("#33000000"); + mTextSize = 35; + mTextBold = false; + mDx = 100; + mDy = 240; + mAlign = Paint.Align.CENTER; + } + + /** + * 设置水印文字倾斜度 + * + * @param degrees 文字倾斜度(默认:-30) + * @return Builder + */ + public Builder setDegrees(int degrees) { + mDegrees = degrees; + return this; + } + + /** + * 设置水印文字颜色 + * + * @param textColor 文字颜色(默认:#33000000) + * @return Builder + */ + public Builder setTextColor(int textColor) { + mTextColor = textColor; + return this; + } + + /** + * 设置水印文字大小(单位:px) + * + * @param textSize 文字大小(默认:42px) + * @return Builder + */ + public Builder setTextSize(int textSize) { + mTextSize = textSize; + return this; + } + + /** + * 设置水印文字是否加粗 + * + * @param textBold 文字加粗(默认:false) + * @return Builder + */ + public Builder setTextBold(boolean textBold) { + mTextBold = textBold; + return this; + } + + /** + * 设置水印文字X轴间距(单位:px) + * + * @param dx 文字X轴间距(默认:100px) + * @return Builder + */ + public Builder setDx(int dx) { + mDx = dx; + return this; + } + + /** + * 设置水印文字Y轴间距(单位:px) + * + * @param dy 文字Y轴间距(默认:240px) + * @return Builder + */ + public Builder setDy(int dy) { + mDy = dy; + return this; + } + + /** + * 设置水印文字对齐方式 + * + * @param align 对齐方式(默认:Center) + * @return Builder + */ + public Builder setAlign(Paint.Align align) { + mAlign = align; + return this; + } + + /** + * 生成水印全局配置信息 + * + * @return 配置信息 + */ + public WaterMarkInfo generate() { + return new WaterMarkInfo(mDegrees, mTextColor, mTextSize, mTextBold, mDx, mDy, mAlign); + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/widget/WaterMarkManager.java b/app/src/main/java/com/police/union/widget/WaterMarkManager.java new file mode 100644 index 0000000..a51fb1e --- /dev/null +++ b/app/src/main/java/com/police/union/widget/WaterMarkManager.java @@ -0,0 +1,188 @@ +package com.police.union.widget; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.graphics.Paint; +import android.view.LayoutInflater; + + +import com.police.union.R; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Leon (wshk729@163.com) + * @date 2018/8/24 + *

+ */ +public class WaterMarkManager { + + static WaterMarkInfo INFO = null; + static String[] CONTENT = null; + static List LIST = new ArrayList<>(); + + /** + * 设置水印全局配置信息 + * + * @param info 配置信息 + */ + public static void setInfo(WaterMarkInfo info) { + INFO = info; + } + + /** + * 获取一个满屏水印View + * + * @param activity activity + */ + @SuppressLint("InflateParams") + public static WaterMarkView getView(Activity activity) { + return (WaterMarkView) LayoutInflater.from(activity).inflate(R.layout.view_water_mark, null); + } + + /** + * WaterMarkInfo初始化判断 + */ + private static void assertInitialized() { + if (INFO == null) { + INFO = WaterMarkInfo.create().generate(); + } + } + + /** + * 同步设置全部水印文字信息 + * + * @param content 文字信息 + */ + public static void setText(String... content) { + assertInitialized(); + CONTENT = content; + if (LIST.size() > 0) { + for (WaterMarkView view : LIST) { + if (view != null) { + view.setSyncText(content); + } + } + } + } + + /** + * 同步设置全部水印倾斜角度 + * + * @param degrees 倾斜角度(默认:-30) + */ + public static void setDegrees(int degrees) { + assertInitialized(); + INFO.setDegrees(degrees); + if (LIST.size() > 0) { + for (WaterMarkView view : LIST) { + if (view != null) { + view.setSyncDegrees(degrees); + } + } + } + } + + /** + * 同步设置全部水印字体颜色 + * + * @param textColor 字体颜色(默认:#33000000) + */ + public static void setTextColor(int textColor) { + assertInitialized(); + INFO.setTextColor(textColor); + if (LIST.size() > 0) { + for (WaterMarkView view : LIST) { + if (view != null) { + view.setSyncTextColor(textColor); + } + } + } + } + + /** + * 同步设置全部水印字体大小(单位:px) + * + * @param textSize 字体大小(默认:42px) + */ + public static void setTextSize(int textSize) { + assertInitialized(); + INFO.setTextSize(textSize); + if (LIST.size() > 0) { + for (WaterMarkView view : LIST) { + if (view != null) { + view.setSyncTextSize(textSize); + } + } + } + } + + /** + * 同步设置全部水印字体是否粗体 + * + * @param textBold 是否粗体(默认:false) + */ + public static void setTextBold(boolean textBold) { + assertInitialized(); + INFO.setTextBold(textBold); + if (LIST.size() > 0) { + for (WaterMarkView view : LIST) { + if (view != null) { + view.setSyncTextBold(textBold); + } + } + } + } + + /** + * 同步设置全部水印X轴偏移量(单位:px) + * + * @param dx X轴偏移量(默认:100px) + */ + public static void setDx(int dx) { + assertInitialized(); + INFO.setDx(dx); + if (LIST.size() > 0) { + for (WaterMarkView view : LIST) { + if (view != null) { + view.setSyncDx(dx); + } + } + } + } + + /** + * 同步设置全部水印Y轴偏移量(单位:px) + * + * @param dy Y轴偏移量(默认:240px) + */ + public static void setDy(int dy) { + assertInitialized(); + INFO.setDy(dy); + if (LIST.size() > 0) { + for (WaterMarkView view : LIST) { + if (view != null) { + view.setSignDy(dy); + } + } + } + } + + /** + * 同步设置全部水印对齐方式 + * + * @param align 对齐方式(默认:Center) + */ + public static void setAlign(Paint.Align align) { + assertInitialized(); + INFO.setAlign(align); + if (LIST.size() > 0) { + for (WaterMarkView view : LIST) { + if (view != null) { + view.setSignAlign(align); + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/union/widget/WaterMarkView.java b/app/src/main/java/com/police/union/widget/WaterMarkView.java new file mode 100644 index 0000000..f238cf0 --- /dev/null +++ b/app/src/main/java/com/police/union/widget/WaterMarkView.java @@ -0,0 +1,335 @@ +package com.police.union.widget; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Rect; +import android.graphics.Typeface; +import android.text.TextPaint; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.View; + +import com.police.union.R; + + +public class WaterMarkView extends View { + + private static final String DEFAULT_SEPARATOR = "///"; + private TextPaint mTextPaint = new TextPaint(); + + private String[] mText; + private int mDegrees; + private int mTextColor; + private int mTextSize=35; + private boolean mTextBold; + private int mDx; + private int mDy; + private Paint.Align mAlign; + private boolean mSync; + private int textWidth, textHeight; + + public WaterMarkView(Context context) { + this(context, null); + } + + public WaterMarkView(Context context, AttributeSet attrs) { + super(context, attrs); + TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.WaterMarkView); + mDegrees = typedArray.getInt(R.styleable.WaterMarkView_water_mark_degree, WaterMarkManager.INFO != null ? WaterMarkManager.INFO.getDegrees() : -30); + String text = typedArray.getString(R.styleable.WaterMarkView_water_mark_text); + if (text != null) { + mText = text.split(DEFAULT_SEPARATOR); + } + mTextColor = typedArray.getColor(R.styleable.WaterMarkView_water_mark_textColor, WaterMarkManager.INFO != null ? WaterMarkManager.INFO.getTextColor() : Color.parseColor("#33000000")); + mTextSize = typedArray.getDimensionPixelSize(R.styleable.WaterMarkView_water_mark_textSize, WaterMarkManager.INFO != null ? WaterMarkManager.INFO.getTextSize() : 42); + mTextBold = typedArray.getBoolean(R.styleable.WaterMarkView_water_mark_textBold, WaterMarkManager.INFO != null && WaterMarkManager.INFO.isTextBold()); + mDx = typedArray.getDimensionPixelSize(R.styleable.WaterMarkView_water_mark_dx, WaterMarkManager.INFO != null ? WaterMarkManager.INFO.getDx() : 100); + mDy = typedArray.getDimensionPixelSize(R.styleable.WaterMarkView_water_mark_dy, WaterMarkManager.INFO != null ? WaterMarkManager.INFO.getDy() : 240); + int align = typedArray.getInt(R.styleable.WaterMarkView_water_mark_align, WaterMarkManager.INFO != null ? WaterMarkManager.INFO.getAlignInt() : 1); + mAlign = align == 0 ? Paint.Align.LEFT : align == 2 ? Paint.Align.RIGHT : Paint.Align.CENTER; + mSync = typedArray.getBoolean(R.styleable.WaterMarkView_water_mark_sync, true); + typedArray.recycle(); + + setBackgroundColor(Color.TRANSPARENT); + mTextPaint.setAntiAlias(true); + mTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG); + mTextPaint.setColor(mTextColor); + mTextPaint.setTextSize(mTextSize); + mTextPaint.setTypeface(mTextBold ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); + mTextPaint.setTextAlign(mAlign); + + mText = mText == null && mSync ? WaterMarkManager.CONTENT : mText; + + textWidth = 0; + textHeight = 0; + if (mText != null && mText.length > 0) { + for (String s : mText) { + Rect tvRect = new Rect(); + mTextPaint.getTextBounds(s, 0, s.length(), tvRect); + textWidth = textWidth > tvRect.width() ? textWidth : tvRect.width(); + textHeight += (tvRect.height() + 10); + } + } + + if (mSync) { + WaterMarkManager.LIST.add(this); + } + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + if (mText != null && mText.length > 0) { + int measuredWidth = getMeasuredWidth(); + int measuredHeight = getMeasuredHeight(); + + if (measuredWidth == 0 || measuredHeight == 0) { + return; + } + + int canvasLength = measuredWidth > measuredHeight ? measuredWidth : measuredHeight; + + canvas.save(); + canvas.rotate(mDegrees, measuredWidth / 2, measuredHeight / 2); + + canvas.save(); + int y = 0; + boolean odd = true; + while (y < canvasLength + textHeight) { + int x = odd ? 0 : -(textWidth + mDx) / 2; + while (x < canvasLength + textWidth) { + drawTexts(mText, mTextPaint, canvas, x, y); + x = x + textWidth + mDx; + } + y = y + textHeight + mDy; + odd = !odd; + } + canvas.restore(); + } + } + + private void drawTexts(String[] ss, Paint paint, Canvas canvas, int x, int y) { + Paint.FontMetrics fontMetrics = paint.getFontMetrics(); + float top = fontMetrics.top; + float bottom = fontMetrics.bottom; + int length = ss.length; + float total = (length - 1) * (bottom - top) + (fontMetrics.descent - fontMetrics.ascent); + float offset = total / 2 - bottom; + for (int i = 0; i < length; i++) { + float yAxis = -(length - i - 1) * (bottom - top) + offset; + canvas.drawText(ss[i], x, y + yAxis + 10, paint); + } + } + + /** + * 设置水印文字内容 + * + * @param text 文字内容 + */ + public void setText(String... text) { + mText = text; + + textWidth = 0; + textHeight = 0; + if (mText != null && mText.length > 0) { + for (String s : mText) { + Rect tvRect = new Rect(); + mTextPaint.getTextBounds(s, 0, s.length(), tvRect); + textWidth = textWidth > tvRect.width() ? textWidth : tvRect.width(); + textHeight += (tvRect.height() + 10); + } + } + postInvalidate(); + } + + /** + * 同步设置水印文字内容 + * + * @param text 文字内容 + */ + void setSyncText(String... text) { + if (mSync) { + setText(text); + } + } + + /** + * 设置水印倾斜角度 + * + * @param degrees 倾斜角度(默认:-30) + */ + public void setDegrees(int degrees) { + mDegrees = degrees; + postInvalidate(); + } + + /** + * 同步设置水印倾斜角度 + * + * @param degrees 倾斜角度(默认:-30) + */ + void setSyncDegrees(int degrees) { + if (mSync) { + setDegrees(degrees); + } + } + + /** + * 设置水印字体颜色 + * + * @param textColor 字体颜色(默认:#33000000) + */ + public void setTextColor(int textColor) { + mTextColor = textColor; + mTextPaint.setColor(mTextColor); + postInvalidate(); + } + + /** + * 同步设置水印字体颜色 + * + * @param textColor 字体颜色(默认:#33000000) + */ + void setSyncTextColor(int textColor) { + if (mSync) { + setTextColor(textColor); + } + } + + /** + * 设置水印字体大小(单位:px) + * + * @param textSize 字体大小(默认:42px) + */ + public void setTextSize(int textSize) { + mTextSize = textSize; + mTextPaint.setTextSize(mTextSize); + postInvalidate(); + } + + /** + * 同步设置水印字体大小(单位:px) + * + * @param textSize 字体大小(默认:42px) + */ + void setSyncTextSize(int textSize) { + if (mSync) { + setTextSize(textSize); + } + } + + /** + * 设置水印字体是否粗体 + * + * @param textBold 是否粗体(默认:false) + */ + public void setTextBold(boolean textBold) { + mTextBold = textBold; + mTextPaint.setTypeface(mTextBold ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); + postInvalidate(); + } + + /** + * 同步设置水印字体是否粗体 + * + * @param textBold 是否粗体(默认:false) + */ + void setSyncTextBold(boolean textBold) { + if (mSync) { + setTextBold(textBold); + } + } + + /** + * 设置水印X轴偏移量(单位:px) + * + * @param dx X轴偏移量(默认:100px) + */ + public void setDx(int dx) { + this.mDx = dx; + postInvalidate(); + } + + /** + * 同步设置水印X轴偏移量(单位:px) + * + * @param dx X轴偏移量(默认:100px) + */ + void setSyncDx(int dx) { + if (mSync) { + setDx(dx); + } + } + + /** + * 设置水印Y轴偏移量(单位:px) + * + * @param dy Y轴偏移量(默认:240px) + */ + public void setDy(int dy) { + this.mDy = dy; + postInvalidate(); + } + + /** + * 同步设置水印Y轴偏移量(单位:px) + * + * @param dy Y轴偏移量(默认:240px) + */ + void setSignDy(int dy) { + if (mSync) { + setDy(dy); + } + } + + /** + * 设置水印对齐方式 + * + * @param align 对齐方式(默认:Center) + */ + public void setAlign(Paint.Align align) { + this.mAlign = align; + postInvalidate(); + } + + /** + * 同步设置水印对齐方式 + * + * @param align 对齐方式(默认:Center) + */ + void setSignAlign(Paint.Align align) { + if (mSync) { + setAlign(align); + } + } + + /** + * 销毁相关页面时调用(切记) + */ + public void onDestroy() { + if (mSync) { + WaterMarkManager.LIST.remove(this); + } + } + + @Override + public boolean dispatchTouchEvent(MotionEvent event) { + return false; + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public boolean onTouchEvent(MotionEvent event) { + return false; + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/all_10_ccc_bg.xml b/app/src/main/res/drawable/all_10_ccc_bg.xml new file mode 100644 index 0000000..757b52d --- /dev/null +++ b/app/src/main/res/drawable/all_10_ccc_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_15_fff_bg.xml b/app/src/main/res/drawable/all_15_fff_bg.xml new file mode 100644 index 0000000..f1400b6 --- /dev/null +++ b/app/src/main/res/drawable/all_15_fff_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_2_4b8e01_bg.xml b/app/src/main/res/drawable/all_2_4b8e01_bg.xml new file mode 100644 index 0000000..257761d --- /dev/null +++ b/app/src/main/res/drawable/all_2_4b8e01_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_2_de7900_bg.xml b/app/src/main/res/drawable/all_2_de7900_bg.xml new file mode 100644 index 0000000..29c0007 --- /dev/null +++ b/app/src/main/res/drawable/all_2_de7900_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_2_selected_bg.xml b/app/src/main/res/drawable/all_2_selected_bg.xml new file mode 100644 index 0000000..352767f --- /dev/null +++ b/app/src/main/res/drawable/all_2_selected_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_3_ccc_bg.xml b/app/src/main/res/drawable/all_3_ccc_bg.xml new file mode 100644 index 0000000..a4e3f93 --- /dev/null +++ b/app/src/main/res/drawable/all_3_ccc_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_7_4b8e01_bg.xml b/app/src/main/res/drawable/all_7_4b8e01_bg.xml new file mode 100644 index 0000000..3a05311 --- /dev/null +++ b/app/src/main/res/drawable/all_7_4b8e01_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_7_999_border_bg.xml b/app/src/main/res/drawable/all_7_999_border_bg.xml new file mode 100644 index 0000000..b45947a --- /dev/null +++ b/app/src/main/res/drawable/all_7_999_border_bg.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_7_999_bottom_border_bg.xml b/app/src/main/res/drawable/all_7_999_bottom_border_bg.xml new file mode 100644 index 0000000..bfae86a --- /dev/null +++ b/app/src/main/res/drawable/all_7_999_bottom_border_bg.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_7_de7900_bg.xml b/app/src/main/res/drawable/all_7_de7900_bg.xml new file mode 100644 index 0000000..f5329ff --- /dev/null +++ b/app/src/main/res/drawable/all_7_de7900_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_7_fff_bg.xml b/app/src/main/res/drawable/all_7_fff_bg.xml new file mode 100644 index 0000000..65ffac7 --- /dev/null +++ b/app/src/main/res/drawable/all_7_fff_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_7_line_ccc_bg.xml b/app/src/main/res/drawable/all_7_line_ccc_bg.xml new file mode 100644 index 0000000..f7fd2cb --- /dev/null +++ b/app/src/main/res/drawable/all_7_line_ccc_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/all_7_main_bg.xml b/app/src/main/res/drawable/all_7_main_bg.xml new file mode 100644 index 0000000..5375343 --- /dev/null +++ b/app/src/main/res/drawable/all_7_main_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/b6f7e9_10_bg.xml b/app/src/main/res/drawable/b6f7e9_10_bg.xml new file mode 100644 index 0000000..1eb82cf --- /dev/null +++ b/app/src/main/res/drawable/b6f7e9_10_bg.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/border_f7933b_6_bg.xml b/app/src/main/res/drawable/border_f7933b_6_bg.xml new file mode 100644 index 0000000..388e126 --- /dev/null +++ b/app/src/main/res/drawable/border_f7933b_6_bg.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/f7eab6_10_bg.xml b/app/src/main/res/drawable/f7eab6_10_bg.xml new file mode 100644 index 0000000..92f9fcd --- /dev/null +++ b/app/src/main/res/drawable/f7eab6_10_bg.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/f7f7f7_top_20_bg.xml b/app/src/main/res/drawable/f7f7f7_top_20_bg.xml new file mode 100644 index 0000000..e1d5880 --- /dev/null +++ b/app/src/main/res/drawable/f7f7f7_top_20_bg.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/f9e2e2_10_bg.xml b/app/src/main/res/drawable/f9e2e2_10_bg.xml new file mode 100644 index 0000000..7934d05 --- /dev/null +++ b/app/src/main/res/drawable/f9e2e2_10_bg.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/fbe5ca_10_bg.xml b/app/src/main/res/drawable/fbe5ca_10_bg.xml new file mode 100644 index 0000000..cab79ef --- /dev/null +++ b/app/src/main/res/drawable/fbe5ca_10_bg.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/right_7_052eba_bg.xml b/app/src/main/res/drawable/right_7_052eba_bg.xml new file mode 100644 index 0000000..f3f0ed4 --- /dev/null +++ b/app/src/main/res/drawable/right_7_052eba_bg.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/top_10_f7_bg.xml b/app/src/main/res/drawable/top_10_f7_bg.xml new file mode 100644 index 0000000..1939c23 --- /dev/null +++ b/app/src/main/res/drawable/top_10_f7_bg.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/white_round_bg.xml b/app/src/main/res/drawable/white_round_bg.xml new file mode 100644 index 0000000..522eb16 --- /dev/null +++ b/app/src/main/res/drawable/white_round_bg.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/white_top_20_bg.xml b/app/src/main/res/drawable/white_top_20_bg.xml new file mode 100644 index 0000000..14a189b --- /dev/null +++ b/app/src/main/res/drawable/white_top_20_bg.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_apply.xml b/app/src/main/res/layout/activity_apply.xml new file mode 100644 index 0000000..88483e0 --- /dev/null +++ b/app/src/main/res/layout/activity_apply.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_apply_detail.xml b/app/src/main/res/layout/activity_apply_detail.xml new file mode 100644 index 0000000..fdd58eb --- /dev/null +++ b/app/src/main/res/layout/activity_apply_detail.xml @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_data.xml b/app/src/main/res/layout/activity_data.xml new file mode 100644 index 0000000..889e8d2 --- /dev/null +++ b/app/src/main/res/layout/activity_data.xml @@ -0,0 +1,365 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_key_person_detail.xml b/app/src/main/res/layout/activity_key_person_detail.xml new file mode 100644 index 0000000..c70034f --- /dev/null +++ b/app/src/main/res/layout/activity_key_person_detail.xml @@ -0,0 +1,896 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..9c29cf4 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_police_emergency_detail.xml b/app/src/main/res/layout/activity_police_emergency_detail.xml new file mode 100644 index 0000000..3d59080 --- /dev/null +++ b/app/src/main/res/layout/activity_police_emergency_detail.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_query_apply_result.xml b/app/src/main/res/layout/activity_query_apply_result.xml new file mode 100644 index 0000000..6d3515c --- /dev/null +++ b/app/src/main/res/layout/activity_query_apply_result.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_dept_selector.xml b/app/src/main/res/layout/dialog_dept_selector.xml new file mode 100644 index 0000000..ff86b68 --- /dev/null +++ b/app/src/main/res/layout/dialog_dept_selector.xml @@ -0,0 +1,40 @@ + + + + + + + + + diff --git a/app/src/main/res/layout/dialog_selector.xml b/app/src/main/res/layout/dialog_selector.xml new file mode 100644 index 0000000..b1e9c58 --- /dev/null +++ b/app/src/main/res/layout/dialog_selector.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/app/src/main/res/layout/dropdown_layout.xml b/app/src/main/res/layout/dropdown_layout.xml new file mode 100644 index 0000000..118fcd8 --- /dev/null +++ b/app/src/main/res/layout/dropdown_layout.xml @@ -0,0 +1,31 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dropdown_layout2.xml b/app/src/main/res/layout/dropdown_layout2.xml new file mode 100644 index 0000000..6cee519 --- /dev/null +++ b/app/src/main/res/layout/dropdown_layout2.xml @@ -0,0 +1,41 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dropdown_layout3.xml b/app/src/main/res/layout/dropdown_layout3.xml new file mode 100644 index 0000000..bdac730 --- /dev/null +++ b/app/src/main/res/layout/dropdown_layout3.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dropdown_layout4.xml b/app/src/main/res/layout/dropdown_layout4.xml new file mode 100644 index 0000000..a9fdb37 --- /dev/null +++ b/app/src/main/res/layout/dropdown_layout4.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dropdown_layout5.xml b/app/src/main/res/layout/dropdown_layout5.xml new file mode 100644 index 0000000..7148c5c --- /dev/null +++ b/app/src/main/res/layout/dropdown_layout5.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_chat.xml b/app/src/main/res/layout/fragment_chat.xml new file mode 100644 index 0000000..5b258e7 --- /dev/null +++ b/app/src/main/res/layout/fragment_chat.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml new file mode 100644 index 0000000..30459d1 --- /dev/null +++ b/app/src/main/res/layout/fragment_home.xml @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mine.xml b/app/src/main/res/layout/fragment_mine.xml new file mode 100644 index 0000000..cb0c584 --- /dev/null +++ b/app/src/main/res/layout/fragment_mine.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_police_emergency_detail_apply_info.xml b/app/src/main/res/layout/include_police_emergency_detail_apply_info.xml new file mode 100644 index 0000000..9ff26d4 --- /dev/null +++ b/app/src/main/res/layout/include_police_emergency_detail_apply_info.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_police_emergency_detail_base_info.xml b/app/src/main/res/layout/include_police_emergency_detail_base_info.xml new file mode 100644 index 0000000..f9e7a60 --- /dev/null +++ b/app/src/main/res/layout/include_police_emergency_detail_base_info.xml @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_police_emergency_detail_cjya_info.xml b/app/src/main/res/layout/include_police_emergency_detail_cjya_info.xml new file mode 100644 index 0000000..3d59f1e --- /dev/null +++ b/app/src/main/res/layout/include_police_emergency_detail_cjya_info.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/include_police_emergency_detail_person_info.xml b/app/src/main/res/layout/include_police_emergency_detail_person_info.xml new file mode 100644 index 0000000..0d95c8a --- /dev/null +++ b/app/src/main/res/layout/include_police_emergency_detail_person_info.xml @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/include_police_emergency_detail_query_info.xml b/app/src/main/res/layout/include_police_emergency_detail_query_info.xml new file mode 100644 index 0000000..ef1a27b --- /dev/null +++ b/app/src/main/res/layout/include_police_emergency_detail_query_info.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_apply_fragment_1.xml b/app/src/main/res/layout/item_apply_fragment_1.xml new file mode 100644 index 0000000..c30c755 --- /dev/null +++ b/app/src/main/res/layout/item_apply_fragment_1.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_apply_fragment_2.xml b/app/src/main/res/layout/item_apply_fragment_2.xml new file mode 100644 index 0000000..aae3f12 --- /dev/null +++ b/app/src/main/res/layout/item_apply_fragment_2.xml @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_dialog_selector.xml b/app/src/main/res/layout/item_dialog_selector.xml new file mode 100644 index 0000000..333cafa --- /dev/null +++ b/app/src/main/res/layout/item_dialog_selector.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/layout/item_key_person.xml b/app/src/main/res/layout/item_key_person.xml new file mode 100644 index 0000000..f0158ab --- /dev/null +++ b/app/src/main/res/layout/item_key_person.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_mine_apply.xml b/app/src/main/res/layout/item_mine_apply.xml new file mode 100644 index 0000000..693fd53 --- /dev/null +++ b/app/src/main/res/layout/item_mine_apply.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_police_emergency.xml b/app/src/main/res/layout/item_police_emergency.xml new file mode 100644 index 0000000..f00b7e4 --- /dev/null +++ b/app/src/main/res/layout/item_police_emergency.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_select_dept.xml b/app/src/main/res/layout/item_select_dept.xml new file mode 100644 index 0000000..80e1c6b --- /dev/null +++ b/app/src/main/res/layout/item_select_dept.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/view_water_mark.xml b/app/src/main/res/layout/view_water_mark.xml new file mode 100644 index 0000000..d3fd223 --- /dev/null +++ b/app/src/main/res/layout/view_water_mark.xml @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xxhdpi/back.png b/app/src/main/res/mipmap-xxhdpi/back.png new file mode 100644 index 0000000..76e3e82 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/back.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/baojing.png b/app/src/main/res/mipmap-xxhdpi/baojing.png new file mode 100644 index 0000000..67744fa Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/baojing.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..33a38f7 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_14.png b/app/src/main/res/mipmap-xxhdpi/icon_14.png new file mode 100644 index 0000000..9bbeb49 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_14.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_aj.png b/app/src/main/res/mipmap-xxhdpi/icon_aj.png new file mode 100644 index 0000000..fd0087f Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_aj.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_apply_detail_query.png b/app/src/main/res/mipmap-xxhdpi/icon_apply_detail_query.png new file mode 100644 index 0000000..5fcffc7 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_apply_detail_query.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_chat_normal.png b/app/src/main/res/mipmap-xxhdpi/icon_chat_normal.png new file mode 100644 index 0000000..75e6845 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_chat_normal.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_chat_selected.png b/app/src/main/res/mipmap-xxhdpi/icon_chat_selected.png new file mode 100644 index 0000000..71975d0 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_chat_selected.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_czya.png b/app/src/main/res/mipmap-xxhdpi/icon_czya.png new file mode 100644 index 0000000..7d551f6 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_czya.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_down_sanjiao.png b/app/src/main/res/mipmap-xxhdpi/icon_down_sanjiao.png new file mode 100644 index 0000000..9ba30d7 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_down_sanjiao.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_fnsq.png b/app/src/main/res/mipmap-xxhdpi/icon_fnsq.png new file mode 100644 index 0000000..9907126 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_fnsq.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_home_normal.png b/app/src/main/res/mipmap-xxhdpi/icon_home_normal.png new file mode 100644 index 0000000..eb3283e Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_home_normal.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_home_selected.png b/app/src/main/res/mipmap-xxhdpi/icon_home_selected.png new file mode 100644 index 0000000..cd3b6ab Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_home_selected.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_jq.png b/app/src/main/res/mipmap-xxhdpi/icon_jq.png new file mode 100644 index 0000000..574c4a2 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_jq.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_jq_normal.png b/app/src/main/res/mipmap-xxhdpi/icon_jq_normal.png new file mode 100644 index 0000000..e38aef1 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_jq_normal.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_jq_selected.png b/app/src/main/res/mipmap-xxhdpi/icon_jq_selected.png new file mode 100644 index 0000000..9dd0f49 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_jq_selected.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_main_bg.png b/app/src/main/res/mipmap-xxhdpi/icon_main_bg.png new file mode 100644 index 0000000..7037d46 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_main_bg.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_personal_normal.png b/app/src/main/res/mipmap-xxhdpi/icon_personal_normal.png new file mode 100644 index 0000000..21c6a21 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_personal_normal.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_personal_selected.png b/app/src/main/res/mipmap-xxhdpi/icon_personal_selected.png new file mode 100644 index 0000000..b4c7781 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_personal_selected.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_query.png b/app/src/main/res/mipmap-xxhdpi/icon_query.png new file mode 100644 index 0000000..a0bbb03 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_query.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_right_sanjiao.png b/app/src/main/res/mipmap-xxhdpi/icon_right_sanjiao.png new file mode 100644 index 0000000..678deb7 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_right_sanjiao.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_selected.png b/app/src/main/res/mipmap-xxhdpi/icon_selected.png new file mode 100644 index 0000000..192e6a9 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_selected.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_sjtc.png b/app/src/main/res/mipmap-xxhdpi/icon_sjtc.png new file mode 100644 index 0000000..517870c Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_sjtc.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_unselected.png b/app/src/main/res/mipmap-xxhdpi/icon_unselected.png new file mode 100644 index 0000000..185a316 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_unselected.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_wdfn.png b/app/src/main/res/mipmap-xxhdpi/icon_wdfn.png new file mode 100644 index 0000000..d7d5c69 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_wdfn.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_xjxc.png b/app/src/main/res/mipmap-xxhdpi/icon_xjxc.png new file mode 100644 index 0000000..88a5f8b Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_xjxc.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_xssp.png b/app/src/main/res/mipmap-xxhdpi/icon_xssp.png new file mode 100644 index 0000000..cc5b549 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_xssp.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_ycyj.png b/app/src/main/res/mipmap-xxhdpi/icon_ycyj.png new file mode 100644 index 0000000..50aa931 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_ycyj.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_yj.png b/app/src/main/res/mipmap-xxhdpi/icon_yj.png new file mode 100644 index 0000000..787abd5 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_yj.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/icon_yq.png b/app/src/main/res/mipmap-xxhdpi/icon_yq.png new file mode 100644 index 0000000..eabed04 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/icon_yq.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/jaintou.png b/app/src/main/res/mipmap-xxhdpi/jaintou.png new file mode 100644 index 0000000..a4aa741 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/jaintou.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/key_person_icon_normal.png b/app/src/main/res/mipmap-xxhdpi/key_person_icon_normal.png new file mode 100644 index 0000000..eeb1ae8 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/key_person_icon_normal.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/key_person_icon_selected.png b/app/src/main/res/mipmap-xxhdpi/key_person_icon_selected.png new file mode 100644 index 0000000..978ed73 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/key_person_icon_selected.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/person.png b/app/src/main/res/mipmap-xxhdpi/person.png new file mode 100644 index 0000000..5221eb2 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/person.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/photo.png b/app/src/main/res/mipmap-xxhdpi/photo.png new file mode 100644 index 0000000..a60bd5c Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/photo.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/search.png b/app/src/main/res/mipmap-xxhdpi/search.png new file mode 100644 index 0000000..f767573 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/search.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/wenjianjia.png b/app/src/main/res/mipmap-xxhdpi/wenjianjia.png new file mode 100644 index 0000000..5b31629 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/wenjianjia.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/wenjianjia_icon.png b/app/src/main/res/mipmap-xxhdpi/wenjianjia_icon.png new file mode 100644 index 0000000..0b8183d Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/wenjianjia_icon.png differ diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..fa379dd --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000..05a0ec9 --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..c759ae0 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,26 @@ + + + #1E78ED + #1E78ED + #1E78ED + #1E78ED + #A7A7A7 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + #E8EBF2 + #F9E2E2 + #999999 + #FBE5CA + #F7EAB6 + #666 + #33052EBA + #333 + #F7933B + #B6F7E9 + #052EBA + #00000000 + #9E9Fa1 + #55cccccc + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..7b1d337 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + 吉林公安警务实战协同系统 + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..fa379dd --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000..fa0f996 --- /dev/null +++ b/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..9ee9997 --- /dev/null +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 0000000..f18e1f0 --- /dev/null +++ b/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/base/.gitignore b/base/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/base/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/base/build.gradle b/base/build.gradle new file mode 100644 index 0000000..27a4457 --- /dev/null +++ b/base/build.gradle @@ -0,0 +1,32 @@ +plugins { + alias(libs.plugins.androidLibrary) +} + +android { + namespace 'com.police.base' + compileSdk 34 + + defaultConfig { + minSdk 24 + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation libs.appcompat + implementation libs.material + testImplementation libs.junit + androidTestImplementation libs.ext.junit + androidTestImplementation libs.espresso.core +} \ No newline at end of file diff --git a/base/src/main/AndroidManifest.xml b/base/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/base/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/base/src/main/java/com/police/base/App.java b/base/src/main/java/com/police/base/App.java new file mode 100644 index 0000000..14fef5e --- /dev/null +++ b/base/src/main/java/com/police/base/App.java @@ -0,0 +1,26 @@ +package com.police.base; + +import android.app.Application; +import android.os.Handler; + +public class App extends Application { + + public static Handler handler; + private static App app; + public boolean findAddress; + + @Override + public void onCreate() { + app = this; + super.onCreate(); + handler = new Handler(); + } + + public static App getApp() { + return app; + } + + public static Handler getHandler() { + return handler; + } +} diff --git a/base/src/main/java/com/police/base/BaseActivity.java b/base/src/main/java/com/police/base/BaseActivity.java new file mode 100644 index 0000000..3623944 --- /dev/null +++ b/base/src/main/java/com/police/base/BaseActivity.java @@ -0,0 +1,15 @@ +package com.police.base; + +import android.app.Activity; +import android.os.Bundle; +import android.os.PersistableBundle; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +public class BaseActivity extends AppCompatActivity { + @Override + public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) { + super.onCreate(savedInstanceState, persistentState); + } +} diff --git a/base/src/main/java/com/police/base/BaseFragment.java b/base/src/main/java/com/police/base/BaseFragment.java new file mode 100644 index 0000000..5b23a06 --- /dev/null +++ b/base/src/main/java/com/police/base/BaseFragment.java @@ -0,0 +1,6 @@ +package com.police.base; + +import androidx.fragment.app.Fragment; + +public class BaseFragment extends Fragment { +} diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..b82031c --- /dev/null +++ b/build.gradle @@ -0,0 +1,5 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { +alias(libs.plugins.androidApplication) apply false + alias(libs.plugins.androidLibrary) apply false +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..4b29016 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,22 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. For more details, visit +# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true +android.enableJetifier=true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..3c1b698 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,23 @@ +[versions] +agp = "8.3.0" +junit = "4.13.2" +junitVersion = "1.1.5" +espressoCore = "3.5.1" +appcompat = "1.6.1" +material = "1.10.0" +activity = "1.8.0" +constraintlayout = "2.1.4" + +[libraries] +junit = { group = "junit", name = "junit", version.ref = "junit" } +ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } +espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } +appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } +material = { group = "com.google.android.material", name = "material", version.ref = "material" } +activity = { group = "androidx.activity", name = "activity", version.ref = "activity" } +constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" } + +[plugins] +androidApplication = { id = "com.android.application", version.ref = "agp" } +androidLibrary = { id = "com.android.library", version.ref = "agp" } + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..152ac3b --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sun Apr 28 21:16:47 CST 2024 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..4f906e0 --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/network/.gitignore b/network/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/network/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/network/build.gradle b/network/build.gradle new file mode 100644 index 0000000..ffcaecf --- /dev/null +++ b/network/build.gradle @@ -0,0 +1,35 @@ +plugins { + alias(libs.plugins.androidLibrary) +} + +android { + namespace 'com.police.network' + compileSdk 34 + + defaultConfig { + minSdk 24 + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + implementation libs.appcompat + implementation libs.material + implementation 'com.squareup.okhttp3:okhttp:4.8.1' // OkHttp库 + implementation 'com.squareup.retrofit2:converter-gson:2.9.0' // 如果你使用 Gson 进行 JSON 转换 + implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2' + implementation project(':base') +} \ No newline at end of file diff --git a/network/src/main/AndroidManifest.xml b/network/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/network/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/network/src/main/java/com/police/network/BaseRequestClient.java b/network/src/main/java/com/police/network/BaseRequestClient.java new file mode 100644 index 0000000..466af4b --- /dev/null +++ b/network/src/main/java/com/police/network/BaseRequestClient.java @@ -0,0 +1,244 @@ +package com.police.network; + +import static com.police.network.UaCredentialApi.PARAMS_KEY_UA_APP_CREDENTIAL; +import static com.police.network.UaCredentialApi.PARAMS_KEY_UA_RET_CODE; +import static com.police.network.UaCredentialApi.PARAMS_KEY_UA_RET_SUCCESS; +import static com.police.network.UaCredentialApi.PARAMS_KEY_UA_USER_CREDENTIAL; + +import android.net.Uri; +import android.os.Bundle; +import android.util.Log; +import android.widget.Toast; + +import androidx.annotation.NonNull; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.police.base.App; +import com.police.network.model.ResourceList; +import com.police.network.model.UserCredential; +import com.police.network.requestparams.RequestParams; +import com.police.network.requestparams.ResponseParams; + +import java.io.IOException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.logging.HttpLoggingInterceptor; + +public class BaseRequestClient { + private final String TAG = "BaseRequestClient"; + private OkHttpClient okHttpClient; + private FindAddressCallback callback; + + public interface FindAddressCallback { + void success(); + } + + /* + + */ + private void call(String url, RequestParams params, Callback callback) { + try { + RequestBody body = RequestBody.create(new Gson().toJson(params), MediaType.parse("application/json; charset=utf-8")); + Request request = new Request.Builder() + .url(url) + .post(body) + .addHeader("userCredential", URLEncoder.encode(Constants.USER_CREDENTIAL, "UTF-8")) + .addHeader("appCredential", URLEncoder.encode(Constants.APP_CREDENTIAL, "UTF-8")) + .build(); + okHttpClient.newCall(request).enqueue(callback); + } catch (Exception e) { + Log.e(TAG, e.toString()); + } + + } + + public void init(FindAddressCallback callback) { + this.callback = callback; + HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); // 设置日志级别,例如打印请求和响应的body + okHttpClient = new OkHttpClient.Builder() + .addInterceptor(loggingInterceptor) // 添加日志拦截器 + .callTimeout(30, TimeUnit.SECONDS) + .connectTimeout(30, TimeUnit.SECONDS) + .build(); + //获取接口需要用到的凭证 + getInterface(); + } + + //获取接口需要用到的凭证 + private void getInterface() { + Uri uri = Uri.parse("content://com.ydjw.ua.getCredential"); + Bundle params = new Bundle(); + String paramsMessageId = UUID.randomUUID().toString(); + //构建参数 + params.putString("messageId", paramsMessageId);//消息id + params.putString("version", "1");//接口版本号,当前为1 + params.putString("appId", Constants.APP_ID);// + params.putString("orgId", Constants.ORG_ID);// + params.putString("networkAreaCode", "3");// + params.putString("packageName", "com.police.policedatasystem");//应用包名,可空 + //获取票据 + Bundle bundle = App.getApp().getContentResolver().call(uri, "", null, params); + //解析结果 + if (bundle == null) { + toastTip("获取应用凭证失败,bundle为空!"); + return; + } + String messageId = bundle.getString("messageId"); + if (paramsMessageId.equals(messageId)) { + int resultCode = bundle.getInt(PARAMS_KEY_UA_RET_CODE); + if (PARAMS_KEY_UA_RET_SUCCESS == resultCode) { + Constants.APP_CREDENTIAL = bundle.getString(PARAMS_KEY_UA_APP_CREDENTIAL); + Constants.USER_CREDENTIAL = bundle.getString(PARAMS_KEY_UA_USER_CREDENTIAL); + Constants.setUserId(new Gson().fromJson(Constants.USER_CREDENTIAL, UserCredential.class).getCredential().getLoad().getUserInfo().getJh()); + Constants.setSFZH(new Gson().fromJson(Constants.USER_CREDENTIAL, UserCredential.class).getCredential().getLoad().getUserInfo().getSfzh()); + Constants.setORG_ID(new Gson().fromJson(Constants.USER_CREDENTIAL, UserCredential.class).getCredential().getLoad().getUserInfo().getOrgId()); + Constants.XM = new Gson().fromJson(Constants.USER_CREDENTIAL, UserCredential.class).getCredential().getLoad().getUserInfo().getXm(); + //根据票据寻址 + findAddress(); + } else { + toastTip(bundle.getString("message") + ",resultCode:" + resultCode); + } + } else { + toastTip("获取应用凭证失败,messageId不一致!"); + } + } + + //第二步,寻址 + private void findAddress() { + Thread thread = new Thread(() -> { + // 在这里执行耗时任务 + Uri uri = Uri.parse("content://com.ydjw.rsb.getResourceAddress"); + Bundle bundle = new Bundle(); + String paramsMessageId = UUID.randomUUID().toString(); + bundle.putString("appCredential", Constants.APP_CREDENTIAL);//应用凭证,由上一步获得 + bundle.putString("userCredential", Constants.USER_CREDENTIAL);//用户凭证,由上一步获得 + bundle.putString("version", "1");//服务总线接口版本号,当前为1 + bundle.putString("messageId", paramsMessageId);//消息 ID + Bundle callBack = App.getApp().getContentResolver().call(uri, "", null, bundle); + if (callBack == null) { + toastTip("获取应用资源地址失败,bundle为空"); + return; + } + String messageId = callBack.getString("messageId"); + String resourceList = callBack.getString("resourceList"); + if (paramsMessageId.equals(messageId)) { + int resultCode = callBack.getInt("resultCode"); + if (resultCode == 0) { + if (resourceList == null || resourceList.isEmpty()) { + toastTip("寻址失败,resourceList为空!"); + return; + } + List resourceLists = new Gson().fromJson(resourceList, new TypeToken>() { + }.getType()); + for (ResourceList item : resourceLists) { + Constants.resourceListsMap.put(item.getResourceId(), item); + } + //2.发起请求,获取重点人数据 + if (callback != null) { + callback.success(); + App.getApp().findAddress = true; + } + } else { + if (resourceList == null || resourceList.isEmpty()) { + toastTip("寻址失败,错误码:" + resultCode); + } + } + } + }); + thread.start(); + } + + + /** + * 基类封装 + */ + public void request(String urlKey, String jsonParams, CustomCallBack callBack) { + ResourceList resourceList = Constants.resourceListsMap.get(urlKey); + if (resourceList == null) { + return; + } + RequestParams.Parameter parameter = getParameter(urlKey, jsonParams); + RequestParams requestParams = new RequestParams(); + requestParams.setMessageId(UUID.randomUUID().toString()); + requestParams.setVersion("1.0"); + requestParams.setParameter(parameter); + call(resourceList.getResourceAddress(), requestParams, new Callback() { + @Override + public void onFailure(@NonNull Call call, @NonNull IOException e) { + // 请求失败 + App.getHandler().post(() -> callBack.onError(call, e)); + } + + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + if (!response.isSuccessful()) { + App.getHandler().post(() -> callBack.onError(call, new IOException("Unexpected code " + response))); + return; + } + try { + // 请求成功,处理响应数据 + if (response.body() == null) { + App.getHandler().post(() -> callBack.onError(call, new Exception("服务器返回数据异常"))); + return; + } + String responseBody = response.body().string(); + ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class); + if (!"200".equals(responseParams.getCode())) { + App.getHandler().post(() -> callBack.onError(call, new Exception("服务器出错,请联系开发人员或稍后重试!"))); + return; + } + if (responseParams.getData().getDataList() == null || responseParams.getData().getDataList().isEmpty()) { + App.getHandler().post(() -> callBack.onError(call, new Exception("服务器返回数据异常"))); + return; + } + ResponseParams.FieldData fieldData = responseParams.getData().getDataList().get(0); + if (fieldData.getFieldValues() == null || fieldData.getFieldValues().isEmpty()) { + App.getHandler().post(() -> callBack.onError(call, new Exception("服务器返回数据异常"))); + return; + } + App.getHandler().post(() -> callBack.onSuccess(fieldData.getFieldValues().get(0).getValue())); + } catch (Exception e) { + App.getHandler().post(() -> callBack.onError(call, e)); + } + } + }); + } + + private void toastTip(String string) { + Toast.makeText(App.getApp(), string, Toast.LENGTH_LONG).show(); + } + + @NonNull + private static RequestParams.Parameter getParameter(String urlKey, String jsonParams) { + RequestParams.Condition condition = new RequestParams.Condition(); + condition.setLogicalOperate("and"); + RequestParams.KeyValues keyValues = new RequestParams.KeyValues(); + keyValues.setKey("injson"); + keyValues.setValue(jsonParams); + List keyValuesList = new ArrayList<>(); + keyValuesList.add(keyValues); + condition.setKeyValueList(keyValuesList); + RequestParams.Parameter parameter = new RequestParams.Parameter(); + parameter.setCondition(condition); + parameter.setPage(new RequestParams.Page()); + parameter.setFields("outjson"); + parameter.setNetworkCode("3"); + parameter.setOrderBy(null); + parameter.setRegionalismCode(Constants.ORG_ID); + parameter.setDataObjId(urlKey); + return parameter; + } +} \ No newline at end of file diff --git a/network/src/main/java/com/police/network/Constants.java b/network/src/main/java/com/police/network/Constants.java new file mode 100644 index 0000000..59e0565 --- /dev/null +++ b/network/src/main/java/com/police/network/Constants.java @@ -0,0 +1,99 @@ +package com.police.network; + + +import com.police.network.model.ResourceList; + +import java.util.HashMap; + +public final class Constants { + /** + * 根据警员编号重点人员信息列表 + */ + public static final String KEY_PERSON_ID = "220000000000-3-0100-103cab8edd784a688ac3c41476454a3a"; + /** + * 根据组织机构查询辖区重点人 + */ + public static final String ORG_KEY_PERSON_ID = "220000000000-3-0100-2faa9acfe614420c8a0c74dbf257d963"; + /** + * 重点人员信息详情 + */ + public static final String KEY_PERSON_DETAIL_ID = "220000000000-3-0100-e589d230e71942a3b87f2e050fbd2058"; + /** + * 警情列表 + */ + public static final String POLICE_EMERGENCY_ID = "220000000000-3-0100-013e30a83e854b1badc23dd31e7dcfec"; + /** + * 警情详情 + */ + public static final String POLICE_EMERGENCY_DETAIL_ID = "220000000000-3-0100-25a416bd99ef4cd19a523715b9612fa1"; + /** + * 重点人消息数量统计 + */ + public static final String KEY_PERSON_MESSAGE_COUNT_ID = "220000000000-3-0100-d29a1ec21b9e44dab6e69a26598b8b8e"; + /** + * 申请事由类型获取 + */ + public static final String APPLY_TYPE_ID = "220000000000-3-0100-d6893e7ffbf04078817c7fd1b3a6b38b"; + /** + * 申请事由发起申请赋能 + */ + public static final String APPLY_COMMIT_ID = "220000000000-3-0100-2271052a92e14a0b952790e97d0f6457"; + /** + * 赋能列表查询 + */ + public static final String MINE_LIST_ID = "220000000000-3-0100-1558d4e5f1f149989b67f988fc7cb291"; + /** + * 赋能详情查询 + */ + public static final String MINE_DETAIL_ID = "220000000000-3-0100-8c3e36bb5bdb4ee8b55b4ad0c4a83d13"; + /** + * 自助查询 + */ + public static final String SELF_QUERY_ID = "220000000000-3-0100-dec70ae1354e4281b6eeced50dc2a7be"; + /** + * 组织机构id + */ + public static final String ORG_ID = "220000000000"; + /** + * 重点人员信息id + */ + public static final String APP_ID = "220000000000-3-1-71d6313523574202bb1f9984b6d95254"; + public static String APP_CREDENTIAL = ""; + public static String USER_CREDENTIAL = ""; + /** + * 当前用户警员编号 + */ + public static String USER_ID = "100307"; /** + * 当前用户警员编号 + */ + public static String XM = "100307"; + /** + * 当前用户身份证号 + */ + public static String SFZH = "220183197210264653"; + + public static void setUserId(String str) { +// USER_ID = str; + } + + public static void setSFZH(String str) { +// SFZH = str; + } + + public static void setORG_ID(String str) { +// USER_ORG_ID = str; + } + + /** + * 当前用户警员组织代码 + */ + public static String USER_ORG_ID = "220183210000";//22018421000//220106290000 + /** + * 寻址后得到的数据-接口列表 + */ + public static final HashMap resourceListsMap = new HashMap<>(); + /** + * 请求分页数据数量 + */ + public static int PAGE_SIZE = 10; +} \ No newline at end of file diff --git a/network/src/main/java/com/police/network/CustomCallBack.java b/network/src/main/java/com/police/network/CustomCallBack.java new file mode 100644 index 0000000..16b4f39 --- /dev/null +++ b/network/src/main/java/com/police/network/CustomCallBack.java @@ -0,0 +1,12 @@ +package com.police.network; + +import androidx.annotation.NonNull; + +import okhttp3.Call; + +public abstract class CustomCallBack { + public abstract void onError(Call call, @NonNull Exception e); + + public abstract void onSuccess(T value); + +} diff --git a/network/src/main/java/com/police/network/UaCredentialApi.java b/network/src/main/java/com/police/network/UaCredentialApi.java new file mode 100644 index 0000000..a6543b0 --- /dev/null +++ b/network/src/main/java/com/police/network/UaCredentialApi.java @@ -0,0 +1,307 @@ +package com.police.network; + +import android.app.Activity; +import android.content.ActivityNotFoundException; +import android.content.BroadcastReceiver; +import android.content.ContentResolver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PackageManager; +import android.content.pm.ProviderInfo; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.text.TextUtils; + +import com.police.network.model.ThirdAppInfo; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class UaCredentialApi { + + + /**********************************************以下是统一认证登录时使用的参数字段常量定义*************************************************************/ + + /** + * 统一认证登录接口(统一认证客户端(UAAC)提供) + */ + public static final String PROVIDER_URI_GET_CREDENTIAL = "content://com.ydjw.ua.getCredential"; + + public static final String PARAMS_KEY_UA_VERSION_VALUE = "1"; + + public static final String PARAMS_KEY_UA_MESSAGE_ID = "messageId"; + + public static final String PARAMS_KEY_UA_VERSION = "version"; + + public static final String PARAMS_KEY_UA_APP_ID = "appId"; + + public static final String PARAMS_KEY_UA_ORG_ID = "orgId"; + + public static final String PARAMS_KEY_UA_NETWORK_AREA_CODE = "networkAreaCode"; + + public static final String PARAMS_KEY_UA_PACKAGE_NAME = "packageName"; + + public static final String PARAMS_KEY_UA_RET_CODE = "resultCode"; + + public static final String PARAMS_KEY_UA_RET_MESSAGE = "message"; + + public static final String PARAMS_KEY_THIRD_APP_INFO = "third_app_info"; + + public static final int PARAMS_KEY_UA_RET_SUCCESS = 0; + + public static final int PARAMS_KEY_UA_RET_ERROR_PARAMS = -3; + + public static final int PARAMS_KEY_UA_RET_ERROR_NOT_EXISTS = -5; + + public static final int CREDENTIAL_CLIENT_NOT_INSTALLED = -7; + + public static final int PARAMS_KEY_UA_RET_ERROR_OTHER = -99; + + public static final String PARAMS_KEY_UA_APP_CREDENTIAL = "appCredential"; + + public static final String PARAMS_KEY_UA_USER_CREDENTIAL = "userCredential"; + + public static final String ACTION_SUFFIX_UA_LOGIN = ".ACTION_LOGIN"; + + public static final String ACTION_UA_LOGOUT = "com.ydjw.ua.ACTION_LOGOUT"; + + /**********************************************以下是统一认证登录时使用的参数字段常量定义*************************************************************/ + + private boolean notExists = false; + + public CredentialReqCallBack credentialReqCallBack; + + private String mMessageId; + + private Context mContext; + private String version = UaCredentialApi.PARAMS_KEY_UA_VERSION_VALUE; + private String appId; + private String orgId; + private String networkAreaCode; + + + private static Map packageActivityMap = new HashMap<>(); + + /** + * 统一认证应用包名(历史原因,统一认证单点登录功能存在多个客户端) + */ + private static String uaacPackageName; + + /** + * 统一认证启动Activity类名 + */ + private static String uaacLoginActivityName; + + static { + //新版统一认证 + packageActivityMap.put("com.xdja.uaac", "com.xdja.uaac.ui.InitActivity"); + //旧版统一认证 + packageActivityMap.put("com.xdja.unifyauthorize", "com.xdja.unifyauthorize.activity.LoginActivity"); + //安全接入融合版 + packageActivityMap.put("com.xdja.safeclient", "com.xdja.safeclient.frame.SplashActivity"); + //警信内部集成的旧版统一认证 + packageActivityMap.put("com.xdja.jxclient", "com.xdja.unifyauthorize.activity.LoginActivity"); + } + + public UaCredentialApi(Builder builder) { + this.mContext = builder.mContext; + this.version = builder.version; + this.appId = builder.appId; + this.orgId = builder.orgId; + this.networkAreaCode = builder.networkAreaCode; + } + + public static class Builder { + protected Context mContext; + protected String version; + protected String appId; + protected String orgId; + protected String networkAreaCode; + + public Builder(Context context) { + this.mContext = context; + } + + public Builder setAppId(String appId) { + this.appId = appId; + return this; + } + + public Builder setVersion(String version) { + this.version = version; + return this; + } + + public Builder setOrgId(String orgId) { + this.orgId = orgId; + return this; + } + + public Builder setNetworkAreaCode(String networkAreaCode) { + this.networkAreaCode = networkAreaCode; + return this; + } + + public UaCredentialApi build() { + return new UaCredentialApi(this); + } + } + + public void reqCredential(CredentialReqCallBack reqCallBack) { + this.credentialReqCallBack = reqCallBack; + + IntentFilter intentFilter = new IntentFilter(); + String pkgName = mContext.getPackageName(); + /**添加登录成功事件监听 + * 当第一次登录,调用【IF-UA-SDK-01】接口可能返回"票据不存在",此时需要注册监听此事件, + * 当登录成功后,接收到此事件即可重新调用【IF-UA-SDK-01】获取相关票据 + * */ + intentFilter.addAction(pkgName + ACTION_SUFFIX_UA_LOGIN); + + /**增加登出事件监听 + * 当UA主动账户退出时会发送该事件,此时已经登录应用可以根据自身业务实施退出 + * */ + intentFilter.addAction(pkgName + ACTION_UA_LOGOUT); + mContext.registerReceiver(uaLoginInReceiver, intentFilter); + loginUaForCredential(mContext); + } + + public void release() { + notExists = false; + if (uaLoginInReceiver == null) { + return; + } + mContext.unregisterReceiver(uaLoginInReceiver); + } + + private BroadcastReceiver uaLoginInReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if (TextUtils.isEmpty(action)) { + return; + } + + if (action.contains(ACTION_SUFFIX_UA_LOGIN) && notExists) { + loginUaForCredential(mContext); + } + } + }; + + /** + * 【步骤1:IF-UA-SDK-01】获取凭证信息 + *
调用此接口获取用户凭证和应用凭证
+ *
如用户已登录 UA客户端,则直接向应用返回凭证信息
+ *
如未登录,待登录完成后将通过广播的形式向应用发送用户登录成功广播,此时可以监听广播重新获取凭证信息
+ */ + private void loginUaForCredential(Context context) { + + if (!isCredentialProviderExist(context)) { + credentialReqCallBack.onCredentialCallBack(CREDENTIAL_CLIENT_NOT_INSTALLED, "未找到UA客户端", "", ""); + return; + } + + notExists = false; + String messageId = UUID.randomUUID().toString().replace("-",""); + mMessageId = messageId; + Uri uri = Uri.parse(PROVIDER_URI_GET_CREDENTIAL); + ContentResolver resolver = context.getContentResolver(); + Bundle params = new Bundle(); + + String packageName = context.getPackageName(); + params.putString(PARAMS_KEY_UA_MESSAGE_ID, messageId); + params.putString(PARAMS_KEY_UA_VERSION, version); + params.putString(PARAMS_KEY_UA_APP_ID, appId); + params.putString(PARAMS_KEY_UA_ORG_ID, orgId); + params.putString(PARAMS_KEY_UA_NETWORK_AREA_CODE, networkAreaCode); + params.putString(PARAMS_KEY_UA_PACKAGE_NAME, packageName); + + try { + Bundle result = resolver.call(uri, "", null, params); + if (result == null) { + credentialReqCallBack.onCredentialCallBack(PARAMS_KEY_UA_RET_ERROR_OTHER, "获取应用凭证失败,bundle为空", "", ""); + return; + } + String messageIdRet = result.getString(PARAMS_KEY_UA_MESSAGE_ID); + if (!mMessageId.equals(messageIdRet)) { + credentialReqCallBack.onCredentialCallBack(PARAMS_KEY_UA_RET_ERROR_OTHER, "获取应用凭证失败,messageId不对应", "", ""); + return; + } + + receiveCredential(result); + } catch (ActivityNotFoundException activityNotFoundException) { + activityNotFoundException.printStackTrace(); + receiveCredentialError(null, activityNotFoundException); + } catch (Exception e) { + e.printStackTrace(); + receiveCredentialError(null, e); + } + } + + private void receiveCredentialError(Bundle result, Exception e) { + credentialReqCallBack.onCredentialCallBack(PARAMS_KEY_UA_RET_ERROR_OTHER, "调用UA客户端获取凭证接口异常:" + (e == null ? "" : e.getMessage()), "", ""); + } + + /** + * 【步骤I:IF-UA-SDK-01】处理获取凭证结果 + * + * @param result + */ + private void receiveCredential(Bundle result) { + + int resultCode = result.getInt(PARAMS_KEY_UA_RET_CODE); + if (PARAMS_KEY_UA_RET_SUCCESS == resultCode) { + String appCredential = result.getString(PARAMS_KEY_UA_APP_CREDENTIAL); + String userCredential = result.getString(PARAMS_KEY_UA_USER_CREDENTIAL); + credentialReqCallBack.onCredentialCallBack(resultCode, "", userCredential, appCredential); + return; + } + + if (PARAMS_KEY_UA_RET_ERROR_NOT_EXISTS == resultCode) { + notExists = true; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + Intent intent = new Intent(); + intent.setClassName(uaacPackageName, uaacLoginActivityName); + final ThirdAppInfo thirdAppInfo = new ThirdAppInfo(); + thirdAppInfo.setMessageId(result.getString(PARAMS_KEY_UA_MESSAGE_ID)); + thirdAppInfo.setPackageName(mContext.getPackageName()); + thirdAppInfo.setAppId(appId); + thirdAppInfo.setOrgId(orgId); + thirdAppInfo.setNetworkAreaCode(networkAreaCode); + thirdAppInfo.setVersion(version); + intent.putExtra(PARAMS_KEY_THIRD_APP_INFO, thirdAppInfo); + if (!(mContext instanceof Activity)) { + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + } + mContext.startActivity(intent); + } + return; + } + + String message = result.getString(PARAMS_KEY_UA_RET_MESSAGE); + credentialReqCallBack.onCredentialCallBack(resultCode, message, "", ""); + } + + /** + * 判断凭证Provider是否存在,如果存在获取Provider所在应用的包名 + */ + private static boolean isCredentialProviderExist(Context context) { + PackageManager packageManager = context.getPackageManager(); + ProviderInfo providerInfo = packageManager.resolveContentProvider(Uri.parse(PROVIDER_URI_GET_CREDENTIAL).getAuthority(), PackageManager.GET_META_DATA); + if (providerInfo == null) { + return false; + } else { + uaacPackageName = providerInfo.applicationInfo.packageName; + uaacLoginActivityName = packageActivityMap.get(uaacPackageName); + return true; + } + } + + public interface CredentialReqCallBack { + void onCredentialCallBack(int resultCode, String message, String userCredential, String appCredential); + } + +} diff --git a/network/src/main/java/com/police/network/model/ResourceList.java b/network/src/main/java/com/police/network/model/ResourceList.java new file mode 100644 index 0000000..25097eb --- /dev/null +++ b/network/src/main/java/com/police/network/model/ResourceList.java @@ -0,0 +1,42 @@ +package com.police.network.model; + +import java.io.Serializable; + +public class ResourceList implements Serializable { + private String resourceRegionalismCode; + private String resourceAddress; + private String resourceId; + private String resourceServiceType; + + public String getResourceRegionalismCode() { + return resourceRegionalismCode; + } + + public void setResourceRegionalismCode(String resourceRegionalismCode) { + this.resourceRegionalismCode = resourceRegionalismCode; + } + + public String getResourceAddress() { + return resourceAddress; + } + + public void setResourceAddress(String resourceAddress) { + this.resourceAddress = resourceAddress; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getResourceServiceType() { + return resourceServiceType; + } + + public void setResourceServiceType(String resourceServiceType) { + this.resourceServiceType = resourceServiceType; + } +} diff --git a/network/src/main/java/com/police/network/model/ThirdAppInfo.java b/network/src/main/java/com/police/network/model/ThirdAppInfo.java new file mode 100644 index 0000000..1821816 --- /dev/null +++ b/network/src/main/java/com/police/network/model/ThirdAppInfo.java @@ -0,0 +1,65 @@ +package com.police.network.model; + +import java.io.Serializable; + +public class ThirdAppInfo implements Serializable { + private String messageId; + + private String packageName; + + private String appId; + + private String orgId; + + private String networkAreaCode; + + private String version; + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public String getNetworkAreaCode() { + return networkAreaCode; + } + + public void setNetworkAreaCode(String networkAreaCode) { + this.networkAreaCode = networkAreaCode; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/network/src/main/java/com/police/network/model/UserCredential.java b/network/src/main/java/com/police/network/model/UserCredential.java new file mode 100644 index 0000000..20d5d37 --- /dev/null +++ b/network/src/main/java/com/police/network/model/UserCredential.java @@ -0,0 +1,174 @@ +package com.police.network.model; + +import java.io.Serializable; + +/** + * { + * "credential":{ + * "head":{ + * "credType":"1", + * "duration":{ + * "endTime":"1709387466556", + * "startTime":"1709380266556" + * }, + * "token":{ + * "orgId":"220000000000", + * "tokenId":"ff8080818bc29187018dff00ea3d33fb" + * }, + * "version":"1.0" + * }, + * "load":{ + * "userInfo":{ + * "jh":"106686", + * "orgId":"220100410000", + * "sfzh":"220105198602152031", + * "userId":"162add958ea344f68d07b6ad2c4b17a7", + * "xm":"路瑶" + * } + * }, + * "serverSign":{ + * "alg":"SM3+SM2", + * "signature":"2WIjCJ/+94XmtIei2+/8eV40dxfvQGqV4ws7WDA5iNPc//zeZTFNewibqa8OSKprWq2P6mnWHMkVPYP+Qdl7Huc0qHJMVFUovF+mqtO5pSxrngem5kXmVK9v1NV7OMurPpa1FiQc1uU0A4Zae4ZrpynM2+qEck/D8KSvLvsKkCQ\u003d", + * "sn":"b11000000000bdc", + * "url":"http://192.168.24.108:8080" + * } + * } + * } + */ +public class UserCredential implements Serializable { + private Credential credential; + + public Credential getCredential() { + return credential; + } + + public void setCredential(Credential credential) { + this.credential = credential; + } + + public static class Credential implements Serializable { + private Head head; + private Load load; + private ServerSign serverSign; + + public Head getHead() { + return head; + } + + public void setHead(Head head) { + this.head = head; + } + + public Load getLoad() { + return load; + } + + public void setLoad(Load load) { + this.load = load; + } + + public ServerSign getServerSign() { + return serverSign; + } + + public void setServerSign(ServerSign serverSign) { + this.serverSign = serverSign; + } + } + + public static class Head implements Serializable{ + private Head head; + private Load load; + private ServerSign serverSign; + + public Head getHead() { + return head; + } + + public void setHead(Head head) { + this.head = head; + } + + public Load getLoad() { + return load; + } + + public void setLoad(Load load) { + this.load = load; + } + + public ServerSign getServerSign() { + return serverSign; + } + + public void setServerSign(ServerSign serverSign) { + this.serverSign = serverSign; + } + } + + public static class Load implements Serializable { + private UserInfo userInfo; + + public UserInfo getUserInfo() { + return userInfo; + } + + public void setUserInfo(UserInfo userInfo) { + this.userInfo = userInfo; + } + } + + public static class ServerSign { + private Head head; + private Load load; + private ServerSign serverSign; + } + + public static class UserInfo implements Serializable { + String jh;//"jh":"106686", + String orgId;//"orgId":"220100410000", + String sfzh;//"sfzh":"220105198602152031", + String userId;//"userId":"162add958ea344f68d07b6ad2c4b17a7", + String xm;//"xm":"路瑶" + + public String getJh() { + return jh; + } + + public void setJh(String jh) { + this.jh = jh; + } + + public String getOrgId() { + return orgId; + } + + public void setOrgId(String orgId) { + this.orgId = orgId; + } + + public String getSfzh() { + return sfzh; + } + + public void setSfzh(String sfzh) { + this.sfzh = sfzh; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getXm() { + return xm; + } + + public void setXm(String xm) { + this.xm = xm; + } + } +} diff --git a/network/src/main/java/com/police/network/requestparams/GetKeyPersonDetailParams.java b/network/src/main/java/com/police/network/requestparams/GetKeyPersonDetailParams.java new file mode 100644 index 0000000..8847580 --- /dev/null +++ b/network/src/main/java/com/police/network/requestparams/GetKeyPersonDetailParams.java @@ -0,0 +1,45 @@ +package com.police.network.requestparams; + +import java.io.Serializable; + +/** + * {"dept" : "220521950000","messageId":"12","version":"1.0" + */ +public class GetKeyPersonDetailParams implements Serializable { + private String sfzh="222304195909250034"; + private String messageId; + private String version; + private String sfhm; + + public String getSfhm() { + return sfhm; + } + + public void setSfhm(String sfhm) { + this.sfhm = sfhm; + } + + public String getSfzh() { + return sfzh; + } + + public void setSfzh(String sfzh) { + this.sfzh = sfzh; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/network/src/main/java/com/police/network/requestparams/GetKeyPersonListParams.java b/network/src/main/java/com/police/network/requestparams/GetKeyPersonListParams.java new file mode 100644 index 0000000..5d34e91 --- /dev/null +++ b/network/src/main/java/com/police/network/requestparams/GetKeyPersonListParams.java @@ -0,0 +1,89 @@ +package com.police.network.requestparams; + +import java.io.Serializable; + +/** + * {"jybh" : "840364","messageId":"12","version":"1.0" + */ +public class GetKeyPersonListParams implements Serializable { + private String jybh;//警员编号 + private String xm = "";//姓名 + private String sfzh = "";//身份证号 + private String messageId; + private String version; + private String pageNum; + private String pageSize; + private String sfhm;//当前用户的身份号码 + + public String getSfhm() { + return sfhm; + } + + public void setSfhm(String sfhm) { + this.sfhm = sfhm; + } + + public String getPageNum() { + return pageNum; + } + + public void setPageNum(String pageNum) { + this.pageNum = pageNum; + } + + public String getPageSize() { + return pageSize; + } + + public void setPageSize(String pageSize) { + this.pageSize = pageSize; + } + + public String getXm() { + return xm; + } + + public void setXm(String xm) { + this.xm = xm; + } + + public String getSfzh() { + return sfzh; + } + + public void setSfzh(String sfzh) { + this.sfzh = sfzh; + } + + public GetKeyPersonListParams(String jybh) { + this.jybh = jybh; + } + + public GetKeyPersonListParams() { + this.jybh = jybh; + } + + public String getJybh() { + return jybh; + } + + public void setJybh(String jybh) { + this.jybh = jybh; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/network/src/main/java/com/police/network/requestparams/GetKeyPersonMessageCountParams.java b/network/src/main/java/com/police/network/requestparams/GetKeyPersonMessageCountParams.java new file mode 100644 index 0000000..a3dec57 --- /dev/null +++ b/network/src/main/java/com/police/network/requestparams/GetKeyPersonMessageCountParams.java @@ -0,0 +1,80 @@ +package com.police.network.requestparams; + +import java.io.Serializable; + +/** + * {"jybh" : "840364","messageId":"12","version":"1.0" + */ +public class GetKeyPersonMessageCountParams implements Serializable { + private String jybh;//警员编号 + private String sfhm = "";//身份证号 + private String dept = "";//组织机构 + private String messageId; + private String version; + private String pageNum; + private String pageSize; + + public String getSfhm() { + return sfhm; + } + + public void setSfhm(String sfhm) { + this.sfhm = sfhm; + } + + public String getPageNum() { + return pageNum; + } + + public void setPageNum(String pageNum) { + this.pageNum = pageNum; + } + + public String getPageSize() { + return pageSize; + } + + public void setPageSize(String pageSize) { + this.pageSize = pageSize; + } + + public GetKeyPersonMessageCountParams(String jybh) { + this.jybh = jybh; + } + + public GetKeyPersonMessageCountParams() { + this.jybh = jybh; + } + + public String getJybh() { + return jybh; + } + + public String getDept() { + return dept; + } + + public void setDept(String dept) { + this.dept = dept; + } + + public void setJybh(String jybh) { + this.jybh = jybh; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/network/src/main/java/com/police/network/requestparams/GetOrgKeyPersonListParams.java b/network/src/main/java/com/police/network/requestparams/GetOrgKeyPersonListParams.java new file mode 100644 index 0000000..9eaf2ad --- /dev/null +++ b/network/src/main/java/com/police/network/requestparams/GetOrgKeyPersonListParams.java @@ -0,0 +1,81 @@ +package com.police.network.requestparams; + +import java.io.Serializable; + +/** + * {"dept" : "220521950000","messageId":"12","version":"1.0" + */ +public class GetOrgKeyPersonListParams implements Serializable { + private String dept; + private String xm; + private String sfzh; + private String messageId; + private String version; + private String pageNum; + private String pageSize; + private String sfhm; + + public String getSfhm() { + return sfhm; + } + + public void setSfhm(String sfhm) { + this.sfhm = sfhm; + } + + public String getPageNum() { + return pageNum; + } + + public void setPageNum(String pageNum) { + this.pageNum = pageNum; + } + + public String getPageSize() { + return pageSize; + } + + public void setPageSize(String pageSize) { + this.pageSize = pageSize; + } + + public String getXm() { + return xm; + } + + public void setXm(String xm) { + this.xm = xm; + } + + public String getSfzh() { + return sfzh; + } + + public void setSfzh(String sfzh) { + this.sfzh = sfzh; + } + + public String getDept() { + return dept; + } + + public void setDept(String dept) { + this.dept = dept; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/network/src/main/java/com/police/network/requestparams/GetPoliceEmergencyDetailParams.java b/network/src/main/java/com/police/network/requestparams/GetPoliceEmergencyDetailParams.java new file mode 100644 index 0000000..692c6b9 --- /dev/null +++ b/network/src/main/java/com/police/network/requestparams/GetPoliceEmergencyDetailParams.java @@ -0,0 +1,45 @@ +package com.police.network.requestparams; + +import java.io.Serializable; + +/** + * {"dept" : "220521950000","messageId":"12","version":"1.0" + */ +public class GetPoliceEmergencyDetailParams implements Serializable { + private String jcjbh="222304195909250034"; + private String messageId; + private String version; + private String sfhm; + + public String getSfhm() { + return sfhm; + } + + public void setSfhm(String sfhm) { + this.sfhm = sfhm; + } + + public String getJcjbh() { + return jcjbh; + } + + public void setJcjbh(String jcjbh) { + this.jcjbh = jcjbh; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/network/src/main/java/com/police/network/requestparams/GetPoliceEmergencyListParams.java b/network/src/main/java/com/police/network/requestparams/GetPoliceEmergencyListParams.java new file mode 100644 index 0000000..67b592b --- /dev/null +++ b/network/src/main/java/com/police/network/requestparams/GetPoliceEmergencyListParams.java @@ -0,0 +1,81 @@ +package com.police.network.requestparams; + +import java.io.Serializable; + +/** + * {"jybh" : "840364","messageId":"12","version":"1.0" + */ +public class GetPoliceEmergencyListParams implements Serializable { + private String sfhm; + private String bjjyqk = "";//报警内容 + private String jcjbh = "";//警情编号 + private String bjrlxdh = "";//报警电话 + private String messageId; + private String version; + private String pageNum; + private String pageSize; + + public String getPageNum() { + return pageNum; + } + + public void setPageNum(String pageNum) { + this.pageNum = pageNum; + } + + public String getPageSize() { + return pageSize; + } + + public void setPageSize(String pageSize) { + this.pageSize = pageSize; + } + + public String getSfhm() { + return sfhm; + } + + public void setSfhm(String sfhm) { + this.sfhm = sfhm; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getBjjyqk() { + return bjjyqk; + } + + public void setBjjyqk(String bjjyqk) { + this.bjjyqk = bjjyqk; + } + + public String getJcjbh() { + return jcjbh; + } + + public void setJcjbh(String jcjbh) { + this.jcjbh = jcjbh; + } + + public String getBjrlxdh() { + return bjrlxdh; + } + + public void setBjrlxdh(String bjrlxdh) { + this.bjrlxdh = bjrlxdh; + } +} diff --git a/network/src/main/java/com/police/network/requestparams/RequestParams.java b/network/src/main/java/com/police/network/requestparams/RequestParams.java new file mode 100644 index 0000000..0a68499 --- /dev/null +++ b/network/src/main/java/com/police/network/requestparams/RequestParams.java @@ -0,0 +1,156 @@ +package com.police.network.requestparams; + +import java.io.Serializable; +import java.util.List; + +public class RequestParams implements Serializable { + private String messageId;//自定义唯一值,建议 UUID.randomUUID().toString() + private String version;//服务总线版本号,目前填写 1.0 即可 + private Parameter parameter;//结构体中参数释义如下 + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public Parameter getParameter() { + return parameter; + } + + public void setParameter(Parameter parameter) { + this.parameter = parameter; + } + + public static class Page { + public int pageSize = 1; + public int pageNo = 1; + } + + public static class Parameter implements Serializable { + private Condition condition;//(条件)结构体释义如下 + private String dataObjId; //应用商店注册对应的资源 id + private String fields;//后台约定字段,可咨询后台开发人员 + private String networkCode;//网络类型,应用商店注册对应的网络类型 + private String orderBy;//排序字段,可空 + private Page page;//页码信息,非空 + private String regionalismCode; //区域代码 应用商店注册 app 对应的区域代码 + + public Condition getCondition() { + return condition; + } + + public void setCondition(Condition condition) { + this.condition = condition; + } + + public String getDataObjId() { + return dataObjId; + } + + public void setDataObjId(String dataObjId) { + this.dataObjId = dataObjId; + } + + public String getFields() { + return fields; + } + + public void setFields(String fields) { + this.fields = fields; + } + + public String getNetworkCode() { + return networkCode; + } + + public void setNetworkCode(String networkCode) { + this.networkCode = networkCode; + } + + public String getOrderBy() { + return orderBy; + } + + public void setOrderBy(String orderBy) { + this.orderBy = orderBy; + } + + public Page getPage() { + return page; + } + + public void setPage(Page page) { + this.page = page; + } + + public String getRegionalismCode() { + return regionalismCode; + } + + public void setRegionalismCode(String regionalismCode) { + this.regionalismCode = regionalismCode; + } + } + + public static class Condition implements Serializable { + private String logicalOperate = "and";//操作符,传值 and + private List keyValueList;//集合,里面装的键值对,字段解释如下 + + public String getLogicalOperate() { + return logicalOperate; + } + + public void setLogicalOperate(String logicalOperate) { + this.logicalOperate = logicalOperate; + } + + public List getKeyValueList() { + return keyValueList; + } + + public void setKeyValueList(List keyValueList) { + this.keyValueList = keyValueList; + } + } + + public static class KeyValues implements Serializable { + private String key;//跟后台约定,你想放在服务总线接口里面入参的 key + private String value;//自己后台接口需要的入参实际值,可放自己接口需要的 json 值 + private String relationOperator = "=";//关系符 传= + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getRelationOperator() { + return relationOperator; + } + + public void setRelationOperator(String relationOperator) { + this.relationOperator = relationOperator; + } + } +} diff --git a/network/src/main/java/com/police/network/requestparams/ResponseParams.java b/network/src/main/java/com/police/network/requestparams/ResponseParams.java new file mode 100644 index 0000000..3111c99 --- /dev/null +++ b/network/src/main/java/com/police/network/requestparams/ResponseParams.java @@ -0,0 +1,96 @@ +package com.police.network.requestparams; + +import java.io.Serializable; +import java.util.List; + +public class ResponseParams implements Serializable { + String messageId;//自定义唯一值,建议 UUID.randomUUID().toString() + String message;// + String version;//服务总线版本号,目前填写 1.0 即可 + String code;//结构体中参数释义如下 + Data data; + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public Data getData() { + return data; + } + + public void setData(Data data) { + this.data = data; + } + + public static class Data implements Serializable { + private List dataList;//(条件)结构体释义如下 + + public List getDataList() { + return dataList; + } + + public void setDataList(List dataList) { + this.dataList = dataList; + } + } + + public static class FieldData implements Serializable { + private List fieldValues; + + public List getFieldValues() { + return fieldValues; + } + + public void setFieldValues(List fieldValues) { + this.fieldValues = fieldValues; + } + } + + public static class FieldValues implements Serializable { + private String field; + private String value; + + public String getField() { + return field; + } + + public void setField(String field) { + this.field = field; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..50d4955 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,43 @@ +pluginManagement { + repositories { + maven { url "https://maven.aliyun.com/nexus/content/groups/public/" } + mavenCentral() + maven { url "https://jitpack.io" } + maven { url 'https://maven.aliyun.com/repository/releases' } + maven { url 'https://maven.aliyun.com/repository/jcenter' } + maven { url 'https://maven.aliyun.com/repository/google' } + maven { url 'https://maven.aliyun.com/repository/central' } + maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } + maven { url 'https://maven.aliyun.com/repository/public' } + gradlePluginPortal() + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + maven { url "https://maven.aliyun.com/nexus/content/groups/public/" } + mavenCentral() + maven { url "https://jitpack.io" } + maven { url 'https://maven.aliyun.com/repository/releases' } + maven { url 'https://maven.aliyun.com/repository/jcenter' } + maven { url 'https://maven.aliyun.com/repository/google' } + maven { url 'https://maven.aliyun.com/repository/central' } + maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } + maven { url 'https://maven.aliyun.com/repository/public' } + gradlePluginPortal() + google() + } +} + +rootProject.name = "Union" +include ':app' +include ':base' +include ':utils' +include ':network' diff --git a/utils/.gitignore b/utils/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/utils/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/utils/build.gradle b/utils/build.gradle new file mode 100644 index 0000000..eae1683 --- /dev/null +++ b/utils/build.gradle @@ -0,0 +1,33 @@ +plugins { + alias(libs.plugins.androidLibrary) +} + +android { + namespace 'com.police.utils' + compileSdk 34 + + defaultConfig { + minSdk 24 + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation libs.appcompat + implementation libs.material + implementation project(':base') +} \ No newline at end of file diff --git a/utils/src/main/AndroidManifest.xml b/utils/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/utils/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/utils/src/main/java/com/police/utils/UiUtils.java b/utils/src/main/java/com/police/utils/UiUtils.java new file mode 100644 index 0000000..10c23c5 --- /dev/null +++ b/utils/src/main/java/com/police/utils/UiUtils.java @@ -0,0 +1,110 @@ +package com.police.utils; + +import android.content.Context; +import android.net.Uri; +import android.util.Base64; +import android.widget.Toast; + + +import com.police.base.App; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.UUID; + +public class UiUtils { + /** + * 将dp值转换为px值,保证尺寸大小不变 + * + * @param dpValue dp值 + * @return 转换后的px值 + */ + public static int dp2Px(int dpValue) { + final float scale = App.getApp().getResources().getDisplayMetrics().density; + return Math.round((float) dpValue * scale); + } + + public static String uuid() { + return UUID.randomUUID().toString(); + } + + public static void toast(String str) { + App.getHandler().post(() -> Toast.makeText(App.getApp(), str, Toast.LENGTH_LONG).show()); + } + + public static boolean isEmpty(String str) { + if (str == null) { + return true; + } + return str.isEmpty(); + } + + public static boolean isNotEmpty(String str) { + if (str == null) { + return false; + } + return !str.isEmpty(); + } + + public static void ui() { + App.getHandler().post(new Runnable() { + @Override + public void run() { + + } + }); + } + + + public static byte[] base64ToBytes(String base64Str) { + return Base64.decode(base64Str, Base64.DEFAULT); + } + + public static String formatTime(String str) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + if (UiUtils.isEmpty(str)) return ""; + if (str.contains("-")) { + return str; + } + if (str.length() == 8) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(str.substring(0, 4)).append("-" + str.substring(4, 6)).append("-" + str.substring(6, 8)); + return stringBuilder.toString(); + } + if (str.length() > 8) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(str.substring(0, 4)) + .append("-" + str.substring(4, 6)) + .append("-" + str.substring(6, 8)) + .append(" " + str.substring(8, 10)) + .append(":" + str.substring(10, 12)); + return stringBuilder.toString(); + } + } + return ""; + } + + public static String uriToBase64(Context context, Uri uri) { + String base64 = null; + try (InputStream inputStream = context.getContentResolver().openInputStream(uri); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) { + + // 读取输入流的内容到字节数组输出流 + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = inputStream.read(buffer)) != -1) { + byteArrayOutputStream.write(buffer, 0, bytesRead); + } + + // 将字节数组转换为Base64编码的字符串 + byte[] byteArray = byteArrayOutputStream.toByteArray(); + base64 = Base64.encodeToString(byteArray, Base64.DEFAULT); + + } catch (IOException e) { + e.printStackTrace(); + } + + return base64; + } +}