其他逻辑处理

This commit is contained in:
wds 2021-06-25 18:28:12 +08:00
parent 8836e4c302
commit ffa24988c3
14 changed files with 568 additions and 113 deletions

View File

@ -7,6 +7,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
@ -40,7 +41,9 @@ public class ChargingPileAdapter extends RecyclerView.Adapter<ChargingPileAdapte
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.rlItem.setBackgroundColor(Color.parseColor("#03A9F4"));
ChargingPileEntity chargingPileEntity = chargingPileEntities.get(position);
holder.textView.setText(chargingPileEntity.getName());
holder.rlItem.setBackgroundColor(Color.parseColor("#03A9F4"));
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -57,10 +60,12 @@ public class ChargingPileAdapter extends RecyclerView.Adapter<ChargingPileAdapte
public class ViewHolder extends RecyclerView.ViewHolder {
ImageView imageView;
RelativeLayout rlItem;
TextView textView;
public ViewHolder(@NonNull View itemView) {
super(itemView);
imageView=itemView.findViewById(R.id.image);
rlItem=itemView.findViewById(R.id.rl_item);
textView=itemView.findViewById(R.id.tv_text);
}
}
}

View File

@ -53,6 +53,8 @@ public class Constant {
public static final int MAIN_CHARGING_PILE= 18;//充电桩的Fragment 对地图页面marker 的一个展示
public static final int CHARGING_PILE_WORD = 20;//地图页面marker 的经纬都回传
public static final int CHARGING_PILE_STATION = 22;//将充电桩的数据回传给充电站
public static final int MAIN_OTHER = 23;//其他的Fragment 对地图页面marker 的一个展示
public static final int OTHER_WORD = 25;//地图页面marker 的经纬都回传
/**
* 用户当前位置
*/

View File

@ -161,8 +161,6 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
json.put("answer", examBeans.get(i).getAnswer());
jsonArray.put(json);
}
examBeans.clear();
Log.d("TAG", "initExamSubmit: " + jsonArray.toString());
OkGoBuilder.getInstance()

View File

@ -76,14 +76,14 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
String[] scutcheon = new String[]{"不存在", "存在"};
String[] stake = new String[]{"可以使用", "不可使用", "维修中", "建设中", "规划中"};
private ArrayAdapter<String> adapterType, adapterScutcheon, adapterStake;
private RadioGroup radioGroup;
private RadioButton radioButton1, radioButton2, radioButton3, radioButton4, radioButton5, radioButton6;
private RelativeLayout rlPanorama, rlCoding, rlEquipment, rlFacility, rlUsable, rlAvailable, rlParking, rlNumber, rlScutcheon, rlDevice;
private ImageView ivPanorama, ivCoding, ivEquipment, ivFacility, ivUsable, ivAvailable, ivParking, ivNumber, ivScutcheon, ivDevice;
private ChargingPileDao chargingPileDao;
private int cp_floor = 1;
private int sign_exist = 0;
private int cp_availableState = 0;
private CheckBox checkButton1, checkButton2, checkButton3, checkButton4, checkButton5, checkButton6;
private int pid;
public static ChargingPileFragment newInstance(Bundle bundle) {
ChargingPileFragment fragment = new ChargingPileFragment();
@ -155,13 +155,65 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
});
checkBoxRight.setVisibility(View.GONE);
editNameContent = findViewById(R.id.tv_name_content);
radioGroup = findViewById(R.id.radio_group);
radioButton1 = findViewById(R.id.radio_button1);
radioButton2 = findViewById(R.id.radio_button2);
radioButton3 = findViewById(R.id.radio_button3);
radioButton4 = findViewById(R.id.radio_button4);
radioButton5 = findViewById(R.id.radio_button5);
radioButton6 = findViewById(R.id.radio_button6);
checkButton1 = findViewById(R.id.check_button1);
checkButton1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){
Toast.makeText(getContext(), "1", Toast.LENGTH_SHORT).show();
checkButton2.setChecked(false);
checkButton3.setChecked(false);
checkButton4.setChecked(false);
checkButton5.setChecked(false);
checkButton6.setChecked(false);
}
}
});
checkButton2 = findViewById(R.id.check_button2);
checkButton2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){
Toast.makeText(getContext(), "2", Toast.LENGTH_SHORT).show();
}
}
});
checkButton3 = findViewById(R.id.check_button3);
checkButton3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){
Toast.makeText(getContext(), "3", Toast.LENGTH_SHORT).show();
}
}
});
checkButton4 = findViewById(R.id.check_button4);
checkButton4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){
Toast.makeText(getContext(), "4", Toast.LENGTH_SHORT).show();
}
}
});
checkButton5 = findViewById(R.id.check_button5);
checkButton5.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){
Toast.makeText(getContext(), "5", Toast.LENGTH_SHORT).show();
}
}
});
checkButton6 = findViewById(R.id.check_button6);
checkButton6.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){
Toast.makeText(getContext(), "6", Toast.LENGTH_SHORT).show();
}
}
});
spinnerType = findViewById(R.id.spinner_type);
adapterType = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, type);
adapterType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //设置下拉列表框的下拉选项样式
@ -206,8 +258,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) { }
public void onNothingSelected(AdapterView<?> parent) {
}
});
spinnerScutcheon = findViewById(R.id.spinner_scutcheon);
adapterScutcheon = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, scutcheon);
@ -303,6 +357,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
editDescribe = findViewById(R.id.edit_describe);
btnSaveLocal = findViewById(R.id.btn_save_local);
btnSaveLocal.setOnClickListener(this::onClick);
pid = getArguments().getInt("pid",0);
}
@ -376,6 +431,17 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} else {
chargingPileEntity.setMemo(describe);
}
if (pid == 0) {
Toast.makeText(getActivity(), "没有关联充电站", Toast.LENGTH_SHORT).show();
}else {
chargingPileEntity.setFid(pid);
}
new Thread(new Runnable() {
@Override
public void run() {
chargingPileDao.insertChargingPileEntity(chargingPileEntity);
}
}).start();
Message obtain = Message.obtain();
obtain.what = Constant.CHARGING_PILE_STATION;
obtain.obj = chargingPileEntity;

