mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-27 01:54:45 +01:00
Hide FAB when RecyclerView in PostFragment is scrolling down.
This commit is contained in:
parent
7b754328fc
commit
a52f608af9
@ -399,6 +399,7 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
|
fab.show();
|
||||||
if(isInLazyMode) {
|
if(isInLazyMode) {
|
||||||
if(position == sectionsPagerAdapter.getCurrentLazyModeFragmentPosition()) {
|
if(position == sectionsPagerAdapter.getCurrentLazyModeFragmentPosition()) {
|
||||||
sectionsPagerAdapter.resumeLazyMode();
|
sectionsPagerAdapter.resumeLazyMode();
|
||||||
@ -793,6 +794,14 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postScrollUp() {
|
||||||
|
fab.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postScrollDown() {
|
||||||
|
fab.hide();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onAccountSwitchEvent(SwitchAccountEvent event) {
|
public void onAccountSwitchEvent(SwitchAccountEvent event) {
|
||||||
if(!getClass().getName().equals(event.excludeActivityClassName)) {
|
if(!getClass().getName().equals(event.excludeActivityClassName)) {
|
||||||
|
@ -189,11 +189,37 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(activity instanceof MainActivity) {
|
||||||
|
mPostRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
if (dy > 0) {
|
||||||
|
((MainActivity) activity).postScrollDown();
|
||||||
|
} else if (dy < 0) {
|
||||||
|
((MainActivity) activity).postScrollUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if(activity instanceof ViewSubredditDetailActivity) {
|
||||||
|
mPostRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
if (dy > 0) {
|
||||||
|
((ViewSubredditDetailActivity) activity).postScrollDown();
|
||||||
|
} else if (dy < 0) {
|
||||||
|
((ViewSubredditDetailActivity) activity).postScrollUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
int postType = getArguments().getInt(EXTRA_POST_TYPE);
|
int postType = getArguments().getInt(EXTRA_POST_TYPE);
|
||||||
String sortType = getArguments().getString(EXTRA_SORT_TYPE);
|
String sortType = getArguments().getString(EXTRA_SORT_TYPE);
|
||||||
int filter = getArguments().getInt(EXTRA_FILTER);
|
int filter = getArguments().getInt(EXTRA_FILTER);
|
||||||
String accessToken = getArguments().getString(EXTRA_ACCESS_TOKEN);
|
String accessToken = getArguments().getString(EXTRA_ACCESS_TOKEN);
|
||||||
boolean nsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, true);
|
boolean nsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, false);
|
||||||
|
|
||||||
PostViewModel.Factory factory;
|
PostViewModel.Factory factory;
|
||||||
|
|
||||||
|
@ -566,6 +566,14 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void postScrollUp() {
|
||||||
|
fab.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postScrollDown() {
|
||||||
|
fab.hide();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onAccountSwitchEvent(SwitchAccountEvent event) {
|
public void onAccountSwitchEvent(SwitchAccountEvent event) {
|
||||||
if(!getClass().getName().equals(event.excludeActivityClassName)) {
|
if(!getClass().getName().equals(event.excludeActivityClassName)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user