版本升级的修改
This commit is contained in:
parent
4de8757925
commit
f54db83131
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.navinfo.outdoor">
|
||||
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
@ -9,6 +10,13 @@
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" /> <!-- <uses-sdk android:minSdkVersion="8"></uses-sdk> -->
|
||||
|
||||
<!-- 在SDCard中创建与删除文件权限 -->
|
||||
<uses-permission
|
||||
android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<!-- 安装APK权限 -->
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<!-- 友盟检测bug -->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />-->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />-->
|
||||
@ -89,6 +97,21 @@
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name=".activity.UserActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="com.navinfo.outdoor.fileprovider"
|
||||
android:grantUriPermissions="true"
|
||||
android:exported="false"
|
||||
>
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
|
||||
|
||||
|
||||
</manifest>
|
@ -4,6 +4,7 @@ import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
@ -13,6 +14,7 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.hjq.permissions.OnPermissionCallback;
|
||||
import com.hjq.permissions.Permission;
|
||||
@ -47,18 +49,30 @@ public class MainActivity extends BaseActivity {
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
if (msg.what==0){
|
||||
Toast.makeText(MainActivity.this, "下载完成", Toast.LENGTH_SHORT).show();
|
||||
//将下载进度对话框取消
|
||||
pBar.cancel();
|
||||
//安装apk,也可以进行静默安装
|
||||
//调用系统安装程序
|
||||
//安装apk,也可以进行静默安装
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(Uri.fromFile(new File(Constant.NAVINFO_APk, "navinfo.apk")),
|
||||
"application/vnd.android.package-archive");
|
||||
startActivityForResult(intent, 10);
|
||||
File file = new File(Constant.NAVINFO_APk+"DTXB.apk");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
Uri contentUri = FileProvider.getUriForFile(MainActivity.this, "com.navinfo.outdoor.fileprovider", file);
|
||||
intent.setDataAndType(contentUri, "application/vnd.android.package-archive");
|
||||
} else {
|
||||
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
}
|
||||
startActivity(intent);
|
||||
}else if (msg.what==1){
|
||||
pBar.setProgress(progress);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
private ProgressDialog pBar;
|
||||
private int progress;
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
@ -91,6 +105,7 @@ public class MainActivity extends BaseActivity {
|
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE/*, Permission.READ_EXTERNAL_STORAGE, Permission.WRITE_EXTERNAL_STORAGE*/)
|
||||
// 申请相机权限
|
||||
.permission(Permission.CAMERA)
|
||||
.permission(Permission.REQUEST_INSTALL_PACKAGES)
|
||||
// 位置权限
|
||||
.permission(Permission.ACCESS_FINE_LOCATION)
|
||||
//.permission(Permission.ACCESS_BACKGROUND_LOCATION)
|
||||
@ -143,7 +158,7 @@ public class MainActivity extends BaseActivity {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
int version = response.getBody().getVersion();
|
||||
if (versionCode < version) {
|
||||
if (versionCode <version) {//TODO 改成<
|
||||
//升级
|
||||
ApkVersionBean.bodyBean body = response.getBody();
|
||||
showUpdateDialog(body);
|
||||
@ -193,6 +208,7 @@ public class MainActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//用户点击了取消
|
||||
initTime();
|
||||
}
|
||||
});
|
||||
}else{//强制更新
|
||||
@ -208,6 +224,14 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
});
|
||||
|
||||
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//用户点击了取消
|
||||
initTime();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
builder.create().show();
|
||||
@ -246,18 +270,23 @@ public class MainActivity extends BaseActivity {
|
||||
try {
|
||||
URL url = new URL(path);
|
||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||
con.setReadTimeout(5000);
|
||||
con.setConnectTimeout(5000);
|
||||
con.setReadTimeout(60000);
|
||||
con.setConnectTimeout(15000);
|
||||
con.setRequestProperty("Charset", "UTF-8");
|
||||
con.setRequestMethod("GET");
|
||||
con.connect();
|
||||
if (con.getResponseCode() == 200) {
|
||||
File files = new File(Constant.NAVINFO_APk);
|
||||
if (!files.exists()){
|
||||
files.mkdir();
|
||||
}
|
||||
int length = con.getContentLength();// 获取文件大小
|
||||
InputStream is = con.getInputStream();
|
||||
pBar.setMax(length); // 设置进度条的总长度
|
||||
pBar.setMax(100); // 设置进度条的总长度
|
||||
FileOutputStream fileOutputStream = null;
|
||||
if (is != null) {
|
||||
//对apk进行保存
|
||||
File file = new File(Constant.NAVINFO_APk, "navinfo.apk");
|
||||
File file = new File(Constant.NAVINFO_APk+"DTXB.apk");
|
||||
fileOutputStream = new FileOutputStream(file);
|
||||
byte[] buf = new byte[1024];
|
||||
int ch;
|
||||
@ -265,7 +294,8 @@ public class MainActivity extends BaseActivity {
|
||||
while ((ch = is.read(buf)) != -1) {
|
||||
fileOutputStream.write(buf, 0, ch);
|
||||
process += ch;
|
||||
pBar.setProgress(process); // 实时更新进度了
|
||||
progress = (int) (((float) process / length) * 100);
|
||||
handler.sendEmptyMessage(1);
|
||||
}
|
||||
}
|
||||
if (fileOutputStream != null) {
|
||||
@ -283,6 +313,8 @@ public class MainActivity extends BaseActivity {
|
||||
}.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
|
@ -36,7 +36,7 @@ public class Constant {
|
||||
public static final String VIDEOS_ = BASE_FOLDER + "/videos";
|
||||
public static final String POI_DAO = BASE_FOLDER + "/BaseDao/";
|
||||
//下载文件
|
||||
public static final String NAVINFO_APk = BASE_FOLDER + "/apk";
|
||||
public static final String NAVINFO_APk = BASE_FOLDER + "/apk/";
|
||||
// 申请权限的RequestCode
|
||||
public static final int PERMISSION_REQUEST_CODE = 0x100;
|
||||
|
||||
|
@ -57,6 +57,7 @@ import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.Base64;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.navinfo.outdoor.util.MyTecentLocationSource;
|
||||
@ -235,10 +236,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
// 移动到当前位置后,开始请求地图数据
|
||||
initList(Constant.currentLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {}
|
||||
public void onCancel() {
|
||||
}
|
||||
});
|
||||
}else {
|
||||
} else {
|
||||
dismissLoadingDialog();
|
||||
}
|
||||
tencentMap.setOnMarkerClickListener(new TencentMap.OnMarkerClickListener() {
|
||||
@ -321,7 +324,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
poiListEntity.setY(latPolygon.get(0).latitude + "");
|
||||
}
|
||||
initMarker(poiListEntity);
|
||||
}else {
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "数据为空", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@ -339,9 +342,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
|
||||
private void iniUserLocation() {
|
||||
String encode = Geohash.getInstance().encode(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
|
||||
Geometry geometry = GeometryTools.createGeometry(new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()));
|
||||
try {
|
||||
String encode = Base64.desEncrypt(geometry.toString());
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("geom",encode);
|
||||
httpParams.put("geom", encode);
|
||||
long time = System.currentTimeMillis();
|
||||
httpParams.put("datetime", time);
|
||||
OkGoBuilder.getInstance().Builder(getActivity())
|
||||
.url(HttpInterface.USER_LOCATION)
|
||||
.cls(UserBean.class)
|
||||
@ -351,24 +358,26 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
public void onSuccess(UserBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode()==200){
|
||||
if (response.getCode() == 200) {
|
||||
Toast.makeText(getActivity(), "成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: ssssssssssssssssssssssssss 成功");
|
||||
}else {
|
||||
Toast.makeText(getActivity(), response.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: "+response.getCode()+response.getMessage()+""+response.getBody());
|
||||
} else {
|
||||
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + response.getCode() + response.getMessage() + "" + response.getBody());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onSuccess: sss********sssssssssssss 成功"+e.getMessage()+"");
|
||||
Log.d("TAG", "onSuccess: sss********sssssssssssss 成功" + e.getMessage() + "");
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
private void initList(TencentLocation tencentLocation) {
|
||||
}
|
||||
private void initList (TencentLocation tencentLocation){
|
||||
int task_type = Constant.TASK_TYPE;
|
||||
int limit_type = Constant.LIMIT_TTPE;
|
||||
int taskStatus = Constant.TASK_STASTUS;
|
||||
@ -540,6 +549,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
obtain.obj = response;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
@ -549,7 +559,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
public void initMarker(PoiEntity poiEntity) {
|
||||
public void initMarker (PoiEntity poiEntity){
|
||||
sliding_layout.setPanelHeight(0);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
|
||||
for (int i = 0; i < removablesMarker.size(); i++) {
|
||||
@ -610,17 +620,17 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}*/
|
||||
}
|
||||
BitmapDescriptor descriptor = null;
|
||||
if (poiEntity.getType()==1){
|
||||
if (poiEntity.getType() == 1) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bags);
|
||||
}else if (poiEntity.getType()==2){
|
||||
} else if (poiEntity.getType() == 2) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bags);
|
||||
}else if (poiEntity.getType()==3){
|
||||
} else if (poiEntity.getType() == 3) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bag);
|
||||
}else if (poiEntity.getType()==4){
|
||||
} else if (poiEntity.getType() == 4) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bag);
|
||||
}else if (poiEntity.getType()==5){
|
||||
} else if (poiEntity.getType() == 5) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bag);
|
||||
}else if (poiEntity.getType()==6){
|
||||
} else if (poiEntity.getType() == 6) {
|
||||
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bag);
|
||||
}
|
||||
if (bigMarker == null) {
|
||||
@ -645,7 +655,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
|
||||
|
||||
private void initThread() {
|
||||
private void initThread () {
|
||||
int taskStatus = Constant.TASK_STASTUS;
|
||||
int type = Constant.TASK_TYPE;
|
||||
int limit = Constant.LIMIT_TTPE;
|
||||
@ -723,10 +733,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
switch (Integer.valueOf(poiEntity.getType())) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor=null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
poiDescriptor= BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1);
|
||||
}else {
|
||||
BitmapDescriptor poiDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1);
|
||||
} else {
|
||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
|
||||
}
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
||||
@ -742,9 +752,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1);
|
||||
}else {
|
||||
} else {
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
|
||||
}
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
|
||||
@ -758,9 +768,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1);
|
||||
}else {
|
||||
} else {
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
||||
}
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
|
||||
@ -773,10 +783,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(poiVideoMarker);
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor =null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
BitmapDescriptor roadDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
|
||||
}else {
|
||||
} else {
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
|
||||
}
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
|
||||
@ -790,9 +800,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
|
||||
}else {
|
||||
} else {
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayother);
|
||||
}
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
|
||||
@ -805,10 +815,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
removablesLocality.add(otherMarker);
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor =null;
|
||||
if (poiEntity.getTaskStatus()==1){
|
||||
BitmapDescriptor Descriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
|
||||
}else {
|
||||
} else {
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bag);
|
||||
}
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
|
||||
@ -832,7 +842,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void initSharePre() {
|
||||
private void initSharePre () {
|
||||
//根据保存时所用的name属性,获取SharedPreferences对象
|
||||
SharedPreferences dataFile = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||
//根据数据类型,调用对应的get方法,通过键取得对应的值。
|
||||
@ -848,7 +858,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()),Double.valueOf(poiEntity.getX()));
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(1, newPoiLatLng);
|
||||
showSlidingFragment(poiFragment);
|
||||
initRemovePoiSharePre();
|
||||
@ -864,7 +874,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()),Double.valueOf(poiEntity.getX()));
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(4, newPoiLatLng);
|
||||
showSlidingFragment(chargingStationFragment);
|
||||
initRemovePoiSharePre();
|
||||
@ -880,7 +890,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()),Double.valueOf(poiEntity.getX()));
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(2, newPoiLatLng);
|
||||
showSlidingFragment(poiVideoFragment);
|
||||
initRemovePoiSharePre();
|
||||
@ -896,7 +906,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()),Double.valueOf(poiEntity.getX()));
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(3, newPoiLatLng);
|
||||
showSlidingFragment(roadFragment);
|
||||
initRemovePoiSharePre();
|
||||
@ -913,7 +923,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()),Double.valueOf(poiEntity.getX()));
|
||||
LatLng newPoiLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
|
||||
showPoiMarkerByType(5, newPoiLatLng);
|
||||
showSlidingFragment(otherFragment);
|
||||
initRemovePoiSharePre();
|
||||
@ -926,7 +936,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
public void initRemovePoiSharePre() {
|
||||
public void initRemovePoiSharePre () {
|
||||
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||
@ -942,7 +952,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
public void onEvent (Message data){
|
||||
if (data.what == Constant.FILTER_LIST_ITEM) { // 点击筛选的item
|
||||
PoiEntity poiEntity = (PoiEntity) data.obj;
|
||||
if (poiEntity.getX() != null && poiEntity.getY() != null) {
|
||||
@ -1178,7 +1188,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
private void initRemoveFragment() {
|
||||
private void initRemoveFragment () {
|
||||
PoiFragment poiFragments = (PoiFragment) supportFragmentManager.findFragmentByTag(PoiFragment.class.getName());
|
||||
if (poiFragments != null) {
|
||||
fragmentTransaction.remove(poiFragments);
|
||||
@ -1205,7 +1215,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
/**
|
||||
* 控制主界面各个按钮的显示状态
|
||||
*/
|
||||
private void setMainButtonVisiable(int visiable) {
|
||||
private void setMainButtonVisiable ( int visiable){
|
||||
ivZoomAdd.setVisibility(visiable);
|
||||
ivZoomDel.setVisibility(visiable);
|
||||
ivLocation.setVisibility(visiable);
|
||||
@ -1216,7 +1226,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
ivMessage.setVisibility(visiable);
|
||||
}
|
||||
|
||||
private void initPoiMarker(LatLng latLng) {
|
||||
private void initPoiMarker (LatLng latLng){
|
||||
LatLng mapCenterPoint = getMapCenterPoint();
|
||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
mapCenterPoint, //中心点坐标,地图目标经纬度
|
||||
@ -1233,12 +1243,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
markerPoi.setFixingPoint(screenPosition.x, screenPosition.y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {}
|
||||
public void onCancel() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initPileMarker(LatLng latLng) {
|
||||
private void initPileMarker (LatLng latLng){
|
||||
LatLng mapCenterPoint = getMapCenterPoint();
|
||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
mapCenterPoint, //中心点坐标,地图目标经纬度
|
||||
@ -1255,12 +1267,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
markerPile.setFixingPoint(screenPosition.x, screenPosition.y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {}
|
||||
public void onCancel() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initCheckedPileMarker(int poiWord) {
|
||||
private void initCheckedPileMarker ( int poiWord){
|
||||
if (screenPosition != null) {
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
LatLng latLng = tencentMap.getProjection().fromScreenLocation(screenPosition);
|
||||
@ -1274,7 +1288,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
private void initCheckedMarker(int poiWord) {
|
||||
private void initCheckedMarker ( int poiWord){
|
||||
if (screenPosition != null) {
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
LatLng latLng = tencentMap.getProjection().fromScreenLocation(screenPosition);
|
||||
@ -1291,7 +1305,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
/**
|
||||
* 设置定位图标样式
|
||||
*/
|
||||
private void setLocMarkerStyle() {
|
||||
private void setLocMarkerStyle () {
|
||||
locationStyle = new MyLocationStyle();
|
||||
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
|
||||
//创建图标
|
||||
@ -1308,7 +1322,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
/**
|
||||
* 定位的一些初始化设置
|
||||
*/
|
||||
private void initLocation() {
|
||||
private void initLocation () {
|
||||
//设置定位周期(位置监听器回调周期)为3s
|
||||
// locationRequest.setInterval(3000);
|
||||
//地图上设置定位数据源
|
||||
@ -1320,7 +1334,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
tencentMap.setMyLocationStyle(locationStyle);
|
||||
}
|
||||
|
||||
private Bitmap getBitMap(int resourceId) {
|
||||
private Bitmap getBitMap ( int resourceId){
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
|
||||
int width = bitmap.getWidth();
|
||||
int height = bitmap.getHeight();
|
||||
@ -1335,38 +1349,38 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
protected void initData () {
|
||||
super.initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
public void onStart () {
|
||||
super.onStart();
|
||||
treasureMap.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
public void onResume () {
|
||||
super.onResume();
|
||||
ivMessage.setVisibility(View.VISIBLE);
|
||||
treasureMap.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
public void onPause () {
|
||||
super.onPause();
|
||||
ivMessage.setVisibility(View.GONE);
|
||||
treasureMap.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
public void onStop () {
|
||||
super.onStop();
|
||||
treasureMap.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
public void onDestroy () {
|
||||
super.onDestroy();
|
||||
treasureMap.onDestroy();
|
||||
if (markerPoi != null) {
|
||||
@ -1383,7 +1397,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
public void onClick (View v){
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_zoom_add://放大
|
||||
CameraUpdate cameraUpdateIn = CameraUpdateFactory.zoomIn();
|
||||
@ -1487,7 +1501,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
private void showPoiMarkerByType(int type, LatLng latLng) {
|
||||
private void showPoiMarkerByType ( int type, LatLng latLng){
|
||||
if (type == 1) {
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor1).zIndex(2));
|
||||
} else if (type == 2) {
|
||||
@ -1506,7 +1520,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
public void initHeader(View view) {
|
||||
public void initHeader (View view){
|
||||
dragView.removeAllViews();
|
||||
dragView.addView(view);
|
||||
}
|
||||
@ -1514,7 +1528,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
/**
|
||||
* 将fragment显示到抽屉内
|
||||
*/
|
||||
private void showSlidingFragment(BaseDrawerFragment fragment) {
|
||||
private void showSlidingFragment (BaseDrawerFragment fragment){
|
||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||
int[] deviceInfo = DensityUtil.getDeviceInfo(getActivity());
|
||||
sliding_layout.setPanelHeight(deviceInfo[1] / 2);
|
||||
@ -1558,7 +1572,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
/**
|
||||
* 检查网络状态
|
||||
*/
|
||||
private void checkNetWork() {
|
||||
private void checkNetWork () {
|
||||
if (NetWorkUtils.iConnected(getContext())) { // 当前网络可用
|
||||
checkMyLocation();
|
||||
} else { // 当前网络不可用
|
||||
@ -1569,7 +1583,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
/**
|
||||
* 检查所需权限
|
||||
*/
|
||||
private void checkMyLocation() {
|
||||
private void checkMyLocation () {
|
||||
|
||||
// 1.判断是否拥有定位的权限
|
||||
// 1.1 拥有权限进行相应操作
|
||||
@ -1607,7 +1621,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
public boolean onBackPressed () {
|
||||
getActivity().finish();
|
||||
return true;
|
||||
}
|
||||
@ -1617,7 +1631,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LatLng getMapCenterPoint() {
|
||||
public LatLng getMapCenterPoint () {
|
||||
// int left = treasureMap.getLeft();
|
||||
// int top = treasureMap.getTop();
|
||||
// int right = treasureMap.getRight();
|
||||
@ -1631,7 +1645,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||
public void onConfigurationChanged (@NonNull Configuration newConfig){
|
||||
super.onConfigurationChanged(newConfig);
|
||||
int measuredWidth = treasureMap.getWidth();
|
||||
int measuredHeight = treasureMap.getHeight();
|
||||
@ -1641,4 +1655,4 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
treasureMap.onSizeChanged(measuredHeight, measuredWidth, measuredWidth, measuredHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ public class HttpInterface {
|
||||
//dtxbmaps.navinfo.com/dtxb/m4/user/appVersion/checkVersion?version=155&operationType=android
|
||||
//172.23.139.4:8001/appVersion/checkVersion?version=155&operationType=android version是版本 operationType固定值 安卓 get
|
||||
public static final String APKIP="http://172.23.139.4:8001/";
|
||||
public static final String APP_CHECK_VERSION = IP+"appVersion/checkVersion"; //版本升级
|
||||
public static final String APP_CHECK_VERSION = IP+USER_PATH+"appVersion/1/checkVersion"; //版本升级
|
||||
/**
|
||||
* 我的
|
||||
* Path=/m4/user/*
|
||||
@ -31,7 +31,7 @@ public class HttpInterface {
|
||||
public static final String USER_AUTH_ADD = IP+USER_PATH+ "userAuth/add"; //实名认证
|
||||
//172.23.139.4:9999/m4/user/userLocation/1/userLocation post 参数 geom:geohash加密
|
||||
public static final String geomIP="http://172.23.139.4:9999/m4";
|
||||
public static final String USER_LOCATION = geomIP+USER_PATH+ "userLocation/"+USERID+"/userLocation"; //上传用户坐标
|
||||
public static final String USER_LOCATION = IP+USER_PATH+ "userLocation/"+USERID+"/userLocation"; //上传用户坐标
|
||||
|
||||
/**
|
||||
* 发现
|
||||
|
@ -13,8 +13,7 @@ public class APKVersionCodeUtils {
|
||||
int versionCode = 0;
|
||||
try {
|
||||
//获取软件版本号,对应AndroidManifest.xml下android:versionCode
|
||||
versionCode = mContext.getPackageManager().
|
||||
getPackageInfo(mContext.getPackageName(), 0).versionCode;
|
||||
versionCode = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionCode;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
5
app/src/main/res/xml/file_paths.xml
Normal file
5
app/src/main/res/xml/file_paths.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<external-path path="Android/data/com.navinfo.outdoor/" name="files_root" />
|
||||
<external-path path="." name="external_storage_root" />
|
||||
</paths>
|
Loading…
x
Reference in New Issue
Block a user