寻宝页面切换
This commit is contained in:
parent
eb90acb1c5
commit
a29fcaf16f
@ -32,7 +32,6 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
|||||||
|
|
||||||
private AlertDialog alertDialog;
|
private AlertDialog alertDialog;
|
||||||
public View mView;
|
public View mView;
|
||||||
protected FragmentManager supportFragmentManager;
|
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -25,6 +25,7 @@ import android.widget.Toast;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
import com.github.lazylibrary.util.DensityUtil;
|
import com.github.lazylibrary.util.DensityUtil;
|
||||||
@ -104,7 +105,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
private ImageView ivSubmit;
|
private ImageView ivSubmit;
|
||||||
private ImageView ivRefish;
|
private ImageView ivRefish;
|
||||||
private SlidingUpPanelLayout sliding_layout;
|
private SlidingUpPanelLayout sliding_layout;
|
||||||
private FragmentTransaction fragmentTransaction;
|
|
||||||
private Marker markerPoi;
|
private Marker markerPoi;
|
||||||
private CheckBox cbFootType;
|
private CheckBox cbFootType;
|
||||||
private ImageView ivFilter;
|
private ImageView ivFilter;
|
||||||
@ -126,6 +126,15 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
private BitmapDescriptor bitmapDescriptor1, bitmapDescriptor2, bitmapDescriptor3, bitmapDescriptor4, bitmapDescriptor5;
|
private BitmapDescriptor bitmapDescriptor1, bitmapDescriptor2, bitmapDescriptor3, bitmapDescriptor4, bitmapDescriptor5;
|
||||||
private Marker bigMarker;
|
private Marker bigMarker;
|
||||||
private Marker markerPile;
|
private Marker markerPile;
|
||||||
|
private PoiFragment poiFragment;
|
||||||
|
private PoiVideoFragment poiVideoFragment;
|
||||||
|
private RoadFragment roadFragment;
|
||||||
|
private ChargingStationFragment chargingStationFragment;
|
||||||
|
private OtherFragment otherFragment;
|
||||||
|
private FilterFragment filterFragment;
|
||||||
|
private ChargingPileFragment chargingPileFragment;
|
||||||
|
private FragmentManager supportFragmentManager;
|
||||||
|
private FragmentTransaction fragmentTransaction;
|
||||||
|
|
||||||
public static TreasureFragment newInstance(Bundle bundle) {
|
public static TreasureFragment newInstance(Bundle bundle) {
|
||||||
TreasureFragment fragment = new TreasureFragment();
|
TreasureFragment fragment = new TreasureFragment();
|
||||||
@ -246,25 +255,19 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
switch (poiEntity.getType()) {
|
switch (poiEntity.getType()) {
|
||||||
case 1:
|
case 1:
|
||||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
showSlidingFragment(1, bundle);
|
||||||
showSlidingFragment(poiFragment);
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
showSlidingFragment(4, bundle);
|
||||||
showSlidingFragment(chargingStationFragment);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
showSlidingFragment(2, bundle);
|
||||||
showSlidingFragment(poiVideoFragment);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
showSlidingFragment(3, bundle);
|
||||||
showSlidingFragment(roadFragment);
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
showSlidingFragment(5, bundle);
|
||||||
showSlidingFragment(otherFragment);
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
initMarker(poiEntity);
|
initMarker(poiEntity);
|
||||||
@ -667,7 +670,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
int taskStatus = Constant.TASK_STASTUS;
|
int taskStatus = Constant.TASK_STASTUS;
|
||||||
int type = Constant.TASK_TYPE;
|
int type = Constant.TASK_TYPE;
|
||||||
int limit = Constant.LIMIT_TTPE;
|
int limit = Constant.LIMIT_TTPE;
|
||||||
if (taskStatus==0){
|
if (taskStatus == 0) {
|
||||||
Message obtain = Message.obtain();
|
Message obtain = Message.obtain();
|
||||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||||
obtain.obj = null;
|
obtain.obj = null;
|
||||||
@ -835,8 +838,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
showSlidingFragment(1, bundle);
|
||||||
showSlidingFragment(poiFragment);
|
|
||||||
initRemovePoiSharePre();
|
initRemovePoiSharePre();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -849,8 +851,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
showSlidingFragment(4, bundle);
|
||||||
showSlidingFragment(chargingStationFragment);
|
|
||||||
initRemovePoiSharePre();
|
initRemovePoiSharePre();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -863,8 +864,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
showSlidingFragment(2, bundle);
|
||||||
showSlidingFragment(poiVideoFragment);
|
|
||||||
initRemovePoiSharePre();
|
initRemovePoiSharePre();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -877,8 +877,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
showSlidingFragment(3, bundle);
|
||||||
showSlidingFragment(roadFragment);
|
|
||||||
initRemovePoiSharePre();
|
initRemovePoiSharePre();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -892,8 +891,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
showSlidingFragment(5, bundle);
|
||||||
showSlidingFragment(otherFragment);
|
|
||||||
initRemovePoiSharePre();
|
initRemovePoiSharePre();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -953,30 +951,21 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
switch (poiEntity.getType()) {
|
switch (poiEntity.getType()) {
|
||||||
case 1:
|
case 1:
|
||||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
showSlidingFragment(1, bundle);
|
||||||
showSlidingFragment(poiFragment);
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
showSlidingFragment(4, bundle);
|
||||||
showSlidingFragment(chargingStationFragment);
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
showSlidingFragment(2, bundle);
|
||||||
showSlidingFragment(poiVideoFragment);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
showSlidingFragment(3, bundle);
|
||||||
showSlidingFragment(roadFragment);
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
showSlidingFragment(5, bundle);
|
||||||
showSlidingFragment(otherFragment);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
frameLayout.setVisibility(View.GONE);
|
|
||||||
if (gatherGetFragment != null) {
|
|
||||||
fragmentTransaction.remove(gatherGetFragment);
|
|
||||||
}
|
|
||||||
} else if (data.what == Constant.GATHER_GET_MAP) { //地图界面点击采集 点击开始采集
|
} else if (data.what == Constant.GATHER_GET_MAP) { //地图界面点击采集 点击开始采集
|
||||||
PoiEntity poiEntity = (PoiEntity) data.obj;
|
PoiEntity poiEntity = (PoiEntity) data.obj;
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
@ -984,24 +973,19 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
bundle.putBoolean("isSliding", true); // 通知抽屉不收回
|
bundle.putBoolean("isSliding", true); // 通知抽屉不收回
|
||||||
switch (poiEntity.getType()) {
|
switch (poiEntity.getType()) {
|
||||||
case 1:
|
case 1:
|
||||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
showSlidingFragment(1, bundle);
|
||||||
showSlidingFragment(poiFragment);
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
showSlidingFragment(4, bundle);
|
||||||
showSlidingFragment(chargingStationFragment);
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
showSlidingFragment(2, bundle);
|
||||||
showSlidingFragment(poiVideoFragment);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
showSlidingFragment(3, bundle);
|
||||||
showSlidingFragment(roadFragment);
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
showSlidingFragment(5, bundle);
|
||||||
showSlidingFragment(otherFragment);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
frameLayout.setVisibility(View.GONE);
|
frameLayout.setVisibility(View.GONE);
|
||||||
@ -1054,7 +1038,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
setMainButtonVisiable((Integer) data.obj);
|
setMainButtonVisiable((Integer) data.obj);
|
||||||
} else if (data.what == Constant.MAIN_HEADER) {// 控制主界面各个header
|
} else if (data.what == Constant.MAIN_HEADER) {// 控制主界面各个header
|
||||||
View view = (View) data.obj;
|
View view = (View) data.obj;
|
||||||
if (view!=null){
|
if (view != null) {
|
||||||
initHeader(view);
|
initHeader(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1084,16 +1068,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
|
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
|
||||||
LatLng mapCenterPoint = getMapCenterPoint();
|
LatLng mapCenterPoint = getMapCenterPoint();
|
||||||
markerPile = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(pileDescriptor));
|
markerPile = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(pileDescriptor));
|
||||||
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
showSlidingFragment(7, bundle);
|
||||||
showSlidingFragment(chargingPileFragment);
|
|
||||||
} else if (data.what == Constant.CHARGING_STATION_PILE) {//充电站的充电桩
|
} else if (data.what == Constant.CHARGING_STATION_PILE) {//充电站的充电桩
|
||||||
chargingPileEntity = (ChargingPileEntity) data.obj;
|
chargingPileEntity = (ChargingPileEntity) data.obj;
|
||||||
} else if (data.what == Constant.CHARGING_STATION_ITEM) {//充电站的item 跳转到充电桩
|
} else if (data.what == Constant.CHARGING_STATION_ITEM) {//充电站的item 跳转到充电桩
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
||||||
bundle.putSerializable("chargingPileEntity", (ChargingPileEntity) data.obj);
|
bundle.putSerializable("chargingPileEntity", (ChargingPileEntity) data.obj);
|
||||||
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
showSlidingFragment(7, bundle);
|
||||||
showSlidingFragment(chargingPileFragment);
|
|
||||||
} else if (data.what == Constant.HOME_TREASURE) {//寻宝的刷新
|
} else if (data.what == Constant.HOME_TREASURE) {//寻宝的刷新
|
||||||
if ((boolean) data.obj) {
|
if ((boolean) data.obj) {
|
||||||
initList(Constant.currentLocation);
|
initList(Constant.currentLocation);
|
||||||
@ -1121,26 +1103,21 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putBoolean("isSliding", true); // 通知抽屉不收回
|
bundle.putBoolean("isSliding", true); // 通知抽屉不收回
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
switch (poiEntity.getType()) {
|
switch (poiEntity.getType()) {//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
|
||||||
case 1:
|
case 1:
|
||||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
showSlidingFragment(1, bundle);
|
||||||
showSlidingFragment(poiFragment);
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
showSlidingFragment(4, bundle);
|
||||||
showSlidingFragment(chargingStationFragment);
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
showSlidingFragment(2, bundle);
|
||||||
showSlidingFragment(poiVideoFragment);
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
showSlidingFragment(3, bundle);
|
||||||
showSlidingFragment(roadFragment);
|
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
showSlidingFragment(5, bundle);
|
||||||
showSlidingFragment(otherFragment);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
frameLayout.setVisibility(View.GONE);
|
frameLayout.setVisibility(View.GONE);
|
||||||
@ -1163,29 +1140,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initRemoveFragment() {
|
|
||||||
PoiFragment poiFragments = (PoiFragment) supportFragmentManager.findFragmentByTag(PoiFragment.class.getName());
|
|
||||||
if (poiFragments != null) {
|
|
||||||
fragmentTransaction.remove(poiFragments);
|
|
||||||
}
|
|
||||||
ChargingStationFragment chargingStationFragment = (ChargingStationFragment) supportFragmentManager.findFragmentByTag(ChargingStationFragment.class.getName());
|
|
||||||
if (chargingStationFragment != null) {
|
|
||||||
fragmentTransaction.remove(chargingStationFragment);
|
|
||||||
}
|
|
||||||
PoiVideoFragment poiVideoFragment = (PoiVideoFragment) supportFragmentManager.findFragmentByTag(PoiVideoFragment.class.getName());
|
|
||||||
if (poiVideoFragment != null) {
|
|
||||||
fragmentTransaction.remove(poiVideoFragment);
|
|
||||||
} RoadFragment roadFragment = (RoadFragment) supportFragmentManager.findFragmentByTag(RoadFragment.class.getName());
|
|
||||||
if (roadFragment != null) {
|
|
||||||
fragmentTransaction.remove(roadFragment);
|
|
||||||
}
|
|
||||||
OtherFragment otherFragment = (OtherFragment) supportFragmentManager.findFragmentByTag(OtherFragment.class.getName());
|
|
||||||
if (otherFragment != null) {
|
|
||||||
fragmentTransaction.remove(otherFragment);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 控制主界面各个按钮的显示状态
|
* 控制主界面各个按钮的显示状态
|
||||||
@ -1434,96 +1388,30 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
LatLng newPoiLatLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
|
LatLng newPoiLatLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
|
||||||
poiEntity.setX(newPoiLatLng.getLongitude() + "");
|
poiEntity.setX(newPoiLatLng.getLongitude() + "");
|
||||||
poiEntity.setY(newPoiLatLng.getLatitude() + "");
|
poiEntity.setY(newPoiLatLng.getLatitude() + "");
|
||||||
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
ShareDialog.show((AppCompatActivity) getActivity(), itemList, new ShareDialog.OnItemClickListener() {
|
ShareDialog.show((AppCompatActivity) getActivity(), itemList, new ShareDialog.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
|
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: // POI
|
case 0: // POI
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
showPoiMarkerByType(1, newPoiLatLng);
|
showPoiMarkerByType(1, newPoiLatLng);
|
||||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
showSlidingFragment(1, bundle);
|
||||||
showSlidingFragment(poiFragment);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
break;
|
break;
|
||||||
case 1: // POI录像
|
case 1: // POI录像
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
showPoiMarkerByType(2, newPoiLatLng);
|
showPoiMarkerByType(2, newPoiLatLng);
|
||||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
showSlidingFragment(2, bundle);
|
||||||
showSlidingFragment(poiVideoFragment);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2://道路录像
|
case 2://道路录像
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
showPoiMarkerByType(3, newPoiLatLng);
|
showPoiMarkerByType(3, newPoiLatLng);
|
||||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
showSlidingFragment(3, bundle);
|
||||||
showSlidingFragment(roadFragment);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
break;
|
break;
|
||||||
case 3://充电站
|
case 3://充电站
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
showPoiMarkerByType(4, newPoiLatLng);
|
showPoiMarkerByType(4, newPoiLatLng);
|
||||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
showSlidingFragment(4, bundle);
|
||||||
showSlidingFragment(chargingStationFragment);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
break;
|
break;
|
||||||
case 4://其他
|
case 4://其他
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
showPoiMarkerByType(5, newPoiLatLng);
|
showPoiMarkerByType(5, newPoiLatLng);
|
||||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
showSlidingFragment(5, bundle);
|
||||||
showSlidingFragment(otherFragment);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1533,9 +1421,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
case R.id.iv_filter:
|
case R.id.iv_filter:
|
||||||
initThread();
|
initThread();
|
||||||
initList(Constant.currentLocation);
|
initList(Constant.currentLocation);
|
||||||
FilterFragment filterFragment = FilterFragment.newInstance(new Bundle());
|
showSlidingFragment(6, new Bundle());
|
||||||
showSlidingFragment(filterFragment);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case R.id.iv_message:
|
case R.id.iv_message:
|
||||||
Intent messageIntent = new Intent(getContext(), FragmentManagement.class);
|
Intent messageIntent = new Intent(getContext(), FragmentManagement.class);
|
||||||
@ -1573,47 +1459,91 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
/**
|
/**
|
||||||
* 将fragment显示到抽屉内
|
* 将fragment显示到抽屉内
|
||||||
*/
|
*/
|
||||||
private void showSlidingFragment(BaseDrawerFragment fragment) {
|
private void showSlidingFragment(int type, Bundle bundle) {
|
||||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||||
int[] deviceInfo = DensityUtil.getDeviceInfo(getActivity());
|
int[] deviceInfo = DensityUtil.getDeviceInfo(getActivity());
|
||||||
|
|
||||||
sliding_layout.setPanelHeight(deviceInfo[1] / 2);
|
sliding_layout.setPanelHeight(deviceInfo[1] / 2);
|
||||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||||
fragmentTransaction.add(R.id.scroll_view, fragment, fragment.getClass().getName());
|
hideAllFragment(fragmentTransaction);
|
||||||
if (!(fragment instanceof FilterFragment)) {
|
switch (type) {
|
||||||
FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
|
case 1://poi:
|
||||||
if (filterFragment != null) {
|
if (poiFragment == null) {
|
||||||
fragmentTransaction.hide(filterFragment);
|
poiFragment = PoiFragment.newInstance(bundle);
|
||||||
|
fragmentTransaction.add(R.id.scroll_view, poiFragment);
|
||||||
|
} else {
|
||||||
|
fragmentTransaction.show(poiFragment);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case 2://poi录像
|
||||||
|
if (poiVideoFragment == null) {
|
||||||
|
poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||||
|
fragmentTransaction.add(R.id.scroll_view, poiVideoFragment);
|
||||||
|
} else {
|
||||||
|
fragmentTransaction.show(poiVideoFragment);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3://道路
|
||||||
|
if (roadFragment == null) {
|
||||||
|
roadFragment = RoadFragment.newInstance(bundle);
|
||||||
|
fragmentTransaction.add(R.id.scroll_view, roadFragment);
|
||||||
|
} else {
|
||||||
|
fragmentTransaction.show(roadFragment);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4://充电站
|
||||||
|
if (chargingStationFragment == null) {
|
||||||
|
chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||||
|
fragmentTransaction.add(R.id.scroll_view, chargingStationFragment);
|
||||||
|
} else {
|
||||||
|
fragmentTransaction.show(chargingStationFragment);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5://其他
|
||||||
|
if (otherFragment == null) {
|
||||||
|
otherFragment = OtherFragment.newInstance(bundle);
|
||||||
|
fragmentTransaction.add(R.id.scroll_view, otherFragment);
|
||||||
|
} else {
|
||||||
|
fragmentTransaction.show(otherFragment);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6://删选
|
||||||
|
if (filterFragment == null) {
|
||||||
|
filterFragment = FilterFragment.newInstance(bundle);
|
||||||
|
fragmentTransaction.add(R.id.scroll_view, filterFragment);
|
||||||
|
} else {
|
||||||
|
fragmentTransaction.show(filterFragment);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
if (chargingPileFragment == null) {
|
||||||
|
chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
||||||
|
fragmentTransaction.add(R.id.scroll_view, chargingPileFragment);
|
||||||
|
} else {
|
||||||
|
fragmentTransaction.show(chargingPileFragment);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fragmentTransaction.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(fragment instanceof ChargingStationFragment)) {
|
private void hideAllFragment(FragmentTransaction fragmentTransaction) {
|
||||||
ChargingStationFragment chargingStationFragment = (ChargingStationFragment) supportFragmentManager.findFragmentByTag(ChargingStationFragment.class.getName());
|
|
||||||
if (chargingStationFragment != null) {
|
|
||||||
fragmentTransaction.hide(chargingStationFragment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!(fragment instanceof PoiFragment)) {
|
|
||||||
PoiFragment poiFragment = (PoiFragment) supportFragmentManager.findFragmentByTag(PoiFragment.class.getName());
|
|
||||||
if (poiFragment != null) {
|
if (poiFragment != null) {
|
||||||
fragmentTransaction.hide(poiFragment);
|
fragmentTransaction.hide(poiFragment);
|
||||||
}
|
} else if (poiVideoFragment != null) {
|
||||||
}
|
|
||||||
if (!(fragment instanceof RoadFragment)) {
|
|
||||||
RoadFragment roadFragment = (RoadFragment) supportFragmentManager.findFragmentByTag(RoadFragment.class.getName());
|
|
||||||
if (roadFragment != null) {
|
|
||||||
fragmentTransaction.hide(roadFragment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!(fragment instanceof PoiVideoFragment)) {
|
|
||||||
PoiVideoFragment poiVideoFragment = (PoiVideoFragment) supportFragmentManager.findFragmentByTag(PoiVideoFragment.class.getName());
|
|
||||||
if (poiVideoFragment != null) {
|
|
||||||
fragmentTransaction.hide(poiVideoFragment);
|
fragmentTransaction.hide(poiVideoFragment);
|
||||||
|
} else if (chargingStationFragment != null) {
|
||||||
|
fragmentTransaction.hide(chargingStationFragment);
|
||||||
|
} else if (roadFragment != null) {
|
||||||
|
fragmentTransaction.hide(roadFragment);
|
||||||
|
} else if (otherFragment != null) {
|
||||||
|
fragmentTransaction.hide(otherFragment);
|
||||||
|
} else if (filterFragment != null) {
|
||||||
|
fragmentTransaction.hide(filterFragment);
|
||||||
|
} else if (chargingPileFragment != null) {
|
||||||
|
fragmentTransaction.hide(chargingPileFragment);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
fragmentTransaction.show(fragment);
|
|
||||||
fragmentTransaction.addToBackStack(null);
|
|
||||||
fragmentTransaction.commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user