merge
This commit is contained in:
@@ -3,6 +3,8 @@ package com.mogo.module.apps;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -12,6 +14,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.apps.adapter.AppIndicatorAdapter;
|
||||
import com.mogo.module.apps.adapter.base.RecycleViewHolder;
|
||||
import com.mogo.module.apps.model.NavigatorApp;
|
||||
import com.mogo.module.apps.model.NavigatorApps;
|
||||
import com.mogo.module.apps.utils.CardScaleTransformer;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -24,6 +29,7 @@ import com.mogo.utils.logger.Logger;
|
||||
import com.yarolegovich.discretescrollview.DiscreteScrollView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -33,14 +39,15 @@ import java.util.Map;
|
||||
* 描述
|
||||
*/
|
||||
public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavigatorPresenter>
|
||||
implements AppNavigatorView, DiscreteScrollView.OnItemChangedListener<RecyclerView.ViewHolder>,
|
||||
DiscreteScrollView.ScrollStateChangeListener<RecyclerView.ViewHolder>,
|
||||
implements AppNavigatorView, DiscreteScrollView.OnItemChangedListener<RecycleViewHolder>,
|
||||
DiscreteScrollView.ScrollStateChangeListener<RecycleViewHolder>,
|
||||
IMogoCardChangedListener {
|
||||
|
||||
private static final String TAG = "AppNavigatorFragment";
|
||||
private View mApps;
|
||||
|
||||
private IMogoFragmentManager mMogoFragmentManager;
|
||||
List<NavigatorApp> apps;
|
||||
|
||||
/**
|
||||
* 搜索莫模块
|
||||
@@ -67,6 +74,9 @@ public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavig
|
||||
mApps = findViewById(R.id.module_apps_id_apps);
|
||||
|
||||
scroller = findViewById(R.id.module_apps_id_scroller);
|
||||
|
||||
scroller.setRatio(330/523F);
|
||||
//scroller.setRatio(176/279F);
|
||||
scroller.setSlideOnFling(true);
|
||||
scroller.addOnItemChangedListener(this);
|
||||
scroller.addScrollStateChangeListener(this);
|
||||
@@ -74,23 +84,10 @@ public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavig
|
||||
scroller.setItemTransformer(new CardScaleTransformer.Builder()
|
||||
.setMinScale(0.84f)
|
||||
.build());
|
||||
//
|
||||
//
|
||||
//LinearLayoutManager linearLayoutManager =
|
||||
// new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false);
|
||||
//
|
||||
//scroller.setLayoutManager(linearLayoutManager);
|
||||
|
||||
ArrayList<Integer> integers = new ArrayList<>(10);
|
||||
apps = NavigatorApps.getApps();
|
||||
|
||||
integers.add(R.drawable.module_apps_ic_online_car);
|
||||
integers.add(R.drawable.module_apps_ic_interest);
|
||||
integers.add(R.drawable.module_apps_ic_news);
|
||||
integers.add(R.drawable.module_apps_ic_media_center);
|
||||
integers.add(R.drawable.module_apps_ic_chat);
|
||||
integers.add(R.drawable.module_apps_ic_tanlu);
|
||||
|
||||
AppIndicatorAdapter appIndicatorAdapter = new AppIndicatorAdapter(getContext(), integers);
|
||||
AppIndicatorAdapter appIndicatorAdapter = new AppIndicatorAdapter(getContext(), apps);
|
||||
scroller.setAdapter(appIndicatorAdapter);
|
||||
scroller.scrollToPosition(Integer.MAX_VALUE / 2 - 1);
|
||||
//mNavigation.setOnClickListener( view -> {
|
||||
@@ -178,27 +175,45 @@ public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavig
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentItemChanged(@Nullable RecyclerView.ViewHolder viewHolder, int i) {
|
||||
public void onCurrentItemChanged(@Nullable RecycleViewHolder viewHolder, int i) {
|
||||
Logger.d(TAG, "onCurrentItemChanged--position--" + i % CARD_SIZE);
|
||||
int currentPosition = i % CARD_SIZE - 2;
|
||||
if (currentPosition < 0) {
|
||||
currentPosition += CARD_SIZE;
|
||||
}
|
||||
this.currentPosition=currentPosition;
|
||||
AppServiceHandler.getMogoCardManager().invoke(currentPosition, "");
|
||||
}
|
||||
AppServiceHandler.getMogoCardManager().switch2(apps.get(i % CARD_SIZE).mModuleType);
|
||||
|
||||
@Override public void onScrollStart(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
|
||||
//holder.showText();
|
||||
|
||||
//ImageView view = viewHolder.getView(R.id.module_apps_id_app_icon);
|
||||
//view.setImageResource(apps.get(currentPosition).getmIconId());
|
||||
//
|
||||
//TextView tvTitle = viewHolder.getView(R.id.module_apps_id_app_name);
|
||||
//tvTitle.setTextColor(getResources().getColor(R.color.white));
|
||||
|
||||
}
|
||||
|
||||
@Override public void onScrollEnd(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
|
||||
@Override public void onScrollStart(@NonNull RecycleViewHolder viewHolder, int i) {
|
||||
int currentPosition = i % CARD_SIZE - 2;
|
||||
//
|
||||
//ImageView view = viewHolder.getView(R.id.module_apps_id_app_icon);
|
||||
//
|
||||
//
|
||||
//view.setImageResource(apps.get(currentPosition).mUncheckedIconId);
|
||||
//TextView tvTitle = viewHolder.getView(R.id.module_apps_id_app_name);
|
||||
//tvTitle.setTextColor(getResources().getColor(R.color.white_80));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override public void onScrollEnd(@NonNull RecycleViewHolder viewHolder, int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(float v, int i, int i1, @Nullable RecyclerView.ViewHolder viewHolder,
|
||||
@Nullable RecyclerView.ViewHolder t1) {
|
||||
public void onScroll(float v, int i, int i1, @Nullable RecycleViewHolder viewHolder,
|
||||
@Nullable RecycleViewHolder t1) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,17 +6,18 @@ import android.widget.ImageView;
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.apps.adapter.base.RecycleBaseAdapter;
|
||||
import com.mogo.module.apps.adapter.base.RecycleViewHolder;
|
||||
import com.mogo.module.apps.model.NavigatorApp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-03-09.
|
||||
*/
|
||||
public class AppIndicatorAdapter extends RecycleBaseAdapter<Integer> {
|
||||
public class AppIndicatorAdapter extends RecycleBaseAdapter<NavigatorApp> {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public AppIndicatorAdapter(Context context, List<Integer> list
|
||||
public AppIndicatorAdapter(Context context, List<NavigatorApp> list
|
||||
) {
|
||||
super(context, list, R.layout.module_apps_item_app_indicator);
|
||||
}
|
||||
@@ -25,10 +26,9 @@ public class AppIndicatorAdapter extends RecycleBaseAdapter<Integer> {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override public void onBindViewHolder(RecycleViewHolder holder, Integer integer) {
|
||||
@Override public void onBindViewHolder(RecycleViewHolder holder, NavigatorApp integer) {
|
||||
ImageView ivIndicator = holder.getView(R.id.module_apps_id_app_icon);
|
||||
ivIndicator.setImageResource(integer);
|
||||
holder.setText(R.id.module_apps_id_app_name,names[holder.getLayoutPosition()%6] );
|
||||
ivIndicator.setImageResource(integer.getmIconId());
|
||||
holder.setText(R.id.module_apps_id_app_name,integer.getmName() );
|
||||
}
|
||||
private String[] names=new String[]{"在线车辆","新鲜事","首页","媒体中心","车聊聊","探路"};
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 4.9 KiB |
@@ -9,7 +9,7 @@
|
||||
|
||||
<com.yarolegovich.discretescrollview.DiscreteScrollView
|
||||
android:id="@+id/module_apps_id_scroller"
|
||||
android:layout_width="@dimen/dp_523"
|
||||
android:layout_width="@dimen/apps_id_scroller_width"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_height="@dimen/module_apps_navigation_icon_container_height"
|
||||
@@ -21,7 +21,7 @@
|
||||
<ImageView
|
||||
android:id="@+id/module_apps_id_apps"
|
||||
android:layout_width="@dimen/module_apps_navigation_icon_width"
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:layout_marginTop="@dimen/apps_margin_top"
|
||||
android:layout_height="@dimen/module_apps_navigation_icon_height"
|
||||
app:layout_constraintLeft_toRightOf="@id/module_apps_id_scroller"
|
||||
app:layout_constraintTop_toTopOf="@id/module_apps_id_scroller"
|
||||
@@ -31,15 +31,15 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginLeft="@dimen/dp_37"
|
||||
android:layout_marginLeft="@dimen/apps_margin_left"
|
||||
app:layout_constraintLeft_toRightOf="@id/module_apps_id_scroller"
|
||||
app:layout_constraintTop_toBottomOf="@id/module_apps_id_apps"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="全部应用"
|
||||
android:maxLines="1"
|
||||
android:layout_marginTop="24px"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="26.25px"
|
||||
android:textSize="@dimen/dp_26"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
<dimen name="module_apps_indicator_width">16px</dimen>
|
||||
<dimen name="module_apps_indicator_interval">2.3px</dimen>
|
||||
<dimen name="module_apps_indicator_marginBottom">54.9px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_width">64px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_height">64px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_marginLeft">31.6px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_width">50px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_height">50px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_marginLeft">22px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_paddingBottom">33px</dimen>
|
||||
<dimen name="module_apps_app_name_marginTop">24px</dimen>
|
||||
<dimen name="module_apps_app_name_textSize">18px</dimen>
|
||||
<dimen name="module_apps_page_paddingLeft">112px</dimen>
|
||||
<dimen name="module_apps_page_paddingRight">112px</dimen>
|
||||
<dimen name="apps_id_scroller_width">279px</dimen>
|
||||
<dimen name="module_apps_page_item_verticalSpacing">89px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_container_height">95px</dimen>
|
||||
<dimen name="apps_margin_top">9.5px</dimen>
|
||||
<dimen name="apps_margin_left">18px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -15,4 +15,7 @@
|
||||
<dimen name="module_apps_page_paddingRight">220px</dimen>
|
||||
<dimen name="module_apps_page_item_verticalSpacing">154px</dimen>
|
||||
<dimen name="module_apps_navigation_icon_container_height">174px</dimen>
|
||||
<dimen name="apps_id_scroller_width">523px</dimen>
|
||||
<dimen name="apps_margin_top">18px</dimen>
|
||||
<dimen name="apps_margin_left">37px</dimen>
|
||||
</resources>
|
||||
@@ -11,7 +11,7 @@ public class MarkerCarInfo implements Serializable {
|
||||
|
||||
private String carBrandLogoUrl;
|
||||
private String carTypeName;
|
||||
private int carType;
|
||||
private int vehicleType;
|
||||
private CarLiveInfo carLiveInfo;
|
||||
|
||||
public String getCarBrandLogoUrl() {
|
||||
@@ -36,12 +36,12 @@ public class MarkerCarInfo implements Serializable {
|
||||
this.carTypeName = carTypeName;
|
||||
}
|
||||
|
||||
public int getCarType() {
|
||||
return carType;
|
||||
public int getVehicleType() {
|
||||
return vehicleType;
|
||||
}
|
||||
|
||||
public void setCarType(int carType) {
|
||||
this.carType = carType;
|
||||
public void setVehicleType(int vehicleType) {
|
||||
this.vehicleType = vehicleType;
|
||||
}
|
||||
|
||||
public CarLiveInfo getCarLiveInfo() {
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.mogo.module.common.entity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -27,6 +30,7 @@ public class MarkerShowEntity {
|
||||
private Object bindObj;
|
||||
//Marker 经纬度位置信息
|
||||
private MarkerLocation markerLocation;
|
||||
private IMogoMarker mMarker;
|
||||
|
||||
public boolean isChecked() {
|
||||
return isChecked;
|
||||
@@ -99,6 +103,14 @@ public class MarkerShowEntity {
|
||||
Objects.equals(markerLocation, that.markerLocation);
|
||||
}
|
||||
|
||||
public void setMarker( IMogoMarker marker ) {
|
||||
this.mMarker = marker;
|
||||
}
|
||||
|
||||
public IMogoMarker getMarker() {
|
||||
return mMarker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(iconUrl, textContent, markerType, bindObj, markerLocation);
|
||||
|
||||
@@ -71,6 +71,8 @@ class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
|
||||
private int viewWidth, viewHeight;
|
||||
|
||||
private float ratio=0.5F;
|
||||
|
||||
@NonNull
|
||||
private final ScrollStateListener scrollStateListener;
|
||||
private DiscreteScrollItemTransformer itemTransformer;
|
||||
@@ -136,6 +138,10 @@ class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void setRatio(float ratio) {
|
||||
this.ratio = ratio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutCompleted(RecyclerView.State state) {
|
||||
if (isFirstOrEmptyLayout) {
|
||||
@@ -175,7 +181,7 @@ class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
recyclerViewProxy.removeAllViews();
|
||||
}
|
||||
recyclerCenter.set(
|
||||
recyclerViewProxy.getWidth() / 523*330,
|
||||
(int) (recyclerViewProxy.getWidth() * ratio),
|
||||
recyclerViewProxy.getHeight() / 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,10 @@ public class DiscreteScrollView extends RecyclerView {
|
||||
setLayoutManager(layoutManager);
|
||||
}
|
||||
|
||||
public void setRatio(float ratio){
|
||||
layoutManager.setRatio(ratio);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLayoutManager(LayoutManager layout) {
|
||||
if (layout instanceof DiscreteScrollLayoutManager) {
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<dimen name="dp_23">12.5781px</dimen>
|
||||
<dimen name="dp_24">13.1250px</dimen>
|
||||
<dimen name="dp_25">13.6719px</dimen>
|
||||
<dimen name="dp_26">14.2188px</dimen>
|
||||
<dimen name="dp_26">14px</dimen>
|
||||
<dimen name="dp_27">14.7656px</dimen>
|
||||
<dimen name="dp_28">15.3125px</dimen>
|
||||
<dimen name="dp_29">15.8594px</dimen>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -30,6 +29,7 @@ import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.dialog.NaviNoticeDialog;
|
||||
import com.mogo.module.extensions.navi.NaviInfoView;
|
||||
import com.mogo.module.share.ShareControl;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
@@ -40,7 +40,6 @@ import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -74,6 +73,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
private TextView mSpeedLimitValue;
|
||||
private View mSpeedLimitUnit;
|
||||
|
||||
private IMogoServiceApis mApis;
|
||||
private IMogoMapService mService;
|
||||
private IMogoMapUIController mMApUIController;
|
||||
private IMogoLocationClient mMogoLocationClient;
|
||||
@@ -100,12 +100,11 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_FRAGMENT_MANAGER )
|
||||
.navigation();
|
||||
mMogoAddressManager = ( IMogoAddressManager ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_ADDRESS_MANAGER )
|
||||
.navigation();
|
||||
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||
|
||||
mMogoFragmentManager = mApis.getFragmentManagerApi();
|
||||
mMogoAddressManager = mApis.getAddressManagerApi();
|
||||
|
||||
mCommonAddress = findViewById( R.id.module_entrance_id_common_address );
|
||||
|
||||
@@ -197,21 +196,13 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
mService = ( IMogoMapService ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_SERVICES_MAP )
|
||||
.navigation( getContext() );
|
||||
mMogoRegisterCenter = ( IMogoRegisterCenter ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_REGISTER_CENTER )
|
||||
.navigation( getContext() );
|
||||
mService = mApis.getMapServiceApi();
|
||||
mMogoRegisterCenter = mApis.getRegisterCenterApi();
|
||||
mMApUIController = mService.getMapUIController();
|
||||
mMogoLocationClient = mService.getSingletonLocationClient( getContext() );
|
||||
mMogoNavi = mService.getNavi( getContext() );
|
||||
mAnalytics = ( IMogoAnalytics ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_UTILS_ANALYTICS )
|
||||
.navigation( getContext() );
|
||||
mMogoStatusManager = ( IMogoStatusManager ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_STATUS_MANAGER )
|
||||
.navigation( getContext() );
|
||||
mAnalytics = mApis.getAnalyticsApi();
|
||||
mMogoStatusManager = mApis.getStatusManagerApi();
|
||||
|
||||
mMogoRegisterCenter.registerMogoNaviListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
mMogoRegisterCenter.registerMogoMapListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
android:resumeWhilePausing="true"
|
||||
android:screenOrientation="landscape"
|
||||
android:stateNotNeeded="true"
|
||||
android:theme="@style/Main"
|
||||
android:taskAffinity=""
|
||||
android:theme="@style/Main"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
@@ -23,6 +23,15 @@
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="launcher"
|
||||
android:path="/main/switch2"
|
||||
android:scheme="mogo" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -314,7 +314,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
switch2Card( marker.getOwner(), false );
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.onMarkerClicked( marker );
|
||||
}
|
||||
@@ -367,6 +366,12 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent( Intent intent ) {
|
||||
super.onNewIntent( intent );
|
||||
mPresenter.handleSchemeIntent( intent );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.module.main;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
@@ -71,7 +73,7 @@ public class MainPresenter extends Presenter< MainView > {
|
||||
if ( TextUtils.isEmpty( cardInfo.mCardName ) ) {
|
||||
return;
|
||||
}
|
||||
mView.switch2Card( cardInfo.mCardName, true );
|
||||
mView.switch2Card( cardInfo.mCardName, cardInfo.mLockCar );
|
||||
} );
|
||||
mAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( getContext() );
|
||||
mCardStartShowTime = System.currentTimeMillis();
|
||||
@@ -136,4 +138,16 @@ public class MainPresenter extends Presenter< MainView > {
|
||||
msg.what = MainConstants.MSG_LOAD_MODULES;
|
||||
mMsgHandler.sendMessageDelayed( msg, 100 );
|
||||
}
|
||||
|
||||
public void handleSchemeIntent( Intent intent ) {
|
||||
if ( intent == null || intent.getData() == null ) {
|
||||
return;
|
||||
}
|
||||
Uri target = intent.getData();
|
||||
switch ( target.getPath() ) {
|
||||
case "/main/switch2":
|
||||
mView.switch2Card( target.getQueryParameter( "type" ), true );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1946,14 +1946,14 @@ public class OrientedViewPager extends ViewGroup {
|
||||
Log.v(TAG, "Moved x to " + x + "," + y + " diff=" + xDiff + "," + yDiff);
|
||||
}
|
||||
|
||||
if (dx != 0 && !isGutterDrag(mLastMotionX, dx) &&
|
||||
canScroll(this, false, (int) dx, (int) x, (int) y)) {
|
||||
// Nested view has scrollable area under this point. Let it be handled there.
|
||||
mLastMotionX = x;
|
||||
mLastMotionY = y;
|
||||
mIsUnableToDrag = true;
|
||||
return false;
|
||||
}
|
||||
//if (dx != 0 && !isGutterDrag(mLastMotionX, dx) &&
|
||||
// canScroll(this, false, (int) dx, (int) x, (int) y)) {
|
||||
// // Nested view has scrollable area under this point. Let it be handled there.
|
||||
// mLastMotionX = x;
|
||||
// mLastMotionY = y;
|
||||
// mIsUnableToDrag = true;
|
||||
// return false;
|
||||
//}
|
||||
if (xDiff > mTouchSlop && xDiff * 0.5f > yDiff) {
|
||||
if (DEBUG) Log.v(TAG, "Starting drag!");
|
||||
mIsBeingDragged = true;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -46,7 +46,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginRight="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_600"
|
||||
android:layout_height="@dimen/cards_container_dp_600"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
android:id="@+id/module_main_id_card_cover_up_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:layout_marginTop="@dimen/dp_600"
|
||||
android:layout_marginTop="@dimen/cards_container_dp_600"
|
||||
android:layout_marginLeft="@dimen/dp_64"
|
||||
android:layout_marginRight="@dimen/dp_64"
|
||||
android:background="@drawable/module_main_card_cover_up_bottom"
|
||||
|
||||
@@ -12,4 +12,7 @@
|
||||
<dimen name="module_main_card_card_shadow_height_div">10px</dimen>
|
||||
<dimen name="module_main_top_shadow_height">144px</dimen>
|
||||
<dimen name="module_main_card_cover_up_margin">352px</dimen>
|
||||
|
||||
<dimen name="cards_container_dp_600">320px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -12,4 +12,6 @@
|
||||
<dimen name="module_main_card_card_shadow_height_div">15px</dimen>
|
||||
<dimen name="module_main_top_shadow_height">270px</dimen>
|
||||
<dimen name="module_main_card_cover_up_margin">660px</dimen>
|
||||
<dimen name="cards_container_dp_600">600px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -17,6 +17,7 @@ import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
|
||||
@@ -36,15 +37,14 @@ public class MarkerServiceHandler {
|
||||
private static IMogoMarkerManager mMarkerManager;
|
||||
private static IMogoNavi mNavi;
|
||||
private static IMogoMapUIController mMapUIController;
|
||||
|
||||
private static IMogoLocationClient mLocationClient;
|
||||
|
||||
private static IMogoStatusManager mMogoStatusManager;
|
||||
private static IMogoImageloader mImageloader;
|
||||
private static IMogoSocketManager mMogoSocketManager;
|
||||
private static IMogoCardManager mMogoCardManager;
|
||||
private static IMogoAnalytics mMogoAnalytics;
|
||||
private static IMogoRegisterCenter mRegisterCenter;
|
||||
private static IMogoActionManager mActionManager;
|
||||
|
||||
private static MapMarkerManager mMapMarkerManager;
|
||||
|
||||
@@ -56,12 +56,12 @@ public class MarkerServiceHandler {
|
||||
mMogoSocketManager = mApis.getSocketManagerApi( context );
|
||||
mMogoCardManager = mApis.getCardManagerApi();
|
||||
mMogoAnalytics = mApis.getAnalyticsApi();
|
||||
|
||||
mMarkerManager = mMapService.getMarkerManager( context );
|
||||
mNavi = mMapService.getNavi( context );
|
||||
mMapUIController = mMapService.getMapUIController();
|
||||
mLocationClient = mMapService.getSingletonLocationClient( context );
|
||||
mRegisterCenter = mApis.getRegisterCenterApi();
|
||||
mActionManager = mApis.getActionManagerApi();
|
||||
|
||||
mMapMarkerManager = MapMarkerManager.getInstance();
|
||||
mMapMarkerManager.init( context );
|
||||
@@ -115,6 +115,10 @@ public class MarkerServiceHandler {
|
||||
return mRegisterCenter;
|
||||
}
|
||||
|
||||
public static IMogoActionManager getActionManager() {
|
||||
return mActionManager;
|
||||
}
|
||||
|
||||
//TODO -------------以下方法是临时过度使用的,后面统一使用,getMapMarkerManager进行调用
|
||||
|
||||
/**
|
||||
|
||||
@@ -157,7 +157,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
return;
|
||||
}
|
||||
mRefreshRemainingTime -= ServiceConst.DECREASE_INTERVAL;
|
||||
if ( mRefreshRemainingTime == 0 ) {
|
||||
if ( mRefreshRemainingTime <= 0 ) {
|
||||
Logger.d( TAG, "move to center and refresh data." );
|
||||
invokeAutoRefresh();
|
||||
} else {
|
||||
@@ -295,7 +295,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
mThreadHandler = new Handler( mHandlerThread.getLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
Logger.d( TAG, "thread = %s", Thread.currentThread().getName() );
|
||||
super.handleMessage( msg );
|
||||
if ( msg.what == ServiceConst.MSG_MAP_CHANGED ) {
|
||||
if ( msg.obj instanceof RefreshObject ) {
|
||||
@@ -504,7 +503,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( factor == 0.0f ) {
|
||||
return false;
|
||||
}
|
||||
Logger.d( TAG, "invokeRefreshWhenTranslationByUser,mLastCustomRefreshCenterLocation = %s, latLng = %s", mLastCustomRefreshCenterLocation, latLng );
|
||||
float distance = Utils.calculateLineDistance( latLng, mLastCustomRefreshCenterLocation );
|
||||
Trace.endSection();
|
||||
return distance > factor;
|
||||
@@ -593,8 +591,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
switch ( descriptor ) {
|
||||
case USER_INTERACTED:
|
||||
if ( isTrue ) {
|
||||
mRefreshRemainingTime = ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT;
|
||||
Logger.i( TAG, "用户状态改变,下次刷新时间:%ss后", mRefreshRemainingTime );
|
||||
restartAutoRefreshAtTime( ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT );
|
||||
}
|
||||
break;
|
||||
case SEARCH_UI:
|
||||
@@ -637,6 +634,21 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
}
|
||||
|
||||
public void restartAutoRefreshAtTime( int time ) {
|
||||
if ( time < 0 ) {
|
||||
Logger.w( TAG, "ignore refresh request case time < 0" );
|
||||
return;
|
||||
}
|
||||
stopAutoRefreshStrategy();
|
||||
mRefreshRemainingTime = time;
|
||||
long delay = ServiceConst.DECREASE_INTERVAL;
|
||||
if( mRefreshRemainingTime < ServiceConst.DECREASE_INTERVAL ){
|
||||
delay = mRefreshRemainingTime;
|
||||
}
|
||||
mHandler.sendEmptyMessageDelayed( ServiceConst.MSG_TYPE_REFRESH_DECREASE, delay );
|
||||
Logger.i( TAG, "下次刷新时间:%ss后", mRefreshRemainingTime );
|
||||
}
|
||||
|
||||
public void refreshStrategy() {
|
||||
Logger.d( TAG, "move to center and refresh data." );
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false );
|
||||
|
||||
@@ -114,13 +114,7 @@ public class ServiceConst {
|
||||
public static final String COMMAND_PREVIOUS = "com.zhidao.desk.previous";
|
||||
public static final String CMD_UN_WAKE_PREV = "CMD_UN_WAKE_PREV";
|
||||
public static final String[] CMD_UN_WAKE_PREV_UN_WAKE_WORDS = new String[]{
|
||||
"上一条",
|
||||
"上一张卡片",
|
||||
"上一个卡片",
|
||||
"切换上一张",
|
||||
"向上滑动卡片",
|
||||
"上一辆车",
|
||||
"上一条消息",
|
||||
"上一条"
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -130,13 +124,7 @@ public class ServiceConst {
|
||||
public static final String CMD_UN_WAKE_NEXT = "CMD_UN_WAKE_NEXT";
|
||||
public static final String[] CMD_UN_WAKE_NEXT_UN_WAKE_WORDS = new String[]{
|
||||
"下一条",
|
||||
"换一个",
|
||||
"切换下一张",
|
||||
"下一张卡片",
|
||||
"下一个卡片",
|
||||
"向下滑动卡片",
|
||||
"下一辆车",
|
||||
"下一条消息"
|
||||
"换一个"
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.service.actionmanager;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.module.IMogoActionListener;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
@@ -43,6 +44,8 @@ public class MogoActionHandler implements IMogoActionManager {
|
||||
|
||||
private Map< String, List< IMogoActionListener > > mListeners = new ConcurrentHashMap<>();
|
||||
|
||||
private IMogoBizActionDoneListener mBizActionDoneListener;
|
||||
|
||||
@Override
|
||||
public void registerActionListener( String biz, IMogoActionListener listener ) {
|
||||
if ( TextUtils.isEmpty( biz ) || listener == null ) {
|
||||
@@ -90,4 +93,21 @@ public class MogoActionHandler implements IMogoActionManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBizActionDoneListener( IMogoBizActionDoneListener listener ) {
|
||||
mBizActionDoneListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterBizActionDoneListener() {
|
||||
mBizActionDoneListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bizInvoke( String biz, int position, Object data ) {
|
||||
if ( mBizActionDoneListener != null ) {
|
||||
mBizActionDoneListener.onBizActionDone( biz, position, data );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.mogo.module.service.actionmanager;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoOverlayManager;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.module.IMogoActionListener;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
@@ -32,6 +34,21 @@ public class MogoActionManager implements IMogoActionManager {
|
||||
MogoActionHandler.getInstance().invoke( biz, action );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBizActionDoneListener( IMogoBizActionDoneListener listener ) {
|
||||
MogoActionHandler.getInstance().registerBizActionDoneListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterBizActionDoneListener() {
|
||||
MogoActionHandler.getInstance().unregisterBizActionDoneListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bizInvoke( String biz, int position, Object data ) {
|
||||
MogoActionHandler.getInstance().bizInvoke( biz, position, data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
MogoActionHandler.getInstance().init( context );
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.module.common.entity.MarkerCardResult;
|
||||
@@ -27,6 +28,7 @@ import com.mogo.module.service.datamanager.MogoDataHandler;
|
||||
import com.mogo.module.service.utils.ViewUtils;
|
||||
import com.mogo.service.cardmanager.IMogoCardChangedListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -48,7 +50,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
IMogoOnMessageListener< MarkerResponse >,
|
||||
IMogoCardChangedListener {
|
||||
IMogoCardChangedListener,
|
||||
IMogoBizActionDoneListener {
|
||||
private static final String TAG = "MapMarkerManager";
|
||||
// 是否选中在线卡片及气泡,语音搜索触发
|
||||
private boolean mIsAISearchOnlineData = false;
|
||||
@@ -91,6 +94,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
// 长连接
|
||||
MarkerServiceHandler.getMogoSocketManager().registerOnMessageListener( 401001, this );
|
||||
MarkerServiceHandler.getMogoCardManager().registerCardChangedListener( "LAUNCHER_MARKER_MODULE", this );
|
||||
MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this );
|
||||
}
|
||||
|
||||
// ACC ON 的时候重置为true,ACC OFF 设置为 false
|
||||
@@ -645,9 +649,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
List< MarkerOnlineCar > onlineCarList = mLastDataResult.getOnlineCar();
|
||||
List< MarkerExploreWay > exploreWayList = mLastDataResult.getExploreWay();
|
||||
List< MarkerNoveltyInfo > noveltyInfoList = mLastDataResult.getNoveltyInfo();
|
||||
dispatchDataToBiss( ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ? new ArrayList<>() : onlineCarList );
|
||||
dispatchDataToBiss( ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList );
|
||||
dispatchDataToBiss( ServiceConst.CARD_TYPE_NOVELTY, noveltyInfoList == null ? new ArrayList<>() : noveltyInfoList );
|
||||
dispatchDataToBis( ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ? new ArrayList<>() : onlineCarList );
|
||||
dispatchDataToBis( ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList );
|
||||
dispatchDataToBis( ServiceConst.CARD_TYPE_NOVELTY, noveltyInfoList == null ? new ArrayList<>() : noveltyInfoList );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -656,7 +660,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param biz
|
||||
* @param object
|
||||
*/
|
||||
private void dispatchDataToBiss( String biz, Object object ) {
|
||||
private void dispatchDataToBis( String biz, Object object ) {
|
||||
if ( TextUtils.isEmpty( biz ) ) {
|
||||
return;
|
||||
}
|
||||
@@ -728,6 +732,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
markers.add( marker );
|
||||
setMarkersSmall( markers );
|
||||
}
|
||||
markerShowEntity.setMarker( marker );
|
||||
return marker;
|
||||
}
|
||||
|
||||
@@ -763,4 +768,29 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
public String getCurrentModuleName() {
|
||||
return mCurrentModuleName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBizActionDone( String biz, int position, Object data ) {
|
||||
Logger.d( TAG, "biz = %s, position = %s", biz, position );
|
||||
if ( !( data instanceof MarkerShowEntity ) ) {
|
||||
return;
|
||||
}
|
||||
if ( ( ( MarkerShowEntity ) data ).getMarker() != null ) {
|
||||
onMarkerClicked( ( ( MarkerShowEntity ) data ).getMarker() );
|
||||
} else {
|
||||
IMogoMarkerManager markerManager = MarkerServiceHandler.getMarkerManager();
|
||||
List< IMogoMarker > markers = markerManager.getMarkers( biz );
|
||||
if ( markers != null ) {
|
||||
for ( IMogoMarker marker : markers ) {
|
||||
if ( !( marker.getObject() instanceof MarkerShowEntity ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() == data ) {
|
||||
onMarkerClicked( marker );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user