mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 12:57:12 +01:00
Fix the FAB shown in subreddit page in SubscribedThingListingActivity.
This commit is contained in:
parent
9ad6d705e6
commit
3263cca582
@ -79,7 +79,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
|||||||
@BindView(R.id.view_pager_subscribed_thing_listing_activity)
|
@BindView(R.id.view_pager_subscribed_thing_listing_activity)
|
||||||
ViewPager viewPager;
|
ViewPager viewPager;
|
||||||
@BindView(R.id.fab_subscribed_thing_listing_activity)
|
@BindView(R.id.fab_subscribed_thing_listing_activity)
|
||||||
public FloatingActionButton fab;
|
FloatingActionButton fab;
|
||||||
@Inject
|
@Inject
|
||||||
@Named("oauth")
|
@Named("oauth")
|
||||||
Retrofit mOauthRetrofit;
|
Retrofit mOauthRetrofit;
|
||||||
@ -189,6 +189,9 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
|||||||
sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||||
viewPager.setAdapter(sectionsPagerAdapter);
|
viewPager.setAdapter(sectionsPagerAdapter);
|
||||||
viewPager.setOffscreenPageLimit(3);
|
viewPager.setOffscreenPageLimit(3);
|
||||||
|
if (viewPager.getCurrentItem() != 2) {
|
||||||
|
fab.hide();
|
||||||
|
}
|
||||||
viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
@ -197,7 +200,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
|||||||
fab.hide();
|
fab.hide();
|
||||||
} else {
|
} else {
|
||||||
lockSwipeRightToGoBack();
|
lockSwipeRightToGoBack();
|
||||||
if (position == 1) {
|
if (position != 2) {
|
||||||
fab.hide();
|
fab.hide();
|
||||||
} else {
|
} else {
|
||||||
fab.show();
|
fab.show();
|
||||||
@ -276,6 +279,18 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showFabInMultiredditTab() {
|
||||||
|
if (viewPager.getCurrentItem() == 2) {
|
||||||
|
fab.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hideFabInMultiredditTab() {
|
||||||
|
if (viewPager.getCurrentItem() == 2) {
|
||||||
|
fab.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void loadMultiReddits() {
|
private void loadMultiReddits() {
|
||||||
FetchMyMultiReddits.fetchMyMultiReddits(mOauthRetrofit, mAccessToken, new FetchMyMultiReddits.FetchMyMultiRedditsListener() {
|
FetchMyMultiReddits.fetchMyMultiReddits(mOauthRetrofit, mAccessToken, new FetchMyMultiReddits.FetchMyMultiRedditsListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -144,9 +144,9 @@ public class MultiRedditListingFragment extends Fragment implements FragmentComm
|
|||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
super.onScrolled(recyclerView, dx, dy);
|
super.onScrolled(recyclerView, dx, dy);
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
((SubscribedThingListingActivity) mActivity).fab.hide();
|
((SubscribedThingListingActivity) mActivity).hideFabInMultiredditTab();
|
||||||
} else {
|
} else {
|
||||||
((SubscribedThingListingActivity) mActivity).fab.show();
|
((SubscribedThingListingActivity) mActivity).showFabInMultiredditTab();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -57,7 +57,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/fab_margin"
|
android:layout_margin="@dimen/fab_margin"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:visibility="gone"
|
|
||||||
app:srcCompat="@drawable/ic_add_day_night_24dp" />
|
app:srcCompat="@drawable/ic_add_day_night_24dp" />
|
||||||
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
Loading…
Reference in New Issue
Block a user