poi上报功能开发

This commit is contained in:
wds 2021-06-11 18:14:00 +08:00
parent e93fff2cef
commit 396eb2f2b0
42 changed files with 1949 additions and 414 deletions

View File

@ -1,13 +1,14 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
ndkVersion '23.0.7123448'
// ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"
minSdkVersion 23
targetSdkVersion 22
targetSdkVersion 30
versionCode 1
versionName "1.0"
@ -95,6 +96,8 @@ dependencies {
//
implementation 'com.otaliastudios:cameraview:2.7.0'
// https://github.com/umano/AndroidSlidingUpPanel
implementation 'com.sothree.slidinguppanel:library:3.4.0'
//
//
@ -104,4 +107,12 @@ dependencies {
//
implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.2.6'
//room
def room_version = "2.2.0-alpha01"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
implementation "androidx.room:room-guava:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
}

View File

@ -25,15 +25,9 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- 支持A-GPS辅助定位 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 用于 log 日志 -->
<!-- &lt;!&ndash; 在sdcard中创建/删除文件的权限 &ndash;&gt;-->
<!-- <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />-->
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:name=".api.UserApplication"
android:name="com.navinfo.outdoor.api.UserApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"

View File

@ -5,6 +5,7 @@ import com.navinfo.outdoor.fragment.FindFragment;
import com.navinfo.outdoor.fragment.MineFragment;
import com.navinfo.outdoor.fragment.RecordFragment;
import com.navinfo.outdoor.fragment.TreasureFragment;
import com.navinfo.outdoor.util.BackHandlerHelper;
import com.navinfo.outdoor.util.NoSlideViewPager;
import androidx.fragment.app.Fragment;
@ -40,6 +41,7 @@ public class HomeActivity extends BaseActivity{
protected void initView() {
super.initView();
ImmersionBar.with(this)
.navigationBarColor(R.color.tipTextColor)
.statusBarDarkFont(true, 0.2f)
//原理如果当前设备支持状态栏字体变色会设置状态栏字体为黑色如果当前设备不支持状态栏字体变色会使当前状态栏加上透明度否则不执行透明度
.init();
@ -98,4 +100,11 @@ public class HomeActivity extends BaseActivity{
img_title.setImageResource(image);
return view;
}
@Override
public void onBackPressed() {
if (!BackHandlerHelper.handleBackPress(this)) {
super.onBackPressed();
}
}
}

View File

@ -1,7 +1,6 @@
package com.navinfo.outdoor.activity;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import android.Manifest;
@ -9,9 +8,10 @@ import android.content.Intent;
import android.os.CountDownTimer;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseActivity;
import com.kongzue.dialog.util.DialogSettings;
import com.navinfo.outdoor.util.BackHandlerHelper;
import com.navinfo.outdoor.util.PermissionUtil;
/**
* 启动页
@ -54,14 +54,12 @@ public class MainActivity extends BaseActivity {
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.ACCESS_COARSE_LOCATION
};
ActivityCompat.requestPermissions(this, pers, Constant.PERMISSION_REQUEST_CODE);
PermissionUtil.getInstance().checkPermission(this, pers, new Runnable() {
@Override
public void run() {
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable @org.jetbrains.annotations.Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
@Override
protected void initView() {
super.initView();

View File

@ -142,7 +142,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
long callbackTime = System.currentTimeMillis();
captureTime = callbackTime - 300;
Log.d("captureTime", captureTime + "");
//
}
@ -187,7 +186,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
@Override
protected void initData() {
super.initData();
camera.setMode(Mode.VIDEO);
}

View File

@ -0,0 +1,147 @@
package com.navinfo.outdoor.adapter;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.bean.PoiBean;
import java.util.List;
/**
* poi 适配器
*/
public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.MyViewHolder> {
private Context context;
private List<PoiBean> list;
public PoiRecycleAdapter(Context context, List<PoiBean> list) {
this.context = context;
this.list = list;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
context).inflate(R.layout.item_poi, parent,
false));
return holder;
}
@Override
public void onBindViewHolder(MyViewHolder holder, final int position) {
PoiBean poiBean = list.get(position);
holder.tvPhone.setText(poiBean.getName());
holder.image.setImageResource(poiBean.getImage());
holder.image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (initPoiClick != null) {
initPoiClick.item(position);
}
}
});
holder.editPhoneNumber.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
//正在输入
String str = holder.editPhoneNumber.getText().toString().trim();
if(str.indexOf('1')==0){
holder.llPoi.setVisibility(View.GONE);
}else {
holder.llPoi.setVisibility(View.VISIBLE);
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//输入之前
}
@Override
public void afterTextChanged(Editable s) {
String str = holder.editPhoneNumber.getText().toString().trim();
if (initPoiEditClick!=null){
initPoiEditClick.item(null,str,position);
}
}
});
}
@Override
public int getItemCount() {
return list.size();
}
// 添加数据
public void addData(PoiBean poiBean) {
// 在list中添加数据并通知条目加入一条
list.add(poiBean);
//添加动画
notifyDataSetChanged();
}
// 删除数据
public void removeData(int position) {
list.remove(position);
//删除动画
notifyItemRemoved(position);
notifyDataSetChanged();
}
/**
* ViewHolder的类用于缓存控件
*/
class MyViewHolder extends RecyclerView.ViewHolder {
TextView tvPhone;
EditText editPhone, editPhoneNumber;
ImageView image;
LinearLayout llPoi;
//因为删除有可能会删除中间条目然后会造成角标越界所以必须整体刷新一下
public MyViewHolder(View view) {
super(view);
tvPhone = view.findViewById(R.id.tv_phone);
editPhone = view.findViewById(R.id.edit_phone);
llPoi = view.findViewById(R.id.ll_poi);
editPhoneNumber = view.findViewById(R.id.edit_phone_number);
image = view.findViewById(R.id.image);
}
}
initPoiClick initPoiClick;
public void setInitPoiClick(PoiRecycleAdapter.initPoiClick initPoiClick) {
this.initPoiClick = initPoiClick;
}
public interface initPoiClick {
void item(int aInt);
}
initPoiEditClick initPoiEditClick;
public void setInitPoiEditClick(PoiRecycleAdapter.initPoiEditClick initPoiEditClick) {
this.initPoiEditClick = initPoiEditClick;
}
public interface initPoiEditClick {
void item(String area,String data,int aInt);
}
}

View File

