This commit is contained in:
wangcongtao
2020-01-08 15:13:56 +08:00
parent 420098c704
commit ad03c651f2
18 changed files with 239 additions and 108 deletions

View File

@@ -1,8 +1,10 @@
package com.mogo.module.apps;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.mvp.IView;
@@ -10,6 +12,8 @@ import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.service.fragmentmanager.FragmentDescriptor;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
/**
* @author congtaowang
@@ -27,6 +31,7 @@ public class AppNavigatorFragment extends MvpFragment< IView, Presenter< IView >
private IMogoCardManager mCardManager;
private AppsFragment mAppsFragment;
private IMogoFragmentManager mMogoFragmentManager;
@Override
protected int getLayoutId() {
@@ -52,7 +57,8 @@ public class AppNavigatorFragment extends MvpFragment< IView, Presenter< IView >
mCardManager.switch2( "CARD_TYPE_CARS_CHATTING" );
} );
mApps.setOnClickListener( view -> {
new AppsFragment().show( getChildFragmentManager(), AppsFragment.TAG );
mAppsFragment = new AppsFragment();
mMogoFragmentManager.push( new FragmentDescriptor.Builder().fragment( mAppsFragment ).tag( "apps" ).notifyMainModule( false ).build() );
} );
}
@@ -62,4 +68,10 @@ public class AppNavigatorFragment extends MvpFragment< IView, Presenter< IView >
return new Presenter< IView >( this ) {
};
}
@Override
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
super.onActivityCreated( savedInstanceState );
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation( getContext() );
}
}

View File

@@ -1,22 +1,14 @@
package com.mogo.module.apps;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.mogo.commons.mvp.MvpDialogFragment;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.module.apps.model.AppInfo;
import com.mogo.utils.BitmapHelper;
import com.mogo.utils.WindowUtils;
import java.util.List;
@@ -26,7 +18,7 @@ import java.util.List;
* <p>
* 描述
*/
public class AppsFragment extends MvpDialogFragment< AppsView, AppsPresenter > implements AppsView {
public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > implements AppsView {
public static final String TAG = "AppsFragment";
@@ -59,21 +51,6 @@ public class AppsFragment extends MvpDialogFragment< AppsView, AppsPresenter > i
// mBottomSheetBehavior.setState( BottomSheetBehavior.STATE_COLLAPSED );
}
@Override
public void onStart() {
super.onStart();
super.onStart();
final Dialog dialog = getDialog();
if ( dialog != null ) {
if ( dialog.getWindow() != null ) {
final WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
params.width = WindowUtils.getScreenWidth( getContext() );
params.height = WindowUtils.getScreenHeight( getContext() );
dialog.getWindow().setAttributes( params );
}
}
}
@NonNull
@Override
protected AppsPresenter createPresenter() {