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