调整页面样式

This commit is contained in:
lianlilong 2024-04-07 09:45:39 +08:00
parent cd2840d319
commit 547ee3b33b
48 changed files with 1125 additions and 704 deletions

View File

@ -16,7 +16,7 @@
</queries> </queries>
<application <application
android:name=".App" android:name=".main.App"
android:allowBackup="true" android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules" android:fullBackupContent="@xml/backup_rules"

View File

@ -0,0 +1,144 @@
package com.police.policedatasystem.apply.fragment;
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.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.police.policedatasystem.R;
import com.police.policedatasystem.apply.model.ApplyDept;
import com.police.policedatasystem.apply.model.ApplyPerson;
import com.police.policedatasystem.apply.model.ApplyType;
import com.police.policedatasystem.apply.viewmodel.ApplyViewModel;
import com.police.policedatasystem.databinding.DialogSelectorBinding;
import com.police.policedatasystem.databinding.DropdownLayout4Binding;
import com.police.policedatasystem.databinding.FragmentApplyBinding;
import com.police.policedatasystem.indexActivity;
import com.police.policedatasystem.util.UiUtils;
import java.util.Arrays;
import java.util.List;
public class ApplyFragment extends Fragment {
private FragmentApplyBinding binding;
private ApplyViewModel viewModel;
@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() {
viewModel = new ApplyViewModel(this, (indexActivity) this.getActivity());
}
@Override
public void onStart() {
super.onStart();
viewModel.getApplyType();
}
public void setPopupWindow(List<ApplyType> applyTypes) {
// 初始化 PopupWindow
PopupWindow popupWindow = new PopupWindow(getContext());
// 加载自定义布局
DropdownLayout4Binding contentViewBinding = DropdownLayout4Binding.inflate(getLayoutInflater());
View contentView = contentViewBinding.getRoot();
// 设置 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.showAtLocation(binding.typeGroup, Gravity.NO_GRAVITY, 0, 0);
binding.tvApplySearchTitle.setText(applyTypes.get(0).getDictLabel());
for (ApplyType item : applyTypes) {
TextView textView = new TextView(getContext());
textView.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
textView.setHeight(UiUtils.dp2Px(40));
textView.setGravity(Gravity.CENTER_VERTICAL);
textView.setTextSize(16);
textView.setBackgroundResource(R.color.white);
textView.setText(item.getDictLabel());
contentViewBinding.llApplyTypeGroup.addView(textView);
textView.setOnClickListener(view -> {
// 处理菜单项 1 的点击事件
binding.tvApplySearchTitle.setText(item.getDictLabel());
popupWindow.dismiss(); // 关闭 PopupWindow
});
}
// 将自定义布局设置为 PopupWindow 的内容视图
popupWindow.setContentView(contentView);
// 设置 PopupWindow 的焦点
popupWindow.setFocusable(true);
popupWindow.setOutsideTouchable(true); // 设置点击 PopupWindow 外部区域使其消失
binding.typeGroup.setOnClickListener(view -> {
popupWindow.setWidth(binding.typeGroup.getWidth());
popupWindow.showAsDropDown(binding.typeGroup);
});
binding.includeApply.tvQueryName.setOnClickListener(view -> {
});
binding.includeApply.tvQueryOrg.setOnClickListener(view -> {
});
}
public void setPopupWindow2(List<ApplyDept> applyDept) {
}
public void setPopupWindow3(List<ApplyPerson> applyPeople) {
}
public void loadingShow() {
if (getActivity() != null) {
getActivity().runOnUiThread(() -> binding.rlLoading.setVisibility(View.VISIBLE));
}
}
public void loadingNone() {
if (getActivity() != null) {
getActivity().runOnUiThread(() -> binding.rlLoading.setVisibility(View.GONE));
}
}
public void showDialog() {
if (getContext() == null) return;
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
DialogSelectorBinding selectorBinding = DialogSelectorBinding.inflate(getLayoutInflater());
View dialogView = selectorBinding.getRoot();
RecyclerView recyclerView = selectorBinding.rcv;
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
List<String> items = Arrays.asList("Item 1", "Item 2", "Item 3", "Item 4");
BaseQuickAdapter<String, BaseViewHolder> adapter = new BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_dialog_selector, items) {
@Override
protected void convert(@NonNull BaseViewHolder baseViewHolder, String s) {
baseViewHolder.setText(R.id.tv_item_text, s);
}
};
recyclerView.setAdapter(adapter);
adapter.setOnItemClickListener((adapter1, view, position) -> {
});
builder.setView(dialogView);
AlertDialog dialog = builder.create();
dialog.show();
}
}

View File

