fix: 修改了寻宝逻辑代码

This commit is contained in:
wangdongsheng
2021-11-02 09:53:10 +08:00
parent dc81a6513d
commit 5809a81438
17 changed files with 120 additions and 161 deletions

View File

@@ -9,8 +9,8 @@ android {
applicationId "com.navinfo.outdoor"
minSdkVersion 22
targetSdkVersion 30
versionCode 4
versionName "4.0"
versionCode 5
versionName "5.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {

View File

@@ -41,7 +41,6 @@ public class HomeActivity extends BaseActivity{
private TabLayout mTab;
private final String[] names = {"寻宝", "记录", "发现", "我的"};
private final int[] pic = {R.drawable.selector_map,R.drawable.selector_task,R.drawable.selector_article,R.drawable.selector_mine};
private RecordFragment recordFragment;
private boolean isBack=false;
private Handler handler = new Handler(new Handler.Callback() {
@Override
@@ -76,7 +75,7 @@ public class HomeActivity extends BaseActivity{
NoSlideViewPager mViewPager = findViewById(R.id.no_slide_view_pager);
ArrayList<Fragment> fragments = new ArrayList<>();
fragments.add(new TreasureFragment());
recordFragment = new RecordFragment();
RecordFragment recordFragment = new RecordFragment();
fragments.add(recordFragment);
fragments.add(new FindFragment());
fragments.add(new MineFragment());
@@ -109,20 +108,24 @@ public class HomeActivity extends BaseActivity{
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}else if (tab.getPosition()==1){
Message obtain = Message.obtain();
obtain.what = Constant.STAY_SUBMIT_ITEM;
obtain.obj = true;
EventBus.getDefault().post(obtain);
Message obtain1 = Message.obtain();
obtain1.what = Constant.HAS_SUBMIT_ITEM;
obtain1.obj = true;
EventBus.getDefault().post(obtain1);
} else if (tab.getPosition()==3){
Message obtain = Message.obtain();
obtain.what = Constant.HOME_MINE;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}
}
//点击table layout效果

View File

@@ -12,6 +12,7 @@ import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
@@ -46,8 +47,7 @@ import java.util.Date;
* 登录页
*/
public class LoginActivity extends BaseActivity implements View.OnClickListener {
private android.widget.EditText etLoginName;
private android.widget.EditText etLoginPaw;
private EditText etLoginName, etLoginPaw;
private SharedPreferences.Editor navInfoEditor;
private CheckBox cbStatement;
private Handler handler = new Handler(new Handler.Callback() {
@@ -106,7 +106,6 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
public void onEvent(Message data) {
if (data.what == Constant.REGISTER_WORD) {
if ((boolean) data.obj) {
etLoginName.setText(Constant.USER_NAME);
etLoginPaw.setText(Constant.PASS_WORD);
}
@@ -163,7 +162,6 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
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();
@@ -224,11 +222,11 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
Constant.REFRESH_TOKEN = body.getRefresh_token();
Constant.USHERED = body.getUserId();
Constant.PASS_WORD = paw;
loginBuilder.append("登录获取token ,");
initGetUserInfo();//获取用户信息
} else {
Toast.makeText(LoginActivity.this, response.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override
@@ -243,7 +241,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
}
private void initGetUserInfo() {
OkGoBuilder.getInstance().Builder(this)
OkGoBuilder.getInstance()
.Builder(this)
.url(HttpInterface.USER_DETAIL_BY_USER_ID)
.token(Constant.ACCESS_TOKEN)
.params(new HttpParams())
@@ -290,9 +289,11 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
navInfoEditor.commit();
int needGuide = body.getNeedGuide();//0不需要 1需要
if (needGuide == 1) {
loginBuilder.append("进入介绍页 ,");
Intent intent = new Intent(LoginActivity.this, GuidanceActivity.class);
startActivity(intent);
} else {
loginBuilder.append("登录成功 ,");
Toast.makeText(LoginActivity.this, "登录成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
startActivity(intent);
@@ -303,6 +304,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
Toast.makeText(LoginActivity.this, response.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
@@ -314,6 +316,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override

View File

@@ -61,7 +61,6 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
private File logFile;
private StringBuilder photographBuilder;
@Override
public void onClick(View v) {
if (v.getId() == R.id.capture_picture) {
@@ -191,19 +190,8 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
});
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
Message obtain = Message.obtain();
obtain.what = Constant.PICTURE_VIDEO_WORD;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}
@Subscribe
public void onEvent(Message data) {
}
public void onEvent(Message data) { }
@Override
protected void onResume() {

View File

@@ -156,7 +156,7 @@ public class Constant {
public static SlidingUpPanelLayout SLIDING_LAYOUT = null;//設置
public static boolean IS_FILTER_LIST_ITEM = true;//poi页面的查重
public static TencentMap.OnMarkerClickListener markerClickListener = null;
public static final String NAVIN_FO = "10.29";//版本日期
public static final String NAVIN_FO = "11.01";//版本日期
//marker
public static final BitmapDescriptor MARKER_POI_SHOW = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_show);
public static final BitmapDescriptor MARKER_CHARGE_SHOW = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_show);
@@ -179,8 +179,6 @@ public class Constant {
public static final BitmapDescriptor GRAY_OTHER= BitmapDescriptorFactory.fromResource(R.drawable.grayother);
public static final BitmapDescriptor GRAY_FACET= BitmapDescriptorFactory.fromResource(R.drawable.grayfacet);
public static final BitmapDescriptor ICON_OPERATION=BitmapDescriptorFactory.fromResource(R.mipmap.icon_operation);
/*
*联系我们的QQ群名称和QQ群号
*/

View File

@@ -1,4 +1,5 @@
package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
@@ -93,6 +94,7 @@ import java.util.List;
import java.util.Objects;
import okhttp3.Response;
/**
* 充电站的Fragment
* 2021-5-25
@@ -122,7 +124,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private LinearLayout linearContact;
private ContactView contactView;
private ArrayList<File> chargingStationList;
String str = "";
private NestedScrollView nestedScrollView;
private Marker markerStation;
private Point screenStationPositions;
@@ -641,9 +642,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
});
}
}).start();
if (showPoiEntity.getTaskStatus() == 3) {
disables();
}
initPile();
}
}
@@ -696,11 +699,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
public boolean onClick(BaseDialog baseDialog, View v) {
Constant.CODE = code;
Constant.TelLength = telLength;
/*for (int i = 0; i < poiBeans.size(); i++) {
poiBeans.get(i).setArea(Constant.CODE);
}
contactView = new ContactView(getActivity(), linearContact, poiBeans);
contactView.resetView();*/
return false;
}
});
@@ -837,7 +835,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
initRoadSaveLocal(false);
break;
case R.id.btn_uploading:
chargingStationBuilder.append("点击了保存本地的按钮 ,");
chargingStationBuilder.append("点击了上传的按钮 ,");
Message obtain = Message.obtain();
obtain.what = Constant.TREASURE_FRAGMENT;
obtain.obj = false;
@@ -1109,6 +1107,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onDenied(List<String> permissions, boolean never) {
if (never) {
@@ -1121,13 +1120,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
private void stationUploadByNetWork(PoiEntity poiEntity, ArrayList<File> chargingStationList) {
if (poiEntity != null ) {
if (poiEntity.getTaskId()==0){
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
Log.e("TAG", "poiUploadByNetWork: " + poiEntity.getBodyId() + chargingStationList);
return;
}
}else {
if (poiEntity == null) {
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
return;
}
@@ -1206,7 +1199,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
if (isLocal) {
stationUploadByNetWork(poiEntity, chargingStationList);
Constant.isPresent = false;
// chargingPileUploadNetWork(chargingPileBody, fileList);
} else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
Message obtain = Message.obtain();
@@ -1260,17 +1252,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
editNameContent.setTextColor(Color.BLACK);
btnSaveLocal.setEnabled(true);
btnUploading.setEnabled(true);
StringBuilder stringBuilder = new StringBuilder();
List<String> body = taskNameBean.getBody();
if (body != null) {
for (int i = 0; i < body.size(); i++) {
str += body.get(i) + ",";
}
if (str != null) {
Toast.makeText(getActivity(), "存在类似名称---" + str, Toast.LENGTH_SHORT).show();
str = "";
} else {
Toast.makeText(getActivity(), "没有类似名称可以作业", Toast.LENGTH_SHORT).show();
stringBuilder.append(body.get(i)).append("");
}
Toast.makeText(getActivity(), "不允许新增上报. 存在类似名称--" + stringBuilder.toString(), Toast.LENGTH_SHORT).show();
editNameContent.setText(null);
} else {
Toast.makeText(getActivity(), "没有类似名称可以作业", Toast.LENGTH_SHORT).show();
}
@@ -1406,7 +1395,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
/**
* 上传充电桩数据到服务端
* 保存充电桩数据到服务端
*/
private void saveChargingPileByWork(ChargingPileEntity chargingPileEntity, int bodyId) {
HttpParams httpParams = new HttpParams();
@@ -1546,7 +1535,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
removablesLocality.clear();
chargingStationBuilder.append("onDestroy ,");
chargingStationBuilder.append("onDestroy ");
chargingStationBuilder.append("\r\n");
FileUtils.writeFile(logFile.getAbsolutePath(), chargingStationBuilder.toString(), true);
}

View File

@@ -108,10 +108,10 @@ public class FindFragment extends BaseFragment implements View.OnClickListener{
break;
case R.id.linear_end:
findBuilder.append("点击了帮助中心:能力测评 ,");
// Toast.makeText(getContext(), "该功能以后上新,敬请期待", Toast.LENGTH_SHORT).show();
Intent endIntent = new Intent(getActivity(), FragmentManagement.class);
Toast.makeText(getContext(), "该功能以后上新,敬请期待", Toast.LENGTH_SHORT).show();
/* Intent endIntent = new Intent(getActivity(), FragmentManagement.class);
endIntent.putExtra("tag", 11);
startActivity(endIntent);
startActivity(endIntent);*/
break;
}

View File

@@ -891,7 +891,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
PoiEntity poiListEntity = new PoiEntity();
poiListEntity.setTaskId(poiEntity.getTaskId());
poiListEntity.setName(listBean.getName());
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setMemo(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(listBean.getType());

View File

@@ -328,17 +328,13 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
Toast.makeText(getContext(), "识别失败,可以重新识别或则进行手动输入", Toast.LENGTH_SHORT).show();
} else {
if (bankCardBean.getResult() != null && bankCardBean.getResult().getBank_card_number() != null) {
String bank_card_number = bankCardBean.getResult().getBank_card_number().trim();
String bankCardNumber = bankCardBean.getResult().getBank_card_number().trim();
String bank_card_number = bankCardNumber.replace(" ", "");
if (StringUtils.isEmpty(bank_card_number)) {
Toast.makeText(getActivity(), "识别失败,可以重新识别或则进行手动输入", Toast.LENGTH_SHORT).show();
return;
}
etBankNum.setText(bank_card_number);
if (bank_card_number.contains(" ")){
Log.d("TAG", "onActivityResult: 包含空格");
}else {
Log.d("TAG", "onActivityResult: 不包含空格");
}
// String bankName = bankCardBean.getResult().getBank_name();
} else {
Toast.makeText(getActivity(), "识别失败,可以重新识别或则进行手动输入", Toast.LENGTH_SHORT).show();

View File

@@ -64,8 +64,6 @@ public class MessageFragment extends BaseFragment implements View.OnClickListen
messageFinal.setOnClickListener(this);
XRecyclerView messageRecycler = (XRecyclerView) findViewById(R.id.message_recycler);
messageRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
TextView tvRoad = findViewById(R.id.tv_read);
tvRoad.setOnClickListener(this);
messageRecycler.addItemDecoration(new DividerItemDecoration(Objects.requireNonNull(getActivity()), DividerItemDecoration.VERTICAL));
messageRecycler.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);
messageRecycler.setLoadingMoreProgressStyle(ProgressStyle.BallRotate);
@@ -156,14 +154,9 @@ public class MessageFragment extends BaseFragment implements View.OnClickListen
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.message_final:
if (v.getId() == R.id.message_final) {
messageBuilder.append("点击返回,");
Objects.requireNonNull(getActivity()).finish();
break;
case R.id.tv_read:
messageBuilder.append("点击全部领取,");
break;
}
}

View File

@@ -768,13 +768,9 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format);
poiEntity.setType(3);
if (fmPoiVideoPic.getTag() == null) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID != null) {
fmPoiVideoPic.setTag(fileListByUUID);
}
}
if (fmPoiVideoPic.getTag() != null && !((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
List<LatLng> lineStringByFileList = AWMp4ParserHelper.getInstance().getLinePhotoByList((List<File>) fmPoiVideoPic.getTag());
String lineString = Geohash.getInstance().encodeList(lineStringByFileList);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmPoiVideoPic.getTag());
@@ -783,6 +779,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
poiEntity.setGeoWkt(lineString);
}
}
return poiEntity;
}

View File

@@ -259,12 +259,11 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
moveLatlng(latLng, null);
}
}
String describe = showPoiEntity.getDescribe();//任务描述
String describe = showPoiEntity.getMemo();//任务描述
if (describe != null && !describe.equals("")) {
etDesc.setText(describe);
}
String photoList = showPoiEntity.getPhoto();//存儲在數據庫中的數據
if (!StringUtils.isEmpty(photoList)) {
if (!StringUtils.isEmpty(photoList)) {
boolean isImageLoad = false;
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
@@ -299,7 +298,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
fmRoadPic.setTag(videoFileList);
}*/
}
}
assert showPoiEntity != null;
if (showPoiEntity.getTaskStatus() == 3) {
disables();
@@ -466,6 +464,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onDenied(List<String> permissions, boolean never) {
if (never) {
@@ -765,22 +764,18 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format);
poiEntity.setType(4);
if (fmRoadPic.getTag() == null) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
if (fileListByUUID != null) {
fmRoadPic.setTag(fileListByUUID);
}
}
if (fmRoadPic.getTag() != null && !((List<File>) fmRoadPic.getTag()).isEmpty()) {
List<LatLng> lineStringByFileList = AWMp4ParserHelper.getInstance().getLinePhotoByList((List<File>) fmRoadPic.getTag());
String encodeList = Geohash.getInstance().encodeList(lineStringByFileList);
Log.d("TAG", "onGranted: " + encodeList);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmRoadPic.getTag());
poiEntity.setPhoto(photoStr);
if (encodeList != null) {
poiEntity.setGeoWkt(encodeList);
}
}
return poiEntity;
}

View File

@@ -3,9 +3,9 @@ package com.navinfo.outdoor.http;
import com.navinfo.outdoor.api.Constant;
public class HttpInterface {
public static final String IP_= "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
public static final String IP= "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
public static final String IP= "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口
public static final String IP_= "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口
public static final String USER_PATH ="/user/";//我的
public static final String MSG_LIST_PATH ="/msgList/";//发现

View File

@@ -55,9 +55,8 @@ public class ZipUtils{
* @param resFileList 要压缩的文件(夹)列表
* @param zipFile 生成的压缩文件
* @param comment 压缩文件的注释
* @param zipListener zipListener
*/
public static void zipFiles(Collection<File> resFileList, File zipFile, String comment, com.github.lazylibrary.util.ZipUtil.ZipListener zipListener)
public static void zipFiles(Collection<File> resFileList, File zipFile, String comment)
{
ZipOutputStream zipout = null;
try {

View File

@@ -23,6 +23,12 @@
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:src="@drawable/ic_baseline_arrow" />
<TextView
android:id="@+id/tv_event"
android:layout_width="wrap_content"
style="@style/text_style_toolbar_title"
android:layout_toRightOf="@id/iv_find_task"
android:text="活动专区" />
</LinearLayout>
<androidx.core.widget.NestedScrollView

View File

@@ -5,46 +5,38 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragment.MessageFragment">
<RelativeLayout
<LinearLayout
android:id="@+id/rl_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:background="@color/colorPrimaryBlue"
android:paddingTop="@dimen/top_pind_sp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/message_final"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:padding="10dp"
android:src="@drawable/ic_arrow_left" />
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:src="@drawable/ic_baseline_arrow"
/>
<TextView
android:id="@+id/tv_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="25dp"
android:layout_height="45dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@id/iv_find_task"
android:gravity="center"
android:text="消息"
android:textColor="#000" />
<TextView
android:id="@+id/tv_read"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="20dp"
android:visibility="gone"
android:layout_marginRight="10dp"
android:text="全部已读"
android:textColor="@color/black" />
</RelativeLayout>
android:textColor="#fff"
android:textSize="17sp"
android:textStyle="bold" />
</LinearLayout>
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/message_recycler"