fix: imageload download logic
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -5,7 +5,7 @@
|
||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||
</configurations>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -104,6 +104,6 @@ ext {
|
||||
jetbrainsannotationsjava5: "org.jetbrains:annotations-java5:15.0",
|
||||
|
||||
// 统一登录
|
||||
accountsdk : "com.zhidao.accoutservice:account-sdk:1.0.0.1@aar",
|
||||
accountsdk : "com.zhidao.accountservice:account-sdk:1.0.2",
|
||||
]
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class AbsMogoApplication extends Application {
|
||||
TipToast.init( sApp, null );
|
||||
|
||||
initNetConfig();
|
||||
// initAccountSdk();
|
||||
initAccountSdk();
|
||||
}
|
||||
|
||||
private static void initNetConfig() {
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.lang.reflect.Method;
|
||||
* Created by congtaowang on 2018/3/29.
|
||||
*/
|
||||
|
||||
class Utils {
|
||||
public class Utils {
|
||||
|
||||
public static String getCellId( Context context ) {
|
||||
TelephonyManager tm = ( TelephonyManager ) context.getSystemService( Context.TELEPHONY_SERVICE );
|
||||
|
||||
@@ -24,7 +24,7 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
|
||||
USERNAME=xintai
|
||||
PASSWORD=xintai2018
|
||||
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
|
||||
RELEASE=true
|
||||
RELEASE=false
|
||||
# 模块版本
|
||||
DEMO_MODULE_MAP_VERSION=1.0.0-SNAPSHOT
|
||||
DEMO_MODULE_MAP2_VERSION=1.0.0-SNAPSHOT
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="35dp"
|
||||
android:paddingRight="35dp">
|
||||
android:paddingLeft="@dimen/dp_70"
|
||||
android:paddingRight="@dimen/dp_70">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_ext_id_voice"
|
||||
@@ -23,7 +23,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/module_ext_str_voice_msg"
|
||||
android:textColor="@color/module_ext_color_voice_text"
|
||||
android:textSize="16dp"
|
||||
android:textSize="@dimen/dp_32"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_ext_id_voice"
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_ext_id_voice"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_ext_id_voice" />
|
||||
@@ -34,7 +34,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="24dp"
|
||||
android:textSize="@dimen/dp_48"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -44,10 +44,10 @@
|
||||
android:id="@+id/module_ext_id_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginRight="@dimen/dp_80"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14dp"
|
||||
android:textSize="@dimen/dp_28"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/module_ext_id_time"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -57,7 +57,7 @@
|
||||
android:id="@+id/module_ext_id_weather_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="13dp"
|
||||
android:layout_marginRight="@dimen/dp_26"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -66,26 +66,26 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_ext_id_weather_icon"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_width="@dimen/dp_44"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
tools:src="@drawable/module_ext_ic_voice" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_weather_temp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="9dp"
|
||||
android:layout_marginRight="@dimen/dp_18"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="17dp"
|
||||
android:textSize="@dimen/dp_34"
|
||||
tools:text="28°" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_weather_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="13dp"
|
||||
android:layout_marginRight="@dimen/dp_26"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14dp"
|
||||
android:textSize="@dimen/dp_28"
|
||||
tools:text="晴转多云" />
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
android:id="@+id/module_ext_id_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="14dp"
|
||||
android:layout_marginRight="@dimen/dp_28"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/module_ext_id_weather_container"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
@@ -112,14 +112,14 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_msg_counter"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:layout_gravity="right"
|
||||
android:background="@drawable/module_ext_drawable_msg_bkg"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_20"
|
||||
android:visibility="invisible"
|
||||
android:textSize="10dp"
|
||||
tools:text="···" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="35dp"
|
||||
android:layout_marginTop="5dp">
|
||||
android:layout_marginLeft="@dimen/dp_70"
|
||||
android:layout_marginTop="@dimen/dp_10">
|
||||
<!-- 卡片-->
|
||||
|
||||
<FrameLayout
|
||||
@@ -32,9 +32,9 @@
|
||||
android:id="@+id/module_main_id_cards_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="90dp"
|
||||
android:layout_marginBottom="@dimen/dp_211"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="10dp" />
|
||||
android:paddingBottom="@dimen/dp_20" />
|
||||
</FrameLayout>
|
||||
|
||||
<!-- 地图-->
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 737 B |
Binary file not shown.
|
After Width: | Height: | Size: 831 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
<solid android:color="#3F4057" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient android:angle="90" android:endColor="#5CC1FF" android:startColor="#256BFF" />
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@@ -7,4 +8,121 @@
|
||||
android:id="@+id/module_map_id_map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_map_id_search"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginLeft="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:background="@drawable/module_map_dw_common_corner_bkg"
|
||||
android:drawableLeft="@drawable/module_map_ic_search"
|
||||
android:drawablePadding="@dimen/dp_16"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/dp_26"
|
||||
android:paddingRight="@dimen/dp_26"
|
||||
android:text="@string/module_map_str_search_hint"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:textSize="@dimen/dp_32"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:background="@drawable/module_map_dw_common_corner_bkg"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/dp_22"
|
||||
android:paddingTop="@dimen/dp_17"
|
||||
android:paddingRight="@dimen/dp_22"
|
||||
android:paddingBottom="@dimen/dp_17"
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_map_id_search"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_map_id_home"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_map_ic_home" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_2"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
android:layout_marginLeft="@dimen/dp_21"
|
||||
android:layout_marginRight="@dimen/dp_21"
|
||||
android:background="#1ED8D8D8" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_map_id_company"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_map_ic_company" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_map_id_operation_panel"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/dp_32"
|
||||
android:layout_marginBottom="@dimen/dp_33"
|
||||
android:background="@drawable/module_map_dw_common_corner_bkg"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/module_map_id_vr_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_92"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/module_map_ic_move2_current_location"
|
||||
android:text="实景"
|
||||
android:textColor="#CCFFFFFF"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_2"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="#1ED8D8D8" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_map_id_move2_current_location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_map_ic_move2_current_location" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_map_id_upload_road_condition"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
android:background="@drawable/module_map_dw_upload_road_condition_bkg"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_map_str_upload_road_condition"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_24"
|
||||
app:layout_constraintBottom_toTopOf="@+id/module_map_id_operation_panel"
|
||||
app:layout_constraintRight_toRightOf="@+id/module_map_id_operation_panel"
|
||||
app:layout_goneMarginBottom="@dimen/dp_32"
|
||||
app:layout_goneMarginRight="@dimen/dp_32" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,3 +1,5 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-module-map</string>
|
||||
<string name="module_map_str_search_hint">搜索目的地</string>
|
||||
<string name="module_map_str_upload_road_condition">上报\n路况</string>
|
||||
</resources>
|
||||
|
||||
@@ -101,7 +101,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
case ServiceConst.MSG_TYPE_REFRESH_DECREASE:
|
||||
mRefreshRemainingTime -= ServiceConst.DECREASE_INTERVAL;
|
||||
if ( mRefreshRemainingTime == 0 ) {
|
||||
notifyRefreshData( mAutoRefreshCallback );
|
||||
notifyRefreshData( mLastAutoRefreshLocation, 2_000, mAutoRefreshCallback );
|
||||
} else {
|
||||
mHandler.sendEmptyMessageDelayed( msg.what, ServiceConst.DECREASE_INTERVAL );
|
||||
}
|
||||
@@ -334,19 +334,26 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
// 手动刷新触发
|
||||
if ( mLastZoomLevel - zoom > mCustomRefreshStrategy.getZoomOutLevel() ) {
|
||||
// 缩放级别缩小
|
||||
notifyRefreshData( mCustomRefreshCallback );
|
||||
notifyRefreshData( latLng, getQueryRadius(), mCustomRefreshCallback );
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mLastZoomLevel = zoom;
|
||||
} else if ( mLastZoomLevel == zoom ) {
|
||||
// 手动平移
|
||||
if ( invokeRefreshWhenTranslationByUser( latLng ) ) {
|
||||
notifyRefreshData( mCustomRefreshCallback );
|
||||
notifyRefreshData( latLng, getQueryRadius(), mCustomRefreshCallback );
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
}
|
||||
}
|
||||
Logger.d( TAG, "current map status: %s, zoom = %f, tilt = %f, bearing = %f", latLng, zoom, tilt, bearing );
|
||||
}
|
||||
|
||||
private int getQueryRadius() {
|
||||
if ( mIsVertical ) {
|
||||
return ( ( int ) ( getMapCameraFactWidth() / 2 ) );
|
||||
}
|
||||
return ( ( int ) ( getMapCameraFactHeight() / 2 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 平移地图刷新策略
|
||||
*
|
||||
@@ -379,11 +386,11 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
// 自动刷新触发
|
||||
if ( mLastAutoRefreshLocation == null ) {
|
||||
mLastAutoRefreshLocation = new MogoLatLng( location.getLatitude(), location.getLongitude() );
|
||||
notifyRefreshData( mAutoRefreshCallback );
|
||||
notifyRefreshData( mLastAutoRefreshLocation, 2_000, mAutoRefreshCallback );
|
||||
} else {
|
||||
float distance = Utils.calculateLineDistance( mLastAutoRefreshLocation, new MogoLatLng( location.getLatitude(), location.getLongitude() ) );
|
||||
if ( distance > mAutoRefreshStrategy.getDistance() ) {
|
||||
notifyRefreshData( mAutoRefreshCallback );
|
||||
notifyRefreshData( mLastAutoRefreshLocation, 2_000, mAutoRefreshCallback );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -391,9 +398,9 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
/**
|
||||
* 刷新数据
|
||||
*/
|
||||
private void notifyRefreshData( RefreshCallback callback ) {
|
||||
private void notifyRefreshData( MogoLatLng latLng, int radius, RefreshCallback callback ) {
|
||||
Logger.d( TAG, mAutoRefreshCallback == callback ? "触发自动刷新" : "触发手动刷新" );
|
||||
mRefreshModel.refreshData( callback );
|
||||
mRefreshModel.refreshData( latLng, radius, callback );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,7 +6,10 @@ import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
/**
|
||||
@@ -17,6 +20,8 @@ import retrofit2.http.QueryMap;
|
||||
*/
|
||||
public interface RefreshApiService {
|
||||
|
||||
@GET( "" )
|
||||
Observable< BaseData > refreshData( @QueryMap Map< String, Object > params );
|
||||
@FormUrlEncoded
|
||||
@POST( "" )
|
||||
Observable< BaseData > refreshData( @QueryMap Map< String, Object > params,
|
||||
@FieldMap Map< String, Object > parameters );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.module.service.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-06
|
||||
* <p>
|
||||
* 刷新地图信息接口
|
||||
*/
|
||||
public class RefreshBody {
|
||||
|
||||
public List< String > dataType = new ArrayList<>();
|
||||
public int limit = 50;// 请求数量
|
||||
public int radius = 2_000; // 地理围栏半径(米)
|
||||
public LatLon location;
|
||||
|
||||
public static class LatLon {
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public LatLon( double lat, double lon ) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,14 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@@ -33,14 +37,21 @@ public class RefreshModel {
|
||||
this.mRefreshApiService = network.create( RefreshApiService.class, "http://www.baidu.com/" );
|
||||
}
|
||||
|
||||
public void refreshData( final RefreshCallback callback ) {
|
||||
public void refreshData( MogoLatLng latLng, int radius, final RefreshCallback callback ) {
|
||||
if ( callback != null ) {
|
||||
callback.onSuccess();
|
||||
return;
|
||||
}
|
||||
if ( mRefreshApiService != null ) {
|
||||
final Map< String, Object > params = new ParamsProvider.Builder( mContext ).build();
|
||||
mRefreshApiService.refreshData( params )
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
|
||||
final Map< String, Object > field = new HashMap<>();
|
||||
field.put( "sn", query.get( "sn" ) );
|
||||
final RefreshBody refreshBody = new RefreshBody();
|
||||
refreshBody.limit = 50;
|
||||
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
|
||||
refreshBody.radius = radius;
|
||||
field.put( "data", GsonUtil.jsonFromObject( refreshBody ) );
|
||||
mRefreshApiService.refreshData( query, field )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( mContext ) ) {
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.mogo.service.impl.imageloader.glide;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
@@ -10,7 +12,10 @@ import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.ImageViewTarget;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
@@ -21,6 +26,8 @@ import com.mogo.service.impl.imageloader.glide.transform.GlideRoundBitmapTransfo
|
||||
import com.mogo.service.impl.imageloader.glide.utils.DiskLruCacheManager;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
@@ -142,22 +149,24 @@ public class GlideImageLoader implements IMogoImageloader {
|
||||
GlideApp.with( context.getApplicationContext() )
|
||||
.asBitmap()
|
||||
.load( url )
|
||||
.listener( new RequestListener< Bitmap >() {
|
||||
|
||||
.into( new SimpleTarget< Bitmap >() {
|
||||
@Override
|
||||
public boolean onLoadFailed( @Nullable GlideException e, Object model, Target< Bitmap > target, boolean isFirstResource ) {
|
||||
if ( listener != null ) {
|
||||
listener.onFailure( e );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady( Bitmap resource, Object model, Target< Bitmap > target, DataSource dataSource, boolean isFirstResource ) {
|
||||
public void onResourceReady( @NonNull Bitmap resource, @Nullable Transition< ? super Bitmap > transition ) {
|
||||
if ( listener != null ) {
|
||||
listener.onCompleted( resource );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadStarted( @Nullable Drawable placeholder ) {
|
||||
super.onLoadStarted( placeholder );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed( @Nullable Drawable errorDrawable ) {
|
||||
if ( listener != null ) {
|
||||
listener.onFailure( new Exception( "download failed." ) );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user