commit 0187e23edea15df41bb3f1cdba876a9ce1138c08 Author: lianlilong <409813353@qq.com> Date: Fri Apr 5 21:53:51 2024 +0800 第一次提交 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..dc5ca96 --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,2 @@ +/build +/release/ diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..3a70d2d --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,75 @@ +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} + +android { + namespace 'com.police.policedatasystem' + compileSdk 33 + viewBinding { + enabled = true + } + defaultConfig { + applicationId "com.police.policedatasystem" + minSdk 24 + targetSdk 33 + versionCode 10019 + versionName "1.0.19" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary true + } + } + + applicationVariants.configureEach { variant -> + variant.outputs.configureEach { + outputFileName = "app_release${variant.versionName}.apk" + } + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + buildFeatures { + compose true + viewBinding true + } + composeOptions { + kotlinCompilerExtensionVersion '1.4.3' + } + packaging { + resources { + excludes += '/META-INF/{AL2.0,LGPL2.1}' + } + } +} + +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' +} \ 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..f4e4383 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/police/policedatasystem/MyApplication.java b/app/src/main/java/com/police/policedatasystem/MyApplication.java new file mode 100644 index 0000000..9c10173 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/MyApplication.java @@ -0,0 +1,26 @@ +package com.police.policedatasystem; + +import android.app.Application; +import android.os.Handler; + + +public class MyApplication extends Application { + private static MyApplication instance; + private static Handler handler; + + + public static MyApplication getInstance() { + return instance; + } + + @Override + public void onCreate() { + super.onCreate(); + handler = new Handler(); + instance = this; + } + + public static Handler getHandler() { + return handler; + } +} diff --git a/app/src/main/java/com/police/policedatasystem/activity/KeyPersonDetailActivity.java b/app/src/main/java/com/police/policedatasystem/activity/KeyPersonDetailActivity.java new file mode 100644 index 0000000..118fc85 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/activity/KeyPersonDetailActivity.java @@ -0,0 +1,173 @@ +package com.police.policedatasystem.activity; + +import android.app.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.policedatasystem.databinding.ActivityKeyPersonDetailBinding; +import com.police.policedatasystem.model.KeyPersonDetail; +import com.police.policedatasystem.util.Constants; +import com.police.policedatasystem.util.UiUtils; + +public class KeyPersonDetailActivity extends Activity { + 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/policedatasystem/activity/PoliceEmergencyDetailActivity.java b/app/src/main/java/com/police/policedatasystem/activity/PoliceEmergencyDetailActivity.java new file mode 100644 index 0000000..1b753c6 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/activity/PoliceEmergencyDetailActivity.java @@ -0,0 +1,71 @@ +package com.police.policedatasystem.activity; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.widget.TextView; + +import com.bumptech.glide.Glide; +import com.google.gson.Gson; +import com.police.policedatasystem.MyApplication; +import com.police.policedatasystem.databinding.ActivityPoliceEmergencyDetailBinding; +import com.police.policedatasystem.model.PoliceEmergencyDetail; +import com.police.policedatasystem.util.Constants; +import com.police.policedatasystem.util.UiUtils; + +/** + * 警情详情页面 + */ +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(MyApplication.getInstance()).asBitmap().load(detail.getZp()).into(binding.ivZp); + } + setText(binding.tvJcjbh, detail.getJcjbh());//报警编号 + setText(binding.tvBjjyqk, detail.getBjjyqk());//报警内容 + setText(binding.tvBjrlxdh, detail.getBjrlxdh());//报警电话 + setText(binding.tvJjsj, UiUtils.formatTime(detail.getJjsj()));//报警时间 + setText(binding.tvAsjfsdddzmc, detail.getAsjfsdddzmc());//报警位置 + setText(binding.tvCjdwgajgjgdm, detail.getCjdwgajgjgdm());//出警单位 + setText(binding.tvCjrxm, detail.getCjrxm());//出警民警 + setText(binding.tvBq, detail.getBq());//标签 + setText(binding.tvJg, detail.getJg());//籍贯 + setText(binding.tvXm, detail.getXm());//姓名 + setText(binding.tvXb, detail.getXb());//性别 + setText(binding.tvMz, detail.getMz());//民族 + setText(binding.tvHyzk, detail.getHyzk());//婚姻状况 + setText(binding.tvSfzh, detail.getBjrzjhm());//身份证号 + setText(binding.tvNl, detail.getNl());//年龄 + setText(binding.tvFwcs, detail.getFwcs());//服务场所 + setText(binding.tvLsbjcs, detail.getLsbjcs());//历史报警次数 + setText(binding.tvJqlb, detail.getJqlb());//警情类别 + setText(binding.tvCllb, detail.getCllx());//处理类型 + setText(binding.tvCljg, detail.getCljg());//处理结果 + } + + 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/policedatasystem/activity/RotatedTextView.java b/app/src/main/java/com/police/policedatasystem/activity/RotatedTextView.java new file mode 100644 index 0000000..fa22b86 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/activity/RotatedTextView.java @@ -0,0 +1,43 @@ +package com.police.policedatasystem.activity; + +import android.content.Context; +import android.graphics.Canvas; +import android.util.AttributeSet; +import android.widget.TextView; + +public class RotatedTextView extends TextView { + + private float rotationAngle=300; // 旋转角度 + + public RotatedTextView(Context context) { + super(context); + } + + public RotatedTextView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public RotatedTextView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + // 设置旋转角度 + public void setRotationAngle(float angle) { + this.rotationAngle = angle; + invalidate(); // 重新绘制 + } + + @Override + protected void onDraw(Canvas canvas) { + int width = getWidth(); + int height = getHeight(); + int centerX = width / 10; + int centerY = height / 3; + + canvas.save(); // 保存当前画布状态 + canvas.translate(centerX, centerY); // 将坐标原点移动到中心点 + canvas.rotate(rotationAngle, centerX, centerY); // 旋转画布 + super.onDraw(canvas); // 绘制原始的TextView + canvas.restore(); // 恢复画布状态 + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/policedatasystem/adapter/KeyPersonAdapter.java b/app/src/main/java/com/police/policedatasystem/adapter/KeyPersonAdapter.java new file mode 100644 index 0000000..1541678 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/adapter/KeyPersonAdapter.java @@ -0,0 +1,35 @@ +package com.police.policedatasystem.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.policedatasystem.MyApplication; +import com.police.policedatasystem.R; +import com.police.policedatasystem.model.KeyPerson; +import com.police.policedatasystem.util.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(MyApplication.getInstance()) + .asBitmap() + .load(item.getZp()) + .into((ImageView) helper.getView(R.id.iv_photo)); + } else { + helper.setImageResource(R.id.iv_photo, R.drawable.photo); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/policedatasystem/adapter/PoliceEmergencyAdapter.java b/app/src/main/java/com/police/policedatasystem/adapter/PoliceEmergencyAdapter.java new file mode 100644 index 0000000..261b4ff --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/adapter/PoliceEmergencyAdapter.java @@ -0,0 +1,23 @@ +package com.police.policedatasystem.adapter; + +import com.chad.library.adapter.base.BaseQuickAdapter; +import com.chad.library.adapter.base.viewholder.BaseViewHolder; +import com.police.policedatasystem.R; +import com.police.policedatasystem.model.PoliceEmergency; +import com.police.policedatasystem.util.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/policedatasystem/fragment/ApplyFragment.java b/app/src/main/java/com/police/policedatasystem/fragment/ApplyFragment.java new file mode 100644 index 0000000..a97ea94 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/fragment/ApplyFragment.java @@ -0,0 +1,99 @@ +package com.police.policedatasystem.fragment; + +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.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.PopupWindow; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import com.police.policedatasystem.R; +import com.police.policedatasystem.databinding.FragmentApplyBinding; + +public class ApplyFragment extends Fragment { + private FragmentApplyBinding binding; + private PopupWindow popupWindow; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + binding = FragmentApplyBinding.inflate(inflater); + initView(); + return binding.getRoot(); + } + + private void initView() { + setPopupWindow(); + binding.typeGroup.setOnClickListener(view -> { + popupWindow.setWidth(binding.typeGroup.getWidth()); + popupWindow.showAsDropDown(binding.typeGroup); + }); + } + + private void setPopupWindow() { + // 初始化 PopupWindow + popupWindow = new PopupWindow(getContext()); + // 加载自定义布局 + LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View contentView = inflater.inflate(R.layout.dropdown_layout4, null); + // 设置 PopupWindow 的宽高 + popupWindow.setWidth(LinearLayout.LayoutParams.MATCH_PARENT); + popupWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.all_7_fff_bg)); + 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 + TextView textView3 = contentView.findViewById(R.id.textView3); // 假设这是菜单项2的ID + TextView textView4 = contentView.findViewById(R.id.textView4); // 假设这是菜单项2的ID + TextView textView5 = contentView.findViewById(R.id.textView5); // 假设这是菜单项2的ID + TextView textView6 = contentView.findViewById(R.id.textView6); // 假设这是菜单项2的ID + textView1.setOnClickListener(v -> { + // 处理菜单项 1 的点击事件 + binding.tvApplySearchTitle.setText("处置警情"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + textView2.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvApplySearchTitle.setText("处置案情"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + textView3.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvApplySearchTitle.setText("管控重点人"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + textView4.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvApplySearchTitle.setText("追踪逃犯"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + textView5.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvApplySearchTitle.setText("核查线索"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + textView6.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvApplySearchTitle.setText("核验信息"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + // 将自定义布局设置为 PopupWindow 的内容视图 + popupWindow.setContentView(contentView); + // 设置 PopupWindow 的焦点 + popupWindow.setFocusable(true); + popupWindow.setOutsideTouchable(true); // 设置点击 PopupWindow 外部区域使其消失 + } + +} diff --git a/app/src/main/java/com/police/policedatasystem/fragment/DataFragment.java b/app/src/main/java/com/police/policedatasystem/fragment/DataFragment.java new file mode 100644 index 0000000..183105c --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/fragment/DataFragment.java @@ -0,0 +1,415 @@ +package com.police.policedatasystem.fragment; + +import android.app.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.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.PopupWindow; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.chad.library.adapter.base.BaseQuickAdapter; +import com.police.policedatasystem.R; +import com.police.policedatasystem.adapter.KeyPersonAdapter; +import com.police.policedatasystem.adapter.PoliceEmergencyAdapter; +import com.police.policedatasystem.databinding.FragmentDataBinding; +import com.police.policedatasystem.indexActivity; +import com.police.policedatasystem.model.KeyPerson; +import com.police.policedatasystem.model.PoliceEmergency; +import com.police.policedatasystem.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 DataFragment extends Fragment { + public FragmentDataBinding 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; + indexActivity act; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + binding = FragmentDataBinding.inflate(inflater); + initView(); + Activity activity = getActivity(); + if (activity instanceof indexActivity) { + act = (indexActivity) activity; + } + viewModel = new DataViewModel(this, act); + initListener(); + return binding.getRoot(); + } + + private void initView() { + binding.refreshLayout.setRefreshHeader(new ClassicsHeader(getContext())); + binding.refreshLayout.setRefreshFooter(new ClassicsFooter(getContext())); + binding.rvGroup.setLayoutManager(new LinearLayoutManager(getContext())); + keyPersonInitAdapter(); + setPopupWindow(); + setPopupWindow2(); + setPopupWindow3(); + } + + public void initData() { + viewModel.keyPersonInit(); + viewModel.getKeyPersonMessageCount(); + } + + @Override + public void onResume() { + super.onResume(); + if (!act.findAddress) { + act.requestClient.init(); + } else { + initData(); + } + } + + 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 (!act.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 (!act.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(R.color.color_666)); + binding.selectAreaKeyPerson.setBackgroundColor(getResources().getColor(R.color.transparent_color)); + binding.tvMyKeyPerson.setTextColor(getResources().getColor(R.color.color_666)); + binding.selectMyKeyPerson.setBackgroundColor(getResources().getColor(R.color.transparent_color)); + if (i == 1) { + binding.tvMyKeyPerson.setTextColor(getResources().getColor(R.color.selected_color)); + binding.selectMyKeyPerson.setBackgroundColor(getResources().getColor(R.color.selected_color)); + } else { + binding.tvAreaKeyPerson.setTextColor(getResources().getColor(R.color.selected_color)); + binding.selectAreaKeyPerson.setBackgroundColor(getResources().getColor(R.color.selected_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(R.drawable.mine_icon); + binding.tvKeyPerson.setTextColor(getResources().getColor(R.color.black)); + binding.selectKeyPerson.setBackgroundColor(getResources().getColor(R.color.white)); + binding.iconPoliceEmergency.setBackgroundResource(R.drawable.huizhang_icon); + binding.tvPoliceEmergency.setTextColor(getResources().getColor(R.color.black)); + binding.selectPoliceEmergency.setBackgroundColor(getResources().getColor(R.color.white)); + binding.iconCaseDetails.setBackgroundResource(R.drawable.wenjianjia_icon); + binding.tvCaseDetails.setTextColor(getResources().getColor(R.color.black)); + binding.selectCaseDetails.setBackgroundColor(getResources().getColor(R.color.white)); + filterType = 0; + switch (i) { + case 1: + binding.iconKeyPerson.setBackgroundResource(R.drawable.mine_normal); + binding.tvKeyPerson.setTextColor(getResources().getColor(R.color.selected_color)); + binding.selectKeyPerson.setBackgroundColor(getResources().getColor(R.color.selected_color)); + 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.iconPoliceEmergency.setBackgroundResource(R.drawable.huizhang); + binding.tvPoliceEmergency.setTextColor(getResources().getColor(R.color.selected_color)); + binding.selectPoliceEmergency.setBackgroundColor(getResources().getColor(R.color.selected_color)); + binding.tvSearchTitle.setText("警情编号"); + policeEmergencyInitAdapter(); + viewModel.policeEmergencyInit(); + binding.tabGroup.setVisibility(View.GONE); + break; + default: + binding.iconCaseDetails.setBackgroundResource(R.drawable.wenjianjia); + binding.tvCaseDetails.setTextColor(getResources().getColor(R.color.selected_color)); + binding.selectCaseDetails.setBackgroundColor(getResources().getColor(R.color.selected_color)); + 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(getContext())); + binding.rvGroup.setAdapter(adapter); + adapter.setOnItemClickListener((adapter1, view, position) -> { + viewModel.keyPersonDetail(data.get(position).getSfzh()); + }); + } + + public void loadingShow() { + getActivity().runOnUiThread(() -> binding.rlLoading.setVisibility(View.VISIBLE)); + + } + + public void loadingNone() { + getActivity().runOnUiThread(() -> binding.rlLoading.setVisibility(View.GONE)); + } + + private void setPopupWindow() { + // 初始化 PopupWindow + popupWindow = new PopupWindow(getContext()); + // 加载自定义布局 + LayoutInflater inflater = (LayoutInflater) getActivity().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(getContext()); + // 加载自定义布局 + LayoutInflater inflater2 = (LayoutInflater) getActivity().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(getContext()); + // 加载自定义布局 + LayoutInflater inflater2 = (LayoutInflater) getActivity().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 外部区域使其消失 + } +} diff --git a/app/src/main/java/com/police/policedatasystem/fragment/MineFragment.java b/app/src/main/java/com/police/policedatasystem/fragment/MineFragment.java new file mode 100644 index 0000000..92eff44 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/fragment/MineFragment.java @@ -0,0 +1,91 @@ +package com.police.policedatasystem.fragment; + +import android.content.Context; +import android.os.Bundle; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.PopupWindow; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +import com.police.policedatasystem.R; +import com.police.policedatasystem.databinding.FragmentMineBinding; + +public class MineFragment extends Fragment { + private FragmentMineBinding binding; + private PopupWindow popupWindow; + + @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() { + setPopupWindow(); + binding.mineTypeGroup.setOnClickListener(view -> { + popupWindow.setWidth(binding.mineTypeGroup.getWidth()); + popupWindow.showAsDropDown(binding.mineTypeGroup); + }); + } + + private void setPopupWindow() { + // 初始化 PopupWindow + popupWindow = new PopupWindow(getContext()); + // 加载自定义布局 + LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View contentView = inflater.inflate(R.layout.dropdown_layout5, null); + // 设置 PopupWindow 的宽高 + popupWindow.setWidth(LinearLayout.LayoutParams.MATCH_PARENT); + popupWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.all_7_fff_bg)); + popupWindow.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT); + // 设置 PopupWindow 的背景 +// popupWindow.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); + // 设置 PopupWindow 显示的位置(相对于按钮) + popupWindow.showAtLocation(binding.mineTypeGroup, Gravity.NO_GRAVITY, 0, 0); + // 为每个菜单项设置点击事件 + TextView textView1 = contentView.findViewById(R.id.textView1); // 假设这是菜单项1的ID + TextView textView2 = contentView.findViewById(R.id.textView2); // 假设这是菜单项2的ID + TextView textView3 = contentView.findViewById(R.id.textView3); // 假设这是菜单项2的ID + TextView textView4 = contentView.findViewById(R.id.textView4); // 假设这是菜单项2的ID + TextView textView5 = contentView.findViewById(R.id.textView5); // 假设这是菜单项2的ID + textView1.setOnClickListener(v -> { + // 处理菜单项 1 的点击事件 + binding.tvMineSearchTitle.setText("赋能编码"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + textView2.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvMineSearchTitle.setText("申请事由"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + textView3.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvMineSearchTitle.setText("申请时间"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + textView4.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvMineSearchTitle.setText("信息来源"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + textView5.setOnClickListener(v -> { + // 处理菜单项 2 的点击事件 + binding.tvMineSearchTitle.setText("办理状态"); + popupWindow.dismiss(); // 关闭 PopupWindow + }); + // 将自定义布局设置为 PopupWindow 的内容视图 + popupWindow.setContentView(contentView); + // 设置 PopupWindow 的焦点 + popupWindow.setFocusable(true); + popupWindow.setOutsideTouchable(true); // 设置点击 PopupWindow 外部区域使其消失 + } +} diff --git a/app/src/main/java/com/police/policedatasystem/http/CustomCallBack.java b/app/src/main/java/com/police/policedatasystem/http/CustomCallBack.java new file mode 100644 index 0000000..8235faf --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/http/CustomCallBack.java @@ -0,0 +1,40 @@ +package com.police.policedatasystem.http; + +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); + +// @Override +// public void onFailure(@NonNull Call call, @NonNull IOException e) { +// onError(call, e); +// } +// +// @Override +// public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException { +// if (!response.isSuccessful()) { +// onError(call, new IOException("Unexpected code " + response)); +// return; +// } +// try { +// ResponseParams responseParams = new Gson().fromJson(response.body().string(), ResponseParams.class); +// if ("200".equals(responseParams.getCode())) { +// for (ResponseParams.FieldData item : responseParams.getData().getDataList()) { +// for (ResponseParams.FieldValues i : item.getFieldValues()) { +//// new Gson().fromJson() +//// onSuccess(i.getValue()); +// } +// } +// } else { +// onError(call, new IOException(responseParams.getMessage())); +// } +// } catch (Exception e) { +// onError(call, new IOException("Unexpected code " + response)); +// } +// } + +} diff --git a/app/src/main/java/com/police/policedatasystem/http/RequestClient.java b/app/src/main/java/com/police/policedatasystem/http/RequestClient.java new file mode 100644 index 0000000..d9525b5 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/http/RequestClient.java @@ -0,0 +1,593 @@ +package com.police.policedatasystem.http; + +import static com.police.policedatasystem.util.UaCredentialApi.PARAMS_KEY_UA_APP_CREDENTIAL; +import static com.police.policedatasystem.util.UaCredentialApi.PARAMS_KEY_UA_RET_CODE; +import static com.police.policedatasystem.util.UaCredentialApi.PARAMS_KEY_UA_RET_SUCCESS; +import static com.police.policedatasystem.util.UaCredentialApi.PARAMS_KEY_UA_USER_CREDENTIAL; + +import android.net.Uri; +import android.os.Bundle; + +import androidx.annotation.NonNull; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.police.policedatasystem.MyApplication; +import com.police.policedatasystem.http.requestparams.GetKeyPersonDetailParams; +import com.police.policedatasystem.http.requestparams.GetKeyPersonListParams; +import com.police.policedatasystem.http.requestparams.GetKeyPersonMessageCountParams; +import com.police.policedatasystem.http.requestparams.GetOrgKeyPersonListParams; +import com.police.policedatasystem.http.requestparams.GetPoliceEmergencyDetailParams; +import com.police.policedatasystem.http.requestparams.GetPoliceEmergencyListParams; +import com.police.policedatasystem.http.requestparams.RequestParams; +import com.police.policedatasystem.http.requestparams.ResponseParams; +import com.police.policedatasystem.indexActivity; +import com.police.policedatasystem.model.DataCount; +import com.police.policedatasystem.model.KeyPerson; +import com.police.policedatasystem.model.KeyPersonDetail; +import com.police.policedatasystem.model.PoliceEmergency; +import com.police.policedatasystem.model.PoliceEmergencyDetail; +import com.police.policedatasystem.model.ResourceList; +import com.police.policedatasystem.model.UserCredential; +import com.police.policedatasystem.util.Constants; +import com.police.policedatasystem.util.UiUtils; + +import java.io.IOException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; +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 RequestClient { + private final indexActivity activity; + private OkHttpClient okHttpClient; + + public RequestClient(indexActivity activity) { + this.activity = activity; + } + + /* + + */ + 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) { + e.printStackTrace(); + } + + } + + public void init() { + 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 = UiUtils.uuid(); + //构建参数 + 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 = MyApplication.getInstance().getContentResolver().call(uri, "", null, params); + //解析结果 + if (bundle == null) { + UiUtils.toast("获取应用凭证失败,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.USER_ID = new Gson().fromJson(Constants.USER_CREDENTIAL, UserCredential.class).getCredential().getLoad().getUserInfo().getJh(); + Constants.SFZH = new Gson().fromJson(Constants.USER_CREDENTIAL, UserCredential.class).getCredential().getLoad().getUserInfo().getSfzh(); + Constants.USER_ORG_ID = new Gson().fromJson(Constants.USER_CREDENTIAL, UserCredential.class).getCredential().getLoad().getUserInfo().getOrgId(); + //根据票据寻址 + findAddress(); + } else { + UiUtils.toast(bundle.getString("message") + ",resultCode:" + resultCode); + } + } else { + UiUtils.toast("获取应用凭证失败,messageId不一致!"); + } + } + + //第二步,寻址 + private void findAddress() { + Thread thread = new Thread(() -> { + // 在这里执行耗时任务 + Uri uri = Uri.parse("content://com.ydjw.rsb.getResourceAddress"); + Bundle bundle = new Bundle(); + String paramsMessageId = UiUtils.uuid(); + bundle.putString("appCredential", Constants.APP_CREDENTIAL);//应用凭证,由上一步获得 + bundle.putString("userCredential", Constants.USER_CREDENTIAL);//用户凭证,由上一步获得 + bundle.putString("version", "1");//服务总线接口版本号,当前为1 + bundle.putString("messageId", paramsMessageId);//消息 ID + Bundle callBack = MyApplication.getInstance().getContentResolver().call(uri, "", null, bundle); + if (callBack == null) { + UiUtils.toast("获取应用资源地址失败,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 (UiUtils.isEmpty(resourceList)) { + UiUtils.toast("寻址失败,resourceList为空!"); + return; + } + List resourceLists = new Gson().fromJson(resourceList, new TypeToken>() { + }.getType()); + for (ResourceList item : resourceLists) { + Constants.resourceListsMap.put(item.getResourceId(), item); + } + //2.发起请求,获取重点人数据 + activity.initData(); + } else { + if (UiUtils.isEmpty(resourceList)) { + UiUtils.toast("寻址失败,错误码:" + resultCode); + } + } + } + }); + thread.start(); + } + + /** + * 获取重点人 + * + * @param params 参数对象 + * @param callback 回调函数 + */ + public void getKeyPerson(GetKeyPersonListParams params, CustomCallBack> callback) { + ResourceList resourceList = Constants.resourceListsMap.get(Constants.KEY_PERSON_ID); + RequestParams.Condition condition = new RequestParams.Condition(); + condition.setLogicalOperate("and"); + RequestParams.KeyValues keyValues = new RequestParams.KeyValues(); + keyValues.setKey("injson"); + params.setJybh(Constants.USER_ID); + params.setSfhm(Constants.SFZH); + params.setPageSize(Constants.PAGE_SIZE + ""); + keyValues.setValue(new Gson().toJson(params)); + 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(Constants.KEY_PERSON_ID); + RequestParams requestParams = new RequestParams(); + requestParams.setMessageId(UiUtils.uuid()); + requestParams.setVersion("1.0"); + requestParams.setParameter(parameter); + if (resourceList == null) return; + call(resourceList.getResourceAddress(), requestParams, new Callback() { + @Override + public void onFailure(@NonNull Call call, @NonNull IOException e) { + activity.runOnUiThread(() -> callback.onError(call, e)); + // 请求失败 + e.printStackTrace(); + } + + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + try { + // 请求成功,处理响应数据 + String responseBody = response.body().string(); + activity.runOnUiThread(() -> { + if (!response.isSuccessful()) { + callback.onError(call, new IOException("Unexpected code " + response)); + return; + } + ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class); + if ("200".equals(responseParams.getCode())) { + for (ResponseParams.FieldData item : responseParams.getData().getDataList()) { + for (ResponseParams.FieldValues i : item.getFieldValues()) { + List keyPersonList = new Gson().fromJson(i.getValue(), new TypeToken>() { + }.getType()); + callback.onSuccess(keyPersonList); + } + } + } else { + callback.onError(call, new IOException(responseParams.getMessage())); + } + }); + } catch (Exception e) { + callback.onError(call, e); + e.printStackTrace(); + } + } + }); + } + + /** + * 获取组织重点人数据 + * + * @param params 搜索关键字姓名 + * @param callBack 回调函数 + */ + public void getOrgKeyPerson(GetOrgKeyPersonListParams params, CustomCallBack> callBack) { + ResourceList resourceList = Constants.resourceListsMap.get(Constants.ORG_KEY_PERSON_ID); + RequestParams.Condition condition = new RequestParams.Condition(); + condition.setLogicalOperate("and"); + RequestParams.KeyValues keyValues = new RequestParams.KeyValues(); + keyValues.setKey("injson"); + params.setSfhm(Constants.SFZH); + params.setDept(Constants.USER_ORG_ID); + params.setPageSize(Constants.PAGE_SIZE + ""); + keyValues.setValue(new Gson().toJson(params)); + 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(Constants.ORG_KEY_PERSON_ID); + RequestParams requestParams = new RequestParams(); + requestParams.setMessageId(UiUtils.uuid()); + requestParams.setVersion("1.0"); + requestParams.setParameter(parameter); + if (resourceList == null) { + callBack.onError(null, new Exception("寻址数据为空")); + return; + } + + call(resourceList.getResourceAddress(), requestParams, new Callback() { + @Override + public void onFailure(@NonNull Call call, @NonNull IOException e) { + activity.runOnUiThread(() -> callBack.onError(call, e)); + // 请求失败 + e.printStackTrace(); + } + + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + if (!response.isSuccessful()) { + activity.runOnUiThread(() -> callBack.onError(call, new IOException("Unexpected code " + response))); + return; + } + try { + // 请求成功,处理响应数据 + String responseBody = response.body().string(); + activity.runOnUiThread(() -> { + ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class); + if ("200".equals(responseParams.getCode())) { + for (ResponseParams.FieldData item : responseParams.getData().getDataList()) { + for (ResponseParams.FieldValues i : item.getFieldValues()) { + List keyPersonList = new Gson().fromJson(i.getValue(), new TypeToken>() { + }.getType()); + callBack.onSuccess(keyPersonList); + } + } + } else { + callBack.onError(call, new Exception(responseParams.getMessage())); + } + }); + } catch (Exception e) { + activity.runOnUiThread(() -> callBack.onError(call, e)); + e.printStackTrace(); + } + + } + }); + } + + + /** + * 获取重点人详情数据 + * + * @param str 身份证号 + */ + public void keyPersonDetail(String str, CustomCallBack callBack) { + ResourceList resourceList = Constants.resourceListsMap.get(Constants.KEY_PERSON_DETAIL_ID); + RequestParams.Condition condition = new RequestParams.Condition(); + condition.setLogicalOperate("and"); + RequestParams.KeyValues keyValues = new RequestParams.KeyValues(); + keyValues.setKey("injson"); + GetKeyPersonDetailParams params = new GetKeyPersonDetailParams(); + params.setSfzh(str);// params.setSfzh("220104197307276911"); + params.setSfhm(Constants.SFZH); + keyValues.setValue(new Gson().toJson(params)); + 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(Constants.KEY_PERSON_DETAIL_ID); + RequestParams requestParams = new RequestParams(); + requestParams.setMessageId(UiUtils.uuid()); + requestParams.setVersion("1.0"); + requestParams.setParameter(parameter); + call(resourceList.getResourceAddress(), requestParams, new Callback() { + @Override + public void onFailure(@NonNull Call call, @NonNull IOException e) { + // 请求失败 + e.printStackTrace(); + activity.runOnUiThread(() -> callBack.onError(call, e)); + } + + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + if (!response.isSuccessful()) { + activity.runOnUiThread(() -> callBack.onError(call, new IOException("Unexpected code " + response))); + return; + } + try { + // 请求成功,处理响应数据 + String responseBody = response.body().string(); + ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class); + if (!"200".equals(responseParams.getCode())) { + activity.runOnUiThread(() -> callBack.onError(call, new Exception("服务器异常,请联系开发人员或稍后重试!"))); + return; + } + for (ResponseParams.FieldData item : responseParams.getData().getDataList()) { + for (ResponseParams.FieldValues i : item.getFieldValues()) { + KeyPersonDetail keyPersonDetail = new Gson().fromJson(i.getValue(), KeyPersonDetail.class); + activity.runOnUiThread(() -> callBack.onSuccess(keyPersonDetail)); + } + } + } catch (Exception e) { + e.printStackTrace(); + activity.runOnUiThread(() -> callBack.onError(call, e)); + } + } + }); + } + + /** + * 获取警情列表数据 + * + * @param params 参数 + * @param callBack 回调函数 + */ + public void getPoliceEmergency(GetPoliceEmergencyListParams params, CustomCallBack> callBack) { + ResourceList resourceList = Constants.resourceListsMap.get(Constants.POLICE_EMERGENCY_ID); + RequestParams.Condition condition = new RequestParams.Condition(); + condition.setLogicalOperate("and"); + RequestParams.KeyValues keyValues = new RequestParams.KeyValues(); + keyValues.setKey("injson"); + params.setSfhm(Constants.SFZH); +// params.setSfhm("220104198105200331"); + params.setPageSize(Constants.PAGE_SIZE + ""); + keyValues.setValue(new Gson().toJson(params)); + 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(Constants.POLICE_EMERGENCY_ID); + RequestParams requestParams = new RequestParams(); + requestParams.setMessageId(UiUtils.uuid()); + requestParams.setVersion("1.0"); + requestParams.setParameter(parameter); + if (resourceList == null) { + callBack.onError(null, new Exception("寻址数据为空")); + return; + } + + call(resourceList.getResourceAddress(), requestParams, new Callback() { + @Override + public void onFailure(@NonNull Call call, @NonNull IOException e) { + activity.runOnUiThread(() -> callBack.onError(call, e)); + // 请求失败 + e.printStackTrace(); + } + + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + if (!response.isSuccessful()) { + activity.runOnUiThread(() -> callBack.onError(call, new IOException("Unexpected code " + response))); + return; + } + try { + // 请求成功,处理响应数据 + String responseBody = response.body().string(); + activity.runOnUiThread(() -> { + ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class); + if ("200".equals(responseParams.getCode())) { + for (ResponseParams.FieldData item : responseParams.getData().getDataList()) { + for (ResponseParams.FieldValues i : item.getFieldValues()) { + List keyPersonList = new Gson().fromJson(i.getValue(), new TypeToken>() { + }.getType()); + callBack.onSuccess(keyPersonList); + } + } + } else { + callBack.onError(call, new Exception(responseParams.getMessage())); + } + }); + } catch (Exception e) { + activity.runOnUiThread(() -> callBack.onError(call, e)); + e.printStackTrace(); + } + + } + }); + } + + + /** + * 获取重点人详情数据 + * + * @param str 身份证号 + */ + public void getPoliceEmergencyDetail(String str, CustomCallBack callBack) { + ResourceList resourceList = Constants.resourceListsMap.get(Constants.POLICE_EMERGENCY_DETAIL_ID); + RequestParams.Condition condition = new RequestParams.Condition(); + condition.setLogicalOperate("and"); + RequestParams.KeyValues keyValues = new RequestParams.KeyValues(); + keyValues.setKey("injson"); + GetPoliceEmergencyDetailParams params = new GetPoliceEmergencyDetailParams(); + params.setJcjbh(str);// params.setSfzh("220104197307276911"); + params.setSfhm(Constants.SFZH); + keyValues.setValue(new Gson().toJson(params)); + 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(Constants.POLICE_EMERGENCY_DETAIL_ID); + RequestParams requestParams = new RequestParams(); + requestParams.setMessageId(UiUtils.uuid()); + requestParams.setVersion("1.0"); + requestParams.setParameter(parameter); + call(resourceList.getResourceAddress(), requestParams, new Callback() { + @Override + public void onFailure(@NonNull Call call, @NonNull IOException e) { + // 请求失败 + e.printStackTrace(); + activity.runOnUiThread(() -> callBack.onError(call, e)); + } + + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + if (!response.isSuccessful()) { + activity.runOnUiThread(() -> callBack.onError(call, new IOException("Unexpected code " + response))); + return; + } + try { + // 请求成功,处理响应数据 + String responseBody = response.body().string(); + ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class); + if (!"200".equals(responseParams.getCode())) { + activity.runOnUiThread(() -> callBack.onError(call, new Exception("服务器异常,请联系开发人员或稍后重试!"))); + return; + } + for (ResponseParams.FieldData item : responseParams.getData().getDataList()) { + for (ResponseParams.FieldValues i : item.getFieldValues()) { + PoliceEmergencyDetail keyPersonDetail = new Gson().fromJson(i.getValue(), PoliceEmergencyDetail.class); + activity.runOnUiThread(() -> callBack.onSuccess(keyPersonDetail)); + } + } + } catch (Exception e) { + e.printStackTrace(); + activity.runOnUiThread(() -> callBack.onError(call, e)); + } + } + }); + } + + /** + * 获取重点人数据统计 + */ + public void getKeyPersonMessageCount(CustomCallBack callBack) { + ResourceList resourceList = Constants.resourceListsMap.get(Constants.KEY_PERSON_MESSAGE_COUNT_ID); + RequestParams.Condition condition = new RequestParams.Condition(); + condition.setLogicalOperate("and"); + RequestParams.KeyValues keyValues = new RequestParams.KeyValues(); + keyValues.setKey("injson"); + GetKeyPersonMessageCountParams params = new GetKeyPersonMessageCountParams(); + params.setSfhm(Constants.SFZH); + params.setJybh(Constants.USER_ID); + params.setDept(Constants.USER_ORG_ID); +// params.setSfhm("220104198105200331"); +// params.setDept(Constants.USER_ORG_ID); +// params.setJybh("106222"); + keyValues.setValue(new Gson().toJson(params)); + 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(Constants.KEY_PERSON_MESSAGE_COUNT_ID); + RequestParams requestParams = new RequestParams(); + requestParams.setMessageId(UiUtils.uuid()); + requestParams.setVersion("1.0"); + requestParams.setParameter(parameter); + call(resourceList.getResourceAddress(), requestParams, new Callback() { + @Override + public void onFailure(@NonNull Call call, @NonNull IOException e) { + // 请求失败 + e.printStackTrace(); + activity.runOnUiThread(() -> callBack.onError(call, e)); + } + + @Override + public void onResponse(@NonNull Call call, @NonNull Response response) { + if (!response.isSuccessful()) { + activity.runOnUiThread(() -> callBack.onError(call, new IOException("Unexpected code " + response))); + return; + } + try { + // 请求成功,处理响应数据 + String responseBody = response.body().string(); + ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class); + if (!"200".equals(responseParams.getCode())) { + activity.runOnUiThread(() -> callBack.onError(call, new Exception("服务器异常,请联系开发人员或稍后重试!"))); + return; + } + for (ResponseParams.FieldData item : responseParams.getData().getDataList()) { + for (ResponseParams.FieldValues i : item.getFieldValues()) { + DataCount dataCount = new Gson().fromJson(i.getValue(), DataCount.class); + activity.runOnUiThread(() -> callBack.onSuccess(dataCount)); + } + } + } catch (Exception e) { + e.printStackTrace(); + activity.runOnUiThread(() -> callBack.onError(call, e)); + } + } + }); + } +} diff --git a/app/src/main/java/com/police/policedatasystem/http/requestparams/GetKeyPersonDetailParams.java b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetKeyPersonDetailParams.java new file mode 100644 index 0000000..a497e26 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetKeyPersonDetailParams.java @@ -0,0 +1,45 @@ +package com.police.policedatasystem.http.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/app/src/main/java/com/police/policedatasystem/http/requestparams/GetKeyPersonListParams.java b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetKeyPersonListParams.java new file mode 100644 index 0000000..3a6b256 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetKeyPersonListParams.java @@ -0,0 +1,89 @@ +package com.police.policedatasystem.http.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/app/src/main/java/com/police/policedatasystem/http/requestparams/GetKeyPersonMessageCountParams.java b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetKeyPersonMessageCountParams.java new file mode 100644 index 0000000..5bf90e3 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetKeyPersonMessageCountParams.java @@ -0,0 +1,80 @@ +package com.police.policedatasystem.http.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/app/src/main/java/com/police/policedatasystem/http/requestparams/GetOrgKeyPersonListParams.java b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetOrgKeyPersonListParams.java new file mode 100644 index 0000000..e2023e2 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetOrgKeyPersonListParams.java @@ -0,0 +1,81 @@ +package com.police.policedatasystem.http.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/app/src/main/java/com/police/policedatasystem/http/requestparams/GetPoliceEmergencyDetailParams.java b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetPoliceEmergencyDetailParams.java new file mode 100644 index 0000000..d198b23 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetPoliceEmergencyDetailParams.java @@ -0,0 +1,45 @@ +package com.police.policedatasystem.http.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/app/src/main/java/com/police/policedatasystem/http/requestparams/GetPoliceEmergencyListParams.java b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetPoliceEmergencyListParams.java new file mode 100644 index 0000000..a054da1 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/http/requestparams/GetPoliceEmergencyListParams.java @@ -0,0 +1,81 @@ +package com.police.policedatasystem.http.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/app/src/main/java/com/police/policedatasystem/http/requestparams/RequestParams.java b/app/src/main/java/com/police/policedatasystem/http/requestparams/RequestParams.java new file mode 100644 index 0000000..795ce3a --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/http/requestparams/RequestParams.java @@ -0,0 +1,156 @@ +package com.police.policedatasystem.http.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/app/src/main/java/com/police/policedatasystem/http/requestparams/ResponseParams.java b/app/src/main/java/com/police/policedatasystem/http/requestparams/ResponseParams.java new file mode 100644 index 0000000..8b525ac --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/http/requestparams/ResponseParams.java @@ -0,0 +1,96 @@ +package com.police.policedatasystem.http.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/app/src/main/java/com/police/policedatasystem/indexActivity.java b/app/src/main/java/com/police/policedatasystem/indexActivity.java new file mode 100644 index 0000000..bb11b57 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/indexActivity.java @@ -0,0 +1,132 @@ +package com.police.policedatasystem; + + +import static com.police.policedatasystem.util.UaCredentialApi.ACTION_SUFFIX_UA_LOGIN; +import static com.police.policedatasystem.util.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.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; + +import com.police.policedatasystem.databinding.ActivityIndexBinding; +import com.police.policedatasystem.fragment.ApplyFragment; +import com.police.policedatasystem.fragment.DataFragment; +import com.police.policedatasystem.fragment.MineFragment; +import com.police.policedatasystem.http.RequestClient; +import com.police.policedatasystem.util.Constants; +import com.police.policedatasystem.viewmodel.IndexViewModel; + +public class indexActivity extends AppCompatActivity { + public ActivityIndexBinding binding; + private IndexViewModel viewModel; + public RequestClient requestClient; + public boolean findAddress = false; + private DataFragment dataFragment; + private ApplyFragment applyFragment; + private MineFragment mineFragment; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivityIndexBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + initView(); + viewModel = new IndexViewModel(this); + requestClient = new RequestClient(this); + } + + private void initView() { + dataFragment = new DataFragment(); + applyFragment = new ApplyFragment(); + mineFragment = new MineFragment(); + binding.navBarGroup.navBar1.setOnClickListener(view -> { + replaceFragment(dataFragment); + binding.navBarGroup.navBarIcon1.setImageResource(R.mipmap.icon_data_selected); + binding.navBarGroup.navBarText1.setTextColor(getColor(R.color.selected_color)); + binding.navBarGroup.navBarIcon2.setImageResource(R.mipmap.icon_apply_normal); + binding.navBarGroup.navBarText2.setTextColor(getColor(R.color.normal_color)); + binding.navBarGroup.navBarIcon3.setImageResource(R.mipmap.icon_mine_normal); + binding.navBarGroup.navBarText3.setTextColor(getColor(R.color.normal_color)); + }); + binding.navBarGroup.navBar2.setOnClickListener(view -> { + replaceFragment(applyFragment); + binding.navBarGroup.navBarIcon1.setImageResource(R.mipmap.icon_data_normal); + binding.navBarGroup.navBarText1.setTextColor(getColor(R.color.normal_color)); + binding.navBarGroup.navBarIcon2.setImageResource(R.mipmap.icon_apply_selected); + binding.navBarGroup.navBarText2.setTextColor(getColor(R.color.selected_color)); + binding.navBarGroup.navBarIcon3.setImageResource(R.mipmap.icon_mine_normal); + binding.navBarGroup.navBarText3.setTextColor(getColor(R.color.normal_color)); + }); + binding.navBarGroup.navBar3.setOnClickListener(view -> { + replaceFragment(mineFragment); + binding.navBarGroup.navBarIcon1.setImageResource(R.mipmap.icon_data_normal); + binding.navBarGroup.navBarText1.setTextColor(getColor(R.color.normal_color)); + binding.navBarGroup.navBarIcon2.setImageResource(R.mipmap.icon_apply_normal); + binding.navBarGroup.navBarText2.setTextColor(getColor(R.color.normal_color)); + binding.navBarGroup.navBarIcon3.setImageResource(R.mipmap.icon_mine_selected); + binding.navBarGroup.navBarText3.setTextColor(getColor(R.color.selected_color)); + }); + replaceFragment(dataFragment); + registerBroadcastReceiver(); + } + + public void initData() { + //改变寻址状态,走到这里证明寻址成功了 + if (findAddress) return; + findAddress = true; + binding.wmWm.setTextSize(50); + binding.wmWm.setText(Constants.SFZH); + dataFragment.initData(); + } + + private void replaceFragment(Fragment newFragment) { + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + transaction.replace(R.id.fc_view, 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(indexActivity.this, indexActivity.class)); + finish(); + } + } + }; +} \ No newline at end of file diff --git a/app/src/main/java/com/police/policedatasystem/model/DataCount.java b/app/src/main/java/com/police/policedatasystem/model/DataCount.java new file mode 100644 index 0000000..b0a24ed --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/model/DataCount.java @@ -0,0 +1,49 @@ +package com.police.policedatasystem.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/policedatasystem/model/KeyPerson.java b/app/src/main/java/com/police/policedatasystem/model/KeyPerson.java new file mode 100644 index 0000000..9708000 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/model/KeyPerson.java @@ -0,0 +1,86 @@ +package com.police.policedatasystem.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/policedatasystem/model/KeyPersonDetail.java b/app/src/main/java/com/police/policedatasystem/model/KeyPersonDetail.java new file mode 100644 index 0000000..67e5f3b --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/model/KeyPersonDetail.java @@ -0,0 +1,289 @@ +package com.police.policedatasystem.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/policedatasystem/model/PoliceEmergency.java b/app/src/main/java/com/police/policedatasystem/model/PoliceEmergency.java new file mode 100644 index 0000000..abdd193 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/model/PoliceEmergency.java @@ -0,0 +1,56 @@ +package com.police.policedatasystem.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/policedatasystem/model/PoliceEmergencyDetail.java b/app/src/main/java/com/police/policedatasystem/model/PoliceEmergencyDetail.java new file mode 100644 index 0000000..f3d0381 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/model/PoliceEmergencyDetail.java @@ -0,0 +1,268 @@ +package com.police.policedatasystem.model; + +import java.io.Serializable; +import java.util.List; + +/** + * 警情详情 + * "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/policedatasystem/model/ResourceList.java b/app/src/main/java/com/police/policedatasystem/model/ResourceList.java new file mode 100644 index 0000000..cc694e0 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/model/ResourceList.java @@ -0,0 +1,42 @@ +package com.police.policedatasystem.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/app/src/main/java/com/police/policedatasystem/model/UserCredential.java b/app/src/main/java/com/police/policedatasystem/model/UserCredential.java new file mode 100644 index 0000000..339d54c --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/model/UserCredential.java @@ -0,0 +1,174 @@ +package com.police.policedatasystem.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/app/src/main/java/com/police/policedatasystem/util/Constants.java b/app/src/main/java/com/police/policedatasystem/util/Constants.java new file mode 100644 index 0000000..49ac0e8 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/util/Constants.java @@ -0,0 +1,63 @@ +package com.police.policedatasystem.util; + +import com.police.policedatasystem.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 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 SFZH = "100307"; + + /** + * 当前用户警员组织代码 + */ + public static String USER_ORG_ID = "22018421000";//22018421000//220106290000 + /** + * 寻址后得到的数据-接口列表 + */ + public static final HashMap resourceListsMap = new HashMap<>(); + /** + * 请求分页数据数量 + */ + public static int PAGE_SIZE = 10; +} \ No newline at end of file diff --git a/app/src/main/java/com/police/policedatasystem/util/ThirdAppInfo.java b/app/src/main/java/com/police/policedatasystem/util/ThirdAppInfo.java new file mode 100644 index 0000000..11313ac --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/util/ThirdAppInfo.java @@ -0,0 +1,65 @@ +package com.police.policedatasystem.util; + +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/app/src/main/java/com/police/policedatasystem/util/UaCredentialApi.java b/app/src/main/java/com/police/policedatasystem/util/UaCredentialApi.java new file mode 100644 index 0000000..444d478 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/util/UaCredentialApi.java @@ -0,0 +1,305 @@ +package com.police.policedatasystem.util; + +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 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/app/src/main/java/com/police/policedatasystem/util/UiUtils.java b/app/src/main/java/com/police/policedatasystem/util/UiUtils.java new file mode 100644 index 0000000..bf05fca --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/util/UiUtils.java @@ -0,0 +1,78 @@ +package com.police.policedatasystem.util; + +import android.util.Base64; +import android.widget.Toast; + +import com.police.policedatasystem.MyApplication; + +import java.util.UUID; + +public class UiUtils { + /** + * 将dp值转换为px值,保证尺寸大小不变 + * + * @param dpValue dp值 + * @return 转换后的px值 + */ + public static int dp2Px(int dpValue) { + final float scale = MyApplication.getInstance().getResources().getDisplayMetrics().density; + return Math.round((float) dpValue * scale); + } + public static String uuid() { + return UUID.randomUUID().toString(); + } + + public static void toast(String str) { + MyApplication.getInstance().getHandler().post(() -> Toast.makeText(MyApplication.getInstance(), 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(){ + MyApplication.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 ""; + } +} diff --git a/app/src/main/java/com/police/policedatasystem/viewmodel/DataViewModel.java b/app/src/main/java/com/police/policedatasystem/viewmodel/DataViewModel.java new file mode 100644 index 0000000..e712b92 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/viewmodel/DataViewModel.java @@ -0,0 +1,360 @@ +package com.police.policedatasystem.viewmodel; + +import androidx.annotation.NonNull; + +import com.google.gson.Gson; +import com.police.policedatasystem.activity.KeyPersonDetailActivity; +import com.police.policedatasystem.activity.PoliceEmergencyDetailActivity; +import com.police.policedatasystem.fragment.DataFragment; +import com.police.policedatasystem.http.CustomCallBack; +import com.police.policedatasystem.http.requestparams.GetKeyPersonListParams; +import com.police.policedatasystem.http.requestparams.GetOrgKeyPersonListParams; +import com.police.policedatasystem.http.requestparams.GetPoliceEmergencyListParams; +import com.police.policedatasystem.indexActivity; +import com.police.policedatasystem.model.DataCount; +import com.police.policedatasystem.model.KeyPerson; +import com.police.policedatasystem.model.KeyPersonDetail; +import com.police.policedatasystem.model.PoliceEmergency; +import com.police.policedatasystem.model.PoliceEmergencyDetail; +import com.police.policedatasystem.util.Constants; +import com.police.policedatasystem.util.UiUtils; + +import java.util.List; + +import okhttp3.Call; + +public class DataViewModel { + private final DataFragment fragment; + public int pageNum = 1; + public indexActivity activity; + + public DataViewModel(DataFragment fragment, indexActivity activity) { + this.fragment = fragment; + this.activity = activity; + } + + public void keyPersonInit() { + fragment.loadingShow(); + pageNum = 1; + fragment.personList.clear(); + //加载数据 + GetKeyPersonListParams params = new GetKeyPersonListParams(); + params.setPageNum(pageNum + ""); + if (fragment.filterType == 0) { + params.setXm(fragment.binding.etInput.getText().toString()); + } else { + params.setSfzh(fragment.binding.etInput.getText().toString()); + } + activity.requestClient.getKeyPerson(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + fragment.loadingNone(); + } + + @Override + public void onSuccess(List value) { + fragment.loadingNone(); + if (value != null) { + fragment.personList.addAll(value); + } + fragment.adapter.notifyDataSetChanged(); + } + }); + } + + public void orgKeyPersonInit() { + fragment.loadingShow(); + pageNum = 1; + fragment.personList.clear(); + //加载数据 + GetOrgKeyPersonListParams params = new GetOrgKeyPersonListParams(); + params.setPageNum(pageNum + ""); + if (fragment.filterType == 0) { + params.setXm(fragment.binding.etInput.getText().toString()); + } else { + params.setSfzh(fragment.binding.etInput.getText().toString()); + } + activity.requestClient.getOrgKeyPerson(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + fragment.loadingNone(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + fragment.loadingNone(); + if (value != null) { + fragment.personList.addAll(value); + } + fragment.adapter.notifyDataSetChanged(); + } + }); + } + + public void keyPersonLoadMore() { + fragment.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) { + fragment.loadingNone(); + fragment.binding.refreshLayout.finishLoadMore(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + fragment.loadingNone(); + if (value == null || value.size() < Constants.PAGE_SIZE) { + fragment.binding.refreshLayout.setNoMoreData(true); + } + if (value != null) { + fragment.personList.addAll(value); + } + fragment.adapter.notifyDataSetChanged(); + fragment.binding.refreshLayout.finishLoadMore(); + } + }); + } + + public void keyPersonRefresh() { + fragment.loadingShow(); + fragment.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) { + fragment.loadingNone(); + fragment.binding.refreshLayout.finishRefresh(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + fragment.loadingNone(); + if (value != null) { + fragment.personList.addAll(value); + } + fragment.adapter.notifyDataSetChanged(); + fragment.binding.refreshLayout.finishRefresh(); + } + }); + } + + public void orgKeyPersonLoadMore() { + fragment.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) { + fragment.loadingNone(); + fragment.binding.refreshLayout.finishLoadMore(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + fragment.loadingNone(); + if (value == null || value.size() < Constants.PAGE_SIZE) { + fragment.binding.refreshLayout.setNoMoreData(true); + } + if (value != null) { + fragment.personList.addAll(value); + } + fragment.adapter.notifyDataSetChanged(); + fragment.binding.refreshLayout.finishLoadMore(); + } + }); + } + + public void orgKeyPersonRefresh() { + fragment.loadingShow(); + fragment.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) { + fragment.loadingNone(); + fragment.binding.refreshLayout.finishRefresh(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + fragment.loadingNone(); + if (value != null) { + fragment.personList.addAll(value); + } + fragment.adapter.notifyDataSetChanged(); + fragment.binding.refreshLayout.finishRefresh(); + } + }); + } + + public void keyPersonDetail(String sfzh) { + fragment.loadingShow(); + activity.requestClient.keyPersonDetail(sfzh, new CustomCallBack() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + fragment.loadingNone(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(KeyPersonDetail value) { + fragment.loadingNone(); + KeyPersonDetailActivity.startAction(activity, new Gson().toJson(value)); + } + }); + } + + /** + * 警情数据初始化 + */ + public void policeEmergencyInit() { + fragment.loadingShow(); + pageNum = 1; + fragment.policeList.clear(); + //加载数据 + GetPoliceEmergencyListParams params = new GetPoliceEmergencyListParams(); + params.setPageNum(pageNum + ""); + if (fragment.filterType == 0) { + params.setJcjbh(fragment.binding.etInput.getText().toString()); + } else if (fragment.filterType == 1) { + params.setBjjyqk(fragment.binding.etInput.getText().toString()); + } else { + params.setBjrlxdh(fragment.binding.etInput.getText().toString()); + } + activity.requestClient.getPoliceEmergency(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + UiUtils.toast(e.getMessage()); + fragment.loadingNone(); + } + + @Override + public void onSuccess(List value) { + fragment.loadingNone(); + if (value != null) { + fragment.policeList.addAll(value); + } + fragment.adapter.notifyDataSetChanged(); + } + }); + } + + public void policeEmergencyRefresh() { + fragment.loadingShow(); + pageNum = 1; + fragment.policeList.clear(); + //加载数据 + GetPoliceEmergencyListParams params = new GetPoliceEmergencyListParams(); + params.setPageNum(pageNum + ""); + if (fragment.filterType == 0) { + params.setJcjbh(fragment.binding.etInput.getText().toString()); + } else if (fragment.filterType == 1) { + params.setBjjyqk(fragment.binding.etInput.getText().toString()); + } else { + params.setBjrlxdh(fragment.binding.etInput.getText().toString()); + } + activity.requestClient.getPoliceEmergency(params, new CustomCallBack>() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + fragment.binding.refreshLayout.finishRefresh(); + UiUtils.toast(e.getMessage()); + fragment.loadingNone(); + } + + @Override + public void onSuccess(List value) { + fragment.binding.refreshLayout.finishRefresh(); + fragment.loadingNone(); + if (value != null) { + fragment.policeList.addAll(value); + } + fragment.adapter.notifyDataSetChanged(); + } + }); + } + + public void policeEmergencyLoadMore() { + fragment.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) { + fragment.loadingNone(); + fragment.binding.refreshLayout.finishLoadMore(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(List value) { + fragment.loadingNone(); + if (value == null || value.size() < Constants.PAGE_SIZE) { + fragment.binding.refreshLayout.setNoMoreData(true); + } + if (value != null) { + fragment.policeList.addAll(value); + } + fragment.adapter.notifyDataSetChanged(); + fragment.binding.refreshLayout.finishLoadMore(); + } + }); + } + + public void policeEmergencyDetail(String jcjbh) { + fragment.loadingShow(); + activity.requestClient.getPoliceEmergencyDetail(jcjbh, new CustomCallBack() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + fragment.loadingNone(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(PoliceEmergencyDetail value) { + fragment.loadingNone(); + PoliceEmergencyDetailActivity.startAction(activity, new Gson().toJson(value)); + } + }); + } + + public void getKeyPersonMessageCount() { + fragment.loadingShow(); + activity.requestClient.getKeyPersonMessageCount( new CustomCallBack() { + @Override + public void onError(@NonNull Call call, @NonNull Exception e) { + fragment.loadingNone(); + UiUtils.toast(e.getMessage()); + } + + @Override + public void onSuccess(DataCount value) { + fragment.loadingNone(); + fragment.binding.tvKeyPersonCount.setText(value.getZdryCount()); + fragment.binding.tvPoliceEmergencyCount.setText(value.getJqCount()); + fragment.binding.tvCaseDetailsCount.setText(value.getAqCount()); + fragment.binding.tvKeyPersonTabCount.setText(value.getZdryCount()); + fragment.binding.tvAreaKeyTabCount.setText(value.getZdryDeptCount()); + } + }); + } +} diff --git a/app/src/main/java/com/police/policedatasystem/viewmodel/IndexViewModel.java b/app/src/main/java/com/police/policedatasystem/viewmodel/IndexViewModel.java new file mode 100644 index 0000000..ea4c2c2 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/viewmodel/IndexViewModel.java @@ -0,0 +1,13 @@ +package com.police.policedatasystem.viewmodel; + +import com.police.policedatasystem.indexActivity; + +public class IndexViewModel { + private final indexActivity activity; + public int pageNum = 1; + + public IndexViewModel(indexActivity activity) { + this.activity = activity; + } + +} diff --git a/app/src/main/java/com/police/policedatasystem/widget/WaterMarkBg.java b/app/src/main/java/com/police/policedatasystem/widget/WaterMarkBg.java new file mode 100644 index 0000000..91c24f5 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/widget/WaterMarkBg.java @@ -0,0 +1,88 @@ +package com.police.policedatasystem.widget; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.ColorFilter; +import android.graphics.Paint; +import android.graphics.PixelFormat; +import android.graphics.drawable.Drawable; + +import androidx.annotation.IntRange; +import androidx.annotation.Nullable; + +import java.util.List; + +public class WaterMarkBg extends Drawable { + private Paint paint = new Paint(); + private List labels; + private Context context; + private int degress;//角度 + private int fontSize;//字体大小 单位sp + + /** + * 初始化构造 + * + * @param context 上下文 + * @param labels 水印文字列表 多行显示支持 + * @param degress 水印角度 + * @param fontSize 水印文字大小 + */ + public WaterMarkBg(Context context, List labels, int degress, int fontSize) { + this.labels = labels; + this.context = context; + this.degress = degress; + this.fontSize = fontSize; + } + + @Override + public void draw(@Nullable Canvas canvas) { + + + int width = getBounds().right; + int height = getBounds().bottom; + + canvas.drawColor(Color.parseColor("#40F3F5F9")); + paint.setColor(Color.parseColor("#50AEAEAE")); + + paint.setAntiAlias(true); + paint.setTextSize(sp2px(context, fontSize)); + canvas.save(); + canvas.rotate(degress); + float textWidth = paint.measureText(labels.get(0)); + int index = 0; + for (int positionY = height / 10; positionY <= height; positionY += height / 10 + 80) { + float fromX = -width + (index++ % 2) * textWidth; + for (float positionX = fromX; positionX < width; positionX += textWidth * 2) { + int spacing = 0;//间距 + for (String label : labels) { + canvas.drawText(label, positionX, positionY + spacing, paint); + spacing = spacing + 50; + } + + } + } + canvas.restore(); + } + + @Override + public void setAlpha(@IntRange(from = 0, to = 255) int alpha) { + + } + + @Override + public void setColorFilter(@Nullable ColorFilter colorFilter) { + + } + + @Override + public int getOpacity() { + return PixelFormat.UNKNOWN; + } + + + public static int sp2px(Context context, float spValue) { + final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; + return (int) (spValue * fontScale + 0.5f); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/police/policedatasystem/widget/WaterMarkInfo.java b/app/src/main/java/com/police/policedatasystem/widget/WaterMarkInfo.java new file mode 100644 index 0000000..bbc9e73 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/widget/WaterMarkInfo.java @@ -0,0 +1,208 @@ +package com.police.policedatasystem.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/policedatasystem/widget/WaterMarkManager.java b/app/src/main/java/com/police/policedatasystem/widget/WaterMarkManager.java new file mode 100644 index 0000000..c3089c7 --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/widget/WaterMarkManager.java @@ -0,0 +1,188 @@ +package com.police.policedatasystem.widget; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.graphics.Paint; +import android.view.LayoutInflater; + + +import com.police.policedatasystem.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/policedatasystem/widget/WaterMarkView.java b/app/src/main/java/com/police/policedatasystem/widget/WaterMarkView.java new file mode 100644 index 0000000..53e453c --- /dev/null +++ b/app/src/main/java/com/police/policedatasystem/widget/WaterMarkView.java @@ -0,0 +1,334 @@ +package com.police.policedatasystem.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.policedatasystem.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/color/bottom_nav_colors.xml b/app/src/main/res/color/bottom_nav_colors.xml new file mode 100644 index 0000000..f834a0b --- /dev/null +++ b/app/src/main/res/color/bottom_nav_colors.xml @@ -0,0 +1,5 @@ + + + + + \ 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_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_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/back.png b/app/src/main/res/drawable/back.png new file mode 100644 index 0000000..76e3e82 Binary files /dev/null and b/app/src/main/res/drawable/back.png differ diff --git a/app/src/main/res/drawable/baojing.png b/app/src/main/res/drawable/baojing.png new file mode 100644 index 0000000..67744fa Binary files /dev/null and b/app/src/main/res/drawable/baojing.png differ diff --git a/app/src/main/res/drawable/bg.png b/app/src/main/res/drawable/bg.png new file mode 100644 index 0000000..7037d46 Binary files /dev/null and b/app/src/main/res/drawable/bg.png differ diff --git a/app/src/main/res/drawable/huizhang.png b/app/src/main/res/drawable/huizhang.png new file mode 100644 index 0000000..9dd0f49 Binary files /dev/null and b/app/src/main/res/drawable/huizhang.png differ diff --git a/app/src/main/res/drawable/huizhang_icon.png b/app/src/main/res/drawable/huizhang_icon.png new file mode 100644 index 0000000..e38aef1 Binary files /dev/null and b/app/src/main/res/drawable/huizhang_icon.png differ diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/icon_14.png b/app/src/main/res/drawable/icon_14.png new file mode 100644 index 0000000..9bbeb49 Binary files /dev/null and b/app/src/main/res/drawable/icon_14.png differ diff --git a/app/src/main/res/drawable/jaintou.png b/app/src/main/res/drawable/jaintou.png new file mode 100644 index 0000000..a4aa741 Binary files /dev/null and b/app/src/main/res/drawable/jaintou.png differ diff --git a/app/src/main/res/drawable/jinghui.png b/app/src/main/res/drawable/jinghui.png new file mode 100644 index 0000000..33a38f7 Binary files /dev/null and b/app/src/main/res/drawable/jinghui.png differ diff --git a/app/src/main/res/drawable/laba.png b/app/src/main/res/drawable/laba.png new file mode 100644 index 0000000..313c61c Binary files /dev/null and b/app/src/main/res/drawable/laba.png differ diff --git a/app/src/main/res/drawable/loading.gif b/app/src/main/res/drawable/loading.gif new file mode 100644 index 0000000..3f522f7 Binary files /dev/null and b/app/src/main/res/drawable/loading.gif differ diff --git a/app/src/main/res/drawable/mine.png b/app/src/main/res/drawable/mine.png new file mode 100644 index 0000000..5221eb2 Binary files /dev/null and b/app/src/main/res/drawable/mine.png differ diff --git a/app/src/main/res/drawable/mine_icon.png b/app/src/main/res/drawable/mine_icon.png new file mode 100644 index 0000000..eeb1ae8 Binary files /dev/null and b/app/src/main/res/drawable/mine_icon.png differ diff --git a/app/src/main/res/drawable/mine_normal.png b/app/src/main/res/drawable/mine_normal.png new file mode 100644 index 0000000..978ed73 Binary files /dev/null and b/app/src/main/res/drawable/mine_normal.png differ diff --git a/app/src/main/res/drawable/photo.png b/app/src/main/res/drawable/photo.png new file mode 100644 index 0000000..a60bd5c Binary files /dev/null and b/app/src/main/res/drawable/photo.png differ 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/search.png b/app/src/main/res/drawable/search.png new file mode 100644 index 0000000..f767573 Binary files /dev/null and b/app/src/main/res/drawable/search.png differ 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/wenjian_9.png b/app/src/main/res/drawable/wenjian_9.png new file mode 100644 index 0000000..5c6e818 Binary files /dev/null and b/app/src/main/res/drawable/wenjian_9.png differ diff --git a/app/src/main/res/drawable/wenjianjia.png b/app/src/main/res/drawable/wenjianjia.png new file mode 100644 index 0000000..5b31629 Binary files /dev/null and b/app/src/main/res/drawable/wenjianjia.png differ diff --git a/app/src/main/res/drawable/wenjianjia_icon.png b/app/src/main/res/drawable/wenjianjia_icon.png new file mode 100644 index 0000000..0b8183d Binary files /dev/null and b/app/src/main/res/drawable/wenjianjia_icon.png differ diff --git a/app/src/main/res/layout/activity_index.xml b/app/src/main/res/layout/activity_index.xml new file mode 100644 index 0000000..17c7fcd --- /dev/null +++ b/app/src/main/res/layout/activity_index.xml @@ -0,0 +1,34 @@ + + + + + + + + + \ 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..4ea204e --- /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..0b15a20 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,9 @@ + + + + \ 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..4df5839 --- /dev/null +++ b/app/src/main/res/layout/activity_police_emergency_detail.xml @@ -0,0 +1,581 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/bottom_navigation_view.xml b/app/src/main/res/layout/bottom_navigation_view.xml new file mode 100644 index 0000000..27d0859 --- /dev/null +++ b/app/src/main/res/layout/bottom_navigation_view.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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..e49fb43 --- /dev/null +++ b/app/src/main/res/layout/dropdown_layout4.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + \ 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_apply.xml b/app/src/main/res/layout/fragment_apply.xml new file mode 100644 index 0000000..22c1c83 --- /dev/null +++ b/app/src/main/res/layout/fragment_apply.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_data.xml b/app/src/main/res/layout/fragment_data.xml new file mode 100644 index 0000000..5d82652 --- /dev/null +++ b/app/src/main/res/layout/fragment_data.xml @@ -0,0 +1,359 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_first.xml b/app/src/main/res/layout/fragment_first.xml new file mode 100644 index 0000000..44baecd --- /dev/null +++ b/app/src/main/res/layout/fragment_first.xml @@ -0,0 +1,35 @@ + + + + + +