@ -0,0 +1,72 @@
package com.police.policedatasystem.apply.model;
import java.io.Serializable;
/**
* {\"checked\":false,\"id\":\"220000000000\",\"name\":\"吉林省公安厅\",\"nocheck\":false,\"open\":false,\"pId\":\"0\",\"title\":\"吉林省公安厅\"}
*/
public class ApplyDept implements Serializable {
private boolean checked;
private String id;
private String name;
private String pId;
private String title;
private boolean open;
private boolean nocheck;
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getpId() {
return pId;
}
public void setpId(String pId) {
this.pId = pId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean isOpen() {
return open;
}
public void setOpen(boolean open) {
this.open = open;
}
public boolean isNocheck() {
return nocheck;
}
public void setNocheck(boolean nocheck) {
this.nocheck = nocheck;
}
}

View File

@ -0,0 +1,24 @@
package com.police.policedatasystem.apply.model;
import java.io.Serializable;
public class ApplyPerson implements Serializable {
private String loginName;
private String userName;
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}

View File

@ -0,0 +1,33 @@
package com.police.policedatasystem.apply.model;
import java.io.Serializable;
public class ApplyType implements Serializable {
private String dictLabel;
private String dictSort;
private String dictValue;
public String getDictLabel() {
return dictLabel;
}
public void setDictLabel(String dictLabel) {
this.dictLabel = dictLabel;
}
public String getDictSort() {
return dictSort;
}
public void setDictSort(String dictSort) {
this.dictSort = dictSort;
}
public String getDictValue() {
return dictValue;
}
public void setDictValue(String dictValue) {
this.dictValue = dictValue;
}
}

View File

@ -0,0 +1,78 @@
package com.police.policedatasystem.apply.viewmodel;
import androidx.annotation.NonNull;
import com.police.policedatasystem.apply.fragment.ApplyFragment;
import com.police.policedatasystem.apply.model.ApplyDept;
import com.police.policedatasystem.apply.model.ApplyType;
import com.police.policedatasystem.http.CustomCallBack;
import com.police.policedatasystem.indexActivity;
import com.police.policedatasystem.util.UiUtils;
import java.util.Comparator;
import java.util.List;
import okhttp3.Call;
public class ApplyViewModel {
private final ApplyFragment fragment;
public indexActivity activity;
public ApplyViewModel(ApplyFragment fragment, indexActivity activity) {
this.fragment = fragment;
this.activity = activity;
}
public void getApplyType() {
fragment.loadingShow();
activity.requestClient.getApplyType(new CustomCallBack<List<ApplyType>>() {
@Override
public void onError(@NonNull Call call, @NonNull Exception e) {
UiUtils.toast(e.getMessage());
fragment.loadingNone();
}
@Override
public void onSuccess(List<ApplyType> value) {
value.sort(Comparator.comparing(ApplyType::getDictSort));
fragment.setPopupWindow(value);
fragment.loadingNone();
}
});
}
public void getApplyDept() {
fragment.loadingShow();
activity.requestClient.getApplyDept(new CustomCallBack<List<ApplyDept>>() {
@Override
public void onError(@NonNull Call call, @NonNull Exception e) {
UiUtils.toast(e.getMessage());
fragment.loadingNone();
}
@Override
public void onSuccess(List<ApplyDept> value) {
// value.sort(Comparator.comparing(ApplyDept::getDictSort));
fragment.setPopupWindow2(value);
fragment.loadingNone();
}
});
}
public void getApplyPerson() {
fragment.loadingShow();
activity.requestClient.getApplyDept(new CustomCallBack<List<ApplyDept>>() {
@Override
public void onError(@NonNull Call call, @NonNull Exception e) {
UiUtils.toast(e.getMessage());
fragment.loadingNone();
}
@Override
public void onSuccess(List<ApplyDept> value) {
// value.sort(Comparator.comparing(ApplyDept::getDictSort));
fragment.setPopupWindow2(value);
fragment.loadingNone();
}
});
}
}

View File

@ -11,7 +11,7 @@ import android.widget.TextView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.police.policedatasystem.databinding.ActivityKeyPersonDetailBinding; import com.police.policedatasystem.databinding.ActivityKeyPersonDetailBinding;
import com.police.policedatasystem.model.KeyPersonDetail; import com.police.policedatasystem.data.model.KeyPersonDetail;
import com.police.policedatasystem.util.Constants; import com.police.policedatasystem.util.Constants;
import com.police.policedatasystem.util.UiUtils; import com.police.policedatasystem.util.UiUtils;

View File

@ -8,9 +8,9 @@ import android.widget.TextView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.police.policedatasystem.App; import com.police.policedatasystem.main.App;
import com.police.policedatasystem.databinding.ActivityPoliceEmergencyDetailBinding; import com.police.policedatasystem.databinding.ActivityPoliceEmergencyDetailBinding;
import com.police.policedatasystem.model.PoliceEmergencyDetail; import com.police.policedatasystem.data.model.PoliceEmergencyDetail;
import com.police.policedatasystem.util.Constants; import com.police.policedatasystem.util.Constants;
import com.police.policedatasystem.util.UiUtils; import com.police.policedatasystem.util.UiUtils;

View File

@ -5,9 +5,9 @@ import android.widget.ImageView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.police.policedatasystem.App; import com.police.policedatasystem.main.App;
import com.police.policedatasystem.R; import com.police.policedatasystem.R;
import com.police.policedatasystem.model.KeyPerson; import com.police.policedatasystem.data.model.KeyPerson;
import com.police.policedatasystem.util.UiUtils; import com.police.policedatasystem.util.UiUtils;
public class KeyPersonAdapter extends BaseQuickAdapter<KeyPerson, BaseViewHolder> { public class KeyPersonAdapter extends BaseQuickAdapter<KeyPerson, BaseViewHolder> {

View File

@ -3,7 +3,7 @@ package com.police.policedatasystem.data.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.police.policedatasystem.R; import com.police.policedatasystem.R;
import com.police.policedatasystem.model.PoliceEmergency; import com.police.policedatasystem.data.model.PoliceEmergency;
import com.police.policedatasystem.util.UiUtils; import com.police.policedatasystem.util.UiUtils;
public class PoliceEmergencyAdapter extends BaseQuickAdapter<PoliceEmergency, BaseViewHolder> { public class PoliceEmergencyAdapter extends BaseQuickAdapter<PoliceEmergency, BaseViewHolder> {

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.fragment; package com.police.policedatasystem.data.fragment;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@ -23,9 +23,9 @@ import com.police.policedatasystem.data.adapter.KeyPersonAdapter;
import com.police.policedatasystem.data.adapter.PoliceEmergencyAdapter; import com.police.policedatasystem.data.adapter.PoliceEmergencyAdapter;
import com.police.policedatasystem.databinding.FragmentDataBinding; import com.police.policedatasystem.databinding.FragmentDataBinding;
import com.police.policedatasystem.indexActivity; import com.police.policedatasystem.indexActivity;
import com.police.policedatasystem.model.KeyPerson; import com.police.policedatasystem.data.model.KeyPerson;
import com.police.policedatasystem.model.PoliceEmergency; import com.police.policedatasystem.data.model.PoliceEmergency;
import com.police.policedatasystem.viewmodel.DataViewModel; import com.police.policedatasystem.data.viewmodel.DataViewModel;
import com.scwang.smart.refresh.footer.ClassicsFooter; import com.scwang.smart.refresh.footer.ClassicsFooter;
import com.scwang.smart.refresh.header.ClassicsHeader; import com.scwang.smart.refresh.header.ClassicsHeader;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.model; package com.police.policedatasystem.data.model;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.model; package com.police.policedatasystem.data.model;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.model; package com.police.policedatasystem.data.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.model; package com.police.policedatasystem.data.model;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.model; package com.police.policedatasystem.data.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;

View File

@ -1,21 +1,21 @@
package com.police.policedatasystem.viewmodel; package com.police.policedatasystem.data.viewmodel;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.police.policedatasystem.data.activity.KeyPersonDetailActivity; import com.police.policedatasystem.data.activity.KeyPersonDetailActivity;
import com.police.policedatasystem.data.activity.PoliceEmergencyDetailActivity; import com.police.policedatasystem.data.activity.PoliceEmergencyDetailActivity;
import com.police.policedatasystem.fragment.DataFragment; import com.police.policedatasystem.data.fragment.DataFragment;
import com.police.policedatasystem.http.CustomCallBack; import com.police.policedatasystem.http.CustomCallBack;
import com.police.policedatasystem.http.requestparams.GetKeyPersonListParams; import com.police.policedatasystem.http.requestparams.GetKeyPersonListParams;
import com.police.policedatasystem.http.requestparams.GetOrgKeyPersonListParams; import com.police.policedatasystem.http.requestparams.GetOrgKeyPersonListParams;
import com.police.policedatasystem.http.requestparams.GetPoliceEmergencyListParams; import com.police.policedatasystem.http.requestparams.GetPoliceEmergencyListParams;
import com.police.policedatasystem.indexActivity; import com.police.policedatasystem.indexActivity;
import com.police.policedatasystem.model.DataCount; import com.police.policedatasystem.data.model.DataCount;
import com.police.policedatasystem.model.KeyPerson; import com.police.policedatasystem.data.model.KeyPerson;
import com.police.policedatasystem.model.KeyPersonDetail; import com.police.policedatasystem.data.model.KeyPersonDetail;
import com.police.policedatasystem.model.PoliceEmergency; import com.police.policedatasystem.data.model.PoliceEmergency;
import com.police.policedatasystem.model.PoliceEmergencyDetail; import com.police.policedatasystem.data.model.PoliceEmergencyDetail;
import com.police.policedatasystem.util.Constants; import com.police.policedatasystem.util.Constants;
import com.police.policedatasystem.util.UiUtils; import com.police.policedatasystem.util.UiUtils;

View File

@ -1,99 +0,0 @@
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 外部区域使其消失
}
}

View File

@ -0,0 +1,259 @@
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.http.requestparams.RequestParams;
import com.police.policedatasystem.http.requestparams.ResponseParams;
import com.police.policedatasystem.indexActivity;
import com.police.policedatasystem.main.App;
import com.police.policedatasystem.main.model.ResourceList;
import com.police.policedatasystem.main.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 BaseRequestClient {
public final indexActivity activity;
private OkHttpClient okHttpClient;
public BaseRequestClient(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 = App.getApp().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 = App.getApp().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<ResourceList> resourceLists = new Gson().fromJson(resourceList, new TypeToken<List<ResourceList>>() {
}.getType());
for (ResourceList item : resourceLists) {
Constants.resourceListsMap.put(item.getResourceId(), item);
}
//2.发起请求获取重点人数据
activity.initData();
} else {
if (UiUtils.isEmpty(resourceList)) {
UiUtils.toast("寻址失败,错误码:" + resultCode);
}
}
}
});
thread.start();
}
/**
* 基类封装
*/
public void request(String urlKey, String jsonParams, CustomCallBack<String> callBack) {
ResourceList resourceList = Constants.resourceListsMap.get(urlKey);
if (resourceList == null) {
return;
}
RequestParams.Parameter parameter = getParameter(urlKey, jsonParams);
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) {
// 请求失败
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 {
// 请求成功处理响应数据
if (response.body() == null) {
activity.runOnUiThread(() -> callBack.onError(call, new Exception("服务器返回数据异常")));
return;
}
String responseBody = response.body().string();
if (urlKey.equals(Constants.APPLY_TYPE_ID)){
responseBody = "{\n" +
"\"code\":\"200\",\n" +
"\"data\":{\n" +
"\"dataList\":[\n" +
"{\n" +
"\"fieldValues\":[\n" +
"{\n" +
"\"field\":\"outjson\",\n" +
"\"value\":\"[{\\\"dictLabel\\\":\\\"管控重点人\\\",\\\"dictSort\\\":1,\\\"dictValue\\\":\\\"1\\\"},{\\\"dictLabel\\\":\\\"核验信息\\\",\\\"dictSort\\\":3,\\\"dictValue\\\":\\\"3\\\"},{\\\"dictLabel\\\":\\\"追踪逃犯\\\",\\\"dictSort\\\":2,\\\"dictValue\\\":\\\"6\\\"},{\\\"dictLabel\\\":\\\"处置警情\\\",\\\"dictSort\\\":0,\\\"dictValue\\\":\\\"0\\\"},{\\\"dictLabel\\\":\\\"核查线索\\\",\\\"dictSort\\\":2,\\\"dictValue\\\":\\\"2\\\"},{\\\"dictLabel\\\":\\\"其他\\\",\\\"dictSort\\\":5,\\\"dictValue\\\":\\\"5\\\"},{\\\"dictLabel\\\":\\\"处置案情\\\",\\\"dictSort\\\":1,\\\"dictValue\\\":\\\"7\\\"}]\"\n" +
"}\n" +
"]\n" +
"}\n" +
"],\n" +
"\"page\":{\n" +
"\"total\":7,\n" +
"\"pageNo\":10,\n" +
"\"pageSize\":1\n" +
"}\n" +
"},\n" +
"\"messageId\":\"788a1cc4-2009-4744-ba66-7503ca37b0f2\",\n" +
"\"message\":\"ok\",\n" +
"\"version\":\"1.0\"\n" +
"}";
}
ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class);
if (!"200".equals(responseParams.getCode())) {
activity.runOnUiThread(() -> callBack.onError(call, new Exception("服务器出错,请联系开发人员或稍后重试!")));
return;
}
if (responseParams.getData().getDataList() == null || responseParams.getData().getDataList().isEmpty()) {
activity.runOnUiThread(() -> callBack.onError(call, new Exception("服务器返回数据异常")));
return;
}
ResponseParams.FieldData fieldData = responseParams.getData().getDataList().get(0);
if (fieldData.getFieldValues() == null || fieldData.getFieldValues().isEmpty()) {
activity.runOnUiThread(() -> callBack.onError(call, new Exception("服务器返回数据异常")));
return;
}
activity.runOnUiThread(() -> callBack.onSuccess(fieldData.getFieldValues().get(0).getValue()));
} catch (Exception e) {
activity.runOnUiThread(() -> callBack.onError(call, e));
}
}
});
}
@NonNull
private static RequestParams.Parameter getParameter(String urlKey, String jsonParams) {
RequestParams.Condition condition = new RequestParams.Condition();
condition.setLogicalOperate("and");
RequestParams.KeyValues keyValues = new RequestParams.KeyValues();
keyValues.setKey("injson");
keyValues.setValue(jsonParams);
List<RequestParams.KeyValues> keyValuesList = new ArrayList<>();
keyValuesList.add(keyValues);
condition.setKeyValueList(keyValuesList);
RequestParams.Parameter parameter = new RequestParams.Parameter();
parameter.setCondition(condition);
parameter.setPage(new RequestParams.Page());
parameter.setFields("outjson");
parameter.setNetworkCode("3");
parameter.setOrderBy(null);
parameter.setRegionalismCode(Constants.ORG_ID);
parameter.setDataObjId(urlKey);
return parameter;
}
}

