dev
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -20,6 +20,7 @@
|
||||
<option value="$PROJECT_DIR$/modules" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-apps" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-common" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-extensions" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-main" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-map" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-navi" />
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:behavior_hideable="false"
|
||||
app:behavior_peekHeight="92dp"
|
||||
app:behavior_peekHeight="76dp"
|
||||
app:layout_behavior="@string/bottom_sheet_behavior" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.extensions;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
@@ -87,13 +88,18 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
|
||||
@Override
|
||||
public void renderWeatherInfo( String temp, String desc, int iconId ) {
|
||||
boolean hidden = false;
|
||||
if ( iconId != 0 ) {
|
||||
mWeatherIcon.setImageResource( iconId );
|
||||
mWeatherIcon.setVisibility( View.VISIBLE );
|
||||
} else {
|
||||
mWeatherIcon.setVisibility( View.GONE );
|
||||
hidden |= true;
|
||||
}
|
||||
hidden |= TextUtils.isEmpty( temp );
|
||||
hidden |= TextUtils.isEmpty( desc );
|
||||
mWeatherTemp.setText( temp );
|
||||
mWeatherDesc.setText( desc );
|
||||
mWeatherContainer.setVisibility( hidden ? View.GONE : View.VISIBLE );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ExtensionsPresenter extends Presenter< ExtensionsView > implements
|
||||
int day = calendar.get( Calendar.DAY_OF_MONTH );
|
||||
int week = calendar.get( Calendar.DAY_OF_WEEK );
|
||||
|
||||
String timeStr = getContext().getResources().getString( R.string.module_ext_str_time_format, hour, minute );
|
||||
String timeStr = getContext().getResources().getString( R.string.module_ext_str_time_format, hour, minute > 9 ? String.valueOf( minute ) : "0" + minute );
|
||||
String dateStr = getContext().getResources().getString( R.string.module_ext_str_date_format, month + 1, day, mWeeks[week - 1] );
|
||||
mView.renderTime( dateStr, timeStr );
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="13dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/module_ext_id_date"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
@@ -117,6 +118,7 @@
|
||||
android:background="@drawable/module_ext_drawable_msg_bkg"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:visibility="invisible"
|
||||
android:textSize="10dp"
|
||||
tools:text="···" />
|
||||
</FrameLayout>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<string name="app_name">mogo-module-extensions</string>
|
||||
<string name="module_ext_str_voice_msg">你好,蘑菇2.0开启智慧互联新世界</string>
|
||||
<string name="module_ext_str_date_format">%1$d月%2$d日 %3$s</string>
|
||||
<string name="module_ext_str_time_format">%1$d:%2$d</string>
|
||||
<string name="module_ext_str_time_format">%1$d:%2$s</string>
|
||||
<string name="module_ext_str_weather_temp_format">%s° </string>
|
||||
<string-array name="module_ext_str_arr_week">
|
||||
<item>周日</item>
|
||||
|
||||
@@ -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 );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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 );
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<!-- 小智语音-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_ai_fragment_container"
|
||||
android:id="@+id/module_main_id_header_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -17,12 +17,13 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginLeft="35dp"
|
||||
android:layout_marginTop="5dp">
|
||||
<!-- 卡片-->
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_fragment_container"
|
||||
android:layout_width="360dp"
|
||||
android:layout_width="330dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
@@ -31,11 +32,9 @@
|
||||
android:id="@+id/module_main_id_cards_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="-15dp"
|
||||
android:layout_marginBottom="90dp"
|
||||
android:background="#ffffff"
|
||||
android:padding="15dp" />
|
||||
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="10dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<!-- 地图-->
|
||||
@@ -43,7 +42,6 @@
|
||||
android:id="@+id/module_main_id_map_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="-15dp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_main_id_fragment_container"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Map;
|
||||
@Keep
|
||||
public interface IMogoAnalytics extends IProvider {
|
||||
|
||||
|
||||
/**
|
||||
* 埋点
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user