mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
Minor bugs fixed.
This commit is contained in:
parent
3938d9734f
commit
4ebd10cd8c
@ -69,7 +69,7 @@ import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||
|
||||
public class SearchResultActivity extends BaseActivity implements SortTypeSelectionCallback,
|
||||
PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface,
|
||||
FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback,
|
||||
FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, RandomBottomSheetFragment.RandomOptionSelectionCallback,
|
||||
PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostFragmentContentScrollingInterface {
|
||||
static final String EXTRA_QUERY = "QK";
|
||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
@ -329,7 +329,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
||||
}
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: {
|
||||
Intent intent = new Intent(this, SearchActivity.class);
|
||||
if (mSubredditName != null && !mSubredditName.equals("")) {
|
||||
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, mSubredditName);
|
||||
}
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
@ -525,7 +527,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
||||
break;
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH:
|
||||
Intent intent = new Intent(this, SearchActivity.class);
|
||||
if (mSubredditName != null && !mSubredditName.equals("")) {
|
||||
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, mSubredditName);
|
||||
}
|
||||
startActivity(intent);
|
||||
break;
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_SUBREDDIT: {
|
||||
@ -651,6 +655,13 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
||||
fab.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomOptionSelected(int option) {
|
||||
Intent intent = new Intent(this, FetchRandomSubredditOrPostActivity.class);
|
||||
intent.putExtra(FetchRandomSubredditOrPostActivity.EXTRA_RANDOM_OPTION, option);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private class SectionsPagerAdapter extends FragmentStateAdapter {
|
||||
|
||||
public SectionsPagerAdapter(FragmentActivity fa) {
|
||||
|
@ -30,17 +30,18 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.NetworkState;
|
||||
import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SortType;
|
||||
import ml.docilealligator.infinityforreddit.activities.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.activities.SearchSubredditsResultActivity;
|
||||
import ml.docilealligator.infinityforreddit.activities.ViewSubredditDetailActivity;
|
||||
import ml.docilealligator.infinityforreddit.adapters.SubredditListingRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.NetworkState;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SortType;
|
||||
import ml.docilealligator.infinityforreddit.subreddit.SubredditListingViewModel;
|
||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||
import retrofit2.Retrofit;
|
||||
@ -156,6 +157,19 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
|
||||
|
||||
mSubredditListingRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
if (mActivity instanceof PostFragmentContentScrollingInterface) {
|
||||
mSubredditListingRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if (dy > 0) {
|
||||
((PostFragmentContentScrollingInterface) mActivity).contentScrollDown();
|
||||
} else if (dy < 0) {
|
||||
((PostFragmentContentScrollingInterface) mActivity).contentScrollUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SubredditListingViewModel.Factory factory = new SubredditListingViewModel.Factory(
|
||||
accessToken == null ? mRetrofit : mOauthRetrofit, query, sortType, accessToken, nsfw);
|
||||
mSubredditListingViewModel = new ViewModelProvider(this, factory).get(SubredditListingViewModel.class);
|
||||
|
@ -29,15 +29,16 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.activities.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.adapters.UserListingRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.NetworkState;
|
||||
import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SortType;
|
||||
import ml.docilealligator.infinityforreddit.activities.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.adapters.UserListingRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.user.UserListingViewModel;
|
||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||
import retrofit2.Retrofit;
|
||||
@ -135,6 +136,19 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato
|
||||
|
||||
mUserListingRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
if (mActivity instanceof PostFragmentContentScrollingInterface) {
|
||||
mUserListingRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if (dy > 0) {
|
||||
((PostFragmentContentScrollingInterface) mActivity).contentScrollDown();
|
||||
} else if (dy < 0) {
|
||||
((PostFragmentContentScrollingInterface) mActivity).contentScrollUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
UserListingViewModel.Factory factory = new UserListingViewModel.Factory(mRetrofit, mQuery,
|
||||
sortType, nsfw);
|
||||
mUserListingViewModel = new ViewModelProvider(this, factory).get(UserListingViewModel.class);
|
||||
|
Loading…
Reference in New Issue
Block a user