This commit is contained in:
wangcongtao
2020-01-06 01:12:04 +08:00
parent 41460d33a1
commit b237a55ca9
12 changed files with 1149 additions and 1130 deletions

View File

@@ -26,7 +26,6 @@ import com.mogo.service.MogoServicePaths;
import com.mogo.service.connection.IMogoSocketManager;
import com.mogo.service.map.IMogoMapService;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.service.module.ModuleType;
import com.mogo.utils.logger.Logger;
import java.util.List;
@@ -128,7 +127,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
mMogoModuleHandler.loadMap( R.id.module_main_id_map_fragment_container );
mMogoModuleHandler.loadAppsList( R.id.module_main_id_fragment_container );
mMogoModuleHandler.loadExtensions( R.id.module_main_id_ai_fragment_container );
mMogoModuleHandler.loadExtensions( R.id.module_main_id_header_fragment_container );
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
mLocationClient.addLocationListener( this );

View File

@@ -5,6 +5,10 @@ import android.view.View;
import androidx.viewpager.widget.ViewPager;
/**
* Created by Nate on 2016/7/22.
*/
public abstract class VerticalBaseTransformer implements ViewPager.PageTransformer {
/**
* Called each {@link #transformPage(View, float)}.
@@ -13,7 +17,7 @@ public abstract class VerticalBaseTransformer implements ViewPager.PageTransform
* @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 );
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.
@@ -24,10 +28,10 @@ public abstract class VerticalBaseTransformer implements ViewPager.PageTransform
* 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 );
public void transformPage(View page, float position) {
onPreTransform(page, position);
onTransform(page, position);
onPostTransform(page, position);
}
/**
@@ -61,24 +65,24 @@ public abstract class VerticalBaseTransformer implements ViewPager.PageTransform
* @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 ) {
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.setTranslationX( 0 );
page.setTranslationY( isPagingEnabled() ? 0f : -height * position );
page.setRotationX(0);
page.setRotationY(0);
page.setRotation(0);
page.setScaleX(1);
page.setScaleY(1);
page.setPivotX(0);
page.setPivotY(0);
page.setTranslationX(0);
page.setTranslationY(isPagingEnabled() ? 0f : -height * position);
if ( hideOffscreenPages() ) {
page.setAlpha( position <= -1f || position >= 1f ? 0f : 1f );
if (hideOffscreenPages()) {
page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
} else {
page.setAlpha( 1f );
page.setAlpha(1f);
}
/*final float normalizedposition = Math.abs(Math.abs(position) - 1);
@@ -92,7 +96,7 @@ public abstract class VerticalBaseTransformer implements ViewPager.PageTransform
* @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 ) {
protected void onPostTransform(View page, float position) {
}
/**
@@ -102,7 +106,7 @@ public abstract class VerticalBaseTransformer implements ViewPager.PageTransform
* @param min
* @return
*/
protected static final float min( float val, float min ) {
protected static final float min(float val, float min) {
return val < min ? min : val;
}
}

View File

@@ -9,8 +9,8 @@ import com.mogo.utils.WindowUtils;
public class VerticalStackTransformer extends VerticalBaseTransformer {
private Context context;
private int spaceBetweenFirAndSecWith = 10 * 2;//第一张卡片和第二张卡片宽度差 dp单位
private int spaceBetweenFirAndSecHeight = 10;//第一张卡片和第二张卡片高度差 dp单位
private int spaceBetweenFirAndSecWith = 5 * 2;//第一张卡片和第二张卡片宽度差 dp单位
private int spaceBetweenFirAndSecHeight = 5;//第一张卡片和第二张卡片高度差 dp单位
public VerticalStackTransformer( Context context ) {
this.context = context;
@@ -26,10 +26,12 @@ public class VerticalStackTransformer extends VerticalBaseTransformer {
protected void onTransform( View page, float position ) {
if ( position <= 0.0f ) {
page.setAlpha( 1.0f );
Log.e( "onTransform", "position <= 0.0f ==>" + position );
page.setTranslationY( 0f );
//控制停止滑动切换的时候,只有最上面的一张卡片可以点击
page.setClickable( true );
} else if ( position <= 3.0f ) {
} else {
Log.e( "onTransform", "position <= 3.0f ==>" + position );
float scale = ( float ) ( page.getWidth() - WindowUtils.dip2px( context, spaceBetweenFirAndSecWith * position ) ) / ( float ) ( page.getWidth() );
//控制下面卡片的可见度
page.setAlpha( 1.0f );