mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 12:57:12 +01:00
New option in FAB: Filter Posts. Add Gif option in PostFilter.
This commit is contained in:
parent
71a7852c79
commit
efa960013a
@ -41,4 +41,8 @@ public interface FragmentCommunicator {
|
|||||||
|
|
||||||
default void changePostFilter(PostFilter postFilter) {
|
default void changePostFilter(PostFilter postFilter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default void filterPosts() {
|
||||||
|
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public class PostFilter implements Parcelable {
|
|||||||
public boolean containsTextType = true;
|
public boolean containsTextType = true;
|
||||||
public boolean containsLinkType = true;
|
public boolean containsLinkType = true;
|
||||||
public boolean containsImageType = true;
|
public boolean containsImageType = true;
|
||||||
|
public boolean containsGifType = true;
|
||||||
public boolean containsVideoType = true;
|
public boolean containsVideoType = true;
|
||||||
public boolean containsGalleryType = true;
|
public boolean containsGalleryType = true;
|
||||||
|
|
||||||
@ -72,6 +73,9 @@ public class PostFilter implements Parcelable {
|
|||||||
if (!postFilter.containsImageType && post.getPostType() == Post.IMAGE_TYPE) {
|
if (!postFilter.containsImageType && post.getPostType() == Post.IMAGE_TYPE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!postFilter.containsGifType && post.getPostType() == Post.GIF_TYPE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!postFilter.containsVideoType && post.getPostType() == Post.VIDEO_TYPE) {
|
if (!postFilter.containsVideoType && post.getPostType() == Post.VIDEO_TYPE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,12 @@ public class CustomizePostFilterActivity extends BaseActivity {
|
|||||||
TextView postTypeImageTextView;
|
TextView postTypeImageTextView;
|
||||||
@BindView(R.id.post_type_image_check_box_customize_post_filter_activity)
|
@BindView(R.id.post_type_image_check_box_customize_post_filter_activity)
|
||||||
MaterialCheckBox postTypeImageCheckBox;
|
MaterialCheckBox postTypeImageCheckBox;
|
||||||
|
@BindView(R.id.post_type_gif_linear_layout_customize_post_filter_activity)
|
||||||
|
LinearLayout postTypeGifLinearLayout;
|
||||||
|
@BindView(R.id.post_type_gif_text_view_customize_post_filter_activity)
|
||||||
|
TextView postTypeGifTextView;
|
||||||
|
@BindView(R.id.post_type_gif_check_box_customize_post_filter_activity)
|
||||||
|
MaterialCheckBox postTypeGifCheckBox;
|
||||||
@BindView(R.id.post_type_video_linear_layout_customize_post_filter_activity)
|
@BindView(R.id.post_type_video_linear_layout_customize_post_filter_activity)
|
||||||
LinearLayout postTypeVideoLinearLayout;
|
LinearLayout postTypeVideoLinearLayout;
|
||||||
@BindView(R.id.post_type_video_text_view_customize_post_filter_activity)
|
@BindView(R.id.post_type_video_text_view_customize_post_filter_activity)
|
||||||
@ -182,6 +188,10 @@ public class CustomizePostFilterActivity extends BaseActivity {
|
|||||||
postTypeImageCheckBox.performClick();
|
postTypeImageCheckBox.performClick();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
postTypeGifLinearLayout.setOnClickListener(view -> {
|
||||||
|
postTypeGifCheckBox.performClick();
|
||||||
|
});
|
||||||
|
|
||||||
postTypeVideoLinearLayout.setOnClickListener(view -> {
|
postTypeVideoLinearLayout.setOnClickListener(view -> {
|
||||||
postTypeVideoCheckBox.performClick();
|
postTypeVideoCheckBox.performClick();
|
||||||
});
|
});
|
||||||
@ -217,6 +227,7 @@ public class CustomizePostFilterActivity extends BaseActivity {
|
|||||||
postTypeTextTextView.setTextColor(primaryTextColor);
|
postTypeTextTextView.setTextColor(primaryTextColor);
|
||||||
postTypeLinkTextView.setTextColor(primaryTextColor);
|
postTypeLinkTextView.setTextColor(primaryTextColor);
|
||||||
postTypeImageTextView.setTextColor(primaryTextColor);
|
postTypeImageTextView.setTextColor(primaryTextColor);
|
||||||
|
postTypeGifTextView.setTextColor(primaryTextColor);
|
||||||
postTypeVideoTextView.setTextColor(primaryTextColor);
|
postTypeVideoTextView.setTextColor(primaryTextColor);
|
||||||
postTypeGalleryTextView.setTextColor(primaryTextColor);
|
postTypeGalleryTextView.setTextColor(primaryTextColor);
|
||||||
onlyNSFWTextView.setTextColor(primaryTextColor);
|
onlyNSFWTextView.setTextColor(primaryTextColor);
|
||||||
@ -288,6 +299,7 @@ public class CustomizePostFilterActivity extends BaseActivity {
|
|||||||
postFilter.containsTextType = postTypeTextCheckBox.isChecked();
|
postFilter.containsTextType = postTypeTextCheckBox.isChecked();
|
||||||
postFilter.containsLinkType = postTypeLinkCheckBox.isChecked();
|
postFilter.containsLinkType = postTypeLinkCheckBox.isChecked();
|
||||||
postFilter.containsImageType = postTypeImageCheckBox.isChecked();
|
postFilter.containsImageType = postTypeImageCheckBox.isChecked();
|
||||||
|
postFilter.containsGifType = postTypeGifCheckBox.isChecked();
|
||||||
postFilter.containsVideoType = postTypeVideoCheckBox.isChecked();
|
postFilter.containsVideoType = postTypeVideoCheckBox.isChecked();
|
||||||
postFilter.containsGalleryType = postTypeGalleryCheckBox.isChecked();
|
postFilter.containsGalleryType = postTypeGalleryCheckBox.isChecked();
|
||||||
postFilter.onlyNSFW = onlyNSFWSwitch.isChecked();
|
postFilter.onlyNSFW = onlyNSFWSwitch.isChecked();
|
||||||
|
@ -161,47 +161,58 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
|
|||||||
|
|
||||||
name = getIntent().getStringExtra(EXTRA_NAME);
|
name = getIntent().getStringExtra(EXTRA_NAME);
|
||||||
postType = getIntent().getIntExtra(EXTRA_POST_TYPE, PostDataSource.TYPE_FRONT_PAGE);
|
postType = getIntent().getIntExtra(EXTRA_POST_TYPE, PostDataSource.TYPE_FRONT_PAGE);
|
||||||
int filter = getIntent().getIntExtra(EXTRA_FILTER, Post.TEXT_TYPE);
|
int filter = getIntent().getIntExtra(EXTRA_FILTER, -1000);
|
||||||
switch (filter) {
|
|
||||||
case Post.NSFW_TYPE:
|
|
||||||
toolbar.setSubtitle(R.string.nsfw);
|
|
||||||
break;
|
|
||||||
case Post.TEXT_TYPE:
|
|
||||||
toolbar.setSubtitle(R.string.text);
|
|
||||||
break;
|
|
||||||
case Post.LINK_TYPE:
|
|
||||||
case Post.NO_PREVIEW_LINK_TYPE:
|
|
||||||
toolbar.setSubtitle(R.string.link);
|
|
||||||
break;
|
|
||||||
case Post.IMAGE_TYPE:
|
|
||||||
toolbar.setSubtitle(R.string.image);
|
|
||||||
break;
|
|
||||||
case Post.VIDEO_TYPE:
|
|
||||||
toolbar.setSubtitle(R.string.video);
|
|
||||||
break;
|
|
||||||
case Post.GIF_TYPE:
|
|
||||||
toolbar.setSubtitle(R.string.gif);
|
|
||||||
break;
|
|
||||||
case Post.GALLERY_TYPE:
|
|
||||||
toolbar.setSubtitle(R.string.gallery);
|
|
||||||
}
|
|
||||||
PostFilter postFilter = new PostFilter();
|
PostFilter postFilter = new PostFilter();
|
||||||
switch (filter) {
|
switch (filter) {
|
||||||
case Post.NSFW_TYPE:
|
case Post.NSFW_TYPE:
|
||||||
postFilter.onlyNSFW = true;
|
postFilter.onlyNSFW = true;
|
||||||
|
break;
|
||||||
case Post.TEXT_TYPE:
|
case Post.TEXT_TYPE:
|
||||||
postFilter.containsTextType = true;
|
postFilter.containsTextType = true;
|
||||||
|
postFilter.containsLinkType = false;
|
||||||
|
postFilter.containsImageType = false;
|
||||||
|
postFilter.containsGifType = false;
|
||||||
|
postFilter.containsVideoType = false;
|
||||||
|
postFilter.containsGalleryType = false;
|
||||||
break;
|
break;
|
||||||
case Post.LINK_TYPE:
|
case Post.LINK_TYPE:
|
||||||
|
postFilter.containsTextType = false;
|
||||||
postFilter.containsLinkType = true;
|
postFilter.containsLinkType = true;
|
||||||
|
postFilter.containsImageType = false;
|
||||||
|
postFilter.containsGifType = false;
|
||||||
|
postFilter.containsVideoType = false;
|
||||||
|
postFilter.containsGalleryType = false;
|
||||||
break;
|
break;
|
||||||
case Post.IMAGE_TYPE:
|
case Post.IMAGE_TYPE:
|
||||||
|
postFilter.containsTextType = false;
|
||||||
|
postFilter.containsLinkType = false;
|
||||||
postFilter.containsImageType = true;
|
postFilter.containsImageType = true;
|
||||||
|
postFilter.containsGifType = false;
|
||||||
|
postFilter.containsVideoType = false;
|
||||||
|
postFilter.containsGalleryType = false;
|
||||||
|
break;
|
||||||
|
case Post.GIF_TYPE:
|
||||||
|
postFilter.containsTextType = false;
|
||||||
|
postFilter.containsLinkType = false;
|
||||||
|
postFilter.containsImageType = false;
|
||||||
|
postFilter.containsGifType = true;
|
||||||
|
postFilter.containsVideoType = false;
|
||||||
|
postFilter.containsGalleryType = false;
|
||||||
break;
|
break;
|
||||||
case Post.VIDEO_TYPE:
|
case Post.VIDEO_TYPE:
|
||||||
|
postFilter.containsTextType = false;
|
||||||
|
postFilter.containsLinkType = false;
|
||||||
|
postFilter.containsImageType = false;
|
||||||
|
postFilter.containsGifType = false;
|
||||||
postFilter.containsVideoType = true;
|
postFilter.containsVideoType = true;
|
||||||
|
postFilter.containsGalleryType = false;
|
||||||
break;
|
break;
|
||||||
case Post.GALLERY_TYPE:
|
case Post.GALLERY_TYPE:
|
||||||
|
postFilter.containsTextType = false;
|
||||||
|
postFilter.containsLinkType = false;
|
||||||
|
postFilter.containsImageType = false;
|
||||||
|
postFilter.containsGifType = false;
|
||||||
|
postFilter.containsVideoType = false;
|
||||||
postFilter.containsGalleryType = true;
|
postFilter.containsGalleryType = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -453,7 +464,7 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
|
|||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
if (requestCode == CUSTOMIZE_POST_FILTER_ACTIVITY_REQUEST_CODE && resultCode == RESULT_OK) {
|
if (requestCode == CUSTOMIZE_POST_FILTER_ACTIVITY_REQUEST_CODE && resultCode == RESULT_OK) {
|
||||||
if (mFragment != null) {
|
if (mFragment != null) {
|
||||||
((PostFragment) mFragment).changePostFilter(data.getParcelableExtra(CustomizePostFilterActivity.RETURN_EXTRA_POST_FILTER));
|
mFragment.changePostFilter(data.getParcelableExtra(CustomizePostFilterActivity.RETURN_EXTRA_POST_FILTER));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -594,6 +594,9 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
||||||
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
||||||
break;
|
break;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
||||||
break;
|
break;
|
||||||
@ -633,6 +636,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
sectionsPagerAdapter.hideReadPosts();
|
sectionsPagerAdapter.hideReadPosts();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.filterPosts();
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
@ -1213,6 +1221,12 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case FABMoreOptionsBottomSheetFragment.FAB_FILTER_POSTS: {
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.filterPosts();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1536,5 +1550,12 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
currentFragment.hideReadPosts();
|
currentFragment.hideReadPosts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void filterPosts() {
|
||||||
|
PostFragment currentFragment = getCurrentFragment();
|
||||||
|
if (currentFragment != null) {
|
||||||
|
currentFragment.filterPosts();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -713,6 +713,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
||||||
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
||||||
break;
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
||||||
break;
|
break;
|
||||||
@ -753,6 +756,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
sectionsPagerAdapter.hideReadPosts();
|
sectionsPagerAdapter.hideReadPosts();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.filterPosts();
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||||
break;
|
break;
|
||||||
@ -1136,6 +1144,13 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
if (sectionsPagerAdapter != null) {
|
if (sectionsPagerAdapter != null) {
|
||||||
sectionsPagerAdapter.hideReadPosts();
|
sectionsPagerAdapter.hideReadPosts();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FABMoreOptionsBottomSheetFragment.FAB_FILTER_POSTS: {
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.filterPosts();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1334,6 +1349,15 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void filterPosts() {
|
||||||
|
if (fragmentManager != null) {
|
||||||
|
Fragment fragment = fragmentManager.findFragmentByTag("f0");
|
||||||
|
if (fragment instanceof PostFragment) {
|
||||||
|
((PostFragment) fragment).filterPosts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -736,6 +736,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS:
|
||||||
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
fab.setImageResource(R.drawable.ic_hide_read_posts_24dp);
|
||||||
break;
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
|
fab.setImageResource(R.drawable.ic_filter_24dp);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
fab.setImageResource(R.drawable.ic_add_day_night_24dp);
|
||||||
break;
|
break;
|
||||||
@ -775,6 +778,11 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
sectionsPagerAdapter.hideReadPosts();
|
sectionsPagerAdapter.hideReadPosts();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS:
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.filterPosts();
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
||||||
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
|
||||||
@ -1108,6 +1116,13 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
if (sectionsPagerAdapter != null) {
|
if (sectionsPagerAdapter != null) {
|
||||||
sectionsPagerAdapter.hideReadPosts();
|
sectionsPagerAdapter.hideReadPosts();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FABMoreOptionsBottomSheetFragment.FAB_FILTER_POSTS: {
|
||||||
|
if (sectionsPagerAdapter != null) {
|
||||||
|
sectionsPagerAdapter.filterPosts();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1445,6 +1460,15 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void filterPosts() {
|
||||||
|
if (fragmentManager != null) {
|
||||||
|
Fragment fragment = fragmentManager.findFragmentByTag("f0");
|
||||||
|
if (fragment instanceof PostFragment) {
|
||||||
|
((PostFragment) fragment).filterPosts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lockSwipeRightToGoBack() {
|
private void lockSwipeRightToGoBack() {
|
||||||
|
@ -26,6 +26,7 @@ public class FABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogF
|
|||||||
public static final int FAB_OPTION_GO_TO_USER = 6;
|
public static final int FAB_OPTION_GO_TO_USER = 6;
|
||||||
public static final int FAB_RANDOM = 7;
|
public static final int FAB_RANDOM = 7;
|
||||||
public static final int FAB_HIDE_READ_POSTS = 8;
|
public static final int FAB_HIDE_READ_POSTS = 8;
|
||||||
|
public static final int FAB_FILTER_POSTS = 9;
|
||||||
|
|
||||||
@BindView(R.id.submit_post_text_view_fab_more_options_bottom_sheet_fragment)
|
@BindView(R.id.submit_post_text_view_fab_more_options_bottom_sheet_fragment)
|
||||||
TextView submitPostTextView;
|
TextView submitPostTextView;
|
||||||
@ -45,6 +46,8 @@ public class FABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogF
|
|||||||
TextView randomTextView;
|
TextView randomTextView;
|
||||||
@BindView(R.id.hide_read_posts_text_view_fab_more_options_bottom_sheet_fragment)
|
@BindView(R.id.hide_read_posts_text_view_fab_more_options_bottom_sheet_fragment)
|
||||||
TextView hideReadPostsTextView;
|
TextView hideReadPostsTextView;
|
||||||
|
@BindView(R.id.filter_posts_text_view_fab_more_options_bottom_sheet_fragment)
|
||||||
|
TextView filterPostsTextView;
|
||||||
private FABOptionSelectionCallback activity;
|
private FABOptionSelectionCallback activity;
|
||||||
|
|
||||||
public FABMoreOptionsBottomSheetFragment() {
|
public FABMoreOptionsBottomSheetFragment() {
|
||||||
@ -104,6 +107,11 @@ public class FABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogF
|
|||||||
dismiss();
|
dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
filterPostsTextView.setOnClickListener(view -> {
|
||||||
|
activity.fabOptionSelected(FAB_FILTER_POSTS);
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1257,6 +1257,38 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void filterPosts() {
|
||||||
|
if (postType == PostDataSource.TYPE_SEARCH) {
|
||||||
|
Intent intent = new Intent(activity, FilteredThingActivity.class);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_NAME, subredditName);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_QUERY, query);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, postType);
|
||||||
|
startActivity(intent);
|
||||||
|
} else if (postType == PostDataSource.TYPE_SUBREDDIT) {
|
||||||
|
Intent intent = new Intent(activity, FilteredThingActivity.class);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_NAME, subredditName);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, postType);
|
||||||
|
startActivity(intent);
|
||||||
|
} else if(postType == PostDataSource.TYPE_MULTI_REDDIT) {
|
||||||
|
Intent intent = new Intent(activity, FilteredThingActivity.class);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_NAME, multiRedditPath);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, postType);
|
||||||
|
startActivity(intent);
|
||||||
|
} else if (postType == PostDataSource.TYPE_USER) {
|
||||||
|
Intent intent = new Intent(activity, FilteredThingActivity.class);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_NAME, username);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, postType);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_USER_WHERE, where);
|
||||||
|
startActivity(intent);
|
||||||
|
} else {
|
||||||
|
Intent intent = new Intent(activity, FilteredThingActivity.class);
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_NAME, activity.getString(R.string.best));
|
||||||
|
intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, postType);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPostUpdateEvent(PostUpdateEventToPostList event) {
|
public void onPostUpdateEvent(PostUpdateEventToPostList event) {
|
||||||
PagedList<Post> posts = mAdapter.getCurrentList();
|
PagedList<Post> posts = mAdapter.getCurrentList();
|
||||||
|
@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.post;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@ -247,6 +248,9 @@ public class ParsePost {
|
|||||||
//Video post
|
//Video post
|
||||||
JSONObject redditVideoObject = data.getJSONObject(JSONUtils.MEDIA_KEY).getJSONObject(JSONUtils.REDDIT_VIDEO_KEY);
|
JSONObject redditVideoObject = data.getJSONObject(JSONUtils.MEDIA_KEY).getJSONObject(JSONUtils.REDDIT_VIDEO_KEY);
|
||||||
int postType = Post.VIDEO_TYPE;
|
int postType = Post.VIDEO_TYPE;
|
||||||
|
if (!redditVideoObject.has(JSONUtils.HLS_URL_KEY)) {
|
||||||
|
Log.i("afasd", "s " + redditVideoObject);
|
||||||
|
}
|
||||||
String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString();
|
String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString();
|
||||||
String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY);
|
String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY);
|
||||||
|
|
||||||
|
@ -196,6 +196,7 @@ public class SharedPreferencesUtils {
|
|||||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER = 6;
|
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER = 6;
|
||||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM = 7;
|
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM = 7;
|
||||||
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS = 8;
|
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS = 8;
|
||||||
|
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS = 9;
|
||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HOME = 0;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HOME = 0;
|
||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS = 1;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS = 1;
|
||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_INBOX = 2;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_INBOX = 2;
|
||||||
@ -210,6 +211,7 @@ public class SharedPreferencesUtils {
|
|||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER = 6;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER = 6;
|
||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM = 7;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM = 7;
|
||||||
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS = 8;
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS = 8;
|
||||||
|
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS = 9;
|
||||||
|
|
||||||
public static final String NSFW_AND_SPOILER_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.nsfw_and_spoiler";
|
public static final String NSFW_AND_SPOILER_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.nsfw_and_spoiler";
|
||||||
public static final String NSFW_BASE = "_nsfw";
|
public static final String NSFW_BASE = "_nsfw";
|
||||||
|
@ -133,6 +133,36 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/post_type_gif_linear_layout_customize_post_filter_activity"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:background="?attr/selectableItemBackground">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/post_type_gif_text_view_customize_post_filter_activity"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="@string/post_type_gif"
|
||||||
|
android:fontFamily="?attr/font_default"
|
||||||
|
android:textSize="?attr/font_default" />
|
||||||
|
|
||||||
|
<com.google.android.material.checkbox.MaterialCheckBox
|
||||||
|
android:id="@+id/post_type_gif_check_box_customize_post_filter_activity"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/post_type_video_linear_layout_customize_post_filter_activity"
|
android:id="@+id/post_type_video_linear_layout_customize_post_filter_activity"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="?attr/actionBarSize"
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
app:subtitle="@string/filtered_posts_activity_subtitle"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||||
app:navigationIcon="?attr/homeAsUpIndicator" />
|
app:navigationIcon="?attr/homeAsUpIndicator" />
|
||||||
|
|
||||||
|
@ -182,6 +182,25 @@
|
|||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:background="?attr/selectableItemBackground" />
|
android:background="?attr/selectableItemBackground" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/filter_posts_text_view_fab_more_options_bottom_sheet_fragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:paddingStart="32dp"
|
||||||
|
android:paddingEnd="32dp"
|
||||||
|
android:text="@string/filter_posts"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:textSize="?attr/font_default"
|
||||||
|
android:fontFamily="?attr/font_family"
|
||||||
|
app:drawableStartCompat="@drawable/ic_filter_24dp"
|
||||||
|
android:drawablePadding="48dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:background="?attr/selectableItemBackground" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
@ -35,6 +35,7 @@
|
|||||||
<string name="give_award_activity_label">Give Award</string>
|
<string name="give_award_activity_label">Give Award</string>
|
||||||
<string name="subreddit_filter_popular_and_all_activity_label">r/all and r/popular</string>
|
<string name="subreddit_filter_popular_and_all_activity_label">r/all and r/popular</string>
|
||||||
<string name="customize_post_filter_activity_label">Post Filter</string>
|
<string name="customize_post_filter_activity_label">Post Filter</string>
|
||||||
|
<string name="filtered_posts_activity_subtitle">Filtered Posts</string>
|
||||||
|
|
||||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||||
@ -199,6 +200,7 @@
|
|||||||
<string name="bottom_sheet_post_link">Link</string>
|
<string name="bottom_sheet_post_link">Link</string>
|
||||||
<string name="bottom_sheet_post_image">Image</string>
|
<string name="bottom_sheet_post_image">Image</string>
|
||||||
<string name="bottom_sheet_post_video">Video</string>
|
<string name="bottom_sheet_post_video">Video</string>
|
||||||
|
<string name="post_type_gif">Gif</string>
|
||||||
<string name="post_type_gallery">Gallery</string>
|
<string name="post_type_gallery">Gallery</string>
|
||||||
|
|
||||||
<string name="select_from_gallery">Select a picture</string>
|
<string name="select_from_gallery">Select a picture</string>
|
||||||
@ -952,6 +954,7 @@
|
|||||||
<string name="select_video_quality">Select Video Quality</string>
|
<string name="select_video_quality">Select Video Quality</string>
|
||||||
|
|
||||||
<string name="hide_read_posts">Hide Read Posts</string>
|
<string name="hide_read_posts">Hide Read Posts</string>
|
||||||
|
<string name="filter_posts">Filter Posts</string>
|
||||||
|
|
||||||
<string name="only_nsfw">Only NSFW</string>
|
<string name="only_nsfw">Only NSFW</string>
|
||||||
<string name="only_spoiler">Only Spoiler</string>
|
<string name="only_spoiler">Only Spoiler</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user