@ -24,6 +24,7 @@ public class Constant {
public static final String BASE_FOLDER = SdkFolderCreate.getSDPath()+"/navinfoOutDoor";
// 保存图片的目录
public static final String PICTURE_FOLDER = BASE_FOLDER+"/picture";
public static final String PoiDao = BASE_FOLDER+"/poi";
// 申请权限的RequestCode
public static final int PERMISSION_REQUEST_CODE = 0x100;
@ -31,8 +32,20 @@ public class Constant {
//message word
public static final int TREASURE_FRAGMENT = 100;
public static final int TREASURE_WORD_0 = 0;
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 TencentLocation currentLocation;
public static TencentLocation markerCurrentLocation;
public static double markerLatitude;
public static double markerLongitude;
}

View File

@ -0,0 +1,31 @@
package com.navinfo.outdoor.base;
import android.os.Message;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.util.FragmentBackHandler;
import org.greenrobot.eventbus.EventBus;
public abstract class BaseDialogFragment extends BaseFragment {
@Override
public void initEvent() {
super.initEvent();
// 监听到返回按钮点击事件
Message obtain = Message.obtain();
obtain.what= Constant.TREASURE_FRAGMENT;
obtain.obj=true;
EventBus.getDefault().post(obtain);
}
@Override
public void onDestroyView() {
super.onDestroyView();
// 监听到返回按钮点击事件
Message obtain = Message.obtain();
obtain.what= Constant.TREASURE_FRAGMENT;
obtain.obj=false;
EventBus.getDefault().post(obtain);
}
}

View File

@ -13,18 +13,23 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.navinfo.outdoor.util.BackHandlerHelper;
import com.navinfo.outdoor.util.FragmentBackHandler;
public abstract class BaseFragment extends Fragment {
public abstract class BaseFragment extends Fragment implements FragmentBackHandler {
private AlertDialog alertDialog;
public View mView;
protected FragmentManager supportFragmentManager;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View mView= LayoutInflater.from(getActivity()).inflate(getLayout(), container, false);
mView = LayoutInflater.from(getActivity()).inflate(getLayout(), container, false);
return mView;
}
@ -34,8 +39,17 @@ public abstract class BaseFragment extends Fragment {
initMvp();
initData();
initView();
initEvent();
}
@Override
public boolean onBackPressed() {
getActivity().getSupportFragmentManager().popBackStack();
return true;
}
public void initEvent(){}
protected <T extends View> T findViewById(@IdRes int id){
return getView().findViewById(id);
}
@ -78,5 +92,6 @@ public abstract class BaseFragment extends Fragment {
@Override
public void onDestroyView() {
super.onDestroyView();
}
}

View File

@ -0,0 +1,47 @@
package com.navinfo.outdoor.bean;
public class Info {
/**
* photo :
* x :
* y :
* t :
*/
private String photo;
private String x;
private String y;
private String t;
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getX() {
return x;
}
public void setX(String x) {
this.x = x;
}
public String getY() {
return y;
}
public void setY(String y) {
this.y = y;
}
public String getT() {
return t;
}
public void setT(String t) {
this.t = t;
}
}

View File

@ -0,0 +1,37 @@
package com.navinfo.outdoor.bean;
public class PoiBean {
String name;
String phone;
int image;
public PoiBean(String name, String phone, int image) {
this.name = name;
this.phone = phone;
this.image = image;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public int getImage() {
return image;
}
public void setImage(int image) {
this.image = image;
}
}

View File

@ -2,79 +2,249 @@ package com.navinfo.outdoor.fragment;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
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.navinfo.outdoor.R;
import com.navinfo.outdoor.base.BaseFragment;
import com.tencent.tencentmap.mapsdk.maps.MapView;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.adapter.PoiRecycleAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDialogFragment;
import com.navinfo.outdoor.bean.PoiBean;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.BackHandlerHelper;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.IOException;
import java.util.ArrayList;
import static android.app.Activity.RESULT_OK;
/**
* 记录的Fragment
* 2021-5-25
*/
public class PoiFragment extends BaseFragment implements View.OnClickListener {
public class PoiFragment extends BaseDialogFragment implements View.OnClickListener {
private EditText editDescribe;
private ImageView imagePanorama;
private ImageView imageName;
private ImageView imageInternalPhotos;
private ImageView imageCard;
private ImageView imageElse;
private RelativeLayout rlPanorama, rlName, rlInternalPhotos, rlCard, rlElse;
private TextView tvExplain;
private ImageView ivPanorama,ivName,ivInternal,ivCard,ivElse;
private TextView tvExamine;
private EditText editNameContent;
private RecyclerView recyclerPhone;
private PoiRecycleAdapter poiRecycleAdapter;
private ArrayList<String> phoneData;
private ArrayList<PoiBean> poiBeans;
private int aInts;
private Button btnSaveLocal;
private Button btnUploading;
private PoiDatabase poiDatabase;
private PoiDao poiDao;
@Override
protected int getLayout() {
return R.layout.poi_fragment;
}
@Override
public void onStart() {
super.onStart();
if(!EventBus.getDefault().isRegistered(this)){//加上判断
EventBus.getDefault().register(this);
}
}
@Override
protected void initView() {
super.initView();
poiDatabase = PoiDatabase.getInstance(getContext());
poiDao = poiDatabase.getPoiDao();
CheckBox checkBoxLife = findViewById(R.id.check_pot_life);
CheckBox checkBoxRight = findViewById(R.id.check_pot_right);
checkBoxLife.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Message obtain = Message.obtain();
obtain.what= Constant.TREASURE_WORD_0;
obtain.obj=isChecked;
EventBus.getDefault().post(obtain);
}
});
checkBoxRight.setVisibility(View.GONE);
btnSaveLocal = findViewById(R.id.btn_save_local);
btnSaveLocal.setOnClickListener(this::onClick);
btnUploading = findViewById(R.id.btn_uploading);
btnUploading.setOnClickListener(this::onClick);
editNameContent = findViewById(R.id.tv_name_content);
tvExamine = findViewById(R.id.tv_examine);
tvExamine.setOnClickListener(this::onClick);
editDescribe = findViewById(R.id.edit_describe);
imagePanorama = findViewById(R.id.image_panorama);
imagePanorama.setOnClickListener(this::onClick);
imageName = findViewById(R.id.image_name);
imageName.setOnClickListener(this::onClick);
imageInternalPhotos = findViewById(R.id.image_internal_photos);
imageInternalPhotos.setOnClickListener(this::onClick);
imageCard = findViewById(R.id.image_card);
imageCard.setOnClickListener(this::onClick);
imageElse = findViewById(R.id.image_else);
imageElse.setOnClickListener(this::onClick);
tvExplain = findViewById(R.id.tv_explain);
ivPanorama = findViewById(R.id.iv_panorama);
ivName = findViewById(R.id.iv_name);
ivInternal = findViewById(R.id.iv_internal);
ivCard = findViewById(R.id.iv_card);
ivElse = findViewById(R.id.iv_else);
tvExplain.setOnClickListener(this::onClick);
rlPanorama = findViewById(R.id.rl_panorama);
rlPanorama.setOnClickListener(this::onClick);
rlName = findViewById(R.id.rl_name);
rlName.setOnClickListener(this::onClick);
rlInternalPhotos = findViewById(R.id.rl_internal_photos);
rlInternalPhotos.setOnClickListener(this::onClick);
rlCard = findViewById(R.id.rl_card);
rlCard.setOnClickListener(this::onClick);
rlElse = findViewById(R.id.rl_else);
rlElse.setOnClickListener(this::onClick);
recyclerPhone = findViewById(R.id.recycler_phone);
recyclerPhone.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(),DividerItemDecoration.VERTICAL));
poiBeans = new ArrayList<>();//存储对象
phoneData = new ArrayList<>();//存储手机号
poiBeans.add(new PoiBean("电话*","1000000",R.drawable.icon_add_bg));
poiRecycleAdapter = new PoiRecycleAdapter(getContext(), poiBeans);
recyclerPhone.setAdapter(poiRecycleAdapter);
poiRecycleAdapter.setInitPoiClick(new PoiRecycleAdapter.initPoiClick() {
@Override
public void item(int aInt) {
if (aInt == 0) {
poiRecycleAdapter.addData(new PoiBean("", "100000", R.drawable.icon_del_bg));
} else {
poiRecycleAdapter.removeData(aInt);
if (phoneData.size()>0){
phoneData.remove(aInt);
Log.d("TAG", "initView: "+phoneData.toString());
}
}
}
});
poiRecycleAdapter.setInitPoiEditClick(new PoiRecycleAdapter.initPoiEditClick() {
@Override
public void item(String a,String data, int aInt) {
if (data.length()==11){
if (a!=null){
phoneData.add(aInt,a+","+data);
}else {
phoneData.add(aInt,data);
}
Log.d("TAG", "initView: "+phoneData.toString());
}
}
});
}
@Override
protected void initData() {
super.initData();
}
@Override
public void onResume() {
super.onResume();
}
// //主界面获取焦点
// private void getFocus() {
// getView().setFocusableInTouchMode(true);
// getView().requestFocus();
// getView().setOnKeyListener(new View.OnKeyListener() {
// @Override
// public boolean onKey(View v, int keyCode, KeyEvent event) {
// if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
//
// }
// return true;
// }
// });
// }
@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){
String s = data.obj.toString();
Toast.makeText(getContext(), s, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.image_panorama:
case R.id.btn_save_local:
case R.id.btn_uploading:
Message obtain = Message.obtain();
obtain.what= Constant.TREASURE_FRAGMENT;
obtain.obj=false;
EventBus.getDefault().post(obtain);
PoiEntity poiEntity = new PoiEntity();
poiDao.insertPoiEntity(poiEntity);
break;
case R.id.tv_examine:
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
break;
case R.id.tv_explain:
Intent intentExplain = new Intent(getActivity(), FragmentManagement.class);
intentExplain.putExtra("tag",7);
startActivity(intentExplain);
break;
case R.id.rl_panorama:
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 101);
break;
case R.id.image_name:
case R.id.rl_name:
Intent intentName = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentName, 102);
break;
case R.id.image_internal_photos:
case R.id.rl_internal_photos:
Intent intentInternal = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentInternal, 103);
break;
case R.id.image_card:
case R.id.rl_card:
Intent intentCard = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentCard, 104);
break;
case R.id.image_else:
case R.id.rl_else:
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentElse, 105);
break;
@ -86,23 +256,153 @@ public class PoiFragment extends BaseFragment implements View.OnClickListener {
if (requestCode == 101 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
imagePanorama.setImageBitmap(bitmap);//显示图像
int height= bitmap.getHeight();
int width= bitmap.getWidth();
if (height>width){
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 101);
return false;
}
});
}else {
ivPanorama.setImageBitmap(bitmap);//显示图像
}
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
imageName.setImageBitmap(bitmap);//显示图像
int height= bitmap.getHeight();
int width= bitmap.getWidth();
if (height>width){
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 102);
return false;
}
});
}else {
ivName.setImageBitmap(bitmap);//显示图像
}
}else if (requestCode == 103 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
imageInternalPhotos.setImageBitmap(bitmap);//显示图像
int height= bitmap.getHeight();
int width= bitmap.getWidth();
if (height>width){
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 103);
return false;
}
});
}else {
ivInternal.setImageBitmap(bitmap);//显示图像
}
}else if (requestCode == 104 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
imageCard.setImageBitmap(bitmap);//显示图像
int height= bitmap.getHeight();
int width= bitmap.getWidth();
if (height>width){
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 104);
return false;
}
});
}else {
ivCard.setImageBitmap(bitmap);//显示图像
}
}else if (requestCode == 105 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
imageElse.setImageBitmap(bitmap);//显示图像
int height= bitmap.getHeight();
int width= bitmap.getWidth();
if (height>width){
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intentPanorama, 105);
return false;
}
});
}else {
ivElse.setImageBitmap(bitmap);//显示图像
}
}
}
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() {
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
super.onDestroy();
}
}

View File

@ -1,5 +1,8 @@
package com.navinfo.outdoor.fragment;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.base.BaseFragment;
@ -8,6 +11,8 @@ import com.navinfo.outdoor.base.BaseFragment;
* 2021-5-25
*/
public class RecordFragment extends BaseFragment {
@Override
protected int getLayout() {
return R.layout.record_fragment;
@ -15,16 +20,8 @@ public class RecordFragment extends BaseFragment {
@Override
protected void initView() {
super.initView();
}
//界面可见时再加载数据
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
}
}
@Override
protected void initData() {
super.initData();

View File

@ -17,9 +17,6 @@ import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.PictureActivity;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseFragment;
import com.otaliastudios.cameraview.size.AspectRatio;
import com.otaliastudios.cameraview.size.SizeSelectors;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@ -59,12 +56,10 @@ public class RoadFragment extends BaseFragment implements View.OnClickListener {
case R.id.et_height:
String ssss = etHeight.getText().toString();
if (ssss != null && !ssss.isEmpty()) {
//
Intent intent = new Intent(getContext(), PictureActivity.class);
// PictureActivity activity = (PictureActivity) getActivity();
// activity.
intent.putExtra("pic", etHeight.getText().toString());
Log.d("TAG", "onClick: jjjjjj"+etHeight.getText()+"");
startActivity(intent);
} else {
Toast.makeText(getContext(), "不能为空", Toast.LENGTH_SHORT).show();

View File

@ -7,14 +7,19 @@ 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;
@ -23,15 +28,22 @@ 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.kongzue.dialog.interfaces.OnBackClickListener;
import com.kongzue.dialog.interfaces.OnShowListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.ShareDialog;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.util.BackHandlerHelper;
import com.navinfo.outdoor.util.NetWorkUtils;
import com.navinfo.outdoor.util.PermissionUtil;
import com.navinfo.outdoor.util.ToastUtil;
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
import com.tencent.map.geolocation.TencentLocation;
import com.tencent.map.geolocation.TencentLocationListener;
import com.tencent.map.geolocation.TencentLocationManager;
@ -42,12 +54,19 @@ 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;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.List;
@ -70,22 +89,36 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private ImageView ivLocation;
private ImageView ivSubmit;
private ImageView ivRefish;
private SlidingUpPanelLayout sliding_layout;
private FragmentTransaction fragmentTransaction;
private PoiFragment poiFragment;
private Marker marker;
private CheckBox cbFootType;
private ImageView ivFilter;
private Point screenPosition; //marker的屏幕坐标
private RoadFragment roadFragment;
@Override
protected int getLayout() {
return R.layout.treasure_fragment;
}
@Override
protected void initView() {
super.initView();
EventBus.getDefault().register(this);
sliding_layout = findViewById(R.id.sliding_layout);
ivRefish = findViewById(R.id.iv_refrish);
ivRefish.setOnClickListener(this::onClick);
ivFilter = findViewById(R.id.iv_filter);
ivSubmit = findViewById(R.id.iv_submit);
ivSubmit.setOnClickListener(this::onClick);
treasureMap = (MapView) findViewById(R.id.treasure_map);
tencentMap = treasureMap.getMap();
cbMapType = (CheckBox) findViewById(R.id.cb_map_type);
cbFootType = (CheckBox) findViewById(R.id.cb_foot_type);
//地图转换
cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@ -116,8 +149,100 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
uiSettings.setLogoScale(0.7f);
//开启定位权限
checkNetWork();
}
@Subscribe
public void onEvent(Message data) {
if (data.what==Constant.TREASURE_WORD_0){
initPoiMarker(Boolean.valueOf((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);
ivRefish.setVisibility(View.GONE);
cbMapType.setVisibility(View.GONE);
cbFootType.setVisibility(View.GONE);
ivSubmit.setVisibility(View.GONE);
ivFilter.setVisibility(View.GONE);
}else {
ivZoomAdd.setVisibility(View.VISIBLE);
ivZoomDel.setVisibility(View.VISIBLE);
ivLocation.setVisibility(View.VISIBLE);
ivRefish.setVisibility(View.VISIBLE);
cbMapType.setVisibility(View.VISIBLE);
cbFootType.setVisibility(View.VISIBLE);
ivSubmit.setVisibility(View.VISIBLE);
ivFilter.setVisibility(View.VISIBLE);
sliding_layout.setPanelHeight(0);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
if (poiFragment!=null){
fragmentTransaction.hide(poiFragment);
}
if (roadFragment!=null){
fragmentTransaction.hide(roadFragment);
}
if (marker!=null){
marker.remove();
}
}
}
}
private void initPoiMarker(Boolean t) {
if (t == true) {
//移动地图
CameraUpdate cameraSigma =
CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(Constant.markerLatitude, Constant.markerLongitude), //中心点坐标地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
@Override
public void onFinish() {
screenPosition = tencentMap.getProjection().toScreenLocation(new LatLng(Constant.markerLatitude, Constant.markerLongitude));
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
//创建Marker对象之前设置属性
LatLng position = new LatLng(Constant.markerLatitude, Constant.markerLongitude);
marker = tencentMap.addMarker(new MarkerOptions(position));
marker.setFixingPoint(screenPosition.x, screenPosition.y);
}
@Override
public void onCancel() {
}
});
} else {
if (screenPosition != null) {
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
LatLng latLng = tencentMap.getProjection().fromScreenLocation(screenPosition);
marker.setPosition(latLng);
marker.setFixingPointEnable(false);
Constant.markerLatitude = latLng.latitude;
Constant.markerLongitude = latLng.longitude;
Message obtain = Message.obtain();
obtain.what=Constant.POI_WORD_2;
obtain.obj=Constant.markerLatitude + " " + Constant.markerLongitude;
EventBus.getDefault().post(obtain);
}
}
}
// @Override
// public boolean onBackPressed() {
//
// return BackHandlerHelper.handleBackPress(supportFragmentManager);
// }
/**
* 设置定位图标样式
*/
@ -145,14 +270,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
//创建定位请求
locationRequest = TencentLocationRequest.create();
//设置定位周期位置监听器回调周期为3s
// locationRequest.setInterval(3000);
// locationRequest.setInterval(3000);
//地图上设置定位数据源
tencentMap.setLocationSource(this);
//设置当前位置可见
tencentMap.setMyLocationEnabled(true);
//设置定位图标样式
setLocMarkerStyle();
// locationStyle = locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);
tencentMap.setMyLocationStyle(locationStyle);
}
@ -203,6 +327,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
public void onDestroy() {
super.onDestroy();
treasureMap.onDestroy();
EventBus.getDefault().unregister(this);
}
@Override
@ -217,7 +342,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
tencentMap.animateCamera(cameraUpdateOut);
break;
case R.id.iv_location://定位:
if (Constant.currentLocation!=null){
if (Constant.currentLocation != null) {
Constant.currentLocation.getLongitude();
CameraUpdate cameraSigma =
CameraUpdateFactory.newCameraPosition(new CameraPosition(
@ -226,15 +351,15 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
0)); //目标旋转角 0~360° (正北方为0)
tencentMap.animateCamera(cameraSigma);
}else {
} else {
Toast.makeText(getActivity(), "无定位", Toast.LENGTH_SHORT).show();
checkNetWork();
}
break;
case R.id.iv_submit://弹窗
//分享
CharSequence title = "请选择上报类型";
CharSequence title = "请选择上报类型";
DialogSettings.style = DialogSettings.STYLE.STYLE_MIUI;
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, "道路"));
@ -243,20 +368,28 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ShareDialog.show((AppCompatActivity) getActivity(), itemList, new ShareDialog.OnItemClickListener() {
@Override
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
switch (index){
supportFragmentManager = getActivity().getSupportFragmentManager();
fragmentTransaction = supportFragmentManager.beginTransaction();
poiFragment = new PoiFragment();
roadFragment = new RoadFragment();
fragmentTransaction.add(R.id.dragView, poiFragment).add(R.id.dragView,roadFragment).commit();
switch (index) {
case 0:
Intent poiIntent = new Intent(getActivity(), FragmentManagement.class);
poiIntent.putExtra("tag",27);
startActivity(poiIntent);
sliding_layout.setPanelHeight(1000);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
fragmentTransaction.show(poiFragment);
fragmentTransaction.hide(roadFragment);
fragmentTransaction.addToBackStack(null);
break;
case 1:
Intent roadIntent = new Intent(getActivity(), FragmentManagement.class);
roadIntent.putExtra("tag",28);
startActivity(roadIntent);
sliding_layout.setPanelHeight(1000);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
fragmentTransaction.show(roadFragment);
fragmentTransaction.hide(poiFragment);
fragmentTransaction.addToBackStack(null);
break;
case 2:
case 3:
Toast.makeText(getContext(), item.getText(), Toast.LENGTH_SHORT).show();
break;
}
return false;
@ -293,67 +426,20 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
String[] permission = {
Manifest.permission.ACCESS_COARSE_LOCATION
};
if (ContextCompat.checkSelfPermission(getContext(), permission[0]) == PackageManager.PERMISSION_GRANTED) { // 拥有权限
//建立定位
initLocation();
} else { // 没有权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { //6.0
requestPermissions(permission, 0);
} else {
// 此处为某些5.0动态权限的手机
// goSystemLocationActivity(); // TODO =======待删除======
tipPermissionAlertDialog();
}
}
}
/**
* 用户授权回调
*
* @param requestCode
* @param permissions
* @param grantResults
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
UserAuthorization(requestCode, grantResults);
}
/**
* 用户授权情况
*
* @param requestCode
* @param grantResults
*/
private void UserAuthorization(int requestCode, int[] grantResults) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { // 拥有了授权
checkMyLocation();
} else {
tipPermissionAlertDialog();
}
}
private void tipPermissionAlertDialog() {
final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("提示");
builder.setMessage(Constant.SET_LOCATION_PERMISSION);
builder.setPositiveButton("我知道了", new DialogInterface.OnClickListener() {
PermissionUtil.getInstance().checkPermission((AppCompatActivity) getActivity(), permission, new Runnable() {
@Override
public void onClick(DialogInterface dialog, int which) {
AlertDialog alertDialog = builder.show();
alertDialog.dismiss();
public void run() {
if (ContextCompat.checkSelfPermission(getContext(), permission[0]) == PackageManager.PERMISSION_GRANTED){
//建立定位
initLocation();
}else {
PermissionUtil.getInstance().showPermissionSettingDialog((AppCompatActivity) getActivity());
}
}
});
builder.show();
}
/**
* 跳转系统定位页面
*/
private void goSystemLocationActivity() {
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}
@Override
public void activate(OnLocationChangedListener onLocationChangedListener) {
@ -398,15 +484,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
location.setLongitude(tencentLocation.getLongitude());
location.setAccuracy(tencentLocation.getAccuracy());
locationChangedListener.onLocationChanged(location);
locationStyle = locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER);
Constant.currentLocation = tencentLocation;
//显示回调的实时位置信息
runOnUiThread(new Runnable() {
@Override
public void run() {
//打印tencentLocation的json字符串
// Toast.makeText(getApplicationContext(), new Gson().toJson(location), Toast.LENGTH_LONG).show();
}
});
Constant.markerCurrentLocation = tencentLocation;
Constant.markerLatitude = tencentLocation.getLatitude();
Constant.markerLongitude = tencentLocation.getLongitude();
}
}
@ -415,4 +497,24 @@ 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()) {
return;
}
tencentMap.setPoisEnabled(false);
}
//显示文字标注
private void performPoiShow() {
if (tencentMap == null || tencentMap.isDestroyed()) {
return;
}
tencentMap.setPoisEnabled(true);
}
@Override
public boolean onBackPressed() {
return false;
}
}

