修改bug

This commit is contained in:
wangdongsheng 2021-09-02 18:45:57 +08:00
parent ddfea1b990
commit a3ff8fd41c
19 changed files with 538 additions and 265 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
ndkVersion '23.0.7123448'
// ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"

View File

@ -47,7 +47,6 @@
android:supportsRtl="true"
android:theme="@style/Theme.WhiteScreen"
tools:targetApi="n">
<activity android:name=".activity.PhotoAlbumActivity"></activity>
<activity android:name=".activity.LinkActivity" />
<activity android:name=".activity.RegardMapActivity" />
<activity android:name=".activity.StatementActivity" />

View File

@ -22,6 +22,7 @@ import com.navinfo.outdoor.fragment.MapDownloadFragment;
import com.navinfo.outdoor.fragment.MessageFragment;
import com.navinfo.outdoor.fragment.MineFragment;
import com.navinfo.outdoor.fragment.OtherFragment;
import com.navinfo.outdoor.fragment.PhotoFragment;
import com.navinfo.outdoor.fragment.PoiFragment;
import com.navinfo.outdoor.fragment.PoiTaskFragment;
import com.navinfo.outdoor.fragment.PrivilegeFragment;
@ -37,6 +38,7 @@ import com.navinfo.outdoor.fragment.TaskPrefectureFragment;
import com.navinfo.outdoor.fragment.RegisterFragment;
import com.navinfo.outdoor.fragment.TreasureFragment;
import com.navinfo.outdoor.fragment.UserAttestationFragment;
import com.navinfo.outdoor.fragment.VideoFragment;
import com.navinfo.outdoor.fragment.WithdrawFragment;
import com.gyf.immersionbar.ImmersionBar;
import com.navinfo.outdoor.fragment.WithdrawalRecordFragment;
@ -87,6 +89,8 @@ public class FragmentManagement extends BaseActivity {
private OtherFragment otherFragment;//寻宝-上传-其他的fragment -33
private ChargingPileFragment chargingPileFragment;//寻宝-上传-充电站-充电桩的fragment-34
private MessageFragment messageFragment;//寻宝 -消息的fragment -35
private PhotoFragment photoFragment;//查看详情-图片-36
private VideoFragment videoFragment;//查看详情-视频-37
@Override
protected int getLayout() {
@ -174,9 +178,12 @@ public class FragmentManagement extends BaseActivity {
fragmentTransaction.hide(otherFragment);
if (chargingPileFragment!=null)//寻宝-上传-充电站-充电桩的fragment-34
fragmentTransaction.hide(chargingPileFragment);
if (messageFragment!=null){//寻宝 -消息的Fragment -35
if (messageFragment!=null)//寻宝 -消息的Fragment -35
fragmentTransaction.hide(messageFragment);
}
if (photoFragment!=null)//查看详情-图片 36
fragmentTransaction.hide(photoFragment);
if (videoFragment!=null)//查看详情-视频 37
fragmentTransaction.hide(videoFragment);
}
@ -470,6 +477,26 @@ public class FragmentManagement extends BaseActivity {
fragmentTransaction.show(messageFragment);
}
break;
case 36://查看详情-图片
if (photoFragment == null){
Bundle bundle = new Bundle();
bundle.putSerializable("showPoiEntity",getIntent().getSerializableExtra("showPoiEntity"));
photoFragment = PhotoFragment.newInstance(bundle);
fragmentTransaction.add(R.id.frame_layout,photoFragment);
}else {
fragmentTransaction.show(photoFragment);
}
break;
case 37://查看详情-视频
if (videoFragment==null){
Bundle bundle = new Bundle();
bundle.putSerializable("showPoiEntity",getIntent().getSerializableExtra("showPoiEntity"));
videoFragment=VideoFragment.newInstance(bundle);
fragmentTransaction.add(R.id.frame_layout,videoFragment);
}else {
fragmentTransaction.show(videoFragment);
}
break;
}
fragmentTransaction.commit();
}

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
@ -38,6 +39,18 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
private android.widget.EditText etLoginPaw;
private SharedPreferences.Editor navInfoEditor;
private CheckBox cbStatement;
private Handler handler=new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(@NonNull Message msg) {
if (msg.what==0x103){
if (btnLogin!=null){
btnLogin.setEnabled(true);
}
}
return false;
}
});
private Button btnLogin;
@Override
public void onStart() {
@ -79,7 +92,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
etLoginPaw = findViewById(R.id.et_login_paw);
TextView tvForgetPaw = findViewById(R.id.tv_forget_paw);
cbStatement = findViewById(R.id.iv_login_check);
Button btnLogin = findViewById(R.id.btn_login);
btnLogin = findViewById(R.id.btn_login);
btnLogin.setOnClickListener(this);
TextView tvStatement = findViewById(R.id.tv_statement);
tvStatement.setOnClickListener(this);
@ -110,6 +123,10 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
startActivity(forgetPaw);
break;
case R.id.btn_login:
btnLogin.setEnabled(false);
Message message = new Message();
message.what=0x103;
handler.sendMessageDelayed(message,500);
String name = etLoginName.getText().toString().trim();
if (name.equals("")) {
Toast.makeText(this, "请输入账号", Toast.LENGTH_SHORT).show();

View File

@ -1,78 +0,0 @@
package com.navinfo.outdoor.activity;
import androidx.recyclerview.widget.GridLayoutManager;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.PhotoAlbumAdapter;
import com.navinfo.outdoor.base.BaseActivity;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import java.io.File;
import java.io.Serializable;
import java.util.List;
public class PhotoAlbumActivity extends BaseActivity implements View.OnClickListener {
private android.widget.ImageView ivPhotoFinal;
private android.widget.TextView tvPhotoAlbumDelete,tvPhotoChoose;
private com.jcodecraeer.xrecyclerview.XRecyclerView photoAlbumRecycler;
private PhotoAlbumAdapter photoAlbumAdapter;
private List<File> fileListByUUID;
@Override
protected int getLayout() {
return R.layout.activity_photo_album;
}
@Override
protected void initView() {
super.initView();
PoiEntity showPoiEntity = (PoiEntity) getIntent().getSerializableExtra("showPoiEntity");
if (showPoiEntity!=null){
String id = showPoiEntity.getId();
if (showPoiEntity.getRecord_way()==1){
fileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(id);
}else if (showPoiEntity.getRecord_way()==2){
fileListByUUID=AWMp4ParserHelper.getInstance().getJPGFileListByUUID(id);
}
}
ivPhotoFinal = (ImageView) findViewById(R.id.iv_photo_final);
ivPhotoFinal.setOnClickListener(this::onClick);
tvPhotoChoose = (TextView) findViewById(R.id.tv_photo_choose);
tvPhotoChoose.setOnClickListener(this::onClick);
tvPhotoAlbumDelete = (TextView) findViewById(R.id.tv_photo_album_delete);
tvPhotoAlbumDelete.setOnClickListener(this::onClick);
photoAlbumRecycler = (XRecyclerView) findViewById(R.id.photo_album_recycler);
photoAlbumRecycler.setLayoutManager(new GridLayoutManager(this,4));
photoAlbumAdapter = new PhotoAlbumAdapter(fileListByUUID,this);
photoAlbumRecycler.setAdapter(photoAlbumAdapter);
}
@Override
protected void initData() {
super.initData();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_photo_final:
finish();
break;
case R.id.tv_photo_album_delete:
//photoAlbumAdapter.setDeletePhoto();
break;
case R.id.tv_photo_choose:
break;
}
}
}

View File

@ -0,0 +1,84 @@
package com.navinfo.outdoor.adapter;
import android.content.Context;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.List;
/**
* 查看拍照成果的activity
*/
public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.ViewHolder> {
private List<File> files ;
private Context context;
public PhotoAdapter(List<File> files, Context context) {
this.files = files;
this.context = context;
}
@NotNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = LayoutInflater.from(context).inflate(R.layout.photo_item, parent, false);
return new ViewHolder(inflate);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
File file= files.get(position);
if (file.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(context, Uri.fromFile(file).toString(), holder.ivPhoto, 500);
}
holder.cbPhoto.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
});
}
@Override
public int getItemCount() {
return files.size();
}
static class ViewHolder extends RecyclerView.ViewHolder {
private ImageView ivPhoto;
private CheckBox cbPhoto;
public ViewHolder(@NonNull @NotNull View itemView) {
super(itemView);
ivPhoto = itemView.findViewById(R.id.iv_photo);
cbPhoto = itemView.findViewById(R.id.check_photo);
}
}
public photoClickItem photoClickItem;
public void setPhotoClickItem(photoClickItem photoClickItem) {
this.photoClickItem = photoClickItem;
}
public interface photoClickItem {
void item(int aInt);
}
}

