筛选页面
This commit is contained in:
parent
ca0663c29a
commit
1359702727
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.0"
|
||||
ndkVersion '23.0.7123448'
|
||||
// ndkVersion '23.0.7123448'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
|
@ -43,7 +43,7 @@
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
android:theme="@style/Theme.WhiteScreen">
|
||||
|
||||
<activity android:name=".activity.PictureActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|navigation"
|
||||
@ -77,7 +77,6 @@
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity android:name=".activity.ImageShowActivity" />
|
||||
<activity android:name=".activity.UserActivity" />
|
||||
<activity android:name=".activity.FilterActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -1,76 +0,0 @@
|
||||
package com.navinfo.outdoor.activity;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.kongzue.dialog.interfaces.OnMenuItemClickListener;
|
||||
import com.kongzue.dialog.v3.BottomMenu;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.base.BaseActivity;
|
||||
|
||||
/**
|
||||
* 筛选的activity
|
||||
*/
|
||||
public class FilterActivity extends BaseActivity implements View.OnClickListener {
|
||||
|
||||
private ImageView ivFilter;
|
||||
private TextView tvType;
|
||||
private TextView tvDist;
|
||||
private Button btnFilter;
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.activity_filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
ConstraintLayout clDist = findViewById(R.id.cl_dist);
|
||||
clDist.setOnClickListener(this::onClick);
|
||||
ConstraintLayout clType = findViewById(R.id.cl_type);
|
||||
clType.setOnClickListener(this::onClick);
|
||||
tvType = findViewById(R.id.tv_type);
|
||||
tvDist = findViewById(R.id.tv_dist);
|
||||
btnFilter = findViewById(R.id.btn_filter);
|
||||
btnFilter.setOnClickListener(this::onClick);
|
||||
ivFilter = findViewById(R.id.iv_filter);
|
||||
ivFilter.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.btn_filter:
|
||||
case R.id.iv_filter:
|
||||
finish();
|
||||
break;
|
||||
case R.id.cl_dist:
|
||||
BottomMenu.show(FilterActivity.this, new String[]{"100米", "200米", "500米", "1000米", "2000米", "2500米", "5000米"}, new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvDist.setText(text);
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
case R.id.cl_type:
|
||||
BottomMenu.show(FilterActivity.this, new String[]{"poi", "道路", "充电站", "其他"}, new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvType.setText(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ import com.navinfo.outdoor.fragment.CapacityEvaluationFragment2;
|
||||
import com.navinfo.outdoor.fragment.CapacityMeasurementFragment;
|
||||
import com.navinfo.outdoor.fragment.ContactFragment;
|
||||
import com.navinfo.outdoor.fragment.EventPrefectureFragment;
|
||||
import com.navinfo.outdoor.fragment.FilterFragment;
|
||||
import com.navinfo.outdoor.fragment.FindFragment;
|
||||
import com.navinfo.outdoor.fragment.ForgetPawFragment;
|
||||
import com.navinfo.outdoor.fragment.GatheringFragment;
|
||||
@ -24,7 +25,6 @@ import com.navinfo.outdoor.fragment.PoiTaskFragment;
|
||||
import com.navinfo.outdoor.fragment.PrivilegeFragment;
|
||||
import com.navinfo.outdoor.fragment.RecordFragment;
|
||||
import com.navinfo.outdoor.fragment.RoadFragment;
|
||||
import com.navinfo.outdoor.fragment.RoadTaskFragment;
|
||||
import com.navinfo.outdoor.fragment.SetFragment;
|
||||
import com.navinfo.outdoor.fragment.StaySubmitFragment;
|
||||
import com.navinfo.outdoor.fragment.TaskExWebFragment;
|
||||
@ -82,8 +82,7 @@ public class FragmentManagement extends BaseActivity {
|
||||
private StaySubmitFragment staySubmitFragment;//记录-待提交的fragment -29
|
||||
private HasSubmitFragment hasSubmitFragment;//记录-已提交的fragment -30
|
||||
private PoiTaskFragment poiTaskFragment;//记录-已提交-POI任务列表的fragment -31
|
||||
private RoadTaskFragment roadTaskFragment;//记录-已提交-道路任务列表的fragment -32
|
||||
|
||||
private FilterFragment filterFragment;//寻宝-删选 -35
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
@ -165,8 +164,9 @@ public class FragmentManagement extends BaseActivity {
|
||||
fragmentTransaction.hide(hasSubmitFragment);
|
||||
if (poiTaskFragment !=null) //记录-已提交-任务列表的fragment -31
|
||||
fragmentTransaction.hide(poiTaskFragment);
|
||||
if (roadTaskFragment !=null) //记录-已提交-任务列表的fragment -31
|
||||
fragmentTransaction.hide(roadTaskFragment);
|
||||
if (filterFragment!=null)//寻宝-删选
|
||||
fragmentTransaction.hide(filterFragment);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -426,6 +426,14 @@ public class FragmentManagement extends BaseActivity {
|
||||
fragmentTransaction.show(poiTaskFragment);
|
||||
}
|
||||
break;
|
||||
case 35://寻宝- 删选
|
||||
if (filterFragment ==null){
|
||||
filterFragment =new FilterFragment();
|
||||
fragmentTransaction.add(R.id.frame_layout,filterFragment);
|
||||
}else {
|
||||
fragmentTransaction.show(filterFragment);
|
||||
}
|
||||
break;
|
||||
}
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
@ -524,6 +532,9 @@ public class FragmentManagement extends BaseActivity {
|
||||
case 30:
|
||||
hasSubmitFragment.onActivityResult(requestCode,resultCode,data);
|
||||
break;
|
||||
case 35:
|
||||
filterFragment.onActivityResult(requestCode,resultCode,data);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,84 @@
|
||||
package com.navinfo.outdoor.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 筛选的适配器
|
||||
*/
|
||||
public class FilterAdapter extends RecyclerView.Adapter<FilterAdapter.ViewHolder> {
|
||||
private Context context;
|
||||
private List<PoiEntity> allPoi=new ArrayList<>();
|
||||
|
||||
public FilterAdapter(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void setAllPoi(List<PoiEntity> allPoi) {
|
||||
this.allPoi.addAll(allPoi);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.item_filter, parent, false);
|
||||
return new ViewHolder(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
PoiEntity poiEntity = allPoi.get(position);
|
||||
holder.tvName.setText(poiEntity.getName());
|
||||
holder.tvTaskId.setText(poiEntity.getTaskId()+"");
|
||||
holder.tvMoney.setText(poiEntity.getPrecision()+"");
|
||||
holder.tvDistance.setText(poiEntity.getDescribe()+"");
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (itemCLick!=null){
|
||||
itemCLick.item(poiEntity);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return allPoi.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvName,tvForm,tvTaskId,tvMoney,tvDistance;
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tvName=itemView.findViewById(R.id.tv_name);
|
||||
tvForm=itemView.findViewById(R.id.tv_form);
|
||||
tvTaskId=itemView.findViewById(R.id.tv_task_id);
|
||||
tvMoney=itemView.findViewById(R.id.tv_money);
|
||||
tvDistance=itemView.findViewById(R.id.tv_distance);
|
||||
}
|
||||
}
|
||||
ItemCLick itemCLick;
|
||||
|
||||
public void setItemCLick(ItemCLick itemCLick) {
|
||||
this.itemCLick = itemCLick;
|
||||
}
|
||||
|
||||
public interface ItemCLick{
|
||||
void item(PoiEntity poiEntity);
|
||||
}
|
||||
}
|
@ -41,6 +41,8 @@ public class Constant {
|
||||
public static final int TREASURE_WORD_1 = 1;
|
||||
public static final int POI_WORD_2 = 2;
|
||||
public static final int POI_WORD_3 = 3;
|
||||
public static final int FILTER_LIST = 4;
|
||||
public static final int FILTER_LIST_ITEM = 5;
|
||||
|
||||
/**
|
||||
* 用户当前位置
|
||||
|
@ -0,0 +1,163 @@
|
||||
package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.jcodecraeer.xrecyclerview.ProgressStyle;
|
||||
import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
||||
import com.kongzue.dialog.interfaces.OnMenuItemClickListener;
|
||||
import com.kongzue.dialog.v3.BottomMenu;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.adapter.FilterAdapter;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDialogFragment;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FilterFragment extends BaseDialogFragment implements View.OnClickListener {
|
||||
private ImageView ivFilter;
|
||||
private Button btnFilter;
|
||||
private XRecyclerView recyclerFilter;
|
||||
private TextView tvType, tvExclusive, tvPhotograph;
|
||||
private ConstraintLayout clPhotograph, clExclusive, clType;
|
||||
private PoiDatabase poiDatabase;
|
||||
private PoiDao poiDao;
|
||||
private FilterAdapter filterAdapter;
|
||||
private ArrayList<PoiEntity> poiEntities;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.fragment_filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
clPhotograph = findViewById(R.id.cl_photograph);
|
||||
clPhotograph.setOnClickListener(this::onClick);
|
||||
tvPhotograph = findViewById(R.id.tv_photograph);
|
||||
clExclusive = findViewById(R.id.cl_exclusive);
|
||||
clExclusive.setOnClickListener(this::onClick);
|
||||
tvExclusive = findViewById(R.id.tv_exclusive);
|
||||
clType = findViewById(R.id.cl_type);
|
||||
clType.setOnClickListener(this::onClick);
|
||||
tvType = findViewById(R.id.tv_type);
|
||||
|
||||
//recyclerView
|
||||
btnFilter = findViewById(R.id.btn_filter);
|
||||
btnFilter.setOnClickListener(this::onClick);
|
||||
ivFilter = findViewById(R.id.iv_filter);
|
||||
ivFilter.setOnClickListener(this);
|
||||
recyclerFilter = findViewById(R.id.recycler_filter);
|
||||
//设置下划线
|
||||
recyclerFilter.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
recyclerFilter.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
||||
recyclerFilter.setRefreshProgressStyle(ProgressStyle.SemiCircleSpin);
|
||||
recyclerFilter.setLoadingMoreProgressStyle(ProgressStyle.BallRotate);
|
||||
//取消上啦加载下拉刷新
|
||||
recyclerFilter.setPullRefreshEnabled(false);
|
||||
recyclerFilter.setLoadingMoreEnabled(false);
|
||||
filterAdapter = new FilterAdapter(getContext());
|
||||
recyclerFilter.setAdapter(filterAdapter);
|
||||
recyclerFilter.getDefaultFootView().setNoMoreHint("成功加载完毕");
|
||||
recyclerFilter.setLoadingListener(new XRecyclerView.LoadingListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
}
|
||||
});
|
||||
filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() {
|
||||
@Override
|
||||
public void item(PoiEntity poiEntity) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.FILTER_LIST_ITEM;
|
||||
obtain.obj = poiEntity;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
poiDatabase = PoiDatabase.getInstance(getContext());
|
||||
poiDao = poiDatabase.getPoiDao();
|
||||
poiEntities = new ArrayList<>();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> allPoi = poiDao.getAllPoi();
|
||||
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d("TAG", "run: " + allPoi.toString());
|
||||
poiEntities.addAll(allPoi);
|
||||
filterAdapter.setAllPoi(allPoi);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.btn_filter:
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.FILTER_LIST;
|
||||
obtain.obj = poiEntities;
|
||||
EventBus.getDefault().post(obtain);
|
||||
break;
|
||||
case R.id.iv_filter:
|
||||
getActivity().finish();
|
||||
break;
|
||||
case R.id.cl_photograph:
|
||||
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"录像", "拍照"}, new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvPhotograph.setText(text);
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
case R.id.cl_exclusive:
|
||||
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"poi", "道路", "充电站", "其他"}, new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvExclusive.setText(text);
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
case R.id.cl_type:
|
||||
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"专属", "普通"}, new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvType.setText(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -220,18 +220,6 @@ public class PoiFragment extends BaseDialogFragment implements View.OnClickListe
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
getView().setFocusableInTouchMode(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
getView().setFocusableInTouchMode(false);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.POI_WORD_2) {
|
||||
@ -327,13 +315,6 @@ public class PoiFragment extends BaseDialogFragment implements View.OnClickListe
|
||||
});
|
||||
break;
|
||||
case R.id.btn_uploading:
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> allPoi = poiDao.getAllPoi();
|
||||
Log.d("TAG", "run: "+allPoi.toString());
|
||||
}
|
||||
}).start();
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_FRAGMENT;
|
||||
obtain.obj = false;
|
||||
@ -492,54 +473,6 @@ public class PoiFragment extends BaseDialogFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
public static int readPictureDegree(String path) {
|
||||
int degree = 0;
|
||||
try {
|
||||
ExifInterface exifInterface = new ExifInterface(path);
|
||||
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION,
|
||||
ExifInterface.ORIENTATION_NORMAL);
|
||||
switch (orientation) {
|
||||
case ExifInterface.ORIENTATION_ROTATE_90:
|
||||
degree = 90;
|
||||
break;
|
||||
case ExifInterface.ORIENTATION_ROTATE_180:
|
||||
degree = 180;
|
||||
break;
|
||||
case ExifInterface.ORIENTATION_ROTATE_270:
|
||||
degree = 270;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return degree;
|
||||
}
|
||||
|
||||
public static Bitmap rotateBitmapByDegree(Bitmap bm, int degree) {
|
||||
if (bm == null) {
|
||||
return null;
|
||||
}
|
||||
Bitmap returnBm = null;
|
||||
|
||||
// 根据旋转角度,生成旋转矩阵
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postRotate(degree);
|
||||
try {
|
||||
// 将原始图片按照旋转矩阵进行旋转,并得到新的图片
|
||||
returnBm = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(),
|
||||
bm.getHeight(), matrix, true);
|
||||
} catch (OutOfMemoryError e) {
|
||||
}
|
||||
if (returnBm == null) {
|
||||
returnBm = bm;
|
||||
}
|
||||
if (bm != returnBm) {
|
||||
bm.recycle();
|
||||
}
|
||||
return returnBm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
@ -1,50 +1,36 @@
|
||||
package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Point;
|
||||
import android.location.Location;
|
||||
import android.os.Build;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.hjq.permissions.OnPermissionCallback;
|
||||
import com.hjq.permissions.Permission;
|
||||
import com.hjq.permissions.XXPermissions;
|
||||
import com.kongzue.dialog.interfaces.OnBackClickListener;
|
||||
import com.kongzue.dialog.interfaces.OnShowListener;
|
||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.kongzue.dialog.v3.ShareDialog;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FilterActivity;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.activity.MainActivity;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.util.BackHandlerHelper;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||
import com.navinfo.outdoor.util.ToastUtil;
|
||||
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
||||
@ -58,8 +44,6 @@ import com.tencent.tencentmap.mapsdk.maps.LocationSource;
|
||||
import com.tencent.tencentmap.mapsdk.maps.MapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.AlphaAnimation;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Animation;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
|
||||
@ -74,8 +58,6 @@ import org.greenrobot.eventbus.Subscribe;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||
|
||||
/**
|
||||
* 寻宝的Fragment
|
||||
* 2021-5-25
|
||||
@ -95,13 +77,15 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
private ImageView ivRefish;
|
||||
private SlidingUpPanelLayout sliding_layout;
|
||||
private FragmentTransaction fragmentTransaction;
|
||||
private PoiFragment poiFragment;
|
||||
private PoiFragment poiFragment;//poi
|
||||
private RoadFragment roadFragment;//道路
|
||||
private FilterFragment filterFragment;//筛选
|
||||
private Marker marker;
|
||||
|
||||
private CheckBox cbFootType;
|
||||
private ImageView ivFilter;
|
||||
private Point screenPosition; //marker的屏幕坐标
|
||||
private RoadFragment roadFragment;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
@ -159,11 +143,28 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what==Constant.TREASURE_WORD_0){
|
||||
if (data.what == Constant.FILTER_LIST_ITEM) {
|
||||
PoiEntity poiEntity = (PoiEntity) data.obj;
|
||||
LatLng position = new LatLng(Double.valueOf(poiEntity.getX()), Double.valueOf(poiEntity.getY()));
|
||||
tencentMap.addMarker(new MarkerOptions(position));
|
||||
sliding_layout.setPanelHeight(0);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
|
||||
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "位置信息", "采集").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
sliding_layout.setPanelHeight(1000);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else if (data.what == Constant.FILTER_LIST) {
|
||||
List<PoiEntity> poiEntities = (List<PoiEntity>) data.obj;
|
||||
initFilterMarker(poiEntities);
|
||||
} else if (data.what == Constant.TREASURE_WORD_0) {
|
||||
initPoiMarker(Boolean.valueOf((Boolean) data.obj));
|
||||
|
||||
}else if (data.what==Constant.TREASURE_FRAGMENT){
|
||||
if ((boolean)data.obj){
|
||||
} else if (data.what == Constant.TREASURE_FRAGMENT) {
|
||||
if ((boolean) data.obj) {
|
||||
ivZoomAdd.setVisibility(View.GONE);
|
||||
ivZoomDel.setVisibility(View.GONE);
|
||||
ivLocation.setVisibility(View.GONE);
|
||||
@ -172,7 +173,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
cbFootType.setVisibility(View.GONE);
|
||||
ivSubmit.setVisibility(View.GONE);
|
||||
ivFilter.setVisibility(View.GONE);
|
||||
}else {
|
||||
} else {
|
||||
ivZoomAdd.setVisibility(View.VISIBLE);
|
||||
ivZoomDel.setVisibility(View.VISIBLE);
|
||||
ivLocation.setVisibility(View.VISIBLE);
|
||||
@ -184,19 +185,28 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
sliding_layout.setPanelHeight(0);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
|
||||
if (poiFragment!=null){
|
||||
if (poiFragment != null) {
|
||||
fragmentTransaction.hide(poiFragment);
|
||||
}
|
||||
if (roadFragment!=null){
|
||||
if (roadFragment != null) {
|
||||
fragmentTransaction.hide(roadFragment);
|
||||
}
|
||||
if (marker!=null){
|
||||
if (filterFragment != null) {
|
||||
fragmentTransaction.hide(filterFragment);
|
||||
}
|
||||
if (marker != null) {
|
||||
marker.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initFilterMarker(List<PoiEntity> poiEntities) {
|
||||
for (int i = 0; i < poiEntities.size(); i++) {
|
||||
LatLng position = new LatLng(Double.valueOf(poiEntities.get(i).getX()), Double.valueOf(poiEntities.get(i).getY()));
|
||||
tencentMap.addMarker(new MarkerOptions(position));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initPoiMarker(Boolean t) {
|
||||
@ -233,8 +243,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Constant.markerLatitude = latLng.latitude;
|
||||
Constant.markerLongitude = latLng.longitude;
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what=Constant.POI_WORD_2;
|
||||
obtain.obj=Constant.markerLatitude +","+ Constant.markerLongitude;
|
||||
obtain.what = Constant.POI_WORD_2;
|
||||
obtain.obj = Constant.markerLatitude + "," + Constant.markerLongitude;
|
||||
EventBus.getDefault().post(obtain);
|
||||
|
||||
}
|
||||
@ -362,6 +372,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
List<ShareDialog.Item> itemList = new ArrayList<>();
|
||||
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_poi, "POI"));
|
||||
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_road, "道路"));
|
||||
itemList.add(new ShareDialog.Item(getContext(), R.mipmap.filter, "筛选"));
|
||||
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_chongdianzhuang, "充电站"));
|
||||
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_qingbao, "其他"));
|
||||
ShareDialog.show((AppCompatActivity) getActivity(), itemList, new ShareDialog.OnItemClickListener() {
|
||||
@ -371,33 +382,42 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||
poiFragment = new PoiFragment();
|
||||
roadFragment = new RoadFragment();
|
||||
fragmentTransaction.add(R.id.dragView, poiFragment).add(R.id.dragView,roadFragment).commit();
|
||||
filterFragment = new FilterFragment();
|
||||
fragmentTransaction.add(R.id.dragView, poiFragment).add(R.id.dragView, roadFragment).add(R.id.dragView, filterFragment).commit();
|
||||
switch (index) {
|
||||
case 0:
|
||||
sliding_layout.setPanelHeight(1000);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
fragmentTransaction.show(poiFragment);
|
||||
fragmentTransaction.hide(roadFragment);
|
||||
fragmentTransaction.hide(roadFragment).hide(filterFragment);
|
||||
fragmentTransaction.addToBackStack(null);
|
||||
break;
|
||||
case 1:
|
||||
sliding_layout.setPanelHeight(1000);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
fragmentTransaction.show(roadFragment);
|
||||
fragmentTransaction.hide(poiFragment);
|
||||
fragmentTransaction.hide(poiFragment).hide(filterFragment);
|
||||
fragmentTransaction.addToBackStack(null);
|
||||
break;
|
||||
case 2:
|
||||
sliding_layout.setPanelHeight(1000);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
fragmentTransaction.show(filterFragment);
|
||||
fragmentTransaction.hide(poiFragment).hide(roadFragment);
|
||||
fragmentTransaction.addToBackStack(null);
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}).setTitle(title);
|
||||
break;
|
||||
case R.id.iv_filter:
|
||||
Intent intent = new Intent(getActivity(), FilterActivity.class);
|
||||
startActivityForResult(intent,Constant.FILTER_CODE);
|
||||
Intent intent = new Intent(getActivity(), FragmentManagement.class);
|
||||
intent.putExtra("tag", 35);
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -508,13 +528,15 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
//GPS, WiFi, Radio 等状态发生变化
|
||||
Log.v("State changed", s + "===" + s1);
|
||||
}
|
||||
|
||||
//隐藏文字标注
|
||||
private void performPoiHide() {
|
||||
if ( tencentMap == null || tencentMap.isDestroyed()) {
|
||||
if (tencentMap == null || tencentMap.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
tencentMap.setPoisEnabled(false);
|
||||
}
|
||||
|
||||
//显示文字标注
|
||||
private void performPoiShow() {
|
||||
if (tencentMap == null || tencentMap.isDestroyed()) {
|
||||
|
@ -21,6 +21,7 @@
|
||||
android:layout_height="45dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/icon_arrow" />
|
||||
|
||||
<TextView
|
||||
@ -40,7 +41,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/rl_filter">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_type"
|
||||
android:id="@+id/cl_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
@ -61,7 +62,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="全部"
|
||||
android:text="专属"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -78,7 +79,7 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_dist"
|
||||
android:id="@+id/cl_exclusive"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
@ -89,17 +90,54 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="距离"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_dist"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_dist" />
|
||||
android:text="类型"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_exclusive"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_exclusive" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dist"
|
||||
android:id="@+id/tv_exclusive"
|
||||
style="@style/main_about_text_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="50000米"
|
||||
android:text="全部"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.65" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/ic_baseline_arrow_forward"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_photograph"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/road_shape">
|
||||
|
||||
<TextView
|
||||
style="@style/text_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="类型"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_photograph"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_photograph" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_photograph"
|
||||
style="@style/main_about_text_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="拍照"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -121,7 +159,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="@drawable/road_shape"
|
||||
android:layout_marginTop="80dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_filter">
|
||||
@ -147,7 +184,7 @@
|
||||
android:id="@+id/btn_filter"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
style="@style/user_style"
|
||||
android:text="地图显示"
|
||||
android:gravity="center"
|
66
app/src/main/res/layout/item_filter.xml
Normal file
66
app/src/main/res/layout/item_filter.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?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="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="测试彼此"
|
||||
android:textColor="#333"
|
||||
android:textSize="25sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_form"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:text="道路"
|
||||
android:padding="5dp"
|
||||
android:textColor="#00BCD4"
|
||||
android:background="@drawable/underline"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_name"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_name"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_task_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="任务id:11315"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_money"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="¥3.5"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_name"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="距离:0.05km"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_task_id"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_money"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_task_id" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
x
Reference in New Issue
Block a user