View File

@ -0,0 +1,64 @@
package com.navinfo.outdoor.room;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
/**
* 访问数据库操作的接口
*/
@Dao
public interface PoiDao {
/**
* 查询
* @return
*/
@Query("SELECT * FROM poi")
List<PoiEntity> getAllPoi();
/**
* 添加
* @param poiEntities
*/
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertPoiEntity(PoiEntity... poiEntities);
/**
* 更新
* @param poiEntities
*/
@Update
void updatePoiEntity(PoiEntity... poiEntities);
/**
* 删除
* @param poiEntities
*/
@Delete
void deletePoiEntity(PoiEntity... poiEntities);
/**
* 全部删除
*/
@Query("DELETE FROM poi")
void deleteAllPoiEntity();
/**
* 降序排列
* @return
*/
@Query("SELECT * FROM poi ORDER BY ID DESC")
List<PoiEntity> getAllPoiEntity();
@Query("SELECT * FROM poi where userId = :userId")
PoiEntity queryPoiEntity(int userId);
@Query("DELETE FROM poi where userId = :userId")
void deletePoiEntity(int userId);
}

View File

@ -0,0 +1,62 @@
package com.navinfo.outdoor.room;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import androidx.room.migration.Migration;
import androidx.sqlite.db.SupportSQLiteDatabase;
@Database(entities = {PoiEntity.class}, version = 1, exportSchema = false)
public abstract class PoiDatabase extends RoomDatabase {
private static final String DB_NAME = "navinfo.db";
private static volatile PoiDatabase instance;
public static synchronized PoiDatabase getInstance(Context context) {
if (instance == null) {
instance = create(context);
}
return instance;
}
private static PoiDatabase create(final Context context) {
return Room.databaseBuilder(context, PoiDatabase.class, DB_NAME)
.addMigrations(migration_1_2)
.addMigrations(migration_2_3)
.addMigrations(migration_3_4)
.addMigrations(migration_4_5)
.build();
}
//@{版本号升级后一定要加migration
private static Migration migration_1_2 = new Migration(1, 2) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("ALTER TABLE user ADD certify INTEGER NOT NULL DEFAULT 0");
}
};
private static Migration migration_2_3 = new Migration(2, 3) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("ALTER TABLE video_list ADD stage TEXT DEFAULT ''");
}
};
private static Migration migration_3_4 = new Migration(3, 4) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("ALTER TABLE video_list ADD views INTEGER NOT NULL DEFAULT 0");
}
};
private static Migration migration_4_5 = new Migration(4, 5) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("ALTER TABLE user ADD partner INTEGER NOT NULL DEFAULT 0");
}
};
public abstract PoiDao getPoiDao();
}