View File

@ -9,32 +9,4 @@ public abstract class CustomCallBack<T> {
public abstract void onSuccess(T value); 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));
// }
// }
} }

View File

@ -1,169 +1,35 @@
package com.police.policedatasystem.http; 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 androidx.annotation.NonNull;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.police.policedatasystem.App; import com.police.policedatasystem.apply.model.ApplyDept;
import com.police.policedatasystem.apply.model.ApplyPerson;
import com.police.policedatasystem.apply.model.ApplyType;
import com.police.policedatasystem.data.model.DataCount;
import com.police.policedatasystem.data.model.KeyPerson;
import com.police.policedatasystem.data.model.KeyPersonDetail;
import com.police.policedatasystem.data.model.PoliceEmergency;
import com.police.policedatasystem.data.model.PoliceEmergencyDetail;
import com.police.policedatasystem.http.requestparams.GetKeyPersonDetailParams; import com.police.policedatasystem.http.requestparams.GetKeyPersonDetailParams;
import com.police.policedatasystem.http.requestparams.GetKeyPersonListParams; import com.police.policedatasystem.http.requestparams.GetKeyPersonListParams;
import com.police.policedatasystem.http.requestparams.GetKeyPersonMessageCountParams; import com.police.policedatasystem.http.requestparams.GetKeyPersonMessageCountParams;
import com.police.policedatasystem.http.requestparams.GetOrgKeyPersonListParams; import com.police.policedatasystem.http.requestparams.GetOrgKeyPersonListParams;
import com.police.policedatasystem.http.requestparams.GetPoliceEmergencyDetailParams; import com.police.policedatasystem.http.requestparams.GetPoliceEmergencyDetailParams;
import com.police.policedatasystem.http.requestparams.GetPoliceEmergencyListParams; 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.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.Constants;
import com.police.policedatasystem.util.UiUtils;
import java.io.IOException; import java.util.HashMap;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import okhttp3.Call; 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 { public class RequestClient extends BaseRequestClient {
private final indexActivity activity;
private OkHttpClient okHttpClient;
public RequestClient(indexActivity activity) { public RequestClient(indexActivity activity) {
this.activity = activity; super(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 = App.getApp().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 = App.getApp().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<ResourceList> resourceLists = new Gson().fromJson(resourceList, new TypeToken<List<ResourceList>>() {
}.getType());
for (ResourceList item : resourceLists) {
Constants.resourceListsMap.put(item.getResourceId(), item);
}
//2.发起请求获取重点人数据
activity.initData();
} else {
if (UiUtils.isEmpty(resourceList)) {
UiUtils.toast("寻址失败,错误码:" + resultCode);
}
}
}
});
thread.start();
} }
/** /**
@ -173,66 +39,20 @@ public class RequestClient {
* @param callback 回调函数 * @param callback 回调函数
*/ */
public void getKeyPerson(GetKeyPersonListParams params, CustomCallBack<List<KeyPerson>> callback) { public void getKeyPerson(GetKeyPersonListParams params, CustomCallBack<List<KeyPerson>> 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.setJybh(Constants.USER_ID);
params.setSfhm(Constants.SFZH); params.setSfhm(Constants.SFZH);
params.setPageSize(Constants.PAGE_SIZE + ""); params.setPageSize(Constants.PAGE_SIZE + "");
keyValues.setValue(new Gson().toJson(params)); request(Constants.KEY_PERSON_ID, new Gson().toJson(params), new CustomCallBack<String>() {
List<RequestParams.KeyValues> 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 @Override
public void onFailure(@NonNull Call call, @NonNull IOException e) { public void onError(Call call, @NonNull Exception e) {
activity.runOnUiThread(() -> callback.onError(call, e)); callback.onError(call, e);
// 请求失败
e.printStackTrace();
} }
@Override @Override
public void onResponse(@NonNull Call call, @NonNull Response response) { public void onSuccess(String value) {
try { List<KeyPerson> keyPersonList = new Gson().fromJson(value, new TypeToken<List<KeyPerson>>() {
// 请求成功处理响应数据 }.getType());
String responseBody = response.body().string(); callback.onSuccess(keyPersonList);
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<KeyPerson> keyPersonList = new Gson().fromJson(i.getValue(), new TypeToken<List<KeyPerson>>() {
}.getType());
callback.onSuccess(keyPersonList);
}
}
} else {
callback.onError(call, new IOException(responseParams.getMessage()));
}
});
} catch (Exception e) {
callback.onError(call, e);
e.printStackTrace();
}
} }
}); });
} }
@ -240,75 +60,23 @@ public class RequestClient {
/** /**
* 获取组织重点人数据 * 获取组织重点人数据
* *
* @param params 搜索关键字姓名 * @param params 搜索关键字姓名
* @param callBack 回调函数
*/ */
public void getOrgKeyPerson(GetOrgKeyPersonListParams params, CustomCallBack<List<KeyPerson>> callBack) { public void getOrgKeyPerson(GetOrgKeyPersonListParams params, CustomCallBack<List<KeyPerson>> 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.setSfhm(Constants.SFZH);
params.setDept(Constants.USER_ORG_ID); params.setDept(Constants.USER_ORG_ID);
params.setPageSize(Constants.PAGE_SIZE + ""); params.setPageSize(Constants.PAGE_SIZE + "");
keyValues.setValue(new Gson().toJson(params)); request(Constants.KEY_PERSON_ID, new Gson().toJson(params), new CustomCallBack<String>() {
List<RequestParams.KeyValues> 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 @Override
public void onFailure(@NonNull Call call, @NonNull IOException e) { public void onError(Call call, @NonNull Exception e) {
activity.runOnUiThread(() -> callBack.onError(call, e)); callback.onError(call, e);
// 请求失败
e.printStackTrace();
} }
@Override @Override
public void onResponse(@NonNull Call call, @NonNull Response response) { public void onSuccess(String value) {
if (!response.isSuccessful()) { List<KeyPerson> keyPersonList = new Gson().fromJson(value, new TypeToken<List<KeyPerson>>() {
activity.runOnUiThread(() -> callBack.onError(call, new IOException("Unexpected code " + response))); }.getType());
return; callback.onSuccess(keyPersonList);
}
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<KeyPerson> keyPersonList = new Gson().fromJson(i.getValue(), new TypeToken<List<KeyPerson>>() {
}.getType());
callBack.onSuccess(keyPersonList);
}
}
} else {
callBack.onError(call, new Exception(responseParams.getMessage()));
}
});
} catch (Exception e) {
activity.runOnUiThread(() -> callBack.onError(call, e));
e.printStackTrace();
}
} }
}); });
} }
@ -320,62 +88,20 @@ public class RequestClient {
* @param str 身份证号 * @param str 身份证号
*/ */
public void keyPersonDetail(String str, CustomCallBack<KeyPersonDetail> callBack) { public void keyPersonDetail(String str, CustomCallBack<KeyPersonDetail> 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(); GetKeyPersonDetailParams params = new GetKeyPersonDetailParams();
params.setSfzh(str);// params.setSfzh("220104197307276911"); params.setSfzh(str);// params.setSfzh("220104197307276911");
params.setSfhm(Constants.SFZH); params.setSfhm(Constants.SFZH);
keyValues.setValue(new Gson().toJson(params)); request(Constants.KEY_PERSON_DETAIL_ID, new Gson().toJson(params), new CustomCallBack<String>() {
List<RequestParams.KeyValues> 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 @Override
public void onFailure(@NonNull Call call, @NonNull IOException e) { public void onError(Call call, @NonNull Exception e) {
// 请求失败 callBack.onError(call, e);
e.printStackTrace();
activity.runOnUiThread(() -> callBack.onError(call, e));
} }
@Override @Override
public void onResponse(@NonNull Call call, @NonNull Response response) { public void onSuccess(String value) {
if (!response.isSuccessful()) { KeyPersonDetail keyPersonList = new Gson().fromJson(value, new TypeToken<KeyPersonDetail>() {
activity.runOnUiThread(() -> callBack.onError(call, new IOException("Unexpected code " + response))); }.getType());
return; callBack.onSuccess(keyPersonList);
}
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));
}
} }
}); });
} }
@ -387,71 +113,20 @@ public class RequestClient {
* @param callBack 回调函数 * @param callBack 回调函数
*/ */
public void getPoliceEmergency(GetPoliceEmergencyListParams params, CustomCallBack<List<PoliceEmergency>> callBack) { public void getPoliceEmergency(GetPoliceEmergencyListParams params, CustomCallBack<List<PoliceEmergency>> 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(Constants.SFZH);
// params.setSfhm("220104198105200331"); // params.setSfhm("220104198105200331");
params.setPageSize(Constants.PAGE_SIZE + ""); params.setPageSize(Constants.PAGE_SIZE + "");
keyValues.setValue(new Gson().toJson(params)); request(Constants.POLICE_EMERGENCY_ID, new Gson().toJson(params), new CustomCallBack<String>() {
List<RequestParams.KeyValues> 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 @Override
public void onFailure(@NonNull Call call, @NonNull IOException e) { public void onError(Call call, @NonNull Exception e) {
activity.runOnUiThread(() -> callBack.onError(call, e)); callBack.onError(call, e);
// 请求失败
e.printStackTrace();
} }
@Override @Override
public void onResponse(@NonNull Call call, @NonNull Response response) { public void onSuccess(String value) {
if (!response.isSuccessful()) { List<PoliceEmergency> keyPersonList = new Gson().fromJson(value, new TypeToken<List<PoliceEmergency>>() {
activity.runOnUiThread(() -> callBack.onError(call, new IOException("Unexpected code " + response))); }.getType());
return; callBack.onSuccess(keyPersonList);
}
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<PoliceEmergency> keyPersonList = new Gson().fromJson(i.getValue(), new TypeToken<List<PoliceEmergency>>() {
}.getType());
callBack.onSuccess(keyPersonList);
}
}
} else {
callBack.onError(call, new Exception(responseParams.getMessage()));
}
});
} catch (Exception e) {
activity.runOnUiThread(() -> callBack.onError(call, e));
e.printStackTrace();
}
} }
}); });
} }
@ -463,62 +138,19 @@ public class RequestClient {
* @param str 身份证号 * @param str 身份证号
*/ */
public void getPoliceEmergencyDetail(String str, CustomCallBack<PoliceEmergencyDetail> callBack) { public void getPoliceEmergencyDetail(String str, CustomCallBack<PoliceEmergencyDetail> 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(); GetPoliceEmergencyDetailParams params = new GetPoliceEmergencyDetailParams();
params.setJcjbh(str);// params.setSfzh("220104197307276911"); params.setJcjbh(str);// params.setSfzh("220104197307276911");
params.setSfhm(Constants.SFZH); params.setSfhm(Constants.SFZH);
keyValues.setValue(new Gson().toJson(params)); request(Constants.POLICE_EMERGENCY_DETAIL_ID, new Gson().toJson(params), new CustomCallBack<String>() {
List<RequestParams.KeyValues> 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 @Override
public void onFailure(@NonNull Call call, @NonNull IOException e) { public void onError(Call call, @NonNull Exception e) {
// 请求失败 callBack.onError(call, e);
e.printStackTrace();
activity.runOnUiThread(() -> callBack.onError(call, e));
} }
@Override @Override
public void onResponse(@NonNull Call call, @NonNull Response response) { public void onSuccess(String value) {
if (!response.isSuccessful()) { PoliceEmergencyDetail keyPersonDetail = new Gson().fromJson(value, PoliceEmergencyDetail.class);
activity.runOnUiThread(() -> callBack.onError(call, new IOException("Unexpected code " + response))); callBack.onSuccess(keyPersonDetail);
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));
}
} }
}); });
} }
@ -527,66 +159,91 @@ public class RequestClient {
* 获取重点人数据统计 * 获取重点人数据统计
*/ */
public void getKeyPersonMessageCount(CustomCallBack<DataCount> callBack) { public void getKeyPersonMessageCount(CustomCallBack<DataCount> 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(); GetKeyPersonMessageCountParams params = new GetKeyPersonMessageCountParams();
params.setSfhm(Constants.SFZH); params.setSfhm(Constants.SFZH);
params.setJybh(Constants.USER_ID); params.setJybh(Constants.USER_ID);
params.setDept(Constants.USER_ORG_ID); params.setDept(Constants.USER_ORG_ID);
// params.setSfhm("220104198105200331"); // params.setSfhm("220104198105200331");
// params.setDept(Constants.USER_ORG_ID);
// params.setJybh("106222"); // params.setJybh("106222");
keyValues.setValue(new Gson().toJson(params)); // params.setDept(Constants.USER_ORG_ID);
List<RequestParams.KeyValues> keyValuesList = new ArrayList<>(); request(Constants.KEY_PERSON_MESSAGE_COUNT_ID, new Gson().toJson(params), new CustomCallBack<String>() {
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 @Override
public void onFailure(@NonNull Call call, @NonNull IOException e) { public void onError(Call call, @NonNull Exception e) {
// 请求失败 callBack.onError(call, e);
e.printStackTrace();
activity.runOnUiThread(() -> callBack.onError(call, e));
} }
@Override @Override
public void onResponse(@NonNull Call call, @NonNull Response response) { public void onSuccess(String value) {
if (!response.isSuccessful()) { DataCount dataCount = new Gson().fromJson(value, DataCount.class);
activity.runOnUiThread(() -> callBack.onError(call, new IOException("Unexpected code " + response))); callBack.onSuccess(dataCount);
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("服务器异常,请联系开发人员或稍后重试!"))); public void getApplyType(CustomCallBack<List<ApplyType>> callBack) {
return; HashMap<String, String> params = new HashMap<>();
} params.put("type", "1");
for (ResponseParams.FieldData item : responseParams.getData().getDataList()) { params.put("deptId", Constants.USER_ORG_ID);
for (ResponseParams.FieldValues i : item.getFieldValues()) { params.put("sfhm", Constants.SFZH);
DataCount dataCount = new Gson().fromJson(i.getValue(), DataCount.class); request(Constants.APPLY_TYPE_ID, new Gson().toJson(params), new CustomCallBack<String>() {
activity.runOnUiThread(() -> callBack.onSuccess(dataCount)); @Override
} public void onError(Call call, @NonNull Exception e) {
} callBack.onError(call, e);
} catch (Exception e) { }
e.printStackTrace();
activity.runOnUiThread(() -> callBack.onError(call, e)); @Override
} public void onSuccess(String value) {
List<ApplyType> applyTypes = new Gson().fromJson(value, new TypeToken<List<ApplyType>>() {
}.getType());
callBack.onSuccess(applyTypes);
}
});
}
/**
* 获取申请部门
*/
public void getApplyDept(CustomCallBack<List<ApplyDept>> callBack) {
HashMap<String, String> params = new HashMap<>();
params.put("type", "2");
params.put("deptId", Constants.USER_ORG_ID);
params.put("sfhm", Constants.SFZH);
request(Constants.APPLY_TYPE_ID, new Gson().toJson(params), new CustomCallBack<String>() {
@Override
public void onError(Call call, @NonNull Exception e) {
callBack.onError(call, e);
}
@Override
public void onSuccess(String value) {
List<ApplyDept> applyTypes = new Gson().fromJson(value, new TypeToken<List<ApplyDept>>() {
}.getType());
callBack.onSuccess(applyTypes);
}
});
}
/**
* 获取申请支援审批人
*/
public void getApplyPerson(CustomCallBack<List<ApplyPerson>> callBack) {
HashMap<String, String> params = new HashMap<>();
params.put("type", "3");
params.put("deptId", Constants.USER_ORG_ID);
params.put("sfhm", Constants.SFZH);
request(Constants.APPLY_TYPE_ID, new Gson().toJson(params), new CustomCallBack<String>() {
@Override
public void onError(Call call, @NonNull Exception e) {
callBack.onError(call, e);
}
@Override
public void onSuccess(String value) {
List<ApplyPerson> applyTypes = new Gson().fromJson(value, new TypeToken<List<ApplyPerson>>() {
}.getType());
callBack.onSuccess(applyTypes);
} }
}); });
} }

