拍照点击

This commit is contained in:
wangdongsheng 2021-09-15 16:21:45 +08:00
parent 0dceef5ecc
commit ed105e8ab7
14 changed files with 238 additions and 224 deletions

View File

@ -62,7 +62,6 @@ dependencies {
implementation 'androidx.navigation:navigation-ui:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation files('libs\\jts-1.13.jar')
implementation files('libs\\jacob.jar')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

Binary file not shown.

View File

@ -32,6 +32,7 @@ import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.MyTecentLocationSource;
import com.navinfo.outdoor.util.SystemTTS;
import com.otaliastudios.cameraview.CameraException;
import com.otaliastudios.cameraview.CameraListener;
import com.otaliastudios.cameraview.CameraLogger;
@ -107,7 +108,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
}
capturePicture.setChecked(false);
stopTimer();
}
return false;
}
@ -117,7 +117,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
private int videoIndex = -1;
private int oration;
private ImageView ivPicImage;
private boolean isPicture=true;
private SystemTTS instance;
@Override
protected int getLayout() {
@ -152,6 +152,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
}
btnSwitch = findViewById(R.id.btn_switch);
btnSwitch.setOnClickListener(this);
//相机记录器
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
ivZoomAdd = findViewById(R.id.iv_zoom_add);
@ -162,6 +163,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
ivLocation.setOnClickListener(this);
camera = findViewById(R.id.camera);
camera.setOnClickListener(this);
ImageView imageView = findViewById(R.id.iv_image);
imageView.setOnClickListener(this);
capturePicture = findViewById(R.id.capture_picture);
if (poi_video_type == 2) {
capturePicture.setText("拍摄");
@ -311,18 +314,9 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
setResult(0x111, intent);
finish();
break;
/* case R.id.camera:
case R.id.iv_image:
benSwitch();
if (!isPicture){
// benSwitch();
}
break;
case R.id.iv_map:
if (isPicture){
benSwitch();
}
break;*/
case R.id.btn_switch:
v.setEnabled(false);
handler.sendEmptyMessageDelayed(0x102, 2000);// 利用handler延迟发送更改状态信息
@ -338,8 +332,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
break;
case R.id.iv_location://定位:
if (Constant.currentLocation != null) {
CameraUpdate cameraSigma =
CameraUpdateFactory.newCameraPosition(new CameraPosition(
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
@ -350,6 +343,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
}
}
private Bitmap getBitMap() {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.location);
int width = bitmap.getWidth();
@ -384,11 +378,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
}
public void benSwitch() {
// DisplayMetrics dm = new DisplayMetrics();
// getWindowManager().getDefaultDisplay().getMetrics(dm);
// System.out.println("width-display :" + dm.widthPixels);
// System.out.println("height-display :" + dm.heightPixels);
int tmpWidth, tmpHeight;
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//地图的宽高
int heightMap = ivMap.getMeasuredHeight();
int widthMap = ivMap.getMeasuredWidth();
@ -407,7 +396,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
layerChange.addView(ivMap);
initMapBig();
ivPicImage.setVisibility(View.VISIBLE);
isPicture = true;
} else {
layoutParamsMap.height = heightCamera;
layoutParamsMap.width = widthCamera;
@ -419,8 +407,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
layerChange.addView(camera);
initMapShort();
ivPicImage.setVisibility(View.GONE);
isPicture = false;
}
}
@ -483,9 +469,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
if (polyline != null) {
polyline.remove();
}
/*
listenerPicture = false;
*/
for (int i = 0; i < removables.size(); i++) {
removables.get(i).remove();
}

View File