View File

@ -0,0 +1,172 @@
package com.navinfo.outdoor.room;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.room.TypeConverters;
import com.navinfo.outdoor.bean.Info;
import com.navinfo.outdoor.util.PhotoInfoConverter;
import java.util.List;
//poi 的实体类
@Entity(tableName = "poi")
public class PoiEntity {
@PrimaryKey(autoGenerate = true) // 设置主键并且自动生长
private int id;
private int pid; //采集id 保存本地或提交数据时时返回
private int taskId;//任务id
private int userId;//用户id
private String createTime; //创建时间/采集时间
private String name;//poi名称
private String describe;//任务描述
private String address;//poi地址
private String telPhone;//poi电话
private String memo;//备注
private double precision;//金额
private String photo;//照片信息
//ROOM不支持直接存储集合
@TypeConverters(PhotoInfoConverter.class)
private List<Info> photoInfo;//照片信息
private int existence;//是否存在
private String x;//经度
private String y;//纬度
private String detail;//深度信息
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public int getTaskId() {
return taskId;
}
public void setTaskId(int taskId) {
this.taskId = taskId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescribe() {
return describe;
}
public void setDescribe(String describe) {
this.describe = describe;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getTelPhone() {
return telPhone;
}
public void setTelPhone(String telPhone) {
this.telPhone = telPhone;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public double getPrecision() {
return precision;
}
public void setPrecision(double precision) {
this.precision = precision;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public List<Info> getPhotoInfo() {
return photoInfo;
}
public void setPhotoInfo(List<Info> infoList) {
this.photoInfo = infoList;
}
public int getExistence() {
return existence;
}
public void setExistence(int existence) {
this.existence = existence;
}
public String getX() {
return x;
}
public void setX(String x) {
this.x = x;
}
public String getY() {
return y;
}
public void setY(String y) {
this.y = y;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
}

View File

@ -0,0 +1,58 @@
package com.navinfo.outdoor.util;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import java.util.List;
//监听fragment 的回退键
public class BackHandlerHelper {
/**
* 将back事件分发给 FragmentManager 中管理的子Fragment如果该 FragmentManager 中的所有Fragment都
* 没有处理back事件则尝试 FragmentManager.popBackStack()
*
* @return 如果处理了back键则返回 <b>true</b>
* @see #handleBackPress(Fragment)
*/
public static boolean handleBackPress(FragmentManager fragmentManager) {
List<Fragment> fragments = fragmentManager.getFragments();
if (fragments == null) return false;
for (int i = fragments.size() - 1; i >= 0; i--) {
Fragment child = fragments.get(i);
if (isFragmentBackHandled(child)) {
return true;
}
}
if (fragmentManager.getBackStackEntryCount() > 0) {
fragmentManager.popBackStack();
return true;
}
return false;
}
public static boolean handleBackPress(Fragment fragment) {
return handleBackPress(fragment.getChildFragmentManager());
}
public static boolean handleBackPress(FragmentActivity fragmentActivity) {
return handleBackPress(fragmentActivity.getSupportFragmentManager());
}
/**
* 判断Fragment是否处理了Back键
*
* @return 如果处理了back键则返回 <b>true</b>
*/
public static boolean isFragmentBackHandled(Fragment fragment) {
return fragment != null
&& fragment.isVisible()
&& fragment.getUserVisibleHint() //for ViewPager
&& fragment instanceof FragmentBackHandler
&& ((FragmentBackHandler) fragment).onBackPressed();
}
}

View File

@ -0,0 +1,5 @@
package com.navinfo.outdoor.util;
//监听Fragment 的回退键
public interface FragmentBackHandler {
boolean onBackPressed();
}

View File

@ -0,0 +1,176 @@
package com.navinfo.outdoor.util;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.provider.Settings;
import android.util.Log;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
/**
* 动态申请权限工具类
*/
public class PermissionUtil {
private final int PERMISSION_REQUEST_CODE = 100;
private final int PERMISSION_SETTING_CODE = 101;
private AlertDialog permissionExplainDialog = null;
private AlertDialog permissionSettingDialog = null;
private PermissionUtil() {
}
public static PermissionUtil getInstance() {
return PermissionUtilHolder.instance;
}
private static class PermissionUtilHolder {
private static final PermissionUtil instance = new PermissionUtil();
}
/**
* 第一步检查权限
*
* @param activity 上下文
* @param permissions 权限数组
* @param callBack 线程
*/
public void checkPermission(AppCompatActivity activity, String[] permissions, Runnable callBack) {
boolean allGranted = true;
for (String permission : permissions) {
int result = ContextCompat.checkSelfPermission(activity, permission);
Log.d("检查权限:" + permission, "结果:" + result);
// 有权限: PackageManager.PERMISSION_GRANTED
// 无权限: PackageManager.PERMISSION_DENIED
if (result != PackageManager.PERMISSION_GRANTED) {// 有权限
allGranted = false;
// Toast.makeText(activity, "拥有" + permission + "权限", Toast.LENGTH_SHORT).show();
}
}
if (allGranted) {// 拥有全部权限
callBack.run();
} else {// 申请权限
startRequestPermission(activity, permissions);
}
}
/**
* 第二步如果用户之前拒绝过展示需要权限的提示框否则的话直接请求相关权限
*
* @param activity 上下文
* @param permissions 权限数组
*/
private void startRequestPermission(AppCompatActivity activity, String[] permissions) {
for (String permission : permissions) {
/**
* shouldShowRequestPermissionRationale
* 如果应用之前请求过该权限但用户拒绝了该方法就会返回true
*
* 如果用户之前拒绝了权限请求并且勾选了权限请求对话框的不再询问该方法会返回false
* 如果设备策略禁止该应用获得该权限也会返回false
*/
if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) {
// 向用户显示一个解释要以异步非阻塞的方式
// 该线程将等待用户响应等用户看完解释后再继续尝试请求权限
Log.v("tag", "showPermissionExplainDialog()");
showPermissionExplainDialog(activity, permissions);
} else {
/**
* 当你的应用调用requestPermissions()方法时系统会向用户展示一个标准对话框
* 你的应用不能修改也不能自定义这个对话框如果你需要给用户一些额外的信息和解释你就需要在
* 调用requestPermissions()之前像上面一样" 解释为什么应用需要这些权限"
*/
Log.v("tag", "requestPermission");
requestPermission(activity, permissions);
}
}
}
/**
* 不需要向用户解释了我们可以直接请求该权限
* 第三步. 请求权限
*
* @param activity 上下文
* @param permissions 权限数组
*/
private void requestPermission(AppCompatActivity activity, String[] permissions) {
ActivityCompat.requestPermissions(activity, permissions, PERMISSION_REQUEST_CODE);
}
/**
* 当用户之前拒绝过展示一个对话框解释为什么需要此权限
*
* @param activity 上下文
* @param permissions 权限数组
*/
private void showPermissionExplainDialog(final AppCompatActivity activity, final String[] permissions) {
if (permissionExplainDialog == null) {
permissionExplainDialog = new AlertDialog.Builder(activity).setTitle("权限申请").setMessage("您刚才拒绝了相关权限,但是现在应用需要这个权限," +
"点击确定申请权限,点击取消将无法使用该功能")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
requestPermission(activity, permissions);
dialog.cancel();
}
})
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
}).create();
permissionExplainDialog.show();
}
}
/**
* 最后一步当用户拒绝并且勾选了不在提示那么只能引导用户去设置页面打开权限
*
* @param activity 上下文
*/
public void showPermissionSettingDialog(final AppCompatActivity activity) {
if (permissionSettingDialog == null) {
permissionSettingDialog = new AlertDialog.Builder(activity)
.setTitle("权限设置")
.setMessage("您刚才拒绝了相关的权限,请到应用设置页面更改应用的权限")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
intent.setData(uri);
activity.startActivityForResult(intent, PERMISSION_SETTING_CODE);
dialog.cancel();
}
})
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
}).create();
permissionSettingDialog.show();
}
}
}

