opt
This commit is contained in:
@@ -25,7 +25,6 @@ import com.mogo.module.main.cards.OrientedViewPager;
|
||||
import com.mogo.module.main.cards.VerticalStackTransformer;
|
||||
import com.mogo.module.main.fragmentmanager.FragmentStack;
|
||||
import com.mogo.module.main.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
@@ -56,6 +55,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
private OrientedViewPager mCardsContainer;
|
||||
private CardModulesAdapter mCardModulesAdapter;
|
||||
|
||||
private View mHeader;
|
||||
private View mCards;
|
||||
private View mApps;
|
||||
private View mEntrance;
|
||||
|
||||
/**
|
||||
* 主模块管控定位,可以向各个模块发送统一定位信息
|
||||
*/
|
||||
@@ -90,12 +94,30 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public void onTransaction() {
|
||||
if ( FragmentStack.getInstance().isEmpty() ) {
|
||||
// TODO: 2020-01-08 动画
|
||||
show();
|
||||
} else if ( FragmentStack.getInstance().getStackSize() == 1 ) {
|
||||
|
||||
hide();
|
||||
}
|
||||
}
|
||||
} );
|
||||
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 );
|
||||
}
|
||||
|
||||
private void hide() {
|
||||
mHeader.setVisibility( View.GONE );
|
||||
mCards.setVisibility( View.GONE );
|
||||
mApps.setVisibility( View.GONE );
|
||||
mEntrance.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
private void show() {
|
||||
mHeader.setVisibility( View.VISIBLE );
|
||||
mCards.setVisibility( View.VISIBLE );
|
||||
mApps.setVisibility( View.VISIBLE );
|
||||
mEntrance.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,7 +152,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.loadAppsList( R.id.module_main_id_apps_fragment_container );
|
||||
mMogoModuleHandler.loadExtensions( R.id.module_main_id_header_fragment_container );
|
||||
mMogoModuleHandler.loadEntrances( R.id.module_main_id_entrance_fragment_container );
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ public class CardModulesAdapter extends FragmentStatePagerAdapter {
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem( int position ) {
|
||||
Logger.i( TAG, "current position: %d", position );
|
||||
int factPosition = getFactPosition( position );
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt( "position", factPosition );
|
||||
Logger.d( TAG, "here" );
|
||||
final Fragment f = mProviders.get( factPosition ).createFragment( mActivity, bundle );
|
||||
return f;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class FragmentStack {
|
||||
if ( mCurrentFragment != null ) {
|
||||
mFragmentTransaction.hide( mCurrentFragment );
|
||||
}
|
||||
mFragmentTransaction.add( mContainerId, fragment, tag );
|
||||
mFragmentTransaction.add( mContainerId, fragment );
|
||||
mFragmentTransaction.addToBackStack( null );
|
||||
mFragmentTransaction.commitAllowingStateLoss();
|
||||
mFragmentStack.push( fragment );
|
||||
@@ -95,6 +95,9 @@ public class FragmentStack {
|
||||
if ( mFragmentStack.isEmpty() ) {
|
||||
mFragmentTransaction.commitAllowingStateLoss();
|
||||
mCurrentFragment = null;
|
||||
if ( getFragmentStackTransactionListener() != null ) {
|
||||
getFragmentStackTransactionListener().onTransaction();
|
||||
}
|
||||
return;
|
||||
}
|
||||
Fragment fragment = mFragmentStack.peek();
|
||||
|
||||
Reference in New Issue
Block a user