修改bug
This commit is contained in:
parent
30ad378cde
commit
4f157306ad
@ -4,6 +4,8 @@ import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -27,6 +29,9 @@ import com.navinfo.outdoor.util.BackHandlerHelper;
|
||||
import com.navinfo.outdoor.util.FragmentBackHandler;
|
||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
||||
public abstract class BaseFragment extends Fragment implements FragmentBackHandler {
|
||||
|
||||
@ -57,8 +62,7 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
return false;
|
||||
}
|
||||
|
||||
public void initEvent() {
|
||||
}
|
||||
public void initEvent() {}
|
||||
|
||||
protected <T extends View> T findViewById(@IdRes int id) {
|
||||
return getView().findViewById(id);
|
||||
@ -81,14 +85,42 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
//loading样式
|
||||
View view = LayoutInflater.from(getContext()).inflate(R.layout.loading, null);
|
||||
alertDialog.setView(view);
|
||||
|
||||
alertDialog.setCanceledOnTouchOutside(false);
|
||||
alertDialog.show();
|
||||
/* final Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
alertDialog.dismiss();
|
||||
timer.cancel();
|
||||
}
|
||||
},10000);*/
|
||||
initTimer();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "网络不可用", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void initTimer() {
|
||||
Timer timer = new Timer(true);
|
||||
TimerTask timerTask = new TimerTask() {
|
||||
int countTime = 10;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (countTime > 0) {
|
||||
countTime--;
|
||||
}
|
||||
if (countTime == 1) {
|
||||
dismissLoadingDialog();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
timer.schedule(timerTask, 1000, 1000);
|
||||
}
|
||||
|
||||
|
||||
public void setLoadingDialogText(String s) {
|
||||
//给loading 添加文字
|
||||
TextView view = alertDialog.findViewById(R.id.progressBar_tx);
|
||||
@ -108,18 +140,14 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
}
|
||||
}
|
||||
|
||||
protected void initMvp() {
|
||||
}
|
||||
protected void initMvp() {}
|
||||
|
||||
protected void initData() {
|
||||
}
|
||||
protected void initData() {}
|
||||
|
||||
protected void initView() {
|
||||
}
|
||||
protected void initView() {}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
@ -72,7 +73,6 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.fragment_stay_submit;
|
||||
@ -122,18 +122,13 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
});
|
||||
refreshData();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.EVENT_STAY_REFRESH) {
|
||||
if ((boolean)data.obj){
|
||||
Toast.makeText(getContext(), "提交成功", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
Toast.makeText(getContext(), "提交失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
Toast.makeText(getContext(), (String) data.obj, Toast.LENGTH_SHORT).show();
|
||||
dismissLoadingDialog();
|
||||
refreshData();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,20 +204,20 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
});
|
||||
break;
|
||||
case R.id.btn_stay_submit://提交
|
||||
if (poiEntities==null){
|
||||
if (poiEntities == null) {
|
||||
poiEntities = new ArrayList<>();
|
||||
}
|
||||
poiEntities.clear();
|
||||
List<PoiEntity> allRoad = staySubmitAdapter.getAllRoad();
|
||||
for (int i = 0; i < allRoad.size(); i++) {
|
||||
if (allRoad.get(i).isChecked()){
|
||||
if (allRoad.get(i).isChecked()) {
|
||||
poiEntities.add(allRoad.get(i));
|
||||
}
|
||||
}
|
||||
if (poiEntities.size()>0){
|
||||
if (poiEntities.size() > 0) {
|
||||
showLoadingDialog();
|
||||
PoiSaveUtils.getInstance(getActivity()).uploadPoiEntityBatch(poiEntities);
|
||||
}else {
|
||||
} else {
|
||||
Toast.makeText(getContext(), "请选择要删除的条目数据", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@ -234,28 +229,29 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
|
||||
if (roadEntities == null) {
|
||||
roadEntities = new ArrayList<>();
|
||||
}else {
|
||||
} else {
|
||||
roadEntities.clear();
|
||||
}
|
||||
if (newEntities == null) {
|
||||
newEntities = new ArrayList<>();
|
||||
}else {
|
||||
} else {
|
||||
newEntities.clear();
|
||||
}
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> roadAll = roadDao.getAllPoi();
|
||||
List<PoiEntity> roadAll = roadDao.getAllPoiByRecoder();
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
roadEntities.clear();
|
||||
for (int i = 0; i < roadAll.size(); i++) {
|
||||
if (roadAll.get(i).getType()!=6){
|
||||
roadEntities.add(roadAll.get(i));
|
||||
}
|
||||
}
|
||||
roadEntities.addAll(roadAll);
|
||||
// for (int i = 0; i < roadAll.size(); i++) {
|
||||
// if (roadAll.get(i).getType()!=6){
|
||||
// roadEntities.add(roadAll.get(i));
|
||||
// }
|
||||
// }
|
||||
Log.d("TAG", "run: " + roadEntities.toString());
|
||||
staySubmitAdapter.setAllRoad(roadEntities);
|
||||
staySubmitAdapter.notifyDataSetChanged();
|
||||
|
@ -676,8 +676,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
switch (Integer.valueOf(poiEntity.getType())) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor=null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
poiDescriptor= BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1);
|
||||
}else {
|
||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
|
||||
}
|
||||
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -690,7 +695,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
|
||||
BitmapDescriptor chargeDescriptor = null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1);
|
||||
}else {
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
|
||||
}
|
||||
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -701,7 +712,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(stationMarker);
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
||||
BitmapDescriptor poiVideoDescriptor = null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1);
|
||||
}else {
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
||||
}
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -712,7 +728,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(poiVideoMarker);
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
|
||||
BitmapDescriptor roadDescriptor =null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
|
||||
}else {
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
|
||||
}
|
||||
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -723,7 +745,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(roadMarker);
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayother);
|
||||
BitmapDescriptor otherDescriptor = null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
|
||||
}else {
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayother);
|
||||
}
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
@ -734,7 +761,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(otherMarker);
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bag);
|
||||
BitmapDescriptor Descriptor =null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
|
||||
}else {
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bag);
|
||||
}
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
|
||||
.clockwise(false)
|
||||
.flat(true));
|
||||
@ -746,6 +778,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||
obtain.obj = allTaskStatus;
|
||||
@ -772,6 +805,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()),Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(1, newPoiLatLng);
|
||||
showSlidingFragment(poiFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
@ -786,6 +821,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()),Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(4, newPoiLatLng);
|
||||
showSlidingFragment(chargingStationFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
@ -800,6 +837,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()),Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(2, newPoiLatLng);
|
||||
showSlidingFragment(poiVideoFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
@ -814,6 +853,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()),Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(3, newPoiLatLng);
|
||||
showSlidingFragment(roadFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
@ -829,6 +870,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()),Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(5, newPoiLatLng);
|
||||
showSlidingFragment(otherFragment);
|
||||
initRemovePoiSharePre();
|
||||
return false;
|
||||
@ -1105,7 +1148,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
} else {
|
||||
frameLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,9 @@ public interface PoiDao {
|
||||
@Query("SELECT * FROM poi")
|
||||
List<PoiEntity> getAllPoi();
|
||||
|
||||
@Query("SELECT * FROM poi where taskStatus > 1 and type!=6")
|
||||
List<PoiEntity> getAllPoiByRecoder();
|
||||
|
||||
@Query("SELECT * FROM poi where type=:type")
|
||||
List<PoiEntity> getAllPoiType(int type);
|
||||
|
||||
|
@ -46,7 +46,8 @@ public class PoiSaveUtils {
|
||||
private Activity mContext;
|
||||
private Gson gson;
|
||||
private static PoiSaveUtils instance;
|
||||
private boolean isBoolean;
|
||||
private int anInt=0;
|
||||
private int bInt=1;
|
||||
|
||||
public static PoiSaveUtils getInstance(Activity mContext) {
|
||||
if (instance == null) {
|
||||
@ -96,7 +97,7 @@ public class PoiSaveUtils {
|
||||
public void run() {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.EVENT_STAY_REFRESH;
|
||||
obtain.obj = isBoolean;
|
||||
obtain.obj = "提交成功"+anInt+",提交失败"+bInt;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
@ -294,10 +295,10 @@ public class PoiSaveUtils {
|
||||
if (otherUploadPicBean.getCode() == 200) {
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().deletePoiEntity(poiEntity);
|
||||
Log.d("TAGss", "uploadPoiNet: 成功");
|
||||
isBoolean=true;
|
||||
anInt++;
|
||||
} else {
|
||||
Log.d("TAGss", "uploadPoiNet: 失败");
|
||||
isBoolean=false;
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user