@ -106,7 +106,6 @@ public class TestActivity extends BaseActivity {
}
//获取中心点位置
LatLng mapCenterPoint = tencentMap.getCameraPosition().target;
String centerEncode = null;
if (mapCenterPoint != null) {
centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
@ -115,6 +114,7 @@ public class TestActivity extends BaseActivity {
OkGo.getInstance().cancelTag(this);
showLoadingDialog();
// 请求方式和请求url
HttpParams httpParams = new HttpParams();
httpParams.put("userGeo", userEncode);
httpParams.put("centerGeo", centerEncode);
@ -402,20 +402,21 @@ public class TestActivity extends BaseActivity {
poiListEntity.setPrecision(listBean.getPrice() + "");
poiListEntity.setDist(listBean.getDist() + "");
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setGeoWkt(listBean.getGeo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setType(listBean.getType());
String beanGeo = listBean.getGeo();
poiListEntity.setGeoWkt(beanGeo);
Geometry geos = GeometryTools.createGeometry(beanGeo);
switch (geos.getGeometryType()) {
String geo = Geohash.getInstance().decode(beanGeo);
Geometry gens = GeometryTools.createGeometry(geo);
switch (gens.getGeometryType()) {
case "Point": //
LatLng lng = GeometryTools.createLatLng(beanGeo);
LatLng lng = GeometryTools.createLatLng(geo);
poiListEntity.setX(lng.longitude + "");
poiListEntity.setY(lng.latitude + "");
break;
case "LineString": //线
case "Polygon": //
List<LatLng> latLineString = GeometryTools.getLatLags(beanGeo);
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
assert latLineString != null;
poiListEntity.setX(latLineString.get(0).longitude + "");
poiListEntity.setY(latLineString.get(0).latitude + "");
@ -589,9 +590,8 @@ public class TestActivity extends BaseActivity {
if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新
if (tencentMap != null) {
TencentLocation tencentLocation = (TencentLocation) msg.obj;
CameraUpdate cameraSigma =
CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(
new CameraPosition(new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别
0, //目标倾斜角
tencentLocation.getBearing())); //目标旋转角 0~360° (正北方为0)

View File

@ -146,12 +146,10 @@ public class Constant {
//CompleteTask
public static final int EVENT_WHAT_COMPLETE_TASK = 42; // 点击记录跳转开始采集
public static final int EVENT_STAY_REFRESH = 44; // 刷新记录页面
public static final int EVENT_WORK_HOME = 45; //切换到寻宝
public static final int PICTURE_VIDEO_WORD = 48; //视频页面崩溃后发给poi录像和道路
public static final int REGISTER_WORD = 46; //注册的返回
public static final int VIDEO_FINISH_ROAD = 47;//录像视频列表的返回
public static final int PICTURE_VIDEO_WORD = 48; //视频页面崩溃后发给poi录像和道路
public static final int PHOTO_FINISH_VIDEO = 49;//拍照列表的返回
public static final int NEST_WORD_SUBMIT =50;//所有的提交/上传
@ -190,7 +188,7 @@ public class Constant {
public static TencentMap.OnMarkerClickListener markerClickListener=null;
public static final String NAVIN_FO="9.14";//版本
public static final String NAVIN_FO="9.14.2";//版本
/**
* 联系我们的QQ群名称和QQ群号

View File

@ -109,7 +109,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private Spinner spinnerType;
String[] caye = new String[]{"充电站", "充换电站", "充电桩组", "换电站"};//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 ,
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
private int existence = 0;
private LinearLayout linearChargingPile;
private ChargingPileAdapter chargingPileAdapter;
@ -123,13 +122,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private ContactView contactView;
private ArrayList<File> chargingStationList;
String str = "";
// private ArrayList<File> fileList;
//private ArrayList<File> fileList;
private NestedScrollView nestedScrollView;
private Marker markerStation;
private Point screenStationPositions;
private List<Removable> removablesLocality;
public static ChargingStationFragment newInstance(Bundle bundle) {
ChargingStationFragment fragment = new ChargingStationFragment();
fragment.setArguments(bundle);
@ -189,7 +186,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
}
@Override
@ -197,7 +193,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
super.onResume();
initHeader();
moveLatlng(latLng, null);
}
@Override
@ -479,7 +474,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
} else {
Toast.makeText(getActivity(), "请输入名称", Toast.LENGTH_SHORT).show();
}
String address = showPoiEntity.getAddress();//地址
if (address != null && !address.equals("")) {
editSiteContent.setText(address);
@ -617,7 +611,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
initPileMarkerShow();
}
});
}
}).start();
if (showPoiEntity.getTaskStatus() == 3) {
@ -687,14 +680,12 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Toast.makeText(getActivity(), getPhoneBean.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
public void initRemovePileSharePre() {
@ -709,9 +700,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
//根据要保存的数据的类型调用对应的put方法,以键值对的形式添加新值
edit.putString("chargingPileEntity", null);
//提交新值必须执行否则前面的操作都无效
edit.commit();
edit.apply();
}
//禁用所有可操作性控件
private void disables() {
checkBoxLife.setEnabled(false);
@ -735,7 +725,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
poiBeans = new ArrayList<>();
}
@Subscribe
public void onEvent(Message data) {
if (data.what == Constant.CHARGING_STATION_WORD) { // 移动充电站点位
@ -863,10 +852,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Constant.isPresent = false;
} else {
Toast.makeText(getContext(), "有正在提交的数据,等提交成功后,方可操作", Toast.LENGTH_SHORT).show();
}
}
});
}
@ -943,7 +929,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
}
}
/**
* 上传充电桩数据
*/
@ -980,42 +965,39 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
} catch (IOException e) {
e.printStackTrace();
}
/*
OkGo
// 请求方式和请求url
.<PoiUploadBean>post(HttpInterface.CS_TASK_UP_LOAD_PIC)
// 请求的 tag, 主要用于取消对应的请求
.params("auditId", chargingPileEntity.getBodyId())
.addFileParams("file", chargingPileFileList)
.tag(this)
.execute(new DialogCallback<PoiUploadBean>(PoiUploadBean.class) {
@Override
public void onSuccess(Response<PoiUploadBean> poiUploadBeanResponse) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
isChargingPoleUploaded = true;
if (isChargeStationUploaded && isChargingPoleUploaded) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
getActivity().onBackPressed();//回退
}
});
}
}
@Override
public void onError(Response<PoiUploadBean> poiUploadBeanResponse) {
super.onError(poiUploadBeanResponse);
dismissLoadingDialog();
Toast.makeText(getActivity(), poiUploadBeanResponse.code() + "", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + poiUploadBeanResponse.code() + "");
}
});
*/
}
/*
OkGo
// 请求方式和请求url
.<PoiUploadBean>post(HttpInterface.CS_TASK_UP_LOAD_PIC)
// 请求的 tag, 主要用于取消对应的请求
.params("auditId", chargingPileEntity.getBodyId())
.addFileParams("file", chargingPileFileList)
.tag(this)
.execute(new DialogCallback<PoiUploadBean>(PoiUploadBean.class) {
@Override
public void onSuccess(Response<PoiUploadBean> poiUploadBeanResponse) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
isChargingPoleUploaded = true;
if (isChargeStationUploaded && isChargingPoleUploaded) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
getActivity().onBackPressed();//回退
}
});
}
}
@Override
public void onError(Response<PoiUploadBean> poiUploadBeanResponse) {
super.onError(poiUploadBeanResponse);
dismissLoadingDialog();
Toast.makeText(getActivity(), poiUploadBeanResponse.code() + "", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + poiUploadBeanResponse.code() + "");
}
});
*/
private void initRoadSaveLocal(boolean isLocal) {
XXPermissions.with(this)
//读写权限
@ -1067,7 +1049,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Log.e("TAG", "poiUploadByNetWork: " + poiEntity.getBodyId() + chargingStationList);
return;
}
new Thread(new Runnable() {
@Override
public void run() {
@ -1096,7 +1077,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Objects.requireNonNull(getActivity()).onBackPressed();//回退
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
WaitDialog.dismiss(3000);
}
});
}
@ -1164,7 +1144,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
Toast.makeText(getActivity(), "" + chargingStationBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
@ -1216,9 +1195,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
btnUploading.setEnabled(false);
Toast.makeText(getActivity(), taskNameBean.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable e, int id) {
if (getActivity() == null) {
@ -1240,7 +1217,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
initStationSharePre();
}

View File

@ -36,61 +36,60 @@ public class ContactFragment extends BaseFragment implements View.OnClickListene
@Override
protected void initView() {
super.initView();
ImageView ivContact = findViewById(R.id.iv_contact);
ImageView ivContact =findViewById(R.id.iv_contact);
ivContact.setOnClickListener(this);
TextView tvJigName = (TextView) findViewById(R.id.tv_jingName);
TextView tvJigName =findViewById(R.id.tv_jingName);
tvJigName.setText(Constant.REGION_JIG_NAME);
TextView tvJigPhone = (TextView) findViewById(R.id.tv_jingPhone);
TextView tvJigPhone =findViewById(R.id.tv_jingPhone);
tvJigPhone.setText(Constant.REGION_JIG_PHONE);
TextView tvHeiName = (TextView) findViewById(R.id.tv_heiName);
TextView tvHeiName =findViewById(R.id.tv_heiName);
tvHeiName.setText(Constant.REGION_HEI_NAME);
TextView tvHeiPhone = (TextView) findViewById(R.id.tv_heiPhone);
TextView tvHeiPhone =findViewById(R.id.tv_heiPhone);
tvHeiPhone.setText(Constant.REGION_HEI_PHONE);
TextView tvSanName = (TextView) findViewById(R.id.tv_shanName);
TextView tvSanName =findViewById(R.id.tv_shanName);
tvSanName.setText(Constant.REGION_SAN_NAME);
TextView tvSanPhone = (TextView) findViewById(R.id.tv_shanPhone);
TextView tvSanPhone =findViewById(R.id.tv_shanPhone);
tvSanPhone.setText(Constant.REGION_SAN_PHONE);
TextView tvYuName = (TextView) findViewById(R.id.tv_yuName);
TextView tvYuName =findViewById(R.id.tv_yuName);
tvYuName.setText(Constant.REGION_YU_NAME);
TextView tvYuPhone = (TextView) findViewById(R.id.tv_yuPhone);
TextView tvYuPhone =findViewById(R.id.tv_yuPhone);
tvYuPhone.setText(Constant.REGION_YU_PHONE);
TextView tvChanName = (TextView) findViewById(R.id.tv_chuanName);
TextView tvChanName =findViewById(R.id.tv_chuanName);
tvChanName.setText(Constant.REGION_CHAN_NAME);
TextView tvChanPhone = (TextView) findViewById(R.id.tv_chuanPhone);
TextView tvChanPhone =findViewById(R.id.tv_chuanPhone);
tvChanPhone.setText(Constant.REGION_CHAN_PHONE);
TextView tvGanName = (TextView) findViewById(R.id.tv_ganName);
TextView tvGanName =findViewById(R.id.tv_ganName);
tvGanName.setText(Constant.REGION_GAN_NAME);
TextView tvGanPhone = (TextView) findViewById(R.id.tv_ganPhone);
TextView tvGanPhone =findViewById(R.id.tv_ganPhone);
tvGanPhone.setText(Constant.REGION_GAN_PHONE);
TextView tvSuName = (TextView) findViewById(R.id.tv_suName);
TextView tvSuName =findViewById(R.id.tv_suName);
tvSuName.setText(Constant.REGION_SU_NAME);
TextView tvSuPhone = (TextView) findViewById(R.id.tv_suPhone);
TextView tvSuPhone =findViewById(R.id.tv_suPhone);
tvSuPhone.setText(Constant.REGION_SU_PHONE);
TextView tvLuName = (TextView) findViewById(R.id.tv_luName);
TextView tvLuName =findViewById(R.id.tv_luName);
tvLuName.setText(Constant.REGION_LU_NAME);
TextView tvLuPhone = (TextView) findViewById(R.id.tv_luPhone);
TextView tvLuPhone =findViewById(R.id.tv_luPhone);
tvLuPhone.setText(Constant.REGION_LU_PHONE);
TextView tvFuName = (TextView) findViewById(R.id.tv_fuName);
TextView tvFuName =findViewById(R.id.tv_fuName);
tvFuName.setText(Constant.REGION_FU_NAME);
TextView tvFuPhone = (TextView) findViewById(R.id.tv_fuPhone);
TextView tvFuPhone =findViewById(R.id.tv_fuPhone);
tvFuPhone.setText(Constant.REGION_FU_PHONE);
TextView tvGangName = (TextView) findViewById(R.id.tv_guangName);
TextView tvGangName =findViewById(R.id.tv_guangName);
tvGangName.setText(Constant.REGION_GANG_NAME);
TextView tvGangPhone = (TextView) findViewById(R.id.tv_guangPhone);
TextView tvGangPhone =findViewById(R.id.tv_guangPhone);
tvGangPhone.setText(Constant.REGION_GANG_PHONE);
TextView tvGabeName = (TextView) findViewById(R.id.tv_ganzName);
TextView tvGabeName =findViewById(R.id.tv_ganzName);
tvGabeName.setText(Constant.REGION_GANZ_NAME);
TextView tvGabePhone = (TextView) findViewById(R.id.tv_ganzPhone);
TextView tvGabePhone =findViewById(R.id.tv_ganzPhone);
tvGabePhone.setText(Constant.REGION_GANZ_PHONE);
TextView tvYueName = (TextView) findViewById(R.id.tv_yueName);
TextView tvYueName =findViewById(R.id.tv_yueName);
tvYueName.setText(Constant.REGION_YUE_NAME);
TextView tvYuePhone = (TextView) findViewById(R.id.tv_yuePhone);
TextView tvYuePhone =findViewById(R.id.tv_yuePhone);
tvYuePhone.setText(Constant.REGION_YUE_PHONE);
TextView tvYunName = (TextView) findViewById(R.id.tv_yunName);
TextView tvYunName =findViewById(R.id.tv_yunName);
tvYunName.setText(Constant.REGION_YUN_NAME);
TextView tvYunPhone = (TextView) findViewById(R.id.tv_yunPhone);
TextView tvYunPhone =findViewById(R.id.tv_yunPhone);
tvYunPhone.setText(Constant.REGION_YUN_PHONE);
}
@Override

View File

@ -21,6 +21,7 @@ import com.jcodecraeer.xrecyclerview.ProgressStyle;
import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.kongzue.dialog.interfaces.OnMenuItemClickListener;
import com.kongzue.dialog.v3.BottomMenu;
import com.kongzue.dialog.v3.WaitDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.FilterAdapter;
@ -236,14 +237,17 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
Button btnFilter = findViewById(R.id.btn_filter);
btnFilter.setOnClickListener(this);
RelativeLayout rlDraw = findViewById(R.id.rl_draw);
if (Constant.LEVEL==1||Constant.LEVEL==2){
rlDraw.setVisibility(View.VISIBLE);
}else {
rlDraw.setVisibility(View.GONE);
}
rlDraw.setOnClickListener(this);
checkOk = findViewById(R.id.check_ok);
Button btnDraw = findViewById(R.id.btn_draw);
btnDraw.setOnClickListener(this);
if (Constant.LEVEL == 1 || Constant.LEVEL == 2) {
checkOk.setEnabled(true);
btnDraw.setEnabled(true);
} else {
checkOk.setEnabled(false);
btnDraw.setEnabled(false);
}
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
recyclerFilter = findViewById(R.id.recycler_filter);
if (slidingPaneLayout != null) {
@ -318,6 +322,11 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.rl_draw:
if (Constant.LEVEL != 1 && Constant.LEVEL != 2) {
Toast.makeText(getActivity(), "您的等级暂不具备此权限哦", Toast.LENGTH_SHORT).show();
}
break;
case R.id.btn_draw:
if (btnChock == null) {
return;

View File

@ -35,7 +35,6 @@ import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.Voice;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.vividsolutions.jts.geom.Geometry;
@ -449,7 +448,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
@ -457,12 +455,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Log.d("TAG", "onError: " + e.getMessage());
}
});
}
/**
* @param url 面妆任务领取任务
* @param
*/
private void initPolygonTask(String url, int taskId, boolean aBoolean) {
if (taskId == 0) {

View File

@ -3,9 +3,9 @@ package com.navinfo.outdoor.http;
import com.navinfo.outdoor.api.Constant;
public class HttpInterface {
public static final String IP_TEST = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
public static final String DATA_IP = "http://172.23.139.4:9999/m4";//接口
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口
public static final String IP_TEXt = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口
public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口
public static final String APKIP = "http://172.23.139.4:8001/";

View File

@ -0,0 +1,95 @@
package com.navinfo.outdoor.util;
import android.content.Context;
import android.speech.tts.TextToSpeech;
import android.speech.tts.UtteranceProgressListener;
import android.widget.Toast;
import java.util.Locale;
public class SystemTTS extends UtteranceProgressListener implements TTS, TextToSpeech.OnUtteranceCompletedListener {
private Context mContext;
private static SystemTTS singleton;
private TextToSpeech textToSpeech; // 系统语音播报类
private boolean isSuccess = true;
public static SystemTTS getInstance(Context context) {
if (singleton == null) {
synchronized (SystemTTS.class) {
if (singleton == null) {
singleton = new SystemTTS(context);
}
}
}
return singleton;
}
private SystemTTS(Context context) {
this.mContext = context.getApplicationContext();
textToSpeech = new TextToSpeech(mContext, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int i) {
//系统语音初始化成功
if (i == TextToSpeech.SUCCESS) {
int result = textToSpeech.setLanguage(Locale.CHINA);
textToSpeech.setPitch(1.0f);// 设置音调值越大声音越尖女生值越小则变成男声,1.0是常规
textToSpeech.setSpeechRate(1.0f);
textToSpeech.setOnUtteranceProgressListener(SystemTTS.this);
textToSpeech.setOnUtteranceCompletedListener(SystemTTS.this);
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
//系统不支持中文播报
isSuccess = false;
}
}
}
});
}
public void playText(String playText) {
if (!isSuccess) {
Toast.makeText(mContext, "系统不支持中文播报", Toast.LENGTH_SHORT).show();
return;
}
if (textToSpeech != null) {
textToSpeech.speak(playText,
TextToSpeech.QUEUE_ADD, null, null);
}
}
public void stopSpeak() {
if (textToSpeech != null) {
textToSpeech.stop();
}
}
// public boolean isSpeaking() {
// if (textToSpeech.isSpeaking()) {
// return true;
// }
// return false;
// }
//播报完成回调
@Override
public void onUtteranceCompleted(String utteranceId) {
}
@Override
public void onStart(String utteranceId) {
}
@Override
public void onDone(String utteranceId) {
}
@Override
public void onError(String utteranceId) {
}
}

View File

@ -0,0 +1,7 @@
package com.navinfo.outdoor.util;
public interface TTS {
void playText(String playText);
void stopSpeak();
}

View File

@ -1,62 +0,0 @@
package com.navinfo.outdoor.util;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
/**
* 语音播放
*/
public class Voice {
/**
* @param type 设定文件 0:开始1停止
* @return 返回类型void
* @Title: start
* @Description: 该方法的主要作用朗读
*/
public static void sprat(String content, int type) {
ActiveXComponent sap = new ActiveXComponent("Sapi.SpVoice");
Dispatch sago = sap.getObject();
if (type == 0) {
try {
// 音量 0-100
sap.setProperty("Volume", new Variant(100));
// 语音朗读速度 -10 +10
sap.setProperty("Rate", new Variant(1.3));
Variant defaultVoice = sap.getProperty("Voice");
Dispatch discrepantVoice = defaultVoice.toDispatch();
Variant allVoices = Dispatch.call(sago, "GetVoices");
Dispatch disVoices = allVoices.toDispatch();
Dispatch serviced = Dispatch.call(disVoices, "Item",
new Variant(1)).toDispatch();
ActiveXComponent voiceActive = new ActiveXComponent(discrepantVoice);
ActiveXComponent servicedActives = new ActiveXComponent(serviced);
Variant item = Dispatch.call(servicedActives, "GetDescription");
// 执行朗读
Dispatch.call(sago, "Speak", new Variant(content));
} catch (Exception e) {
e.printStackTrace();
} finally {
sago.safeRelease();
sap.safeRelease();
}
} else {
// 停止
try {
Dispatch.call(sago, "Speak", new Variant(content), new Variant(2));
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
/**
* @return 返回类型void
* @Title: test
* @Description: 该方法的主要作用执行朗读内容
*/
public void test() {
sprat("请不要超过 多少", 0);
}
}

View File

@ -10,24 +10,28 @@
<FrameLayout
android:id="@+id/layer_change"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.otaliastudios.cameraview.CameraView
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cameraPictureSizeMaxArea="3686400"
app:cameraPictureSizeMinArea="1166400"
app:cameraPictureSizeMaxHeight="1920"
app:cameraPictureSizeMinHeight="1080"
app:cameraPictureSizeMaxWidth="1920"
app:cameraPictureSizeMinWidth="1080"
app:cameraPictureSizeAspectRatio="1920:1080"
app:cameraPictureFormat="jpeg"
app:cameraPictureSizeBiggest="true"
app:cameraPictureSizeSmallest="true"
app:cameraPictureMetering="true"
android:keepScreenOn="true"
app:cameraPictureFormat="jpeg"
app:cameraPictureMetering="true"
app:cameraPictureSizeAspectRatio="1920:1080"
app:cameraPictureSizeBiggest="true"
app:cameraPictureSizeMaxArea="3686400"
app:cameraPictureSizeMaxHeight="1920"
app:cameraPictureSizeMaxWidth="1920"
app:cameraPictureSizeMinArea="1166400"
app:cameraPictureSizeMinHeight="1080"
app:cameraPictureSizeMinWidth="1080"
app:cameraPictureSizeSmallest="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -41,7 +45,17 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_default="percent"
app:layout_constraintWidth_percent="0.4" />
</FrameLayout>
</FrameLayout>
<ImageView
android:id="@+id/iv_image"
android:layout_width="300dp"
android:layout_height="157dp"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_default="percent"
app:layout_constraintWidth_percent="0.4" />
<ImageView
android:id="@+id/iv_zoom_add"
@ -52,7 +66,6 @@
app:layout_constraintBottom_toTopOf="@+id/btn_stop_picture"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/btn_switch"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
@ -65,17 +78,17 @@
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_add"
app:layout_constraintTop_toBottomOf="@id/iv_zoom_add" />
<!-- <CheckBox-->
<!-- android:id="@+id/cb_map_type"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_marginTop="15dp"-->
<!-- android:background="@drawable/atlas_selector"-->
<!-- android:button="@null"-->
<!-- android:checked="false"-->
<!-- android:visibility="gone"-->
<!-- app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"-->
<!-- app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />-->
<!-- <CheckBox-->
<!-- android:id="@+id/cb_map_type"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_marginTop="15dp"-->
<!-- android:background="@drawable/atlas_selector"-->
<!-- android:button="@null"-->
<!-- android:checked="false"-->
<!-- android:visibility="gone"-->
<!-- app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"-->
<!-- app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />-->
<ImageView
android:id="@+id/iv_location"
@ -87,7 +100,6 @@
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />
<Button
android:id="@+id/btn_switch"
android:layout_width="wrap_content"
@ -106,6 +118,7 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/capture_picture"
style="@style/user_data_style"
@ -131,4 +144,5 @@
app:layout_constraintBottom_toBottomOf="@id/capture_picture"
app:layout_constraintLeft_toRightOf="@id/capture_picture"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>