diff --git a/app/build.gradle b/app/build.gradle index daf5ae2078..a4df10bbff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,10 +21,10 @@ android { multiDexEnabled true externalNativeBuild { - ndk { - // 设置支持的SO库架构 - abiFilters 'armeabi-v7a' - } +// ndk { +// // 设置支持的SO库架构 +// abiFilters 'armeabi-v7a' +// } } } signingConfigs { @@ -165,3 +165,4 @@ def getGitCommit() { assert !gitCommit.isEmpty() gitCommit } + diff --git a/modules/mogo-module-apps/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-apps/src/main/res/values-xhdpi/dimens.xml index c1b852350a..2d59d27b6e 100644 --- a/modules/mogo-module-apps/src/main/res/values-xhdpi/dimens.xml +++ b/modules/mogo-module-apps/src/main/res/values-xhdpi/dimens.xml @@ -17,7 +17,7 @@ 174px 523px 18px - 37px - 120px - 120px + 35px + 94px + 94px \ No newline at end of file diff --git a/modules/mogo-module-main/src/main/AndroidManifest.xml b/modules/mogo-module-main/src/main/AndroidManifest.xml index ec58588f6d..d7dee65541 100644 --- a/modules/mogo-module-main/src/main/AndroidManifest.xml +++ b/modules/mogo-module-main/src/main/AndroidManifest.xml @@ -14,7 +14,7 @@ android:stateNotNeeded="true" android:taskAffinity="" android:theme="@style/Main" - android:windowSoftInputMode="adjustPan"> + android:windowSoftInputMode="adjustPan|stateHidden"> diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java index 8d03a90a14..6d75caaf9b 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java @@ -24,6 +24,7 @@ import com.mogo.module.common.MogoModule; import com.mogo.module.common.MogoModulePaths; import com.mogo.module.main.assist.MapBroadCastHelper; import com.mogo.module.main.cards.CardModulesAdapter; +import com.mogo.module.main.cards.HorizentalStackTransformer; import com.mogo.module.main.cards.MogoModulesHandler; import com.mogo.module.main.cards.MogoModulesManager; import com.mogo.module.main.cards.OnPageChangeListenerAdapter; @@ -70,7 +71,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme private IMogoStatusManager mMogoStatusManager; private OrientedViewPager mCardsContainer; - //private VerticalStackTransformer mTransformer; + private HorizentalStackTransformer mTransformer; private CardModulesAdapter mCardModulesAdapter; private View mHeader; @@ -102,7 +103,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme protected void initViews() { mCardsContainer = findViewById( R.id.module_main_id_cards_container ); mCardsContainer.setOrientation( OrientedViewPager.Orientation.HORIZONTAL ); - //mTransformer = new VerticalStackTransformer( this ); + mTransformer = new HorizentalStackTransformer( this ); mCardsContainer.setOnPageChangeListener( mOnPageChangeListener = new OnPageChangeListenerAdapter() { private boolean mIsLast = true; private boolean mCardFlipStatus = false; @@ -139,7 +140,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme } } else if ( state == ViewPager.SCROLL_STATE_IDLE ) { mCardFlipStatus = false; - //mTransformer.resetOffsetScroll(); + mTransformer.resetOffsetScroll(); } int cardSize = mCardModulesAdapter.getCount(); @@ -164,7 +165,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme int positionOffsetPixels ) { super.onPageScrolled( position, positionOffset, positionOffsetPixels ); Logger.d( TAG, "pageScrolled : offset --- " + positionOffset ); - //mTransformer.offsetScrollChanged( positionOffset ); + mTransformer.offsetScrollChanged( positionOffset ); } } ); @@ -305,7 +306,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme List< IMogoModuleProvider > providers = mMogoModuleHandler.loadCardsModule(); mCardModulesAdapter = new CardModulesAdapter( this, providers ); mCardsContainer.setOffscreenPageLimit( providers.size() ); - //mCardsContainer.setPageTransformer( true, mTransformer ); + mCardsContainer.setPageTransformer( true, mTransformer ); mCardsContainer.setAdapter( mCardModulesAdapter ); } diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/assist/MapBroadCastHelper.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/assist/MapBroadCastHelper.java index 9e771b7f65..06f3f4dacb 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/assist/MapBroadCastHelper.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/assist/MapBroadCastHelper.java @@ -2,14 +2,18 @@ package com.mogo.module.main.assist; import android.content.Context; import android.content.Intent; +import android.text.TextUtils; import android.util.Log; import com.mogo.map.navi.MogoNaviInfo; +import com.mogo.module.service.receiver.MogoReceiver; +import com.mogo.service.impl.intent.IntentManager; +import com.mogo.service.intent.IMogoIntentListener; /** * @author zyz * 2020-01-17. */ -public class MapBroadCastHelper { +public class MapBroadCastHelper implements IMogoIntentListener { private static volatile MapBroadCastHelper sInstance; private static final String ACTION_NAV_SEND = "AUTONAVI_STANDARD_BROADCAST_SEND"; @@ -21,6 +25,8 @@ public class MapBroadCastHelper { private MapBroadCastHelper(Context context) { this.context = context; + + IntentManager.getInstance().registerIntentListener(MogoReceiver.ACTION_VOICE_READY,this); } public static MapBroadCastHelper getInstance( Context context ) { @@ -71,6 +77,9 @@ public class MapBroadCastHelper { notifyXizhiNavStatus(STATUS_NAV_STOP); } - - + @Override public void onIntentReceived(String intentStr, Intent intent) { + if (TextUtils.equals(intentStr, MogoReceiver.ACTION_VOICE_READY)) { + mapFrount(); + } + } } diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/HorizentalBaseTransformer.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/HorizentalBaseTransformer.java new file mode 100644 index 0000000000..3983ef6b56 --- /dev/null +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/HorizentalBaseTransformer.java @@ -0,0 +1,110 @@ + +package com.mogo.module.main.cards; + +import android.view.View; +import androidx.viewpager.widget.ViewPager; + +/** + * Created by Nate on 2016/7/22. + */ +public abstract class HorizentalBaseTransformer implements ViewPager.PageTransformer { + /** + * Called each {@link #transformPage(View, float)}. + * + * @param page Apply the transformation to this page + * @param position Position of page relative to the current front-and-center position of the pager. 0 is front and + * center. 1 is one full page position to the right, and -1 is one page position to the left. + */ + protected abstract void onTransform(View page, float position); + + /** + * Apply a property transformation to the given page. For most use cases, this method should not be overridden. + * Instead use {@link #transformPage(View, float)} to perform typical transformations. + * + * @param page Apply the transformation to this page + * @param position Position of page relative to the current front-and-center position of the pager. 0 is front and + * center. 1 is one full page position to the right, and -1 is one page position to the left. + */ + @Override + public void transformPage(View page, float position) { + onPreTransform(page, position); + onTransform(page, position); + onPostTransform(page, position); + } + + /** + * If the position offset of a fragment is less than negative one or greater than one, returning true will set the + * fragment alpha to 0f. Otherwise fragment alpha is always defaulted to 1f. + * + * @return + */ + protected boolean hideOffscreenPages() { + return true; + } + + /** + * Indicates if the default animations of the view pager should be used. + * + * @return + */ + protected boolean isPagingEnabled() { + return false; + } + + /** + * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)}. + *

+ * The default implementation attempts to reset all view properties. This is useful when toggling transforms that do + * not modify the same page properties. For instance changing from a transformation that applies rotation to a + * transformation that fades can inadvertently leave a fragment stuck with a rotation or with some degree of applied + * alpha. + * + * @param page Apply the transformation to this page + * @param position Position of page relative to the current front-and-center position of the pager. 0 is front and + * center. 1 is one full page position to the right, and -1 is one page position to the left. + */ + protected void onPreTransform(View page, float position) { + final float width = page.getWidth(); + //final float height = page.getHeight(); + + page.setRotationX(0); + page.setRotationY(0); + page.setRotation(0); + page.setScaleX(1); + page.setScaleY(1); + page.setPivotX(0); + page.setPivotY(0); + page.setTranslationY(0); + page.setTranslationX(isPagingEnabled() ? 0f : -width * position); + + if (hideOffscreenPages()) { + page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f); + } else { + page.setAlpha(1f); + } + + /*final float normalizedposition = Math.abs(Math.abs(position) - 1); + page.setAlpha(normalizedposition);*/ + } + + /** + * Called each {@link #transformPage(View, float)} after {@link #onTransform(View, float)}. + * + * @param page Apply the transformation to this page + * @param position Position of page relative to the current front-and-center position of the pager. 0 is front and + * center. 1 is one full page position to the right, and -1 is one page position to the left. + */ + protected void onPostTransform(View page, float position) { + } + + /** + * Same as {@link Math#min(double, double)} without double casting, zero closest to infinity handling, or NaN support. + * + * @param val + * @param min + * @return + */ + protected static final float min(float val, float min) { + return val < min ? min : val; + } +} \ No newline at end of file diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/HorizentalStackTransformer.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/HorizentalStackTransformer.java new file mode 100644 index 0000000000..16f7ea21f6 --- /dev/null +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/HorizentalStackTransformer.java @@ -0,0 +1,73 @@ +package com.mogo.module.main.cards; + +import android.content.Context; +import android.view.View; +import com.mogo.module.main.R; +import com.mogo.utils.logger.Logger; + +public class HorizentalStackTransformer extends HorizentalBaseTransformer { + + private Context context; + private int spaceBetweenFirAndSecWith;//第一张卡片和第二张卡片宽度差 + private int spaceBetweenFirAndSecHeight;//第一张卡片和第二张卡片高度差 + private float offsetScroll = 0.0f;//ViewPager滑动时变化幅度 + + public HorizentalStackTransformer( Context context ) { + this.context = context; + spaceBetweenFirAndSecHeight = 0; + spaceBetweenFirAndSecWith = context.getResources().getDimensionPixelSize( R.dimen.module_main_card_card_shadow_width_div ); + } + + public HorizentalStackTransformer( Context context, int spaceBetweenFirAndSecWith, int spaceBetweenFirAndSecHeight ) { + this.context = context; + this.spaceBetweenFirAndSecWith = spaceBetweenFirAndSecWith; + this.spaceBetweenFirAndSecHeight = spaceBetweenFirAndSecHeight; + } + + public void offsetScrollChanged(float offset){ + if(offset ==0){ + return; + } + offsetScroll = offset; + } + + public void resetOffsetScroll(){ + offsetScroll = 0.0f; + } + + @Override + protected void onTransform( View page, float position ) { + if ( position == 0.0f ) { + page.setAlpha( 1.0f ); + page.setTranslationX( 0f ); + //控制停止滑动切换的时候,只有最上面的一张卡片可以点击 + page.setClickable( true ); + } else if(position>0){ + float scale = ( float ) ( page.getWidth() - spaceBetweenFirAndSecWith * position ) / ( float ) ( page.getWidth() ); + Logger.d("VerticalStackTransformer","scale :" + scale); + //控制下面卡片的可见度 + page.setAlpha( 1.0f ); + //控制停止滑动切换的时候,只有最上面的一张卡片可以点击 + page.setClickable( false ); + page.setPivotX( page.getWidth() / 2f ); + page.setPivotY( page.getHeight() / 2f ); + page.setScaleX( scale ); + page.setScaleY( scale ); + page.setTranslationX( -page.getHeight() * position + ( page.getHeight() * 0.5f ) * ( 1 - scale ) + spaceBetweenFirAndSecHeight * position ); + }else{ + float currentPage; + if(offsetScroll > 0.2f){ + currentPage = 0.2f; + }else{ + currentPage = offsetScroll; + } + page.setAlpha( 1 ); + page.setScaleX(1-currentPage); + page.setScaleY(1-currentPage); + page.setPivotX( page.getWidth() / 2f ); + page.setPivotY( page.getHeight() / 2f ); + page.setTranslationX( 0f ); + page.setClickable( false ); + } + } +} \ No newline at end of file diff --git a/modules/mogo-module-main/src/main/res/drawable-ldpi/module_apps_bg_card.png b/modules/mogo-module-main/src/main/res/drawable-ldpi/module_apps_bg_card.png index 3e68a54a4a..50943aa8c9 100644 Binary files a/modules/mogo-module-main/src/main/res/drawable-ldpi/module_apps_bg_card.png and b/modules/mogo-module-main/src/main/res/drawable-ldpi/module_apps_bg_card.png differ diff --git a/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_apps_bg_card.png b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_apps_bg_card.png old mode 100755 new mode 100644 index bb0c8aef1c..d2b6a05cb6 Binary files a/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_apps_bg_card.png and b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_apps_bg_card.png differ diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java index f821dda80e..a10e28ec59 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java @@ -82,9 +82,14 @@ public class MapPresenter extends Presenter implements mView.getUIController().changeMapMode(EnumMapUI.CarUp_2D); } else if (opera_type == 1) { mView.getUIController().changeMapMode(EnumMapUI.NorthUP_2D); + AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null); + } else if (opera_type == 2) { mView.getUIController().changeMapMode(EnumMapUI.CarUp_3D); + AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null); + } + } } else if (key_type == 10048) { //* @param type 0:自动; 1:白天; 2:黑夜 @@ -111,11 +116,11 @@ public class MapPresenter extends Presenter implements int extra_is_show = intent.getIntExtra("EXTRA_IS_SHOW", 0); - if (extra_is_show == 0) { - mView.getUIController().displayOverview(); - } else { - mView.getUIController().recoverLockMode(); - } + //if (extra_is_show == 0) { + // mView.getUIController().displayOverview(); + //} else { + // mView.getUIController().recoverLockMode(); + //} }else if (key_type == 10005){ int navi_route_prefer = intent.getIntExtra("NAVI_ROUTE_PREFER", type); @@ -247,11 +252,15 @@ public class MapPresenter extends Presenter implements AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null); case VoiceConstants.CMD_MAP_NORTH_UP_MODE: mView.getUIController().changeMapMode(EnumMapUI.NorthUP_2D); + AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null); + break; case VoiceConstants.CMD_MAP_3D_UN_WAKEUP: AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null); case VoiceConstants.CMD_MAP_3D: mView.getUIController().changeMapMode(EnumMapUI.CarUp_3D); + AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null); + break; case VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP: AIAssist.getInstance(getContext()).speakTTSVoice("已切换", null);