View File

@ -1,117 +0,0 @@
package com.navinfo.outdoor.adapter;
import android.content.Context;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 查看拍照成果的activity
*/
public class PhotoAlbumAdapter extends RecyclerView.Adapter<PhotoAlbumAdapter.ViewHolder> {
private List<File> files ;
private Context context;
public PhotoAlbumAdapter(List<File> files, Context context) {
this.files = files;
this.context = context;
}
Handler handler = new Handler() {
@Override
public void handleMessage(@NonNull @NotNull Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 0x107:
notifyDataSetChanged();
break;
}
}
};
@NonNull
@NotNull
@Override
public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
View inflate = LayoutInflater.from(context).inflate(R.layout.photo_album_item, parent, false);
return new ViewHolder(inflate);
}
@Override
public void onBindViewHolder(@NonNull @NotNull ViewHolder holder, int position) {
File file= files.get(position);
if (file.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(context, Uri.fromFile(file).toString(), holder.ivPhoto, 500);
}
//点击每个条目
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (photoClickItem != null) {
photoClickItem.item(position);
}
}
});
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
holder.cbPhoto.setVisibility(View.VISIBLE);
holder.cbPhoto.setChecked(true);
return false;
}
});
}
@Override
public int getItemCount() {
return files.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
private ImageView ivPhoto;
private CheckBox cbPhoto;
public ViewHolder(@NonNull @NotNull View itemView) {
super(itemView);
ivPhoto = itemView.findViewById(R.id.iv_photo_album);
cbPhoto = itemView.findViewById(R.id.cb_photo_album);
}
}
public photoClickItem photoClickItem;
public void setPhotoClickItem(photoClickItem photoClickItem) {
this.photoClickItem = photoClickItem;
}
public interface photoClickItem {
void item(int aInt);
}
}