View File

@ -95,7 +95,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private boolean aBoolean = false;
private PoiEntity poiEntity;
private PoiEntity showPoiEntity;
private ArrayList<ChargingPileEntity> chargingPileEntities;
private ChargingPileDao chargingPileDao;
public static ChargingStationFragment newInstance(Bundle bundle) {
@ -299,9 +298,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
recyclerStation.setLayoutManager(new GridLayoutManager(getContext(), 3));
chargingPileAdapter = new ChargingPileAdapter(getContext());
recyclerStation.setAdapter(chargingPileAdapter);
/**
* 数据处理
*/
showPoiEntity = (PoiEntity) getArguments().getSerializable("PoiEntity");
if (showPoiEntity != null) {
editNameContent.setText(showPoiEntity.getName());
@ -310,13 +308,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
String x = showPoiEntity.getX();
String y = showPoiEntity.getY();
int id = showPoiEntity.getId();
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
new Thread(new Runnable() {
@Override
public void run() {
List<ChargingPileEntity> chargingPile = chargingPileDao.getChargingPile();
for (int i = 0; i < chargingPile.size(); i++) {
ChargingPileEntity chargingPileEntity = chargingPile.get(i);
if (id == chargingPileEntity.getFid()) {
if (showPoiEntity.getTaskId() == chargingPileEntity.getFid()) {
chargingPileEntities.add(chargingPileEntity);
}
}
@ -361,8 +360,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
phoneData = new ArrayList<>();
//存储图片地址
photoBean = new ArrayList<>();
//充电桩的数据
chargingPileEntities = new ArrayList<>();
}
@ -374,13 +371,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Toast.makeText(getContext(), inode, Toast.LENGTH_SHORT).show();
} else if (data.what == Constant.CHARGING_PILE_STATION) {
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) data.obj;
chargingPileEntity.setFid(poiEntity.getId());
new Thread(new Runnable() {
@Override
public void run() {
chargingPileDao.insertChargingPileEntity(chargingPileEntity);
}
}).start();
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
chargingPileEntities.add(chargingPileEntity);
chargingPileAdapter.setChargingPileEntities(chargingPileEntities);
@ -428,7 +418,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Toast.makeText(getActivity(), "请输入任务描述", Toast.LENGTH_SHORT).show();
return;
} else {
poiEntity.setMemo(describe);
poiEntity.setDescribe(describe);
}
if (phoneData.size() <= 0) {
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
@ -456,6 +446,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
poiEntity.setCreateTime(format);
poiEntity.setType(2);
poiEntity.setTaskStatus(0);
poiEntity.setTaskId(101);
new Thread(new Runnable() {
@Override
public void run() {
@ -519,7 +510,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
case R.id.linear_charging_pile:
Message obtains = Message.obtain();
obtains.what = Constant.CHARGING_STATION;
obtains.obj = true;
obtains.obj = 101;
EventBus.getDefault().post(obtains);
break;
}

View File

@ -46,7 +46,6 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
return R.layout.fragment_has_submit;
}
@Override
protected void initView() {
super.initView();
clPoi = (ConstraintLayout) findViewById(R.id.cl_poi);

View File

@ -1,30 +1,79 @@
package com.navinfo.outdoor.fragment;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.slidingpanelayout.widget.SlidingPaneLayout;
import com.bumptech.glide.Glide;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.bean.Info;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.PhotoPathUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import static android.app.Activity.RESULT_OK;
/**
* 寻宝-上报-其他的fragment
*/
public class OtherFragment extends BaseDrawerFragment implements View.OnClickListener {
private ImageView ivOtherFinal;
private Spinner spinnerOther;
String[] others = new String[]{"下拉选择", "门牌","道路施工","标牌采集","公交","其他"};
private String inode;
private EditText editTaskName,editOtherDescribe;
private RelativeLayout rlPicture;
private ImageView ivPicture;
private RelativeLayout rlPictures;
private ImageView ivPictures;
private Button btnOtherLocal;
private Button btnOtherUploading;
private List<Info> photoBean;
private PoiDatabase poiDatabase;
private PoiDao poiDao;
private boolean aBoolean=false;
private boolean bBoolean=false;
private PoiEntity showPoiEntity;
public static OtherFragment newInstance(Bundle bundle) {
OtherFragment fragment = new OtherFragment();
@ -36,18 +85,23 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
protected int getLayout() {
return R.layout.fragment_other;
}
@Override
public void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
}
@Override
public void onResume() {
super.onResume();
View header = LayoutInflater.from(getActivity()).inflate(R.layout.other_header, null);
Message obtain = Message.obtain();
obtain.what = Constant.MAIN_HEADER;
obtain.obj = header;
EventBus.getDefault().post(obtain);
//点击按钮返回上一页
ImageView ivOtherFinal = header.findViewById(R.id.iv_other_final);
ivOtherFinal.setOnClickListener(new View.OnClickListener() {
header.findViewById(R.id.iv_final).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle arguments = getArguments();
@ -61,31 +115,262 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
obtain.what= Constant.TREASURE_FRAGMENT;
obtain.obj=isSliding;
EventBus.getDefault().post(obtain);
Message mainButtonVisiableMsg = Message.obtain();
mainButtonVisiableMsg.what= Constant.MAIN_BUTTON_VISIABLE;
mainButtonVisiableMsg.obj= View.VISIBLE;
EventBus.getDefault().post(mainButtonVisiableMsg);
}
onBackPressed();
}
});
}
@Override
protected void initView() {
super.initView();
//存储图片地址
photoBean = new ArrayList<>();
}
@Subscribe
public void onEvent(Message data) {
if (data.what == Constant.OTHER_WORD) {
inode = data.obj.toString();
Toast.makeText(getContext(), inode, Toast.LENGTH_SHORT).show();
}
}
@Override
protected void initData() {
super.initData();
poiDatabase = PoiDatabase.getInstance(getContext());
poiDao = poiDatabase.getPoiDao();
spinnerOther = findViewById(R.id.spinner_other);
ArrayAdapter<String> adapterOthers = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, others);
adapterOthers.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //设置下拉列表框的下拉选项样式
spinnerOther.setAdapter(adapterOthers);
spinnerOther.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
break;
case 1:
Toast.makeText(getActivity(), others[1], Toast.LENGTH_SHORT).show();
break;
case 2:
Toast.makeText(getActivity(), others[2], Toast.LENGTH_SHORT).show();
break;
case 3:
Toast.makeText(getActivity(), others[3], Toast.LENGTH_SHORT).show();
break;
case 4:
Toast.makeText(getActivity(), others[4], Toast.LENGTH_SHORT).show();
break;
case 5:
Toast.makeText(getActivity(), others[5], Toast.LENGTH_SHORT).show();
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {}
});
CheckBox checkPot = findViewById(R.id.check_pot);
checkPot.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Message obtain = Message.obtain();
obtain.what = Constant.MAIN_OTHER;
obtain.obj = isChecked;
EventBus.getDefault().post(obtain);
}
});
editTaskName = findViewById(R.id.et_task_name);
rlPicture = findViewById(R.id.rl_picture);
rlPicture.setOnClickListener(this::onClick);
ivPicture = findViewById(R.id.iv_picture);
rlPictures = findViewById(R.id.rl_pictures);
rlPictures.setOnClickListener(this::onClick);
ivPictures = findViewById(R.id.iv_pictures);
editOtherDescribe = findViewById(R.id.edit_other_describe);
btnOtherLocal = findViewById(R.id.btn_other_local);
btnOtherLocal.setOnClickListener(this::onClick);
btnOtherUploading = findViewById(R.id.btn_other_uploading);
btnOtherUploading.setOnClickListener(this::onClick);
showPoiEntity = (PoiEntity) getArguments().getSerializable("PoiEntity");
if (showPoiEntity != null) {
editTaskName.setText(showPoiEntity.getName());
inode = showPoiEntity.getX() + "," + showPoiEntity.getY();
editOtherDescribe.setText(showPoiEntity.getDescribe());
if (showPoiEntity.getPhotoInfo() != null) {
if (showPoiEntity.getPhotoInfo().get(0).getPhoto() != null) {
Glide.with(getActivity()).load(showPoiEntity.getPhotoInfo().get(0).getPhoto()).into(ivPicture);
}
if (showPoiEntity.getPhotoInfo().get(1).getPhoto() != null) {
Glide.with(getActivity()).load(showPoiEntity.getPhotoInfo().get(1).getPhoto()).into(ivPictures);
}
}
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.rl_picture:
Intent intentPicture = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPicture, 101);
break;
case R.id.rl_pictures:
Intent intentPictures = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPictures, 102);
break;
case R.id.btn_other_local:
XXPermissions.with(this)
//读写权限
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
.request(new OnPermissionCallback() {
@Override
public void onGranted(List<String> permissions, boolean all) {
if (all) {
//保存数据库
PoiEntity poiEntity = new PoiEntity();
String name = editTaskName.getText().toString().trim();//名称
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
return;
} else {
poiEntity.setName(name);
}
if (inode == null || inode.equals("")) {
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
return;
} else {
String[] split = inode.split(",");
poiEntity.setX(split[0]);
poiEntity.setY(split[1]);
}
String describe = editOtherDescribe.getText().toString().trim();
if (describe == null || describe.equals("")) {
Toast.makeText(getActivity(), "请输入任务描述", Toast.LENGTH_SHORT).show();
return;
} else {
poiEntity.setDescribe(describe);
}
if (photoBean.size() < 0) {
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
return;
} else {
poiEntity.setPhotoInfo(photoBean);
}
if (!aBoolean) {
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
return;
}
if (!bBoolean) {
Toast.makeText(getActivity(), "请拍照 名称", Toast.LENGTH_SHORT).show();
return;
}
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format);
poiEntity.setType(3);
poiEntity.setTaskStatus(0);
new Thread(new Runnable() {
@Override
public void run() {
poiDao.insertPoiEntity(poiEntity);
}
}).start();
Message obtains = Message.obtain();
obtains.what = Constant.TREASURE_FRAGMENT;
obtains.obj = false;
EventBus.getDefault().post(obtains);
onBackPressed();
} else {
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onDenied(List<String> permissions, boolean never) {
if (never) {
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
// 如果是被永久拒绝就跳转到应用权限系统设置页面
XXPermissions.startPermissionActivity(getActivity(), permissions);
}
}
});
break;
case R.id.btn_other_uploading:
break;
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 101 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 101);
return false;
}
});
} else {
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);//照片路径
Info info = new Info();
info.setPhoto(takePhotoPath);
photoBean.add(info);
ivPicture.setImageBitmap(bitmap);//显示图像
aBoolean=true;
}
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 102);
return false;
}
});
} else {
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);//照片路径
Info info = new Info();
info.setPhoto(takePhotoPath);
photoBean.add(info);
ivPictures.setImageBitmap(bitmap);//显示图像
bBoolean=true;
}
}
}
@Override
public void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
super.onDestroy();
}
}

