Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/childfragment #210

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.util.TypedValue;
Expand Down Expand Up @@ -202,8 +203,8 @@ public void setTabData(ArrayList<CustomTabEntity> tabEntitys) {
}

/** 关联数据支持同时切换fragments */
public void setTabData(ArrayList<CustomTabEntity> tabEntitys, FragmentActivity fa, int containerViewId, ArrayList<Fragment> fragments) {
mFragmentChangeManager = new FragmentChangeManager(fa.getSupportFragmentManager(), containerViewId, fragments);
public void setTabData(ArrayList<CustomTabEntity> tabEntitys, FragmentManager manager, int containerViewId, ArrayList<Fragment> fragments) {
mFragmentChangeManager = new FragmentChangeManager(manager, containerViewId, fragments);
setTabData(tabEntitys);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.util.TypedValue;
Expand Down Expand Up @@ -171,8 +172,8 @@ public void setTabData(String[] titles) {
}

/** 关联数据支持同时切换fragments */
public void setTabData(String[] titles, FragmentActivity fa, int containerViewId, ArrayList<Fragment> fragments) {
mFragmentChangeManager = new FragmentChangeManager(fa.getSupportFragmentManager(), containerViewId, fragments);
public void setTabData(String[] titles, FragmentManager manager, int containerViewId, ArrayList<Fragment> fragments) {
mFragmentChangeManager = new FragmentChangeManager(manager, containerViewId, fragments);
setTabData(titles);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public void setViewPager(ViewPager vp, String[] titles) {
}

/** 关联ViewPager,用于连适配器都不想自己实例化的情况 */
public void setViewPager(ViewPager vp, String[] titles, FragmentActivity fa, ArrayList<Fragment> fragments) {
public void setViewPager(ViewPager vp, String[] titles, FragmentManager manager, ArrayList<Fragment> fragments) {
if (vp == null) {
throw new IllegalStateException("ViewPager can not be NULL !");
}
Expand All @@ -215,7 +215,7 @@ public void setViewPager(ViewPager vp, String[] titles, FragmentActivity fa, Arr
}

this.mViewPager = vp;
this.mViewPager.setAdapter(new InnerPagerAdapter(fa.getSupportFragmentManager(), fragments, titles));
this.mViewPager.setAdapter(new InnerPagerAdapter(manager, fragments, titles));

this.mViewPager.removeOnPageChangeListener(this);
this.mViewPager.addOnPageChangeListener(this);
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.1.0'
// compile project(':FlycoTabLayout_Lib')
compile project(':FlycoTabLayout_Lib')

//--->support 3.0+
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
// compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
//--->support 2.2+
// compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.0.0@aar'
// compile 'com.nineoldandroids:library:2.4.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected void onCreate(Bundle savedInstanceState) {

mTabLayout_1.setTabData(mTabEntities);
tl_2();
mTabLayout_3.setTabData(mTabEntities, this, R.id.fl_change, mFragments2);
mTabLayout_3.setTabData(mTabEntities, this.getSupportFragmentManager(), R.id.fl_change, mFragments2);
mTabLayout_4.setTabData(mTabEntities);
mTabLayout_5.setTabData(mTabEntities);
mTabLayout_6.setTabData(mTabEntities);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void onCreate(Bundle savedInstanceState) {
tabLayout_1.setTabData(mTitles);
tabLayout_2.setTabData(mTitles_2);
tl_3();
tabLayout_4.setTabData(mTitles_2, this, R.id.fl_change, mFragments2);
tabLayout_4.setTabData(mTitles_2, this.getSupportFragmentManager(), R.id.fl_change, mFragments2);
tabLayout_5.setTabData(mTitles_3);

//显示未读红点
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void onCreate(Bundle savedInstanceState) {
tabLayout_5.setViewPager(vp);
tabLayout_6.setViewPager(vp);
tabLayout_7.setViewPager(vp, mTitles);
tabLayout_8.setViewPager(vp, mTitles, this, mFragments);
tabLayout_8.setViewPager(vp, mTitles, this.getSupportFragmentManager(), mFragments);
tabLayout_9.setViewPager(vp);
tabLayout_10.setViewPager(vp);

Expand Down