mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 12:47:26 +01:00
Fix issues of searching in a specific subreddit. Minor bugs fixed.
This commit is contained in:
parent
07bca6d635
commit
2e59daa9cd
@ -1004,7 +1004,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
} else {
|
||||
switch (position) {
|
||||
case 0:
|
||||
return "Best";
|
||||
return "Home";
|
||||
case 1:
|
||||
return "Popular";
|
||||
case 2:
|
||||
|
@ -615,6 +615,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
if (mAccessToken != null) {
|
||||
if (showBottomAppBar) {
|
||||
bottomNavigationView.performShow();
|
||||
}
|
||||
fab.show();
|
||||
}
|
||||
if (isInLazyMode) {
|
||||
if (viewPager.getCurrentItem() == 0) {
|
||||
sectionsPagerAdapter.resumeLazyMode();
|
||||
@ -782,7 +788,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
sectionsPagerAdapter.changePostLayout(postLayout);
|
||||
}
|
||||
|
||||
public void postScrollUp() {
|
||||
public void contentScrollUp() {
|
||||
if (mAccessToken != null) {
|
||||
if (showBottomAppBar && !lockBottomAppBar) {
|
||||
bottomNavigationView.performShow();
|
||||
@ -793,7 +799,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
}
|
||||
}
|
||||
|
||||
public void postScrollDown() {
|
||||
public void contentScrollDown() {
|
||||
if (mAccessToken != null) {
|
||||
if (!(showBottomAppBar && lockBottomAppBar)) {
|
||||
fab.hide();
|
||||
@ -829,7 +835,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
public Fragment getItem(int position) {
|
||||
if (position == 0) {
|
||||
PostFragment fragment = new PostFragment();
|
||||
fragment = new PostFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(PostFragment.EXTRA_NAME, subredditName);
|
||||
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
|
||||
|
@ -158,6 +158,9 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
((SubredditViewHolder) viewHolder).favoriteImageView.setVisibility(View.GONE);
|
||||
name = username;
|
||||
iconUrl = userIconUrl;
|
||||
if (itemClickListener != null) {
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(name, iconUrl, true));
|
||||
}
|
||||
} else {
|
||||
int offset;
|
||||
if (itemClickListener != null) {
|
||||
@ -234,11 +237,13 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (itemClickListener != null) {
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(name, iconUrl, false));
|
||||
}
|
||||
}
|
||||
|
||||
if (itemClickListener != null) {
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(name, iconUrl, true));
|
||||
} else {
|
||||
if (itemClickListener == null) {
|
||||
viewHolder.itemView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(mContext, ViewSubredditDetailActivity.class);
|
||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, name);
|
||||
@ -332,7 +337,7 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
|
||||
});
|
||||
|
||||
if (itemClickListener != null) {
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(name, iconUrl, true));
|
||||
viewHolder.itemView.setOnClickListener(view -> itemClickListener.onClick(name, iconUrl, false));
|
||||
} else {
|
||||
viewHolder.itemView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(mContext, ViewSubredditDetailActivity.class);
|
||||
|
@ -309,9 +309,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if (dy > 0) {
|
||||
((ViewSubredditDetailActivity) activity).postScrollDown();
|
||||
((ViewSubredditDetailActivity) activity).contentScrollDown();
|
||||
} else if (dy < 0) {
|
||||
((ViewSubredditDetailActivity) activity).postScrollUp();
|
||||
((ViewSubredditDetailActivity) activity).contentScrollUp();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import io.noties.markwon.recycler.table.TableEntryPlugin;
|
||||
import io.noties.markwon.simple.ext.SimpleExtPlugin;
|
||||
import io.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute;
|
||||
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubredditDataAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.FetchSubredditData;
|
||||
@ -134,6 +135,17 @@ public class SidebarFragment extends Fragment {
|
||||
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(activity));
|
||||
recyclerView.setAdapter(markwonAdapter);
|
||||
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if (dy > 0) {
|
||||
((ViewSubredditDetailActivity) activity).contentScrollDown();
|
||||
} else if (dy < 0) {
|
||||
((ViewSubredditDetailActivity) activity).contentScrollUp();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mSubredditViewModel = new ViewModelProvider(this,
|
||||
new SubredditViewModel.Factory(activity.getApplication(), mRedditDataRoomDatabase, subredditName))
|
||||
|
Loading…
Reference in New Issue
Block a user