Commit 14bcec48 authored by jianglx's avatar jianglx

修改海报页面的分享头像;修改定位失败周边游无数据的问题

parent c4142127
package com.rv.component.utils;
import android.content.Context;
import android.content.SharedPreferences;
/******
* 记录上一次的经纬度
*/
public class LocationRecord {
private final static String FILE_NAME = "location_cookie";
private final static String KEY_LAT = "key_lat";
private final static String KEY_LON = "key_lon";
private static SharedPreferences preferences;
private static SharedPreferences getPreference(Context context) {
if (preferences == null) {
preferences = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
}
return preferences;
}
public static double getOrSavelatLatitude(Context context, int errorCode, double latLatitude) {
if (errorCode == 61 || errorCode == 161) {
saveLat(context, latLatitude);
} else {
latLatitude = getLat(context);
if (latLatitude == 0d) {
latLatitude = 22.954073;
}
}
return latLatitude;
}
public static double getOrSaveLonLongitude(Context context, int errorCode, double lonLongitude) {
if (errorCode == 61 || errorCode == 161) {
saveLon(context, lonLongitude);
} else {
lonLongitude = getLon(context);
if (lonLongitude == 0d) {
lonLongitude = 113.881138;
}
}
return lonLongitude;
}
public static void savePosition(Context context, int errorCode, double latLatitude, double lonLongitude) {
if (errorCode == 61 || errorCode == 161) {
LocationRecord.saveLat(context, latLatitude);
LocationRecord.saveLon(context, lonLongitude);
} else {
latLatitude = LocationRecord.getLat(context);
lonLongitude = LocationRecord.getLat(context);
if (latLatitude == 0) {
latLatitude = 23.05;
}
if (lonLongitude == 0) {
lonLongitude = 113.75;
}
}
}
public static void saveLat(Context context, double s) {
getPreference(context).edit().putString(KEY_LAT, String.valueOf(s)).commit();
}
public static double getLat(Context context) {
return Double.valueOf(getPreference(context).getString(KEY_LAT, "0.00"));
}
public static void saveLon(Context context, double s) {
getPreference(context).edit().putString(KEY_LON, String.valueOf(s)).commit();
}
public static double getLon(Context context) {
return Double.valueOf(getPreference(context).getString(KEY_LON, "0.00"));
}
}
......@@ -39,6 +39,7 @@ import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.ruiwenliu.wrapper.util.permission.RxPermission;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import com.rv.component.utils.LocationRecord;
import com.rv.tourism.adapter.AllPopularAdapter;
import com.rv.tourism.adapter.PopularBrigadeAdapter;
import com.rv.tourism.adapter.TourAroundAdapter;
......@@ -420,10 +421,13 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements S
if (geoCoder != null) {
geoCoder.destroy();
}
if (locationManager != null) {
locationManager.stopLocation();
locationManager.onDestroy();
}
}
// @Override
// @Override
// public void onLoadMoreRequested() {
// if (mPage >= countPage) {
// mTourAroundAdapter.loadMoreEnd();
......@@ -568,8 +572,8 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements S
if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
//没有检索到结果
} else {
latLatitude = result.getLocation().latitude;
lonLongitude = result.getLocation().longitude;
latLatitude = LocationRecord.getOrSavelatLatitude(getContext(), 161, result.getLocation().latitude);
lonLongitude = LocationRecord.getOrSaveLonLongitude(getContext(), 161, result.getLocation().longitude);
mTourAroundAdapter.getData().clear();
mTourAroundAdapter.notifyDataSetChanged();
......@@ -583,8 +587,8 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements S
if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
//没有找到检索结果
} else {
latLatitude = result.getLocation().latitude;
lonLongitude = result.getLocation().longitude;
latLatitude = LocationRecord.getOrSavelatLatitude(getContext(), 161, result.getLocation().latitude);
lonLongitude = LocationRecord.getOrSaveLonLongitude(getContext(), 161, result.getLocation().longitude);
mTourAroundAdapter.getData().clear();
mTourAroundAdapter.notifyDataSetChanged();
loadTourAroundData();
......@@ -611,15 +615,10 @@ public class TourismFragment extends BaseFragment<TourismPresenter> implements S
//获取经纬度坐标类型,以LocationClientOption中设置过的坐标类型为准
String coorType = location.getCoorType();
//获取定位类型、定位错误返回码,具体信息可参照类参考中BDLocation类中的说明
int errorCode = location.getLocType();
// setGpsContent("count=:",String.valueOf(count));
// setGpsContent("latitude:",String.valueOf(location.getLatitude()));
// setGpsContent("longitude:",String.valueOf(location.getLongitude()));
// setGpsContent("城市:",location.getCity());
// setGpsContent("街道:",location.getAddrStr());
// setGpsContent("当前位置:",location.getLocationDescribe());
latLatitude = location.getLatitude();
lonLongitude = location.getLongitude();
int errorCode = location.getLocType(); //62
latLatitude = LocationRecord.getOrSavelatLatitude(getContext(), errorCode, location.getLatitude());
lonLongitude = LocationRecord.getOrSaveLonLongitude(getContext(), errorCode, location.getLongitude());
mLatLng = new LatLng(location.getLatitude(), location.getLongitude());
loadTourAroundData();
if (!TextUtils.isEmpty(location.getCity()))
......
......@@ -63,6 +63,7 @@ public class BillPresenter extends CommonPresenter {
}
}
}
/******
* 分享地址
* @param var1
......@@ -173,6 +174,8 @@ public class BillPresenter extends CommonPresenter {
}
if (file != null) {
image = new UMImage(getPresenterContext(), file);//bitmap文件
UMImage thumb = new UMImage(getPresenterContext(), file);
image.setThumb(thumb);
image.compressStyle = UMImage.CompressStyle.SCALE;//大小压缩,默认为大小压缩,适合普通很大的图
image.compressStyle = UMImage.CompressStyle.QUALITY;//质量压缩,适合长图的分享
image.compressFormat = Bitmap.CompressFormat.PNG;
......
......@@ -83,6 +83,8 @@ public class ReativeBillPresenter extends CommonPresenter {
}
if (file != null) {
image = new UMImage(getPresenterContext(), file);//bitmap文件
UMImage thumb = new UMImage(getPresenterContext(), file);
image.setThumb(thumb);
image.compressStyle = UMImage.CompressStyle.SCALE;//大小压缩,默认为大小压缩,适合普通很大的图
image.compressStyle = UMImage.CompressStyle.QUALITY;//质量压缩,适合长图的分享
image.compressFormat = Bitmap.CompressFormat.PNG;
......
......@@ -4,7 +4,6 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.ConsoleMessage;
......@@ -18,7 +17,6 @@ import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import com.ruiwenliu.wrapper.SPConstance;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.rv.component.utils.Cookie;
import com.rv.component.utils.LogUtil;
import com.rv.home.rv.module.ui.login.LoginRvActivity;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment