diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index f9f33c3..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 7bfef59..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 1b29773..d139b6c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,9 +22,9 @@ android { } } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } } //efs { @@ -54,8 +54,8 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' - implementation 'com.umeng.umsdk:common:9.3.8' - implementation 'com.umeng.umsdk:asms:1.2.2' + implementation 'com.umeng.umsdk:common:9.3.8' + implementation 'com.umeng.umsdk:asms:1.2.2' implementation 'com.umeng.umsdk:apm:1.2.0' //状态栏侵染 @@ -65,7 +65,6 @@ dependencies { implementation 'com.gyf.immersionbar:immersionbar-components:3.0.0' - //网络框架 implementation 'com.lzy.net:okgo:3.0.4' implementation 'com.google.code.gson:gson:2.8.5' @@ -96,4 +95,12 @@ dependencies { implementation project(':xrecyclerview') +//腾讯地图 + // 地图库 + implementation 'com.tencent.map:tencent-map-vector-sdk:4.4.2' + // 地图组件库,包括小车平移、点聚合等组件功能,详见开发指南。 + implementation 'com.tencent.map:sdk-utilities:1.0.6' + + //腾讯地图 定位 + implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.2.6' } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d1495c3..52a502f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,12 +8,38 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/navinfo/outdoor/api/Constant.java b/app/src/main/java/com/navinfo/outdoor/api/Constant.java new file mode 100644 index 0000000..0386e8c --- /dev/null +++ b/app/src/main/java/com/navinfo/outdoor/api/Constant.java @@ -0,0 +1,28 @@ +package com.navinfo.outdoor.api; + +import com.tencent.map.geolocation.TencentLocation; + +/** + * 常量 + */ +public class Constant { + /** + * 当前网络不可用 + */ + public static final CharSequence NETWORK_UNAVAILABLE = "当前网络不可用,请检查网络设置"; + + /** + * 位置权限 + */ + public static final String SET_LOCATION_PERMISSION = "请在“设置”中给予“TengXunMap”位置权限,否则当前功能将不可使用"; + + + public static final String GET_ERR_MESSAGE1 = "设备缺少使用腾讯定位服务需要的基本条件"; + public static final String GET_ERR_MESSAGE2 = "manifest 中配置的 key 不正确"; + public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败"; + + /** + * 用户当前位置 + */ + public static TencentLocation currentLocation; +} diff --git a/app/src/main/java/com/navinfo/outdoor/api/UserApplication.java b/app/src/main/java/com/navinfo/outdoor/api/UserApplication.java index 13e8e6c..047b3e9 100644 --- a/app/src/main/java/com/navinfo/outdoor/api/UserApplication.java +++ b/app/src/main/java/com/navinfo/outdoor/api/UserApplication.java @@ -25,6 +25,7 @@ public class UserApplication extends Application { public void onCreate() { super.onCreate(); userApplication=this; + //友盟 检测bug UMConfigure.init(this, "60b885bd6c421a3d97db55e6", "navinfo", UMConfigure.DEVICE_TYPE_PHONE, ""); /** *设置组件化的Log开关 diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java index 64533ac..caef03e 100644 --- a/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java +++ b/app/src/main/java/com/navinfo/outdoor/fragment/TreasureFragment.java @@ -1,13 +1,65 @@ package com.navinfo.outdoor.fragment; +import android.Manifest; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Matrix; +import android.location.Location; +import android.os.Build; +import android.os.Looper; +import android.provider.Settings; +import android.util.Log; +import android.view.View; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.core.content.ContextCompat; + import com.navinfo.outdoor.R; +import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.base.BaseFragment; +import com.navinfo.outdoor.util.NetWorkUtils; +import com.navinfo.outdoor.util.ToastUtil; +import com.tencent.map.geolocation.TencentLocation; +import com.tencent.map.geolocation.TencentLocationListener; +import com.tencent.map.geolocation.TencentLocationManager; +import com.tencent.map.geolocation.TencentLocationRequest; +import com.tencent.tencentmap.mapsdk.maps.CameraUpdate; +import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory; +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.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.MyLocationStyle; + +import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; /** * 寻宝的Fragment * 2021-5-25 */ -public class TreasureFragment extends BaseFragment { +public class TreasureFragment extends BaseFragment implements View.OnClickListener, LocationSource, TencentLocationListener { + private MapView treasureMap; + private TencentMap tencentMap; + private CheckBox cbMapType; + private ImageView ivZoomAdd; + private ImageView ivZoomDel; + private TencentLocationManager locationManager; + private TencentLocationRequest locationRequest; + private MyLocationStyle locationStyle; + private OnLocationChangedListener locationChangedListener; + private ImageView ivLocation; + @Override protected int getLayout() { return R.layout.treasure_fragment; @@ -16,10 +68,297 @@ public class TreasureFragment extends BaseFragment { @Override protected void initView() { super.initView(); + treasureMap = (MapView) findViewById(R.id.treasure_map); + tencentMap = treasureMap.getMap(); + cbMapType = (CheckBox) findViewById(R.id.cb_map_type); + //地图转换 + cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + tencentMap.setMapType(TencentMap.MAP_TYPE_SATELLITE); + } else { + tencentMap.setMapType(TencentMap.MAP_TYPE_NORMAL); + } + } + }); + //地图放大 + ivZoomAdd = (ImageView) findViewById(R.id.iv_zoom_add); + ivZoomAdd.setOnClickListener(this::onClick); + //地图缩小 + ivZoomDel = (ImageView) findViewById(R.id.iv_zoom_del); + ivZoomDel.setOnClickListener(this::onClick); + //回到定位位置 + ivLocation = findViewById(R.id.iv_location); + ivLocation.setOnClickListener(this::onClick); + //样式 + tencentMap.setMapStyle(2); + //启用3d视图 + tencentMap.setBuilding3dEffectEnable(true); + //获取地图UI 设置对象 + UiSettings uiSettings = tencentMap.getUiSettings(); + //设置logo的大小 + uiSettings.setLogoScale(0.7f); + //开启定位权限 + checkNetWork(); + } + + /** + * 设置定位图标样式 + */ + private void setLocMarkerStyle() { + locationStyle = new MyLocationStyle(); + //创建图标 + BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap(R.drawable.location)); + locationStyle.icon(bitmapDescriptor); + //设置定位圆形区域的边框宽度; + locationStyle.strokeWidth(1); + //设置圆区域的颜色 + // locationStyle.fillColor(R.color.colormap); + // locationStyle.anchor(1000,2000); + tencentMap.setMyLocationStyle(locationStyle); + } + + /** + * 定位的一些初始化设置 + */ + private void initLocation() { +//用于访问腾讯定位服务的类, 周期性向客户端提供位置更新 + locationManager = TencentLocationManager.getInstance(getContext()); + //设置坐标系 + locationManager.setCoordinateType(TencentLocationManager.COORDINATE_TYPE_GCJ02); + //创建定位请求 + locationRequest = TencentLocationRequest.create(); + //设置定位周期(位置监听器回调周期)为3s + locationRequest.setInterval(3000); + //地图上设置定位数据源 + tencentMap.setLocationSource(this); + //设置当前位置可见 + tencentMap.setMyLocationEnabled(true); + //设置定位图标样式 + setLocMarkerStyle(); +// locationStyle = locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE); + tencentMap.setMyLocationStyle(locationStyle); + } + + private Bitmap getBitMap(int resourceId) { + Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId); + int width = bitmap.getWidth(); + int height = bitmap.getHeight(); + int newWidth = 55; + int newHeight = 55; + float widthScale = ((float) newWidth) / width; + float heightScale = ((float) newHeight) / height; + Matrix matrix = new Matrix(); + matrix.postScale(widthScale, heightScale); + bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true); + return bitmap; } @Override protected void initData() { super.initData(); } -} + + @Override + public void onStart() { + super.onStart(); + treasureMap.onStart(); + } + + @Override + public void onResume() { + super.onResume(); + treasureMap.onResume(); + } + + @Override + public void onPause() { + super.onPause(); + treasureMap.onPause(); + } + + @Override + public void onStop() { + super.onStop(); + treasureMap.onStop(); + } + + @Override + public void onDestroy() { + super.onDestroy(); + treasureMap.onDestroy(); + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.iv_zoom_add://放大 + CameraUpdate cameraUpdateIn = CameraUpdateFactory.zoomIn(); + tencentMap.animateCamera(cameraUpdateIn); + break; + case R.id.iv_zoom_del://缩小 + CameraUpdate cameraUpdateOut = CameraUpdateFactory.zoomOut(); + tencentMap.animateCamera(cameraUpdateOut); + break; + case R.id.iv_location://定位: + Constant.currentLocation.getLongitude(); + CameraUpdate cameraSigma = + CameraUpdateFactory.newCameraPosition(new CameraPosition( + new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度 + 19, //目标缩放级别 + 0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0) + 0)); //目标旋转角 0~360° (正北方为0) + tencentMap.animateCamera(cameraSigma); + break; + } + } + + /** + * 检查网络状态 + */ + private void checkNetWork() { + if (NetWorkUtils.isNetworkAvailable(getContext())) { // 当前网络可用 + checkMyLocation(); + } else { // 当前网络不可用 + ToastUtil.showShort(getContext(), Constant.NETWORK_UNAVAILABLE); + } + } + + /** + * 检查所需权限 + */ + private void checkMyLocation() { + // 1.判断是否拥有定位的权限 + // 1.1 拥有权限进行相应操作 + // 1.2 没有权限申请权限 + // 1.2.1 Android 6.0 动态申请权限 + // 1.2.1.1 用户给予权限进行相应操作 + // 1.2.1.2 用户没有给予权限 作出相应提示 + // 1.2.2 某些5.0权限的手机执行相应操作 + 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() { + @Override + public void onClick(DialogInterface dialog, int which) { + AlertDialog alertDialog = builder.show(); + alertDialog.dismiss(); + } + }); + builder.show(); + } + + /** + * 跳转系统定位页面 + */ + private void goSystemLocationActivity() { + startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)); + } + + @Override + public void activate(OnLocationChangedListener onLocationChangedListener) { + locationChangedListener = onLocationChangedListener; + int err = locationManager.requestLocationUpdates(locationRequest, this, Looper.myLooper()); + switch (err) { + case 1: + ToastUtil.showShort(getContext(), Constant.GET_ERR_MESSAGE1); + break; + case 2: + ToastUtil.showShort(getContext(), Constant.GET_ERR_MESSAGE2); + break; + case 3: + ToastUtil.showShort(getContext(), Constant.GET_ERR_MESSAGE3); + break; + default: + break; + } + } + + @Override + public void deactivate() { + locationManager.removeUpdates(this); + locationManager = null; + locationRequest = null; + locationChangedListener = null; + } + + /** + * 实现位置监听 + * + * @param tencentLocation + * @param i + * @param s + */ + @Override + public void onLocationChanged(TencentLocation tencentLocation, int i, String s) { + if (i == TencentLocation.ERROR_OK && locationChangedListener != null) { + Location location = new Location(tencentLocation.getProvider()); + //设置经纬度以及精度 + location.setLatitude(tencentLocation.getLatitude()); + location.setLongitude(tencentLocation.getLongitude()); + location.setAccuracy(tencentLocation.getAccuracy()); + locationChangedListener.onLocationChanged(location); + Constant.currentLocation = tencentLocation; + //显示回调的实时位置信息 + runOnUiThread(new Runnable() { + @Override + public void run() { + //打印tencentLocation的json字符串 +// Toast.makeText(getApplicationContext(), new Gson().toJson(location), Toast.LENGTH_LONG).show(); + } + }); + } + } + + @Override + public void onStatusUpdate(String s, int i, String s1) { + //GPS, WiFi, Radio 等状态发生变化 + Log.v("State changed", s + "===" + s1); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/navinfo/outdoor/util/NetWorkUtils.java b/app/src/main/java/com/navinfo/outdoor/util/NetWorkUtils.java new file mode 100644 index 0000000..01fb01e --- /dev/null +++ b/app/src/main/java/com/navinfo/outdoor/util/NetWorkUtils.java @@ -0,0 +1,35 @@ +package com.navinfo.outdoor.util; + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; + +/** + * 项目名称:网络工具类 + * 创建人: mwb + * 创建时间:2018/9/3 8:57 + */ +public class NetWorkUtils { + /** + * 当前网络是否可用 + * + * @param context + * @return + */ + public static boolean isNetworkAvailable(Context context) { + ConnectivityManager connectivityManager = + (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + + if (connectivityManager != null) { + NetworkInfo info = connectivityManager.getActiveNetworkInfo(); + if (info != null && info.isConnected()) { + // 当前网络是连接的 + if (info.getState() == NetworkInfo.State.CONNECTED) { + // 当前所链接的网络可用 + return true; + } + } + } + return false; + } +} diff --git a/app/src/main/java/com/navinfo/outdoor/util/ToastUtil.java b/app/src/main/java/com/navinfo/outdoor/util/ToastUtil.java new file mode 100644 index 0000000..411eff9 --- /dev/null +++ b/app/src/main/java/com/navinfo/outdoor/util/ToastUtil.java @@ -0,0 +1,286 @@ +package com.navinfo.outdoor.util; + +import android.content.Context; +import android.view.View; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.Toast; + +/** + * 项目名称:ToastUtil + * 创建人:mwb + * 创建时间:2018/9/3 9:25 + */ +public class ToastUtil { + private static boolean isShow = true;//默认显示 + private static Toast mToast = null;//全局唯一的Toast + + /*private控制不应该被实例化*/ + private ToastUtil() { + throw new UnsupportedOperationException("不能被实例化"); + } + + /** + * 全局控制是否显示Toast + * + * @param isShowToast + */ + public static void controlShow(boolean isShowToast) { + isShow = isShowToast; + } + + /** + * 取消Toast显示 + */ + public void cancelToast() { + if (isShow && mToast != null) { + mToast.cancel(); + } + } + + /** + * 短时间显示Toast + * + * @param context + * @param message + */ + public static void showShort(Context context, CharSequence message) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, message, Toast.LENGTH_SHORT); + } else { + mToast.setText(message); + } + mToast.show(); + } + } + + /** + * 短时间显示Toast + * + * @param context + * @param resId 资源ID:getResources().getString(R.string.xxxxxx); + */ + public static void showShort(Context context, int resId) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, resId, Toast.LENGTH_SHORT); + } else { + mToast.setText(resId); + } + mToast.show(); + } + } + + /** + * 长时间显示Toast + * + * @param context + * @param message + */ + public static void showLong(Context context, CharSequence message) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, message, Toast.LENGTH_LONG); + } else { + mToast.setText(message); + } + mToast.show(); + } + } + + /** + * 长时间显示Toast + * + * @param context + * @param resId 资源ID:getResources().getString(R.string.xxxxxx); + */ + public static void showLong(Context context, int resId) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, resId, Toast.LENGTH_LONG); + } else { + mToast.setText(resId); + } + mToast.show(); + } + } + + /** + * 自定义显示Toast时间 + * + * @param context + * @param message + * @param duration 单位:毫秒 + */ + public static void show(Context context, CharSequence message, int duration) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, message, duration); + } else { + mToast.setText(message); + } + mToast.show(); + } + } + + /** + * 自定义显示Toast时间 + * + * @param context + * @param resId 资源ID:getResources().getString(R.string.xxxxxx); + * @param duration 单位:毫秒 + */ + public static void show(Context context, int resId, int duration) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, resId, duration); + } else { + mToast.setText(resId); + } + mToast.show(); + } + } + + /** + * 自定义Toast的View + * + * @param context + * @param message + * @param duration 单位:毫秒 + * @param view 显示自己的View + */ + public static void customToastView(Context context, CharSequence message, int duration, View view) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, message, duration); + } else { + mToast.setText(message); + } + if (view != null) { + mToast.setView(view); + } + mToast.show(); + } + } + + /** + * 自定义Toast的位置 + * + * @param context + * @param message + * @param duration 单位:毫秒 + * @param gravity + * @param xOffset + * @param yOffset + */ + public static void customToastGravity(Context context, CharSequence message, int duration, int gravity, int xOffset, int yOffset) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, message, duration); + } else { + mToast.setText(message); + } + mToast.setGravity(gravity, xOffset, yOffset); + mToast.show(); + } + } + + /** + * 自定义带图片和文字的Toast,最终的效果就是上面是图片,下面是文字 + * + * @param context + * @param message + * @param iconResId 图片的资源id,如:R.drawable.icon + * @param duration + * @param gravity + * @param xOffset + * @param yOffset + */ + public static void showToastWithImageAndText(Context context, CharSequence message, int iconResId, int duration, int gravity, int xOffset, int yOffset) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, message, duration); + } else { + mToast.setText(message); + } + mToast.setGravity(gravity, xOffset, yOffset); + LinearLayout toastView = (LinearLayout) mToast.getView(); + ImageView imageView = new ImageView(context); + imageView.setImageResource(iconResId); + toastView.addView(imageView, 0); + mToast.show(); + } + } + + /** + * 自定义Toast,针对类型CharSequence + * + * @param context + * @param message + * @param duration + * @param view + * @param isGravity true,表示后面的三个布局参数生效,false,表示不生效 + * @param gravity + * @param xOffset + * @param yOffset + * @param isMargin true,表示后面的两个参数生效,false,表示不生效 + * @param horizontalMargin + * @param verticalMargin + */ + public static void customToastAll(Context context, CharSequence message, int duration, View view, boolean isGravity, int gravity, int xOffset, int yOffset, boolean isMargin, float horizontalMargin, float verticalMargin) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, message, duration); + } else { + mToast.setText(message); + } + if (view != null) { + mToast.setView(view); + } + if (isMargin) { + mToast.setMargin(horizontalMargin, verticalMargin); + } + if (isGravity) { + mToast.setGravity(gravity, xOffset, yOffset); + } + mToast.show(); + } + } + + /** + * 自定义Toast,针对类型resId + * + * @param context + * @param resId + * @param duration + * @param view :应该是一个布局,布局中包含了自己设置好的内容 + * @param isGravity true,表示后面的三个布局参数生效,false,表示不生效 + * @param gravity + * @param xOffset + * @param yOffset + * @param isMargin true,表示后面的两个参数生效,false,表示不生效 + * @param horizontalMargin + * @param verticalMargin + */ + public static void customToastAll(Context context, int resId, int duration, View view, boolean isGravity, int gravity, int xOffset, int yOffset, boolean isMargin, float horizontalMargin, float verticalMargin) { + if (isShow) { + if (mToast == null) { + mToast = Toast.makeText(context, resId, duration); + } else { + mToast.setText(resId); + } + if (view != null) { + mToast.setView(view); + } + if (isMargin) { + mToast.setMargin(horizontalMargin, verticalMargin); + } + if (isGravity) { + mToast.setGravity(gravity, xOffset, yOffset); + } + mToast.show(); + } + } + +} diff --git a/app/src/main/res/drawable/atlas_selector.xml b/app/src/main/res/drawable/atlas_selector.xml new file mode 100644 index 0000000..c8e06bd --- /dev/null +++ b/app/src/main/res/drawable/atlas_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/foot_selector.xml b/app/src/main/res/drawable/foot_selector.xml new file mode 100644 index 0000000..7f2929d --- /dev/null +++ b/app/src/main/res/drawable/foot_selector.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/location.png b/app/src/main/res/drawable/location.png new file mode 100644 index 0000000..2e7fd80 Binary files /dev/null and b/app/src/main/res/drawable/location.png differ diff --git a/app/src/main/res/layout/treasure_fragment.xml b/app/src/main/res/layout/treasure_fragment.xml index dbfe1ee..c54c301 100644 --- a/app/src/main/res/layout/treasure_fragment.xml +++ b/app/src/main/res/layout/treasure_fragment.xml @@ -1,18 +1,91 @@ - - + app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xxhdpi/filter.png b/app/src/main/res/mipmap-xxhdpi/filter.png new file mode 100644 index 0000000..fe1035f Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/filter.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/footprint.png b/app/src/main/res/mipmap-xxhdpi/footprint.png new file mode 100644 index 0000000..a95140e Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/footprint.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/footprint_select.png b/app/src/main/res/mipmap-xxhdpi/footprint_select.png new file mode 100644 index 0000000..27cd18f Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/footprint_select.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/map_type.png b/app/src/main/res/mipmap-xxhdpi/map_type.png new file mode 100644 index 0000000..5765eca Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/map_type.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/map_type_select.png b/app/src/main/res/mipmap-xxhdpi/map_type_select.png new file mode 100644 index 0000000..45e6a8e Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/map_type_select.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/mine_location.png b/app/src/main/res/mipmap-xxhdpi/mine_location.png new file mode 100644 index 0000000..4776aee Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/mine_location.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/refresh.png b/app/src/main/res/mipmap-xxhdpi/refresh.png new file mode 100644 index 0000000..115b586 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/refresh.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/submit.png b/app/src/main/res/mipmap-xxhdpi/submit.png new file mode 100644 index 0000000..62fb298 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/submit.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/zoom_add.png b/app/src/main/res/mipmap-xxhdpi/zoom_add.png new file mode 100644 index 0000000..aa8e3a0 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/zoom_add.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/zoom_del.png b/app/src/main/res/mipmap-xxhdpi/zoom_del.png new file mode 100644 index 0000000..d24f63a Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/zoom_del.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index d397903..6a00f53 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -3,6 +3,7 @@ #6200EE #3700B3 #03A9F4 + #CBC2C5C6 #2196F3 #03DAC5 #000000 diff --git a/build.gradle b/build.gradle index ea50806..55e93f5 100644 --- a/build.gradle +++ b/build.gradle @@ -3,8 +3,15 @@ buildscript { repositories { google() jcenter() + mavenCentral() maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} + //友盟 检测bug maven { url 'https://repo1.maven.org/maven2/' } + //腾讯地图 + maven{ + url "https://oss.sonatype.org/content/groups/public" + } + } dependencies { @@ -21,6 +28,7 @@ allprojects { repositories { google() jcenter() + mavenCentral() maven { url 'https://jitpack.io' } maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} maven { url 'https://repo1.maven.org/maven2/' }