opt
This commit is contained in:
@@ -102,4 +102,10 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
mWeatherDesc.setText( desc );
|
||||
mWeatherContainer.setVisibility( hidden ? View.GONE : View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMsgInfo( boolean hasMsg, int amount ) {
|
||||
mMsgContainer.setVisibility( hasMsg ? View.VISIBLE : View.GONE );
|
||||
mMsgCounter.setText( amount > 99 ? getString( R.string.module_ext_str_dots ) : String.valueOf( amount ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,15 @@ import android.content.IntentFilter;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.extensions.weather.Phenomena;
|
||||
import com.mogo.module.extensions.weather.WeatherCallback;
|
||||
import com.mogo.module.extensions.weather.WeatherInfo;
|
||||
import com.mogo.module.extensions.weather.WeatherModel;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Calendar;
|
||||
@@ -24,7 +28,7 @@ import java.util.Calendar;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class ExtensionsPresenter extends Presenter< ExtensionsView > implements WeatherCallback {
|
||||
public class ExtensionsPresenter extends Presenter< ExtensionsView > implements WeatherCallback, IMogoMsgCenterListener {
|
||||
|
||||
private static final String TAG = "ExtensionsPresenter";
|
||||
|
||||
@@ -46,6 +50,8 @@ public class ExtensionsPresenter extends Presenter< ExtensionsView > implements
|
||||
}
|
||||
};
|
||||
|
||||
private IMogoMsgCenter mMsgCenter;
|
||||
|
||||
|
||||
public ExtensionsPresenter( ExtensionsView view ) {
|
||||
super( view );
|
||||
@@ -60,6 +66,8 @@ public class ExtensionsPresenter extends Presenter< ExtensionsView > implements
|
||||
mWeatherModel.init( this );
|
||||
mWeatherModel.queryWeatherInformation();
|
||||
refreshTimeAndDate();
|
||||
mMsgCenter = ( IMogoMsgCenter ) ARouter.getInstance().build( MogoServicePaths.PATH_MSG_CENTER ).navigation();
|
||||
mMsgCenter.registerMsgCenterListener( this );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,12 +108,21 @@ public class ExtensionsPresenter extends Presenter< ExtensionsView > implements
|
||||
mView.renderWeatherInfo( temp, desc, resId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgChanged( boolean hasMsg, int amount ) {
|
||||
if ( mView != null ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
if ( mWeatherModel != null ) {
|
||||
mWeatherModel.destroy();
|
||||
}
|
||||
|
||||
if ( mMsgCenter != null ) {
|
||||
mMsgCenter.unregisterMsgCenterListener( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,12 @@ public interface ExtensionsView extends IView {
|
||||
* @param iconId 图标
|
||||
*/
|
||||
void renderWeatherInfo( String temp, String desc, int iconId );
|
||||
|
||||
/**
|
||||
* 刷新消息信息
|
||||
*
|
||||
* @param hasMsg 是否有消息
|
||||
* @param amount 消息数量
|
||||
*/
|
||||
void renderMsgInfo( boolean hasMsg, int amount );
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/dp_28"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/module_ext_id_weather_container"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
@@ -119,7 +120,6 @@
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_20"
|
||||
android:visibility="invisible"
|
||||
tools:text="···" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -13,4 +13,5 @@
|
||||
<item>周五</item>
|
||||
<item>周六</item>
|
||||
</string-array>
|
||||
<string name="module_ext_str_dots">···</string>
|
||||
</resources>
|
||||
|
||||
@@ -27,6 +27,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
targetCompatibility 1.8
|
||||
sourceCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.MogoMapView;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
|
||||
/**
|
||||
@@ -24,6 +31,20 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
private MogoMapView mMogoMapView;
|
||||
private IMogoMap mMogoMap;
|
||||
|
||||
private View mSearch;
|
||||
private View mHome;
|
||||
|
||||
private View mCompany;
|
||||
|
||||
private View mUploadRoadCondition;
|
||||
|
||||
private View mVRMode;
|
||||
private View mMove2CurrentLocation;
|
||||
|
||||
private IMogoMapService mService;
|
||||
private IMogoMapUIController mMApUIController;
|
||||
private IMogoLocationClient mMogoLocationClient;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_map_fragment_map;
|
||||
@@ -31,9 +52,38 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
mMogoMapView = findViewById( R.id.module_map_id_map );
|
||||
mMogoMap = mMogoMapView.getMap();
|
||||
mMogoMap.getUIController().showMyLocation( true );
|
||||
|
||||
mSearch = findViewById( R.id.module_map_id_search );
|
||||
mSearch.setOnClickListener( view -> {
|
||||
} );
|
||||
|
||||
mHome = findViewById( R.id.module_map_id_home );
|
||||
mHome.setOnClickListener( view -> {
|
||||
} );
|
||||
|
||||
mCompany = findViewById( R.id.module_map_id_company );
|
||||
mCompany.setOnClickListener( view -> {
|
||||
} );
|
||||
|
||||
mUploadRoadCondition = findViewById( R.id.module_map_id_upload_road_condition );
|
||||
mUploadRoadCondition.setOnClickListener( view -> {
|
||||
} );
|
||||
|
||||
mVRMode = findViewById( R.id.module_map_id_vr_mode );
|
||||
mVRMode.setOnClickListener( view -> {
|
||||
} );
|
||||
|
||||
mMove2CurrentLocation = findViewById( R.id.module_map_id_move2_current_location );
|
||||
mMove2CurrentLocation.setOnClickListener( view -> {
|
||||
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
|
||||
if ( location != null ) {
|
||||
mMApUIController.moveToCenter( new MogoLatLng( location.getLatitude(), location.getLongitude() ) );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -49,6 +99,9 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
mMogoMapView.onCreate( savedInstanceState );
|
||||
}
|
||||
initMapView();
|
||||
mService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation( getContext() );
|
||||
mMApUIController = mService.getMapUIController();
|
||||
mMogoLocationClient = mService.getLocationClient( getContext() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,7 @@ package com.mogo.module.service;
|
||||
*/
|
||||
public class AutoRefreshStrategy {
|
||||
|
||||
public static final long ONE_MINUTE = 5 * 1_000L;
|
||||
public static final long ONE_MINUTE = 60 * 1_000L;
|
||||
|
||||
/**
|
||||
* 距离(米)
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.module.service;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -19,9 +18,7 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
@@ -59,7 +56,6 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
*/
|
||||
private AutoRefreshStrategy mAutoRefreshStrategy = new AutoRefreshStrategy();
|
||||
private MogoLatLng mLastAutoRefreshLocation = null;
|
||||
private long mLastRefreshTime = 0;
|
||||
|
||||
private IMogoMarkerManager mMarkerManager;
|
||||
private IMogoMapUIController mUiController;
|
||||
@@ -85,7 +81,6 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
private MogoLatLng mLastCustomRefreshCenterLocation;
|
||||
|
||||
private IMogoMapService mMogoMapService;
|
||||
private IMogoMarker mCameraCenterMarker = null;
|
||||
private IMogoStatusManager mStatusManager;
|
||||
|
||||
/**
|
||||
@@ -315,18 +310,6 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mCameraCenterMarker == null ) {
|
||||
mCameraCenterMarker = mMarkerManager.addMarker( ServiceConst.TYPE,
|
||||
new MogoMarkerOptions()
|
||||
.icon( BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_search_poi_location ) )
|
||||
.latitude( latLng.lat )
|
||||
.longitude( latLng.lng )
|
||||
.owner( ServiceConst.TYPE )
|
||||
);
|
||||
} else {
|
||||
mCameraCenterMarker.setPosition( latLng.lat, latLng.lng );
|
||||
}
|
||||
|
||||
if ( mLastZoomLevel != zoom ) {
|
||||
refreshCameraPosition();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import retrofit2.http.QueryMap;
|
||||
public interface RefreshApiService {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST( "" )
|
||||
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync" )
|
||||
Observable< BaseData > refreshData( @QueryMap Map< String, Object > params,
|
||||
@FieldMap Map< String, Object > parameters );
|
||||
}
|
||||
|
||||
@@ -38,10 +38,6 @@ public class RefreshModel {
|
||||
}
|
||||
|
||||
public void refreshData( MogoLatLng latLng, int radius, final RefreshCallback callback ) {
|
||||
if ( callback != null ) {
|
||||
callback.onSuccess();
|
||||
return;
|
||||
}
|
||||
if ( mRefreshApiService != null ) {
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
|
||||
final Map< String, Object > field = new HashMap<>();
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
android:layout_height="50dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:miv_placeHolder="@drawable/ic_amap_app_main_current_location_bkg"
|
||||
app:miv_shape="circle" />
|
||||
|
||||
<ImageView
|
||||
|
||||
Reference in New Issue
Block a user