View File

@ -207,11 +207,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
initFilterMarker(poiEntities);
} else if (data.what == Constant.TREASURE_WORD) { // POI采集-移动位置
initPoiMarker(Boolean.valueOf((Boolean) data.obj), Constant.POI_WORD);
}else if (data.what==Constant.MAIN_CHARGING_STATION){//充电站采集-移动位置
initPoiMarker(Boolean.valueOf((Boolean) data.obj),Constant.CHARGING_STATION_WORD);
}else if (data.what ==Constant.MAIN_CHARGING_PILE){//充电桩采集-移动位置
initPoiMarker(Boolean.valueOf((Boolean)data.obj),Constant.CHARGING_PILE_WORD);
} else if (data.what == Constant.MAIN_CHARGING_STATION) {//充电站采集-移动位置
initPoiMarker(Boolean.valueOf((Boolean) data.obj), Constant.CHARGING_STATION_WORD);
} else if (data.what == Constant.MAIN_CHARGING_PILE) {//充电桩采集-移动位置
initPoiMarker(Boolean.valueOf((Boolean) data.obj), Constant.CHARGING_PILE_WORD);
} else if (data.what == Constant.MAIN_OTHER) {//其他采集-移动位置
initPoiMarker(Boolean.valueOf((Boolean) data.obj), Constant.OTHER_WORD);
} else if (data.what == Constant.TREASURE_FRAGMENT) {
if ((boolean) data.obj == true) {
frameLayout.setVisibility(View.GONE);
@ -237,14 +238,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
sliding_layout.setPanelHeight(1000);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
}
}else if (data.what==Constant.CHARGING_STATION){//充电站的充电桩
if ((boolean)data.obj){
Bundle bundle = new Bundle();
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
showSlidingFragment(chargingPileFragment);
}
} else if (data.what == Constant.CHARGING_STATION) {//充电站的充电桩
Bundle bundle = new Bundle();
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
bundle.putInt("pid", (Integer) data.obj);
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
showSlidingFragment(chargingPileFragment);
}
@ -274,7 +273,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
private void initPoiMarker(Boolean t,int aInt) {
private void initPoiMarker(Boolean t, int aInt) {
if (t == true) {
//移动地图
CameraUpdate cameraSigma =
@ -475,14 +474,15 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case R.id.iv_message:
Intent messageIntent = new Intent(getContext(), FragmentManagement.class);
messageIntent.putExtra("tag",35);
startActivity(messageIntent);
messageIntent.putExtra("tag", 35);
startActivity(messageIntent);
break;
}
}
/**
* header 头部布局
*
* @param view
*/
public void initHeader(View view) {

View File

@ -18,7 +18,7 @@ import static androidx.room.ForeignKey.CASCADE;
* PoiEntity实体类的id和ChargingPileEntity实体类的pileId相关联
* 注解中包含Delete = CASCADE 你可以告诉SQLite如果相应的PoiEntity实例被删除那么删除这个PoiEntity下的所有ChargingPileEntity
*/
@Entity(tableName = "pile", foreignKeys = @ForeignKey(entity = PoiEntity.class,parentColumns = "id",childColumns = "pileId",onDelete =CASCADE))
@Entity(tableName = "pile")
public class ChargingPileEntity {
@PrimaryKey(autoGenerate = true) // 设置主键并且自动生长
private int pileId;

View File

@ -120,7 +120,81 @@
android:layout_margin="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/linear_name" />
<RadioGroup
<LinearLayout
android:id="@+id/ll_charging"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:padding="2dp"
android:orientation="vertical"
android:background="@drawable/underline"
app:layout_constraintTop_toBottomOf="@id/text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<CheckBox
android:id="@+id/check_button1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="对所有车辆开放"
/>
<CheckBox
android:id="@+id/check_button2"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="对环卫车开放"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<CheckBox
android:id="@+id/check_button3"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="对公交车开放"
/>
<CheckBox
android:id="@+id/check_button4"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="对出租车开放"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
>
<CheckBox
android:id="@+id/check_button5"
android:layout_width="150dp"
android:layout_height="80dp"
android:text="对除环卫,公交,出租,品牌,之外的其他 特种车辆开放"
/>
<CheckBox
android:id="@+id/check_button6"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="对某品牌汽车开放"
/>
</LinearLayout>
</LinearLayout>
<!-- <RadioGroup
android:id="@+id/radio_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -169,7 +243,7 @@
android:text="对某品牌汽车开放"
/>
</RadioGroup>
</RadioGroup>-->
<RelativeLayout
android:id="@+id/linear_type"
android:layout_width="match_parent"
@ -177,7 +251,7 @@
android:layout_margin="10dp"
android:padding="2dp"
android:background="@drawable/underline"
app:layout_constraintTop_toBottomOf="@id/radio_group"
app:layout_constraintTop_toBottomOf="@id/ll_charging"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
@ -311,7 +385,6 @@
android:layout_height="wrap_content"
android:padding="2dp"
android:background="@drawable/underline"
app:layout_constraintTop_toBottomOf="@id/radio_group"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
@ -497,7 +570,6 @@
android:layout_height="wrap_content"
android:padding="2dp"
android:background="@drawable/underline"
app:layout_constraintTop_toBottomOf="@id/radio_group"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView

View File

@ -20,13 +20,13 @@
android:layout_margin="20dp"
android:text="01.选择情报类型"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/rl_other"/>
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<LinearLayout
android:id="@+id/ll_text"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_height="100dp"
app:layout_constraintLeft_toLeftOf="@id/tv_select_type"
app:layout_constraintTop_toBottomOf="@id/tv_select_type">
@ -36,24 +36,32 @@
android:layout_margin="20dp"
android:background="@drawable/other_text">
<TextView
android:id="@+id/tv_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="下拉选择"
android:textStyle="bold"
<Spinner
android:id="@+id/spinner_other"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_margin="2dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="5dp"
android:background="@color/white"
android:textColor="#333"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/other_dawn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="10dp"
android:background="@drawable/ic_arrow_down"
app:layout_constraintRight_toRightOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="5dp"
android:background="@drawable/ic_baseline_arrow_drop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
@ -95,15 +103,20 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/et_position"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:background="@null"
android:paddingLeft="10dp"
app:layout_constraintBottom_toBottomOf="@id/tv_indeo"
app:layout_constraintLeft_toRightOf="@id/tv_indeo"
app:layout_constraintTop_toTopOf="@id/tv_indeo" />
<CheckBox
android:id="@+id/check_pot"
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:background="@drawable/selector_change_bg"
android:button="@null"
android:gravity="center"
android:text="编辑"
android:textSize="8sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/tv_indeo"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_other_map"
@ -164,47 +177,70 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_other_picture">
<LinearLayout
<RelativeLayout
android:id="@+id/rl_picture"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_margin="10dp"
android:background="#03A9F4"
android:gravity="center"
android:orientation="vertical">
android:gravity="center">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/plus" />
android:id="@+id/image_picture"
android:layout_centerHorizontal="true"
android:layout_width="40dp"
android:layout_marginTop="20dp"
android:background="@drawable/plus"
android:layout_height="40dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*照片"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:layout_centerHorizontal="true"
android:text="照片"
android:textSize="8sp"
android:layout_margin="5dp"
android:textColor="@color/pickerview_wheelview_textcolor_divider"
android:layout_below="@id/image_picture"
/>
<ImageView
android:id="@+id/iv_picture"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_pictures"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_margin="10dp"
android:background="#03A9F4"
android:gravity="center"
android:orientation="vertical">
android:gravity="center">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/plus" />
android:id="@+id/image_pictures"
android:layout_centerHorizontal="true"
android:layout_width="40dp"
android:layout_marginTop="20dp"
android:background="@drawable/plus"
android:layout_height="40dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*照片"
android:textColor="@color/white" />
</LinearLayout>
android:layout_centerHorizontal="true"
android:text="照片"
android:textSize="8sp"
android:layout_margin="5dp"
android:textColor="@color/pickerview_wheelview_textcolor_divider"
android:layout_below="@id/image_pictures"
/>
<ImageView
android:id="@+id/iv_pictures"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
</LinearLayout>
<TextView

View File

@ -25,6 +25,7 @@
android:background="@drawable/chartall" />
<TextView
android:id="@+id/tv_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image"

View File

@ -15,7 +15,7 @@
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_other_final"
android:id="@+id/iv_final"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_alignParentLeft="true"

View File

@ -389,7 +389,7 @@
android:id="@+id/tv_03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="02拍照"
android:text="03描述"
android:layout_margin="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/linear_photograph" />