Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.mogo.module.main;
|
package com.mogo.module.main;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -23,6 +24,7 @@ import com.mogo.module.main.cards.OnPageChangeListenerAdapter;
|
|||||||
import com.mogo.module.main.cards.OrientedViewPager;
|
import com.mogo.module.main.cards.OrientedViewPager;
|
||||||
import com.mogo.module.main.cards.VerticalStackTransformer;
|
import com.mogo.module.main.cards.VerticalStackTransformer;
|
||||||
import com.mogo.module.main.fragmentmanager.FragmentStack;
|
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.MarkerServiceHandler;
|
||||||
import com.mogo.module.service.ServiceConst;
|
import com.mogo.module.service.ServiceConst;
|
||||||
import com.mogo.service.MogoServicePaths;
|
import com.mogo.service.MogoServicePaths;
|
||||||
@@ -84,6 +86,16 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
FragmentStack.getInstance().init( this, R.id.module_main_id_search_fragment );
|
FragmentStack.getInstance().init( this, R.id.module_main_id_search_fragment );
|
||||||
|
FragmentStack.getInstance().setFragmentStackTransactionListener( new FragmentStackTransactionListener() {
|
||||||
|
@Override
|
||||||
|
public void onTransaction() {
|
||||||
|
if ( FragmentStack.getInstance().isEmpty() ) {
|
||||||
|
// TODO: 2020-01-08 动画
|
||||||
|
} else if ( FragmentStack.getInstance().getStackSize() == 1 ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -87,12 +87,17 @@ public class FragmentStack {
|
|||||||
mFragmentTransaction.commitAllowingStateLoss();
|
mFragmentTransaction.commitAllowingStateLoss();
|
||||||
mCurrentFragment = null;
|
mCurrentFragment = null;
|
||||||
} else {
|
} else {
|
||||||
Fragment fragment = mFragmentStack.pop();
|
mFragmentStack.pop();
|
||||||
if ( fragment != null ) {
|
if ( !mFragmentStack.isEmpty() ) {
|
||||||
mFragmentTransaction.show( fragment );
|
Fragment fragment = mFragmentStack.pop();
|
||||||
mFragmentTransaction.commitAllowingStateLoss();
|
if ( fragment != null ) {
|
||||||
|
mFragmentTransaction.show( fragment );
|
||||||
|
mFragmentTransaction.commitAllowingStateLoss();
|
||||||
|
}
|
||||||
|
mCurrentFragment = fragment;
|
||||||
|
} else {
|
||||||
|
mCurrentFragment = null;
|
||||||
}
|
}
|
||||||
mCurrentFragment = fragment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( getFragmentStackTransactionListener() != null ) {
|
if ( getFragmentStackTransactionListener() != null ) {
|
||||||
@@ -104,6 +109,10 @@ public class FragmentStack {
|
|||||||
return mFragmentStack.isEmpty();
|
return mFragmentStack.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getStackSize() {
|
||||||
|
return mFragmentStack.size();
|
||||||
|
}
|
||||||
|
|
||||||
public FragmentStackTransactionListener getFragmentStackTransactionListener() {
|
public FragmentStackTransactionListener getFragmentStackTransactionListener() {
|
||||||
return mFragmentStackTransactionListener;
|
return mFragmentStackTransactionListener;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user