View File

@ -0,0 +1,84 @@
package com.navinfo.outdoor.adapter;
import android.content.Context;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.List;
/**
* 查看录像成果的activity
*/
public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.ViewHolder> {
private List<File> files ;
private Context context;
public VideoAdapter(List<File> files, Context context) {
this.files = files;
this.context = context;
}
@NotNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = LayoutInflater.from(context).inflate(R.layout.video_item, parent, false);
return new ViewHolder(inflate);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
File file= files.get(position);
if (file.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(context, Uri.fromFile(file).toString(), holder.ivVideo, 500);
}
holder.cbVideo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
});
}
@Override
public int getItemCount() {
return files.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
private ImageView ivVideo;
private CheckBox cbVideo;
public ViewHolder(@NonNull @NotNull View itemView) {
super(itemView);
ivVideo = itemView.findViewById(R.id.iv_video);
cbVideo = itemView.findViewById(R.id.check_video);
}
}
public photoClickItem photoClickItem;
public void setPhotoClickItem(photoClickItem photoClickItem) {
this.photoClickItem = photoClickItem;
}
public interface photoClickItem {
void item(int aInt);
}
}

View File

@ -35,7 +35,6 @@ public class Constant {
public static final String GET_ERR_MESSAGE2 = "manifest 中配置的 key 不正确";
public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败";
public static final String ROOT_FOLDER = SdkFolderCreate.getSDPath() + "/navinfoOutDoor";
public static String BASE_FOLDER = ROOT_FOLDER;
// 保存图片的目录

View File

@ -900,10 +900,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private void saveChargingPileByChargingStation(PoiEntity chargingStationPoiEntity) {
if (chargingStationPoiEntity != null) {
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(getActivity()).getChargingPileDao().getChargingPileByStationId(chargingStationPoiEntity.getId());
PoiEntity poiEntity = PoiDatabase.getInstance(getActivity()).getPoiDao().getPoiEntity(chargingStationPoiEntity.getId());
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
for (ChargingPileEntity pileEntity : chargingPileEntityList) {
if (pileEntity.getBodyId() == 0) {
saveChargingPileByWork(pileEntity);
saveChargingPileByWork(pileEntity,poiEntity.getBodyId());
}
}
}
@ -1357,14 +1358,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
/**
* 上传充电桩数据到服务端
*/
private void saveChargingPileByWork(ChargingPileEntity chargingPileEntity) {
private void saveChargingPileByWork(ChargingPileEntity chargingPileEntity, int bodyId) {
HttpParams httpParams = new HttpParams();
httpParams.put("taskId", chargingPileEntity.getTaskId());
httpParams.put("name", chargingPileEntity.getName());
httpParams.put("existence", chargingPileEntity.getExist());
httpParams.put("geo", chargingPileEntity.getP());
httpParams.put("memo", chargingPileEntity.getMemo());
httpParams.put("ffid", chargingPileEntity.getFid());
httpParams.put("ffid", bodyId);
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("cp_openType", chargingPileEntity.getCp_openType());
hashMap.put("cp_floor", chargingPileEntity.getCp_floor());

View File

@ -0,0 +1,85 @@
package com.navinfo.outdoor.fragment;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.PhotoAdapter;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 图片-fragment
*/
public class PhotoFragment extends BaseFragment implements View.OnClickListener {
private List<File> fileArrayList;
public static PhotoFragment newInstance(Bundle bundle) {
PhotoFragment fragment = new PhotoFragment();
fragment.setArguments(bundle);
return fragment;
}
@Override
protected int getLayout() {
return R.layout.fragment_photo;
}
@Override
protected void initView() {
super.initView();
PoiEntity showPoiEntity = (PoiEntity) Objects.requireNonNull(getActivity()).getIntent().getSerializableExtra("showPoiEntity");
if (showPoiEntity!=null){
String id = showPoiEntity.getId();
if (showPoiEntity.getRecord_way()==2){//連拍
fileArrayList = new ArrayList<>();
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(id);
for (int i = 0; i < fileListByUUID.size(); i++) {
if (!fileListByUUID.get(i).getPath().contains(".txt")){
fileArrayList.add(fileListByUUID.get(i));
}
}
}
}
ImageView ivPhotoFinal = (ImageView) findViewById(R.id.iv_photo_final);
ivPhotoFinal.setOnClickListener(this);
TextView tvPhotoChoose = (TextView) findViewById(R.id.tv_photo_choose);
tvPhotoChoose.setOnClickListener(this);
TextView tvPhotoAlbumDelete = (TextView) findViewById(R.id.tv_photo_album_delete);
tvPhotoAlbumDelete.setOnClickListener(this);
RecyclerView photoRecycler = findViewById(R.id.photo_album_recycler);
photoRecycler.setLayoutManager(new GridLayoutManager(getContext(),2));
PhotoAdapter photoAdapter = new PhotoAdapter(fileArrayList, getContext());
photoRecycler.setAdapter(photoAdapter);
}
@Override
protected void initData() {
super.initData();
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.iv_photo_final:
Objects.requireNonNull(getActivity()).finish();
break;
}
}
}

View File

@ -2,24 +2,17 @@ package com.navinfo.outdoor.fragment;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
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.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
@ -42,7 +35,6 @@ import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.activity.PhotoAlbumActivity;
import com.navinfo.outdoor.activity.PictureActivity;
import com.navinfo.outdoor.activity.PicturesActivity;
import com.navinfo.outdoor.api.Constant;
@ -65,12 +57,13 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Objects;
@ -173,9 +166,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
Button btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
btnPoiVideoUpload.setOnClickListener(this);
rgType = (RadioGroup) findViewById(R.id.rg_type);
rbCar =findViewById(R.id.rb_car);
rbBicycle =findViewById(R.id.rb_bicycle);
rbWalking =findViewById(R.id.rb_walking);
rbCar = findViewById(R.id.rb_car);
rbBicycle = findViewById(R.id.rb_bicycle);
rbWalking = findViewById(R.id.rb_walking);
rbManual = findViewById(R.id.rb_manual);
tvPhotoAlbum = findViewById(R.id.tv_photo_album);
tvPhotoAlbum.setOnClickListener(this::onClick);
@ -188,7 +181,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
case R.id.rb_bicycle:
case R.id.rb_walking:
tvPicture.setVisibility(View.VISIBLE);
break;
break;
case R.id.rb_manual:
tvPicture.setVisibility(View.GONE);
break;
@ -239,7 +232,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
int work_type = showPoiEntity.getWork_type();
showPictureType(work_type);
if (work_type==3){
if (work_type == 3) {
tvPicture.setVisibility(View.GONE);
}
String describe = showPoiEntity.getMemo();//任务描述
@ -268,7 +261,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
} else if (record_way == 2) {//连拍
isRequest = 0x102;
if (work_type==3){
if (work_type == 3) {
showWorkType(work_type);
}
tvPicture.setEnabled(false);
@ -296,7 +289,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
private void showWorkType(int work_type) {
switch (work_type){
switch (work_type) {
case 0:
rgType.setEnabled(false);
rbCar.setEnabled(true);
@ -351,7 +344,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
@ -364,7 +356,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
File filePath = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
intents.putExtra(Constant.INTENT_JPG_PATH, filePath.getAbsolutePath());
int pictureType = getPictureType();
intents.putExtra("type",pictureType);
intents.putExtra("type", pictureType);
intents.putExtra("poiEntity", showPoiEntity);
startActivityForResult(intents, 0x102);
break;
@ -413,15 +405,25 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
break;
case R.id.tv_photo_album:
if (tvPicture.isEnabled()){
if (tvPicture.isEnabled() && tvPictures.isEnabled()) {//如果两个都有
Toast.makeText(getActivity(), "请拍照或者录像!", Toast.LENGTH_SHORT).show();
return;
}
if (tvPicture.isEnabled()) {
showPoiEntity.setRecord_way(1);
Intent photoAlbumIntent = new Intent(getActivity(), FragmentManagement.class);
photoAlbumIntent.putExtra("tag", 37);
photoAlbumIntent.putExtra("showPoiEntity", showPoiEntity);
startActivity(photoAlbumIntent);
}
if (tvPictures.isEnabled()){
if (tvPictures.isEnabled()) {
showPoiEntity.setRecord_way(2);
Intent photoAlbumIntent = new Intent(getActivity(), FragmentManagement.class);
photoAlbumIntent.putExtra("tag", 36);
photoAlbumIntent.putExtra("showPoiEntity", showPoiEntity);
startActivity(photoAlbumIntent);
}
Intent photoAlbumIntent = new Intent(getActivity(), PhotoAlbumActivity.class);
photoAlbumIntent.putExtra("showPoiEntity",showPoiEntity);
startActivity(photoAlbumIntent);
break;
}
}
@ -613,7 +615,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
if (data != null && data.hasExtra(Constant.INTENT_PICTURES_PATH)) {
int type = data.getIntExtra("type", 0);
if (type==3){
if (type == 3) {
showWorkType(type);
}
@ -665,7 +667,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
return 1;
} else if (rbWalking != null && rbWalking.isChecked()) {
return 2;
} else if (rbManual !=null &&rbManual.isChecked()){
} else if (rbManual != null && rbManual.isChecked()) {
return 3;
}
return -1;
@ -765,7 +767,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
String roadName = etRoadName.getText().toString().trim();
if (roadName!= null&&!roadName.equals("")) {
if (roadName != null && !roadName.equals("")) {
poiEntity.setName(roadName + "");
} else {
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");

View File

@ -0,0 +1,76 @@
package com.navinfo.outdoor.fragment;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.VideoAdapter;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import java.io.File;
import java.util.List;
import java.util.Objects;
/**
* 视频-fragment
*/
public class VideoFragment extends BaseFragment implements View.OnClickListener {
private List<File> fileListByUUID;
public static VideoFragment newInstance(Bundle bundle) {
VideoFragment fragment = new VideoFragment();
fragment.setArguments(bundle);
return fragment;
}
@Override
protected int getLayout() {
return R.layout.fragment_video;
}
@Override
protected void initView() {
super.initView();
PoiEntity showPoiEntity = (PoiEntity) Objects.requireNonNull(getActivity()).getIntent().getSerializableExtra("showPoiEntity");
if (showPoiEntity != null) {
String id = showPoiEntity.getId();
if (showPoiEntity.getRecord_way() == 2) {
fileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(id);
}
}
ImageView ivPhotoFinal =(ImageView) findViewById(R.id.iv_video_final);
ivPhotoFinal.setOnClickListener(this);
TextView tvPhotoChoose =(TextView) findViewById(R.id.tv_video_choose);
tvPhotoChoose.setOnClickListener(this);
TextView tvPhotoAlbumDelete =(TextView) findViewById(R.id.tv_video_album_delete);
tvPhotoAlbumDelete.setOnClickListener(this);
RecyclerView videoRecycler = findViewById(R.id.video_album_recycler);
videoRecycler.setLayoutManager(new GridLayoutManager(getContext(), 2));
VideoAdapter videoAdapter = new VideoAdapter(fileListByUUID, getContext());
videoRecycler.setAdapter(videoAdapter);
}
@Override
protected void initData() {
super.initData();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_video_final:
Objects.requireNonNull(getActivity()).finish();
break;
}
}
}

View File

@ -354,11 +354,13 @@ public class PoiSaveUtils {
boolean result = true;
if (chargingStationPoiEntity != null) {
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(mContext).getChargingPileDao().getChargingPileByStationId(chargingStationPoiEntity.getId());
PoiEntity poiEntity = PoiDatabase.getInstance(mContext).getPoiDao().getPoiEntity(chargingStationPoiEntity.getId());
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
// 依次上传充电桩数据如果有一条数据未上传成功则返回false
for (ChargingPileEntity pileEntity : chargingPileEntityList) {
if (pileEntity.getBodyId() == 0) {
int saveResult = saveChargingPile2NetWork(pileEntity);
int saveResult = saveChargingPile2NetWork(pileEntity,poiEntity.getBodyId());
if (saveResult == 200) {
result = result & true;
} else {
@ -375,14 +377,14 @@ public class PoiSaveUtils {
/**
* 保存充电桩数据到服务端
*/
private int saveChargingPile2NetWork(ChargingPileEntity chargingPileEntity) {
private int saveChargingPile2NetWork(ChargingPileEntity chargingPileEntity, int bodyId) {
HttpParams httpParams = new HttpParams();
httpParams.put("taskId", chargingPileEntity.getTaskId());
httpParams.put("name", chargingPileEntity.getName());
httpParams.put("existence", chargingPileEntity.getExist());
httpParams.put("geo", chargingPileEntity.getP());
httpParams.put("memo", chargingPileEntity.getMemo());
httpParams.put("ffid", chargingPileEntity.getFid());
httpParams.put("ffid", bodyId);
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("cp_openType", chargingPileEntity.getCp_openType());
hashMap.put("cp_floor", chargingPileEntity.getCp_floor());
@ -390,6 +392,7 @@ public class PoiSaveUtils {
hashMap.put("sign_exist", chargingPileEntity.getSign_exist());
httpParams.put("detail", String.valueOf(hashMap));
try {
Response execute = OkGoBuilder.getInstance()
.Builder(mContext)
.url(HttpInterface.SUBMIT_CSTASK)

View File

@ -3,8 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.PhotoAlbumActivity">
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/rl_photo_album"
@ -21,16 +20,14 @@
android:id="@+id/iv_photo_final"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp"
android:src="@drawable/icon_arrow" />
<TextView
android:id="@+id/tv_event"
style="@style/text_style_toolbar_title"
android:layout_width="wrap_content"
android:layout_toRightOf="@id/iv_find_task"
android:text="查看相册" />
android:text="查看图片" />
</LinearLayout>
<TextView
@ -55,7 +52,7 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_photo_album"/>
<com.jcodecraeer.xrecyclerview.XRecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/photo_album_recycler"
android:layout_width="match_parent"
android:layout_height="0dp"

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/rl_video_album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1BA5F1"
android:orientation="horizontal"
android:paddingTop="@dimen/top_pind_sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_video_final"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_marginStart="15dp"
android:src="@drawable/icon_arrow" />
<TextView
android:id="@+id/tv_event"
style="@style/text_style_toolbar_title"
android:layout_width="wrap_content"
android:text="查看視頻" />
</LinearLayout>
<TextView
android:id="@+id/tv_video_choose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="选择"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_video_album"/>
<TextView
android:id="@+id/tv_video_album_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="删除"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_video_album"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/video_album_recycler"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_video_album_delete" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_photo_album"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<CheckBox
android:id="@+id/cb_photo_album"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_margin="10dp"
app:layout_constraintRight_toRightOf="@+id/iv_photo_album"
app:layout_constraintTop_toTopOf="@+id/iv_photo_album" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/check_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_photo"
android:layout_width="0dp"
android:layout_height="150dp"
android:layout_margin="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/check_photo"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/check_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_video"
android:layout_width="0dp"
android:layout_height="150dp"
android:layout_margin="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/check_video"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>