Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0
This commit is contained in:
@@ -123,8 +123,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
mUploadRoadCondition = findViewById( R.id.module_entrance_id_upload_road_condition );
|
||||
mUploadRoadCondition.setOnClickListener( view -> {
|
||||
ShareControl shareControl = new ShareControl();
|
||||
shareControl.showDialog( getActivity() );
|
||||
ShareControl.getInstance(getActivity()).showDialog();
|
||||
} );
|
||||
|
||||
mVRMode = findViewById( R.id.module_entrance_id_vr_mode );
|
||||
|
||||
@@ -46,7 +46,7 @@ import java.util.Map;
|
||||
* <p>
|
||||
* 描述:加载各个模块
|
||||
*/
|
||||
public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView,
|
||||
public class MainActivity extends MvpActivity<MainView, MainPresenter> implements MainView,
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener {
|
||||
|
||||
@@ -90,174 +90,189 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mCardsContainer = findViewById( R.id.module_main_id_cards_container );
|
||||
mCardsContainer.setOrientation( OrientedViewPager.Orientation.VERTICAL );
|
||||
|
||||
mCardsContainer.setOnPageChangeListener( new OnPageChangeListenerAdapter() {
|
||||
mCardsContainer = findViewById(R.id.module_main_id_cards_container);
|
||||
mCardsContainer.setOrientation(OrientedViewPager.Orientation.VERTICAL);
|
||||
|
||||
mCardsContainer.setOnPageChangeListener(new OnPageChangeListenerAdapter() {
|
||||
private boolean mIsLast = true;
|
||||
private boolean mCardFlipStatus = false;
|
||||
|
||||
@Override
|
||||
public void onPageSelected( int position ) {
|
||||
public void onPageSelected(int position) {
|
||||
try {
|
||||
IMogoModuleProvider provider = mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
trackLastCardShowEvent( provider );
|
||||
IMogoModuleProvider provider = mCardModulesAdapter.getProvider(mCurrentPosition);
|
||||
trackLastCardShowEvent(provider);
|
||||
|
||||
mCurrentPosition = position;
|
||||
provider = mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
mMogoModuleHandler.setModuleEnable( provider.getModuleName() );
|
||||
if ( !isClickMarker ) {
|
||||
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
|
||||
provider = mCardModulesAdapter.getProvider(mCurrentPosition);
|
||||
mMogoModuleHandler.setModuleEnable(provider.getModuleName());
|
||||
if (!isClickMarker) {
|
||||
mMogoCardManager.invoke(position, mMogoModuleHandler.getCurrentModuleName());
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged( int state ) {
|
||||
super.onPageScrollStateChanged( state );
|
||||
if ( state == ViewPager.SCROLL_STATE_DRAGGING ) {
|
||||
if ( !mCardFlipStatus ) {
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
super.onPageScrollStateChanged(state);
|
||||
if (state == ViewPager.SCROLL_STATE_DRAGGING) {
|
||||
if (!mCardFlipStatus) {
|
||||
mCardFlipStatus = true;
|
||||
final IMogoModuleProvider provider = mCardModulesAdapter.getProvider( mCurrentPosition );
|
||||
trackCardFlipEvent( provider );
|
||||
final IMogoModuleProvider provider = mCardModulesAdapter.getProvider(mCurrentPosition);
|
||||
trackCardFlipEvent(provider);
|
||||
}
|
||||
} else if ( state == ViewPager.SCROLL_STATE_IDLE ) {
|
||||
} else if (state == ViewPager.SCROLL_STATE_IDLE) {
|
||||
mCardFlipStatus = false;
|
||||
}
|
||||
|
||||
int cardSize = mCardModulesAdapter.getCount();
|
||||
|
||||
if (state == ViewPager.SCROLL_STATE_SETTLING) {
|
||||
mIsLast = false;
|
||||
} else if (state == ViewPager.SCROLL_STATE_IDLE && mIsLast) {
|
||||
//此处为你需要的情况,再加入当前页码判断可知道是第一页还是最后一页
|
||||
if (cardSize != 1 && mCurrentPosition == (cardSize - 1)) {
|
||||
mCardsContainer.setCurrentItem(0, false);
|
||||
} else if (cardSize != 1 && mCurrentPosition == 0) {
|
||||
mCardsContainer.setCurrentItem(cardSize - 1, false);
|
||||
}
|
||||
} else {
|
||||
mIsLast = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片展示时长埋点
|
||||
* @param provider
|
||||
*/
|
||||
private void trackLastCardShowEvent( IMogoModuleProvider provider ) {
|
||||
if ( provider == null ) {
|
||||
private void trackLastCardShowEvent(IMogoModuleProvider provider) {
|
||||
if (provider == null) {
|
||||
return;
|
||||
}
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "appname", provider.getAppName() );
|
||||
properties.put( "packagename", provider.getAppPackage() );
|
||||
properties.put( "activeTime", System.currentTimeMillis() - mCardStartShowTime );
|
||||
properties.put( "type", provider.getModuleName() );
|
||||
mAnalytics.track( "Launcher_Card_Show", properties );
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("appname", provider.getAppName());
|
||||
properties.put("packagename", provider.getAppPackage());
|
||||
properties.put("activeTime", System.currentTimeMillis() - mCardStartShowTime);
|
||||
properties.put("type", provider.getModuleName());
|
||||
mAnalytics.track("Launcher_Card_Show", properties);
|
||||
mCardStartShowTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片滑动埋点,WTF
|
||||
*/
|
||||
private void trackCardFlipEvent( IMogoModuleProvider provider ) {
|
||||
if ( provider == null ) {
|
||||
private void trackCardFlipEvent(IMogoModuleProvider provider) {
|
||||
if (provider == null) {
|
||||
return;
|
||||
}
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "appname", provider.getAppName() );
|
||||
properties.put( "packagename", provider.getAppPackage() );
|
||||
properties.put( "type", provider.getModuleName() );
|
||||
mAnalytics.track( "Launcher_Card_Slide", properties );
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("appname", provider.getAppName());
|
||||
properties.put("packagename", provider.getAppPackage());
|
||||
properties.put("type", provider.getModuleName());
|
||||
mAnalytics.track("Launcher_Card_Slide", properties);
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation( this );
|
||||
mMogoFragmentManager.init( this, R.id.module_main_id_search_fragment );
|
||||
mMogoFragmentManager.registerMainFragmentStackTransactionListener( ( size ) -> {
|
||||
if ( size == 0 ) {
|
||||
mMogoFragmentManager = (IMogoFragmentManager) ARouter.getInstance().build(MogoServicePaths.PATH_FRAGMENT_MANAGER).navigation(this);
|
||||
mMogoFragmentManager.init(this, R.id.module_main_id_search_fragment);
|
||||
mMogoFragmentManager.registerMainFragmentStackTransactionListener((size) -> {
|
||||
if (size == 0) {
|
||||
showLayout();
|
||||
} else if ( size == 1 ) {
|
||||
} else if (size == 1) {
|
||||
hideLayout();
|
||||
}
|
||||
} );
|
||||
mHeader = findViewById( R.id.module_main_id_header_fragment_container );
|
||||
mCards = findViewById( R.id.module_main_id_cards_container );
|
||||
mApps = findViewById( R.id.module_main_id_apps_fragment_container );
|
||||
mEntrance = findViewById( R.id.module_main_id_entrance_fragment_container );
|
||||
mFloatingLayout = findViewById( R.id.module_main_id_floating_view );
|
||||
mLeftShadowFrame = findViewById( R.id.module_main_id_map_left_shadow_frame );
|
||||
mTopShadowFrame = findViewById( R.id.module_main_id_map_top_shadow_frame );
|
||||
});
|
||||
mHeader = findViewById(R.id.module_main_id_header_fragment_container);
|
||||
mCards = findViewById(R.id.module_main_id_cards_container);
|
||||
mApps = findViewById(R.id.module_main_id_apps_fragment_container);
|
||||
mEntrance = findViewById(R.id.module_main_id_entrance_fragment_container);
|
||||
mFloatingLayout = findViewById(R.id.module_main_id_floating_view);
|
||||
mLeftShadowFrame = findViewById(R.id.module_main_id_map_left_shadow_frame);
|
||||
mTopShadowFrame = findViewById(R.id.module_main_id_map_top_shadow_frame);
|
||||
|
||||
WindowViewHandler.init( mFloatingLayout );
|
||||
WindowViewHandler.init(mFloatingLayout);
|
||||
}
|
||||
|
||||
// 隐藏布局
|
||||
private void hideLayout() {
|
||||
mHeader.setVisibility( View.GONE );
|
||||
mCards.setVisibility( View.GONE );
|
||||
mApps.setVisibility( View.GONE );
|
||||
mEntrance.setVisibility( View.GONE );
|
||||
mFloatingLayout.setVisibility( View.GONE );
|
||||
mLeftShadowFrame.setVisibility( View.GONE );
|
||||
mHeader.setVisibility(View.GONE);
|
||||
mCards.setVisibility(View.GONE);
|
||||
mApps.setVisibility(View.GONE);
|
||||
mEntrance.setVisibility(View.GONE);
|
||||
mFloatingLayout.setVisibility(View.GONE);
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// 显示布局
|
||||
private void showLayout() {
|
||||
mHeader.setVisibility( View.VISIBLE );
|
||||
mCards.setVisibility( View.VISIBLE );
|
||||
mApps.setVisibility( View.VISIBLE );
|
||||
mEntrance.setVisibility( View.VISIBLE );
|
||||
mFloatingLayout.setVisibility( View.VISIBLE );
|
||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||
mHeader.setVisibility(View.VISIBLE);
|
||||
mCards.setVisibility(View.VISIBLE);
|
||||
mApps.setVisibility(View.VISIBLE);
|
||||
mEntrance.setVisibility(View.VISIBLE);
|
||||
mFloatingLayout.setVisibility(View.VISIBLE);
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
MogoModulePaths.addModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY));
|
||||
|
||||
mMogoModuleHandler = new MogoModulesManager( this );
|
||||
mMogoMapService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation();
|
||||
if ( mMogoMapService != null ) {
|
||||
mMogoMapService.getHostListenerRegister().registerHostMapListener( mMogoModuleHandler );
|
||||
mMogoMapService.getHostListenerRegister().registerHostNaviListener( mMogoModuleHandler );
|
||||
mMogoMapService.getHostListenerRegister().registerMarkerClickListener( this );
|
||||
mMogoModuleHandler = new MogoModulesManager(this);
|
||||
mMogoMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation();
|
||||
if (mMogoMapService != null) {
|
||||
mMogoMapService.getHostListenerRegister().registerHostMapListener(mMogoModuleHandler);
|
||||
mMogoMapService.getHostListenerRegister().registerHostNaviListener(mMogoModuleHandler);
|
||||
mMogoMapService.getHostListenerRegister().registerMarkerClickListener(this);
|
||||
}
|
||||
|
||||
mMogoModuleHandler.setMapLoadedCallback( () -> {
|
||||
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );
|
||||
mMogoModuleHandler.setMapLoadedCallback(() -> {
|
||||
Logger.d(TAG, "map loaded." + Thread.currentThread().getName());
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
mMogoModuleHandler.loadModules();
|
||||
loadContainerModules();
|
||||
loadCardModules();
|
||||
|
||||
// 显示左边遮罩
|
||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||
mTopShadowFrame.setVisibility( View.VISIBLE );
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
mTopShadowFrame.setVisibility(View.VISIBLE);
|
||||
|
||||
// 右移地图中心点
|
||||
mMogoMapUIController = mMogoMapService.getMapUIController();
|
||||
mMogoMapUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
mMogoMapUIController.setPointToCenter(0.66145, 0.590688);
|
||||
|
||||
// 开启定位
|
||||
startLocation();
|
||||
} );
|
||||
mMogoModuleHandler.loadMapModule( R.id.module_main_id_map_fragment_container );
|
||||
});
|
||||
mMogoModuleHandler.loadMapModule(R.id.module_main_id_map_fragment_container);
|
||||
|
||||
mMogoCardManager = ( IMogoCardManager ) ARouter.getInstance().build( MogoServicePaths.PATH_CARD_MANAGER ).navigation( this );
|
||||
mAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( this );
|
||||
mMogoCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation(this);
|
||||
mAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(this);
|
||||
}
|
||||
|
||||
private void startLocation() {
|
||||
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient = mMogoMapService.getSingletonLocationClient(getApplicationContext());
|
||||
mLocationClient.addLocationListener(this);
|
||||
mLocationClient.start();
|
||||
}
|
||||
|
||||
private void loadContainerModules() {
|
||||
mMogoModuleHandler.loadAppsListModule( R.id.module_main_id_apps_fragment_container );
|
||||
mMogoModuleHandler.loadExtensionsModule( R.id.module_main_id_header_fragment_container );
|
||||
mMogoModuleHandler.loadEntrancesModule( R.id.module_main_id_entrance_fragment_container );
|
||||
mMogoModuleHandler.loadAppsListModule(R.id.module_main_id_apps_fragment_container);
|
||||
mMogoModuleHandler.loadExtensionsModule(R.id.module_main_id_header_fragment_container);
|
||||
mMogoModuleHandler.loadEntrancesModule(R.id.module_main_id_entrance_fragment_container);
|
||||
}
|
||||
|
||||
private void loadCardModules() {
|
||||
|
||||
List< IMogoModuleProvider > providers = mMogoModuleHandler.loadCardsModule();
|
||||
mCardModulesAdapter = new CardModulesAdapter( this, providers );
|
||||
mCardsContainer.setOffscreenPageLimit( providers.size() );
|
||||
mCardsContainer.setPageTransformer( true, new VerticalStackTransformer( this ) );
|
||||
mCardsContainer.setAdapter( mCardModulesAdapter );
|
||||
mCardsContainer.setCurrentItem( mCurrentPosition );
|
||||
List<IMogoModuleProvider> providers = mMogoModuleHandler.loadCardsModule();
|
||||
mCardModulesAdapter = new CardModulesAdapter(this, providers);
|
||||
mCardsContainer.setOffscreenPageLimit(providers.size());
|
||||
mCardsContainer.setPageTransformer(true, new VerticalStackTransformer(this));
|
||||
mCardsContainer.setAdapter(mCardModulesAdapter);
|
||||
mCardsContainer.setCurrentItem(mCurrentPosition);
|
||||
|
||||
mCardStartShowTime = System.currentTimeMillis();
|
||||
}
|
||||
@@ -266,60 +281,62 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@NonNull
|
||||
@Override
|
||||
protected MainPresenter createPresenter() {
|
||||
return new MainPresenter( this );
|
||||
return new MainPresenter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.onLocationChanged( location );
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
if (mMogoModuleHandler != null) {
|
||||
mMogoModuleHandler.onLocationChanged(location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
isClickMarker = true;
|
||||
switch2( marker.getOwner() );
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.onMarkerClicked( marker );
|
||||
switch2(marker.getOwner());
|
||||
if (mMogoModuleHandler != null) {
|
||||
mMogoModuleHandler.onMarkerClicked(marker);
|
||||
}
|
||||
isClickMarker = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switch2( String cardType ) {
|
||||
if ( mCardModulesAdapter != null ) {
|
||||
public void switch2(String cardType) {
|
||||
if (mCardModulesAdapter != null) {
|
||||
|
||||
int position = mCardModulesAdapter.getProviderPosition( cardType );
|
||||
if ( position != -1 ) {
|
||||
int lastFactPosition = mCardModulesAdapter.getFactPosition( mCurrentPosition );
|
||||
mCardsContainer.setCurrentItem( mCurrentPosition + position - lastFactPosition, Math.abs( lastFactPosition - position ) == 1 );
|
||||
if ( !isClickMarker ) {
|
||||
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
|
||||
int position = mCardModulesAdapter.getProviderPosition(cardType);
|
||||
if (position != -1) {
|
||||
int lastFactPosition = mCardModulesAdapter.getFactPosition(mCurrentPosition);
|
||||
mCardsContainer.setCurrentItem(mCurrentPosition + position - lastFactPosition, Math.abs(lastFactPosition - position) == 1);
|
||||
if (!isClickMarker) {
|
||||
mMogoCardManager.invoke(position, mMogoModuleHandler.getCurrentModuleName());
|
||||
}
|
||||
} else {
|
||||
Logger.e( TAG, "Can't find type of %s's position", cardType );
|
||||
Logger.e(TAG, "Can't find type of %s's position", cardType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void onResume() {
|
||||
@Override
|
||||
protected void onResume() {
|
||||
MapBroadCastHelper.getInstance(this).mapFrount();
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override protected void onPause() {
|
||||
@Override
|
||||
protected void onPause() {
|
||||
MapBroadCastHelper.getInstance(this).mapBackground();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( mMogoFragmentManager.getStackSize() == 0 ) {
|
||||
if (mMogoFragmentManager.getStackSize() == 0) {
|
||||
return;
|
||||
}
|
||||
if ( mMogoFragmentManager != null ) {
|
||||
if (mMogoFragmentManager != null) {
|
||||
mMogoFragmentManager.pop();
|
||||
}
|
||||
}
|
||||
@@ -328,12 +345,12 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if ( mLocationClient != null ) {
|
||||
mLocationClient.removeLocationListener( this );
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.removeLocationListener(this);
|
||||
mLocationClient.destroy();
|
||||
}
|
||||
mLocationClient = null;
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
if (mMogoModuleHandler != null) {
|
||||
mMogoModuleHandler.destroy();
|
||||
}
|
||||
mMogoModuleHandler = null;
|
||||
@@ -342,6 +359,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoCardManager = null;
|
||||
mMogoFragmentManager = null;
|
||||
|
||||
AIAssist.getInstance( this ).release();
|
||||
AIAssist.getInstance(this).release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public interface IShareControl {
|
||||
* 显示对话框
|
||||
*/
|
||||
@Keep
|
||||
void showDialog(Context context);
|
||||
void showDialog(/*Context context*/);
|
||||
|
||||
/**
|
||||
* 对话框消失
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.mogo.module.share;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.MogoNavi;
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.module.share.dialog.LaucherShareDialog;
|
||||
|
||||
/**
|
||||
@@ -9,14 +12,36 @@ import com.mogo.module.share.dialog.LaucherShareDialog;
|
||||
* @since 2020-01-10
|
||||
*/
|
||||
public class ShareControl implements IShareControl {
|
||||
|
||||
private static volatile ShareControl sInstance;
|
||||
private Context mContext;
|
||||
|
||||
private ShareControl(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static ShareControl getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (ShareControl.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new ShareControl(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void showDialog(Context context) {
|
||||
LaucherShareDialog shareDialog = new LaucherShareDialog(context);
|
||||
public void showDialog() {
|
||||
LaucherShareDialog shareDialog = new LaucherShareDialog(mContext);
|
||||
shareDialog.setCanceledOnTouchOutside(true);
|
||||
shareDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismissDialog() {
|
||||
|
||||
LaucherShareDialog shareDialog = new LaucherShareDialog(mContext);
|
||||
shareDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,7 @@ public class TanluConstants {
|
||||
//语音搜索
|
||||
public static final String CARNET_VOICE_SEARCH = "CarNet_Voice_Search";
|
||||
|
||||
//视频播放
|
||||
public static final String CARNET_USER_VIDEO_PLAY = "CarNet_user_video_play";
|
||||
|
||||
}
|
||||
|
||||
@@ -186,6 +186,17 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
|
||||
simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||
autoZoomInImageView.setVisibility(View.GONE);
|
||||
|
||||
//视频点击
|
||||
// simpleCoverVideoPlayer.getStartButton().setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// Logger.d(TAG, "simpleCoverVideoPlayer onClick -------> ");
|
||||
// gsyVideoOptionBuilder.setUrl(mVideoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
// .build(simpleCoverVideoPlayer);
|
||||
//// simpleCoverVideoPlayer.getStartButton().performClick();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
@@ -430,6 +441,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
sendShareReceiver("1");
|
||||
Logger.d(TAG, "mogoIntentListener 上报路况 ----> ");
|
||||
traceTypeData("1");
|
||||
ShareControl.getInstance(getActivity()).dismissDialog();
|
||||
} else if (intentStr.equals(TanluConstants.SHARE_ROAD_CLOSURE)) { //分享封路(封路了) --ok
|
||||
traceData("2");
|
||||
sendShareReceiver("3");
|
||||
@@ -441,8 +453,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
Logger.d(TAG, "mogoIntentListener 分享交通检查 ----> ");
|
||||
traceTypeData("3");
|
||||
} else if (intentStr.equals(TanluConstants.GO_TO_SHARE)) { //我要分享 --ok
|
||||
ShareControl shareControl = new ShareControl();
|
||||
shareControl.showDialog(getActivity());
|
||||
ShareControl.getInstance(getActivity()).showDialog();
|
||||
Logger.d(TAG, "mogoIntentListener 我要分享 ----> ");
|
||||
}
|
||||
}
|
||||
@@ -460,6 +471,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
gsyVideoOptionBuilder.setUrl(mVideoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
.build(simpleCoverVideoPlayer);
|
||||
simpleCoverVideoPlayer.getStartButton().performClick();
|
||||
traceVideoPlayStatusData("1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,12 +663,27 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
.build(simpleCoverVideoPlayer);
|
||||
simpleCoverVideoPlayer.getStartButton().performClick();
|
||||
traceVideoPlayStatusData("2");
|
||||
|
||||
if (mImageUrl == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传播放
|
||||
* @param type
|
||||
* type=1 主动触发播放
|
||||
*
|
||||
* type=2 自动播放
|
||||
*/
|
||||
private void traceVideoPlayStatusData(String type) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", type);
|
||||
mAnalytics.track(TanluConstants.CARNET_USER_VIDEO_PLAY, properties);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新单个图片数据
|
||||
*/
|
||||
|
||||
@@ -66,7 +66,8 @@
|
||||
android:layout_below="@+id/layout_top_view"
|
||||
android:layout_marginLeft="@dimen/tanlu_module_card_margin_left"
|
||||
android:layout_marginRight="@dimen/tanlu_module_card_margin_left"
|
||||
android:background="@drawable/shape_bg_222533_9px">
|
||||
>
|
||||
<!-- android:background="@drawable/shape_bg_222533_9px"-->
|
||||
|
||||
<com.mogo.module.tanlu.video.SimpleCoverVideoPlayer
|
||||
android:id="@+id/video_player_main"
|
||||
|
||||
Reference in New Issue
Block a user