View File

@ -0,0 +1,35 @@
package com.navinfo.outdoor.util;
import androidx.room.TypeConverter;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.navinfo.outdoor.bean.Info;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
/**
* describe:使用Room框架,room不支持对象中直接存储集合
* https://stackoverflow.com/questions/53812636/android-error-cannot-figure-out-how-to-save-this-field-into-database-you-can
*/
public class PhotoInfoConverter {
Gson gson = new Gson();
@TypeConverter
public List<Info> stringToSomeObjectList(String data) {
if (data == null) {
return Collections.emptyList();
}
Type listType = new TypeToken<List<Info>>() {}.getType();
return gson.fromJson(data, listType);
}
@TypeConverter
public String someObjectListToString(List<Info> someObjects) {
return gson.toJson(someObjects);
}
}

View File

@ -0,0 +1,33 @@
package com.navinfo.outdoor.util;
import androidx.room.TypeConverter;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
/**
* describe:使用Room框架,room不支持对象中直接存储集合
* https://stackoverflow.com/questions/53812636/android-error-cannot-figure-out-how-to-save-this-field-into-database-you-can
*/
public class StringTypeConverter {
Gson gson = new Gson();
@TypeConverter
public List<String> stringToSomeObjectList(String data) {
if (data == null) {
return Collections.emptyList();
}
Type listType = new TypeToken<List<String>>() {}.getType();
return gson.fromJson(data, listType);
}
@TypeConverter
public String someObjectListToString(List<String> someObjects) {
return gson.toJson(someObjects);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/checkbox" android:state_pressed="false"/>
<item android:drawable="@mipmap/checkbox_checked" android:state_pressed="true"/>
<item android:drawable="@mipmap/checkbox" android:state_checked="false"/>
<item android:drawable="@mipmap/checkbox_checked" android:state_checked="true"/>
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_red_radius_bg" android:state_checked="true" />
<item android:drawable="@drawable/shape_transparent_pink_radius_bg" android:state_checked="false"/>
</selector>

View File

@ -5,5 +5,5 @@
<corners android:radius="40dp" />
<solid android:color="@color/white" />
<stroke android:width="1dp" android:color="#918F8F"/>
</shape>

View File

@ -2,6 +2,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#fff"/>
<stroke android:width="2dp"
<stroke android:width="1dp"
android:color="#D1D0CF"/>
</shape>

View File

@ -47,6 +47,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:visibility="gone"
android:text="切换"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -54,6 +55,7 @@
app:layout_constraintTop_toBottomOf="@id/btn_switch"
app:layout_constraintRight_toRightOf="@id/btn_switch"
android:id="@+id/btn_video"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="停止" />
@ -93,14 +95,10 @@
android:id="@+id/capturePicture"
android:layout_width="56dp"
android:layout_height="56dp"
android:visibility="gone"
android:background="?attr/selectableItemBackgroundBorderless"
app:srcCompat="@drawable/ic_photo" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/capturePictureSnapshot"
android:layout_width="56dp"

View File

@ -5,46 +5,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragment.RoadFragment">
<LinearLayout
android:id="@+id/rl_road"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryBlue"
android:orientation="horizontal"
android:paddingTop="@dimen/top_pind_sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_road_final"
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_road"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@id/iv_road_final"
android:gravity="center"
android:text="编辑道路"
android:textColor="#fff"
android:textSize="17sp"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="@+id/road_bg"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:background="@drawable/top_bg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/rl_road" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv1"
@ -89,7 +56,9 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="450dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/road_bg">
<TextView
@ -111,8 +80,7 @@
android:layout_marginTop="10dp"
android:background="@drawable/road_shape"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="@+id/tv_message"
app:layout_constraintTop_toBottomOf="@+id/tv_message">
<TextView
@ -131,17 +99,17 @@
android:layout_gravity="center_vertical"
android:background="@null" />
</LinearLayout>
<!--<LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/ll_name"-->
<!-- android:orientation="horizontal">-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="02.拍照方式"-->
<!-- -->
<!--</LinearLayout>-->
<!--<LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/ll_name"-->
<!-- android:orientation="horizontal">-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="02.拍照方式"-->
<!-- -->
<!--</LinearLayout>-->
<LinearLayout
android:id="@+id/ll_pictures"
@ -213,8 +181,7 @@
android:layout_marginTop="10dp"
android:background="@drawable/road_shape"
android:hint=" 任务描述"
android:paddingBottom="50dp"
/>
android:paddingBottom="50dp" />
</LinearLayout>
<LinearLayout
@ -223,6 +190,7 @@
android:gravity="center_horizontal"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/ll_desc">
<Button

View File

@ -0,0 +1,92 @@
<?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_phone"
android:layout_width="36dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="10dp"
android:text="电话*"
android:textColor="#333"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/ll_poi"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/tv_phone"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/edit_phone"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="10dp"
android:background="@color/white"
android:digits="1234567890"
android:hint="010"
android:maxLength="3"
android:inputType="phone|number"
android:textColor="#333"
android:textSize="15sp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/tv_phone"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_view"
android:layout_width="4dp"
android:layout_height="18dp"
android:text="-"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.523" />
</LinearLayout>
<EditText
android:id="@+id/edit_phone_number"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="@color/white"
android:digits="1234567890"
android:hint="电话号码"
android:layout_marginLeft="10dp"
android:inputType="phone|number"
android:maxLength="11"
android:textColor="#333"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="@+id/tv_phone"
app:layout_constraintStart_toEndOf="@+id/ll_poi"
app:layout_constraintTop_toTopOf="@+id/tv_phone" />
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:background="@drawable/icon_add_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -2,17 +2,17 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="65dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_poi">
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -21,7 +21,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/linear_image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_height="150dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toTopOf="@+id/tv_01"
app:layout_constraintEnd_toEndOf="parent"
@ -31,12 +31,13 @@
<ImageView
android:id="@+id/road_bg"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_height="150dp"
android:background="@drawable/top_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
<TextView
android:id="@+id/tv1"
@ -70,6 +71,7 @@
app:layout_constraintTop_toTopOf="@id/tv1" />
<TextView
android:id="@+id/tv_explain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
@ -93,42 +95,61 @@
<RelativeLayout
android:id="@+id/linear_pot"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:padding="2dp"
android:background="@drawable/underline"
app:layout_constraintTop_toBottomOf="@id/tv_01"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_01">
<TextView
android:id="@+id/tv_pot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="18dp"
android:text="点位*"
android:textColor="#333"
android:layout_marginLeft="18dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/tv_pot_content"
android:textColor="#333" />
<CheckBox
android:id="@+id/check_pot_life"
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_centerVertical="true"
android:text="111111111.0,5555555555.0"
android:textColor="#333"
android:layout_marginLeft="18dp"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@id/tv_pot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:background="@drawable/selector_change_bg"
android:button="@null"
android:gravity="center"
android:text="编辑"
android:textSize="8sp" />
<CheckBox
android:id="@+id/check_pot_right"
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@id/check_pot_life"
android:background="@drawable/selector_change_bg"
android:button="@null"
android:visibility="gone"
android:gravity="center"
android:text="保存"
android:textSize="8sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/linear_name"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:padding="2dp"
android:background="@drawable/underline"
app:layout_constraintTop_toBottomOf="@id/linear_pot"
app:layout_constraintEnd_toEndOf="parent"
@ -138,6 +159,8 @@
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="名称*"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textColor="#333"
android:layout_marginLeft="18dp"
android:layout_width="wrap_content"
@ -146,23 +169,34 @@
<EditText
android:id="@+id/tv_name_content"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="18dp"
android:layout_toRightOf="@id/tv_name"
android:background="@color/white"
android:hint="poi名称"
android:layout_toEndOf="@id/tv_name"
android:layout_toStartOf="@id/tv_examine"
android:textSize="15sp"
android:textColor="#333" />
<TextView
android:id="@+id/tv_examine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="查看"
android:layout_margin="4dp"
android:textColor="@color/design_default_color_primary"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/linear_site"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:padding="2dp"
android:background="@drawable/underline"
app:layout_constraintTop_toBottomOf="@id/linear_name"
app:layout_constraintEnd_toEndOf="parent"
@ -172,6 +206,8 @@
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="地址*"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textColor="#333"
android:layout_marginLeft="18dp"
android:layout_width="wrap_content"
@ -180,8 +216,9 @@
<EditText
android:id="@+id/tv_site_content"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_centerVertical="true"
android:layout_marginLeft="18dp"
android:layout_toRightOf="@id/tv_site"
@ -193,36 +230,18 @@
<RelativeLayout
android:id="@+id/linear_phone"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/underline"
app:layout_constraintTop_toBottomOf="@id/linear_site"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/tv_phone"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="电话*"
android:textColor="#333"
android:layout_marginLeft="18dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/tv_phone_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="18dp"
android:layout_toRightOf="@id/tv_phone"
android:background="@color/white"
android:text="010"
android:textSize="15sp"
android:textColor="#333" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_phone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
/>
</RelativeLayout>
<TextView
android:id="@+id/tv_02"
@ -248,62 +267,182 @@
android:layout_height="0dp"
android:layout_weight="1"
>
<ImageView
android:id="@+id/image_panorama"
<RelativeLayout
android:id="@+id/rl_panorama"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@mipmap/bg"
android:layout_marginRight="5dp"
android:layout_height="match_parent"
/>
<ImageView
android:id="@+id/image_name"
android:layout_marginTop="10dp"
android:background="#03A9F4"
android:layout_marginRight="5dp"
android:layout_marginBottom="10dp">
<ImageView
android:id="@+id/image_panorama"
android:layout_centerHorizontal="true"
android:layout_width="20dp"
android:layout_marginTop="20dp"
android:background="@drawable/quanjing"
android:layout_height="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="*全景图"
android:textSize="8sp"
android:layout_margin="5dp"
android:textColor="@color/pickerview_wheelview_textcolor_divider"
android:layout_below="@id/image_panorama"
/>
<ImageView
android:id="@+id/iv_panorama"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_name"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"
android:background="@mipmap/bg"
android:layout_height="match_parent"
/>
<ImageView
android:id="@+id/image_internal_photos"
android:layout_marginTop="10dp"
android:background="#03A9F4"
android:layout_marginRight="5dp"
android:layout_marginBottom="10dp">
<ImageView
android:id="@+id/image_name"
android:layout_centerHorizontal="true"
android:layout_width="20dp"
android:layout_marginTop="20dp"
android:background="@drawable/mingcheng"
android:layout_height="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="*名称"
android:textSize="8sp"
android:layout_margin="5dp"
android:textColor="@color/pickerview_wheelview_textcolor_divider"
android:layout_below="@id/image_name"
/>
<ImageView
android:id="@+id/iv_name"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_internal_photos"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"
android:background="@mipmap/bg"
android:layout_height="match_parent"
/>
android:layout_marginTop="10dp"
android:background="#EFEDED"
android:layout_marginRight="5dp"
android:layout_marginBottom="10dp">
<ImageView
android:id="@+id/image_internal"
android:layout_centerHorizontal="true"
android:layout_width="20dp"
android:layout_marginTop="20dp"
android:background="@drawable/mingcheng"
android:layout_height="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="内部照片"
android:textSize="8sp"
android:layout_margin="5dp"
android:textColor="@color/pickerview_wheelview_textcolor_divider"
android:layout_below="@id/image_internal"
/>
<ImageView
android:id="@+id/iv_internal"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<ImageView
android:id="@+id/image_card"
<RelativeLayout
android:id="@+id/rl_card"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"
android:background="@mipmap/bg"
android:layout_height="match_parent"
/>
<ImageView
android:id="@+id/image_else"
android:layout_marginTop="10dp"
android:background="#EFEDED"
android:layout_marginRight="5dp"
android:layout_marginBottom="10dp">
<ImageView
android:id="@+id/image_card"
android:layout_centerHorizontal="true"
android:layout_width="20dp"
android:layout_marginTop="20dp"
android:background="@drawable/mingpian"
android:layout_height="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="名片"
android:textSize="8sp"
android:layout_margin="5dp"
android:textColor="@color/pickerview_wheelview_textcolor_divider"
android:layout_below="@id/image_card"
/>
<ImageView
android:id="@+id/iv_card"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_else"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"
android:background="@mipmap/bg"
android:layout_height="match_parent"
/>
android:layout_marginTop="10dp"
android:background="#EFEDED"
android:layout_marginRight="5dp"
android:layout_marginBottom="10dp">
<ImageView
android:id="@+id/image_else"
android:layout_centerHorizontal="true"
android:layout_width="20dp"
android:layout_marginTop="20dp"
android:background="@drawable/qita"
android:layout_height="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="其他"
android:textSize="8sp"
android:layout_margin="5dp"
android:textColor="@color/pickerview_wheelview_textcolor_divider"
android:layout_below="@id/image_else"
/>
<ImageView
android:id="@+id/iv_else"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</RelativeLayout>
<ImageView
android:layout_width="0dp"
android:layout_weight="1"
@ -325,7 +464,7 @@
<LinearLayout
android:id="@+id/linear_describe"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
@ -337,6 +476,7 @@
android:id="@+id/edit_describe"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="30dp"
android:layout_margin="2dp"
android:gravity="top"
android:focusable="true"
@ -382,30 +522,4 @@
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<LinearLayout
android:id="@+id/rl_poi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#1BA5F1"
android:orientation="horizontal"
android:paddingTop="@dimen/top_pind_sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_poi"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:src="@drawable/icon_arrow" />
<TextView
android:id="@+id/tv_poi"
style="@style/text_style_toolbar_title"
android:layout_width="wrap_content"
android:layout_toRightOf="@id/iv_find_task"
android:text="编辑poi" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,30 @@
<?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:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/slideView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button2" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
android:text="测试"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,105 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:gravity="bottom"
android:id="@+id/sliding_layout"
sothree:umanoPanelHeight="0dp"
sothree:umanoShadowHeight="0dp"
sothree:umanoOverlay="false"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.tencent.tencentmap.mapsdk.maps.MapView
android:id="@+id/treasure_map"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" >
android:gravity="center"
>
<com.tencent.tencentmap.mapsdk.maps.MapView
android:id="@+id/treasure_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:gravity="center"
android:focusable="false"
android:focusableInTouchMode="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" >
</com.tencent.tencentmap.mapsdk.maps.MapView>
</com.tencent.tencentmap.mapsdk.maps.MapView>
<CheckBox
android:id="@+id/cb_map_type"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="15dp"
android:background="@drawable/atlas_selector"
android:button="@null"
android:checked="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/cb_map_type"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="15dp"
android:background="@drawable/atlas_selector"
android:button="@null"
android:checked="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/cb_foot_type"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:background="@drawable/foot_selector"
android:button="@null"
android:checked="false"
app:layout_constraintRight_toRightOf="@id/cb_map_type"
app:layout_constraintTop_toBottomOf="@id/cb_map_type" />
<ImageView
android:id="@+id/iv_submit"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/submit"
app:layout_constraintLeft_toLeftOf="@id/cb_foot_type"
app:layout_constraintTop_toTopOf="@id/iv_zoom_del"
app:layout_constraintBottom_toBottomOf="@id/iv_refrish"
/>
<ImageView
android:id="@+id/iv_filter"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/filter"
android:layout_marginTop="15dp"
app:layout_constraintLeft_toLeftOf="@id/cb_foot_type"
app:layout_constraintTop_toBottomOf="@id/iv_submit"
/>
<ImageView
android:id="@+id/iv_zoom_add"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:src="@mipmap/zoom_add"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/cb_foot_type" />
<CheckBox
android:id="@+id/cb_foot_type"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:background="@drawable/foot_selector"
android:button="@null"
android:checked="false"
app:layout_constraintRight_toRightOf="@id/cb_map_type"
app:layout_constraintTop_toBottomOf="@id/cb_map_type" />
<ImageView
android:id="@+id/iv_submit"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/submit"
app:layout_constraintLeft_toLeftOf="@id/cb_foot_type"
app:layout_constraintTop_toTopOf="@id/iv_zoom_del"
app:layout_constraintBottom_toBottomOf="@id/iv_refrish"
/>
<ImageView
android:id="@+id/iv_filter"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/filter"
android:layout_marginTop="15dp"
app:layout_constraintLeft_toLeftOf="@id/cb_foot_type"
app:layout_constraintTop_toBottomOf="@id/iv_submit"
/>
<ImageView
android:id="@+id/iv_zoom_add"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:src="@mipmap/zoom_add"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/cb_foot_type" />
<ImageView
android:id="@+id/iv_zoom_del"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:src="@mipmap/zoom_del"
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_add"
app:layout_constraintTop_toBottomOf="@id/iv_zoom_add" />
<ImageView
android:id="@+id/iv_refrish"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:src="@mipmap/refresh"
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />
<ImageView
android:id="@+id/iv_location"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:src="@mipmap/mine_location"
app:layout_constraintLeft_toLeftOf="@id/iv_refrish"
app:layout_constraintTop_toBottomOf="@id/iv_refrish" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/iv_zoom_del"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:src="@mipmap/zoom_del"
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_add"
app:layout_constraintTop_toBottomOf="@id/iv_zoom_add" />
<ImageView
android:id="@+id/iv_refrish"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:src="@mipmap/refresh"
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />
<ImageView
android:id="@+id/iv_location"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:src="@mipmap/mine_location"
app:layout_constraintLeft_toLeftOf="@id/iv_refrish"
app:layout_constraintTop_toBottomOf="@id/iv_refrish" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
android:layout_height="match_parent"
android:orientation="vertical"
android:clickable="true"
android:focusable="true"
android:id="@+id/dragView">
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

View File

@ -6,6 +6,13 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<!--解决黑白屏问题-->
<style name="Theme.WhiteScreen" parent="Theme.AppCompat.Light.NoActionBar">
<!--设置系统的取消预览(空白窗口)为true -->
<item name="android:windowDisablePreview">true</item>
<!--设置背景为透明-->
<item name="android:windowIsTranslucent">true</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
@ -118,4 +125,11 @@
<item name="android:background">@drawable/user_style</item>
<item name="android:textColor">@color/white</item>
</style>
<style name="ColorTranslucentTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">false</item>
<!--Android 5.x开始需要把颜色设置透明否则导航栏会呈现系统默认的浅灰色-->
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>

View File

@ -13,7 +13,7 @@ buildscript {
maven{
url "https://oss.sonatype.org/content/groups/public"
}
maven { url "https://jitpack.io" }
}