View File

@ -0,0 +1,32 @@
package com.police.policedatasystem.improve.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.police.policedatasystem.databinding.FragmentImproveBinding;
/**
* 改进意见
*/
public class ImproveFragment extends Fragment {
private FragmentImproveBinding binding;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = FragmentImproveBinding.inflate(inflater);
initView();
return binding.getRoot();
}
private void initView() {
}
}

View File

@ -0,0 +1,67 @@
package com.police.policedatasystem.improve.viewmodel;
import androidx.annotation.NonNull;
import com.google.gson.Gson;
import com.police.policedatasystem.data.activity.KeyPersonDetailActivity;
import com.police.policedatasystem.data.activity.PoliceEmergencyDetailActivity;
import com.police.policedatasystem.data.fragment.DataFragment;
import com.police.policedatasystem.data.model.DataCount;
import com.police.policedatasystem.data.model.KeyPerson;
import com.police.policedatasystem.data.model.KeyPersonDetail;
import com.police.policedatasystem.data.model.PoliceEmergency;
import com.police.policedatasystem.data.model.PoliceEmergencyDetail;
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.improve.fragment.ImproveFragment;
import com.police.policedatasystem.indexActivity;
import com.police.policedatasystem.util.Constants;
import com.police.policedatasystem.util.UiUtils;
import java.util.List;
import okhttp3.Call;
public class ImproveViewModel {
private final ImproveFragment fragment;
public int pageNum = 1;
public indexActivity activity;
public ImproveViewModel(ImproveFragment 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<List<KeyPerson>>() {
// @Override
// public void onError(@NonNull Call call, @NonNull Exception e) {
// UiUtils.toast(e.getMessage());
// fragment.loadingNone();
// }
//
// @Override
// public void onSuccess(List<KeyPerson> value) {
// fragment.loadingNone();
// if (value != null) {
// fragment.personList.addAll(value);
// }
// fragment.adapter.notifyDataSetChanged();
// }
// });
}
}

View File

@ -15,22 +15,24 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import com.police.policedatasystem.apply.fragment.ApplyFragment;
import com.police.policedatasystem.data.fragment.DataFragment;
import com.police.policedatasystem.databinding.ActivityIndexBinding; 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.http.RequestClient;
import com.police.policedatasystem.improve.fragment.ImproveFragment;
import com.police.policedatasystem.main.viewmodel.IndexViewModel;
import com.police.policedatasystem.mine.fragment.MineFragment;
import com.police.policedatasystem.util.Constants; import com.police.policedatasystem.util.Constants;
import com.police.policedatasystem.viewmodel.IndexViewModel;
public class indexActivity extends AppCompatActivity { public class indexActivity extends AppCompatActivity {
public ActivityIndexBinding binding; public ActivityIndexBinding binding;
private IndexViewModel viewModel; private IndexViewModel viewModel;
public RequestClient requestClient; public RequestClient requestClient;
public boolean findAddress = false; public boolean findAddress = false;
private final DataFragment dataFragment = new DataFragment(); private final DataFragment dataFragment = new DataFragment();
private final ApplyFragment applyFragment= new ApplyFragment(); private final ApplyFragment applyFragment = new ApplyFragment();
private final MineFragment mineFragment= new MineFragment(); private final MineFragment mineFragment = new MineFragment();
private final ImproveFragment improveFragment = new ImproveFragment();
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -51,6 +53,8 @@ public class indexActivity extends AppCompatActivity {
binding.navBarGroup.navBarText2.setTextColor(getColor(R.color.normal_color)); binding.navBarGroup.navBarText2.setTextColor(getColor(R.color.normal_color));
binding.navBarGroup.navBarIcon3.setImageResource(R.mipmap.icon_mine_normal); binding.navBarGroup.navBarIcon3.setImageResource(R.mipmap.icon_mine_normal);
binding.navBarGroup.navBarText3.setTextColor(getColor(R.color.normal_color)); binding.navBarGroup.navBarText3.setTextColor(getColor(R.color.normal_color));
binding.navBarGroup.navBarIcon4.setImageResource(R.mipmap.icon_improve_normal);
binding.navBarGroup.navBarText4.setTextColor(getColor(R.color.normal_color));
}); });
binding.navBarGroup.navBar2.setOnClickListener(view -> { binding.navBarGroup.navBar2.setOnClickListener(view -> {
replaceFragment(applyFragment); replaceFragment(applyFragment);
@ -60,6 +64,8 @@ public class indexActivity extends AppCompatActivity {
binding.navBarGroup.navBarText2.setTextColor(getColor(R.color.selected_color)); binding.navBarGroup.navBarText2.setTextColor(getColor(R.color.selected_color));
binding.navBarGroup.navBarIcon3.setImageResource(R.mipmap.icon_mine_normal); binding.navBarGroup.navBarIcon3.setImageResource(R.mipmap.icon_mine_normal);
binding.navBarGroup.navBarText3.setTextColor(getColor(R.color.normal_color)); binding.navBarGroup.navBarText3.setTextColor(getColor(R.color.normal_color));
binding.navBarGroup.navBarIcon4.setImageResource(R.mipmap.icon_improve_normal);
binding.navBarGroup.navBarText4.setTextColor(getColor(R.color.normal_color));
}); });
binding.navBarGroup.navBar3.setOnClickListener(view -> { binding.navBarGroup.navBar3.setOnClickListener(view -> {
replaceFragment(mineFragment); replaceFragment(mineFragment);
@ -69,6 +75,19 @@ public class indexActivity extends AppCompatActivity {
binding.navBarGroup.navBarText2.setTextColor(getColor(R.color.normal_color)); binding.navBarGroup.navBarText2.setTextColor(getColor(R.color.normal_color));
binding.navBarGroup.navBarIcon3.setImageResource(R.mipmap.icon_mine_selected); binding.navBarGroup.navBarIcon3.setImageResource(R.mipmap.icon_mine_selected);
binding.navBarGroup.navBarText3.setTextColor(getColor(R.color.selected_color)); binding.navBarGroup.navBarText3.setTextColor(getColor(R.color.selected_color));
binding.navBarGroup.navBarIcon4.setImageResource(R.mipmap.icon_improve_normal);
binding.navBarGroup.navBarText4.setTextColor(getColor(R.color.normal_color));
});
binding.navBarGroup.navBar4.setOnClickListener(view -> {
replaceFragment(improveFragment);
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_normal);
binding.navBarGroup.navBarText3.setTextColor(getColor(R.color.normal_color));
binding.navBarGroup.navBarIcon4.setImageResource(R.mipmap.icon_improve_selected);
binding.navBarGroup.navBarText4.setTextColor(getColor(R.color.selected_color));
}); });
replaceFragment(dataFragment); replaceFragment(dataFragment);
registerBroadcastReceiver(); registerBroadcastReceiver();

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem; package com.police.policedatasystem.main;
import android.app.Application; import android.app.Application;
import android.os.Handler; import android.os.Handler;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.model; package com.police.policedatasystem.main.model;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.model; package com.police.policedatasystem.main.model;
import java.io.Serializable; import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.viewmodel; package com.police.policedatasystem.main.viewmodel;
import com.police.policedatasystem.indexActivity; import com.police.policedatasystem.indexActivity;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.main; package com.police.policedatasystem.main.widget;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.widget; package com.police.policedatasystem.main.widget;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.widget; package com.police.policedatasystem.main.widget;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.widget; package com.police.policedatasystem.main.widget;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.widget; package com.police.policedatasystem.main.widget;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;

View File

@ -1,4 +1,4 @@
package com.police.policedatasystem.fragment; package com.police.policedatasystem.mine.fragment;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;

View File

@ -1,6 +1,6 @@
package com.police.policedatasystem.util; package com.police.policedatasystem.util;
import com.police.policedatasystem.model.ResourceList; import com.police.policedatasystem.main.model.ResourceList;
import java.util.HashMap; import java.util.HashMap;

View File

@ -3,7 +3,7 @@ package com.police.policedatasystem.util;
import android.util.Base64; import android.util.Base64;
import android.widget.Toast; import android.widget.Toast;
import com.police.policedatasystem.App; import com.police.policedatasystem.main.App;
import java.util.UUID; import java.util.UUID;

View File

@ -9,14 +9,14 @@
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/fc_view" android:id="@+id/fc_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"
android:layout_marginBottom="50dp" />
<include <include
android:id="@+id/nav_bar_group" android:id="@+id/nav_bar_group"
android:visibility="invisible"
layout="@layout/bottom_navigation_view" /> layout="@layout/bottom_navigation_view" />
<com.police.policedatasystem.widget.WaterMarkView <com.police.policedatasystem.main.widget.WaterMarkView
android:id="@+id/wm_wm" android:id="@+id/wm_wm"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -878,7 +878,7 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>
<com.police.policedatasystem.widget.WaterMarkView <com.police.policedatasystem.main.widget.WaterMarkView
android:id="@+id/wm" android:id="@+id/wm"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -563,7 +563,7 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>
<com.police.policedatasystem.widget.WaterMarkView <com.police.policedatasystem.main.widget.WaterMarkView
android:id="@+id/wm" android:id="@+id/wm"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -76,4 +76,28 @@
android:text="我的赋能" android:text="我的赋能"
android:textColor="@color/normal_color" /> android:textColor="@color/normal_color" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/nav_bar_4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/nav_bar_icon_4"
android:layout_width="30dp"
android:layout_height="30dp"
android:padding="5dp"
android:src="@mipmap/icon_improve_normal" />
<TextView
android:id="@+id/nav_bar_text_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="改进意见"
android:textColor="@color/normal_color" />
</LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/all_7_fff_bg"
android:padding="10dp">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="选择部门"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rcv"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_marginTop="40dp"
android:verticalSpacing="8dp" />
</RelativeLayout>

View File

@ -4,73 +4,74 @@
android:background="@drawable/all_7_line_ccc_bg" android:background="@drawable/all_7_line_ccc_bg"
android:paddingHorizontal="15dp" android:paddingHorizontal="15dp"
android:paddingVertical="2dp" android:paddingVertical="2dp"
android:id="@+id/ll_apply_type_group"
android:orientation="vertical"> android:orientation="vertical">
<TextView <!-- <TextView-->
android:id="@+id/textView1" <!-- android:id="@+id/textView1"-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="40dp" <!-- android:layout_height="40dp"-->
android:background="@color/white" <!-- android:background="@color/white"-->
android:clickable="true" <!-- android:clickable="true"-->
android:focusable="true" <!-- android:focusable="true"-->
android:gravity="center_vertical" <!-- android:gravity="center_vertical"-->
android:text="处置警情" <!-- android:text="处置警情"-->
android:textSize="16sp" /> <!-- android:textSize="16sp" />-->
<TextView <!-- <TextView-->
android:id="@+id/textView2" <!-- android:id="@+id/textView2"-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="40dp" <!-- android:layout_height="40dp"-->
android:background="@color/white" <!-- android:background="@color/white"-->
android:clickable="true" <!-- android:clickable="true"-->
android:gravity="center_vertical" <!-- android:gravity="center_vertical"-->
android:focusable="true" <!-- android:focusable="true"-->
android:text="处置案情" <!-- android:text="处置案情"-->
android:textSize="16sp" /> <!-- android:textSize="16sp" />-->
<TextView <!-- <TextView-->
android:id="@+id/textView3" <!-- android:id="@+id/textView3"-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="40dp" <!-- android:layout_height="40dp"-->
android:background="@color/white" <!-- android:background="@color/white"-->
android:clickable="true" <!-- android:clickable="true"-->
android:focusable="true" <!-- android:focusable="true"-->
android:gravity="center_vertical" <!-- android:gravity="center_vertical"-->
android:text="管控重点人" <!-- android:text="管控重点人"-->
android:textSize="16sp" /> <!-- android:textSize="16sp" />-->
<TextView <!-- <TextView-->
android:id="@+id/textView4" <!-- android:id="@+id/textView4"-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="40dp" <!-- android:layout_height="40dp"-->
android:background="@color/white" <!-- android:background="@color/white"-->
android:clickable="true" <!-- android:clickable="true"-->
android:focusable="true" <!-- android:focusable="true"-->
android:gravity="center_vertical" <!-- android:gravity="center_vertical"-->
android:text="追踪逃犯" <!-- android:text="追踪逃犯"-->
android:textSize="16sp" /> <!-- android:textSize="16sp" />-->
<TextView <!-- <TextView-->
android:id="@+id/textView5" <!-- android:id="@+id/textView5"-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="40dp" <!-- android:layout_height="40dp"-->
android:background="@color/white" <!-- android:background="@color/white"-->
android:clickable="true" <!-- android:clickable="true"-->
android:focusable="true" <!-- android:focusable="true"-->
android:gravity="center_vertical" <!-- android:gravity="center_vertical"-->
android:text="核查线索" <!-- android:text="核查线索"-->
android:textSize="16sp" /> <!-- android:textSize="16sp" />-->
<TextView <!-- <TextView-->
android:id="@+id/textView6" <!-- android:id="@+id/textView6"-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="40dp" <!-- android:layout_height="40dp"-->
android:background="@color/white" <!-- android:background="@color/white"-->
android:clickable="true" <!-- android:clickable="true"-->
android:focusable="true" <!-- android:focusable="true"-->
android:gravity="center_vertical" <!-- android:gravity="center_vertical"-->
android:text="核验信息" <!-- android:text="核验信息"-->
android:textSize="16sp" /> <!-- android:textSize="16sp" />-->
<!-- 可以添加更多菜单项 --> <!-- &lt;!&ndash; 可以添加更多菜单项 &ndash;&gt;-->
</LinearLayout> </LinearLayout>

View File

@ -72,9 +72,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:text="处置警情"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" /> android:textSize="16sp"
tools:text="处置警情" />
<View <View
android:layout_width="10dp" android:layout_width="10dp"
@ -93,7 +93,9 @@
android:layout_below="@id/table_group" android:layout_below="@id/table_group"
android:layout_marginTop="15dp"> android:layout_marginTop="15dp">
<include layout="@layout/item_apply_fragment_1" /> <include
android:id="@+id/include_apply"
layout="@layout/item_apply_fragment_1" />
</FrameLayout> </FrameLayout>
<RelativeLayout <RelativeLayout

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@mipmap/bg" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="58dp"
android:gravity="center"
android:paddingTop="8dp">
<View
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/jinghui" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="吉林公安大数据实战赋能系统"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="100dp"
android:background="@drawable/top_10_f7_bg" />
<FrameLayout
android:id="@+id/mine_table_group"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_marginHorizontal="10dp"
android:layout_marginTop="60dp"
android:background="@drawable/all_7_fff_bg">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:text="意见:"
android:textColor="@color/black"
android:textSize="15sp" />
<EditText
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginVertical="15dp"
android:layout_marginStart="60dp"
android:layout_marginEnd="15dp"
android:background="@drawable/all_7_line_ccc_bg"
android:gravity="top"
android:hint="请输入改进意见"
android:padding="10dp"
android:textColor="@color/normal_color"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@drawable/all_7_main_bg"
android:paddingHorizontal="20dp"
android:paddingVertical="5dp"
android:layout_marginBottom="50dp"
android:text="提交"
android:textColor="@color/white"
android:textSize="18sp" />
</FrameLayout>
<RelativeLayout
android:id="@+id/mine_rl_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ProgressBar
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true" />
</RelativeLayout>
</RelativeLayout>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/all_7_fff_bg"
android:padding="10dp">
<TextView
android:id="@+id/tv_item_text"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:gravity="center"
android:textColor="@color/normal_color"
android:textSize="16sp"
tools:text="item内容" />
</RelativeLayout>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.police.policedatasystem.widget.WaterMarkView xmlns:android="http://schemas.android.com/apk/res/android" <com.police.policedatasystem.main.widget.WaterMarkView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB