mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-27 19:38:22 +01:00
Show an indicator for the current sort type.
This commit is contained in:
parent
0c7e5bc16f
commit
965d8ab8ae
@ -355,24 +355,22 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
|
||||
} else if (itemId == R.id.action_sort_filtered_thing_activity) {
|
||||
switch (postType) {
|
||||
case PostPagingSource.TYPE_FRONT_PAGE:
|
||||
SortTypeBottomSheetFragment bestSortTypeBottomSheetFragment = SortTypeBottomSheetFragment.getNewInstance(false, mFragment.getSortType().getType().fullName);
|
||||
SortTypeBottomSheetFragment bestSortTypeBottomSheetFragment = SortTypeBottomSheetFragment.getNewInstance(false, mFragment.getSortType());
|
||||
bestSortTypeBottomSheetFragment.show(getSupportFragmentManager(), bestSortTypeBottomSheetFragment.getTag());
|
||||
break;
|
||||
case PostPagingSource.TYPE_SEARCH:
|
||||
SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment = new SearchPostSortTypeBottomSheetFragment();
|
||||
Bundle searchBundle = new Bundle();
|
||||
searchPostSortTypeBottomSheetFragment.setArguments(searchBundle);
|
||||
SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment = SearchPostSortTypeBottomSheetFragment.getNewInstance(mFragment.getSortType());
|
||||
searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag());
|
||||
break;
|
||||
case PostPagingSource.TYPE_SUBREDDIT:
|
||||
case PostPagingSource.TYPE_MULTI_REDDIT:
|
||||
case PostPagingSource.TYPE_ANONYMOUS_MULTIREDDIT:
|
||||
case PostPagingSource.TYPE_ANONYMOUS_FRONT_PAGE:
|
||||
SortTypeBottomSheetFragment sortTypeBottomSheetFragment = SortTypeBottomSheetFragment.getNewInstance(true, mFragment.getSortType().getType().fullName);
|
||||
SortTypeBottomSheetFragment sortTypeBottomSheetFragment = SortTypeBottomSheetFragment.getNewInstance(true, mFragment.getSortType());
|
||||
sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag());
|
||||
break;
|
||||
case PostPagingSource.TYPE_USER:
|
||||
UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment = new UserThingSortTypeBottomSheetFragment();
|
||||
UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment = UserThingSortTypeBottomSheetFragment.getNewInstance(mFragment.getSortType());
|
||||
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
|
||||
}
|
||||
return true;
|
||||
|
@ -1067,7 +1067,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
int currentPostType = sectionsPagerAdapter.getCurrentPostType();
|
||||
PostFragment postFragment = sectionsPagerAdapter.getCurrentFragment();
|
||||
if (postFragment != null) {
|
||||
SortTypeBottomSheetFragment sortTypeBottomSheetFragment = SortTypeBottomSheetFragment.getNewInstance(currentPostType != PostPagingSource.TYPE_FRONT_PAGE, postFragment.getSortType().getType().fullName);
|
||||
SortTypeBottomSheetFragment sortTypeBottomSheetFragment = SortTypeBottomSheetFragment.getNewInstance(currentPostType != PostPagingSource.TYPE_FRONT_PAGE, postFragment.getSortType());
|
||||
sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag());
|
||||
}
|
||||
}
|
||||
|
@ -324,8 +324,11 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
||||
break;
|
||||
}
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: {
|
||||
SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment = new SearchPostSortTypeBottomSheetFragment();
|
||||
searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag());
|
||||
Fragment fragment = sectionsPagerAdapter.getCurrentFragment();
|
||||
if (fragment instanceof PostFragment) {
|
||||
SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment = SearchPostSortTypeBottomSheetFragment.getNewInstance(((PostFragment) fragment).getSortType());
|
||||
searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: {
|
||||
@ -382,21 +385,20 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
||||
}
|
||||
|
||||
private void displaySortTypeBottomSheetFragment() {
|
||||
switch (viewPager2.getCurrentItem()) {
|
||||
case 0: {
|
||||
SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment = new SearchPostSortTypeBottomSheetFragment();
|
||||
searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag());
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 2:
|
||||
Fragment fragment = sectionsPagerAdapter.getCurrentFragment();
|
||||
if (fragment instanceof PostFragment) {
|
||||
SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment = SearchPostSortTypeBottomSheetFragment.getNewInstance(((PostFragment) fragment).getSortType());
|
||||
searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag());
|
||||
} else {
|
||||
if (fragment instanceof SubredditListingFragment) {
|
||||
SearchUserAndSubredditSortTypeBottomSheetFragment searchUserAndSubredditSortTypeBottomSheetFragment
|
||||
= new SearchUserAndSubredditSortTypeBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(SearchUserAndSubredditSortTypeBottomSheetFragment.EXTRA_FRAGMENT_POSITION, viewPager2.getCurrentItem());
|
||||
searchUserAndSubredditSortTypeBottomSheetFragment.setArguments(bundle);
|
||||
= SearchUserAndSubredditSortTypeBottomSheetFragment.getNewInstance(viewPager2.getCurrentItem(), ((SubredditListingFragment) fragment).getSortType());
|
||||
searchUserAndSubredditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchUserAndSubredditSortTypeBottomSheetFragment.getTag());
|
||||
break;
|
||||
} else if (fragment instanceof UserListingFragment) {
|
||||
SearchUserAndSubredditSortTypeBottomSheetFragment searchUserAndSubredditSortTypeBottomSheetFragment
|
||||
= SearchUserAndSubredditSortTypeBottomSheetFragment.getNewInstance(viewPager2.getCurrentItem(), ((UserListingFragment) fragment).getSortType());
|
||||
searchUserAndSubredditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchUserAndSubredditSortTypeBottomSheetFragment.getTag());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,7 +576,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
|
||||
|
||||
private void showSortTypeBottomSheetFragment() {
|
||||
if (mFragment instanceof PostFragment) {
|
||||
SortTypeBottomSheetFragment sortTypeBottomSheetFragment = SortTypeBottomSheetFragment.getNewInstance(true, ((PostFragment) mFragment).getSortType().getType().fullName);
|
||||
SortTypeBottomSheetFragment sortTypeBottomSheetFragment = SortTypeBottomSheetFragment.getNewInstance(true, ((PostFragment) mFragment).getSortType());
|
||||
sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag());
|
||||
}
|
||||
}
|
||||
|
@ -1093,7 +1093,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
private void displaySortTypeBottomSheetFragment() {
|
||||
Fragment fragment = fragmentManager.findFragmentByTag("f0");
|
||||
if (fragment instanceof PostFragment) {
|
||||
SortTypeBottomSheetFragment sortTypeBottomSheetFragment = SortTypeBottomSheetFragment.getNewInstance(true, ((PostFragment) fragment).getSortType().getType().fullName);
|
||||
SortTypeBottomSheetFragment sortTypeBottomSheetFragment = SortTypeBottomSheetFragment.getNewInstance(true, ((PostFragment) fragment).getSortType());
|
||||
sortTypeBottomSheetFragment.show(fragmentManager, sortTypeBottomSheetFragment.getTag());
|
||||
}
|
||||
}
|
||||
|
@ -208,9 +208,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
private FragmentManager fragmentManager;
|
||||
private SectionsPagerAdapter sectionsPagerAdapter;
|
||||
private RequestManager glide;
|
||||
private UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment;
|
||||
private SortTimeBottomSheetFragment sortTimeBottomSheetFragment;
|
||||
private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment;
|
||||
private NavigationWrapper navigationWrapper;
|
||||
private Call<String> subredditAutocompleteCall;
|
||||
private String mAccessToken;
|
||||
@ -585,10 +582,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
}
|
||||
});
|
||||
|
||||
userThingSortTypeBottomSheetFragment = new UserThingSortTypeBottomSheetFragment();
|
||||
sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment();
|
||||
postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
|
||||
|
||||
karmaTextView.setOnClickListener(view -> {
|
||||
UserData userData = userViewModel.getUserLiveData().getValue();
|
||||
if (userData != null) {
|
||||
@ -862,10 +855,11 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
break;
|
||||
}
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: {
|
||||
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
|
||||
|
||||
break;
|
||||
}
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: {
|
||||
PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
|
||||
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
||||
break;
|
||||
}
|
||||
@ -944,7 +938,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
break;
|
||||
}
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_SORT_TYPE: {
|
||||
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
|
||||
displaySortTypeBottomSheetFragment();
|
||||
break;
|
||||
}
|
||||
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_CHANGE_POST_LAYOUT: {
|
||||
@ -1065,6 +1059,17 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
}
|
||||
}
|
||||
|
||||
private void displaySortTypeBottomSheetFragment() {
|
||||
Fragment fragment = sectionsPagerAdapter.getCurrentFragment();
|
||||
if (fragment instanceof PostFragment) {
|
||||
UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment = UserThingSortTypeBottomSheetFragment.getNewInstance(((PostFragment) fragment).getSortType());
|
||||
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
|
||||
} else if (fragment instanceof CommentsListingFragment) {
|
||||
UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment = UserThingSortTypeBottomSheetFragment.getNewInstance(((CommentsListingFragment) fragment).getSortType());
|
||||
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchUserInfo() {
|
||||
if (!mFetchUserInfoSuccess) {
|
||||
FetchUserData.fetchUserData(mRetrofit, username, new FetchUserData.FetchUserDataListener() {
|
||||
@ -1123,7 +1128,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
finish();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_sort_view_user_detail_activity) {
|
||||
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
|
||||
displaySortTypeBottomSheetFragment();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_search_view_user_detail_activity) {
|
||||
Intent intent = new Intent(this, SearchActivity.class);
|
||||
@ -1137,6 +1142,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
fetchUserInfo();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_change_post_layout_view_user_detail_activity) {
|
||||
PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
|
||||
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
||||
return true;
|
||||
} else if (itemId == R.id.action_share_view_user_detail_activity) {
|
||||
@ -1262,6 +1268,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
|
||||
@Override
|
||||
public void sortTypeSelected(String sortType) {
|
||||
SortTimeBottomSheetFragment sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(SortTimeBottomSheetFragment.EXTRA_SORT_TYPE, sortType);
|
||||
sortTimeBottomSheetFragment.setArguments(bundle);
|
||||
@ -1286,9 +1293,10 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
}
|
||||
break;
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_SORT_TYPE:
|
||||
userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag());
|
||||
displaySortTypeBottomSheetFragment();
|
||||
break;
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_POST_LAYOUT:
|
||||
PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
|
||||
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
||||
break;
|
||||
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH:
|
||||
|
@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import butterknife.BindView;
|
||||
@ -27,6 +28,8 @@ import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||
*/
|
||||
public class PostCommentSortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment {
|
||||
|
||||
public static final String EXTRA_CURRENT_SORT_TYPE = "ECST";
|
||||
|
||||
@BindView(R.id.best_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
|
||||
TextView bestTypeTextView;
|
||||
@BindView(R.id.confidence_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
|
||||
@ -46,10 +49,19 @@ public class PostCommentSortTypeBottomSheetFragment extends LandscapeExpandedRou
|
||||
@BindView(R.id.live_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
|
||||
TextView liveTypeTextView;
|
||||
private BaseActivity activity;
|
||||
|
||||
public PostCommentSortTypeBottomSheetFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static PostCommentSortTypeBottomSheetFragment getNewInstance(String currentSortTypeValue) {
|
||||
PostCommentSortTypeBottomSheetFragment fragment = new PostCommentSortTypeBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EXTRA_CURRENT_SORT_TYPE, currentSortTypeValue);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
@ -58,6 +70,27 @@ public class PostCommentSortTypeBottomSheetFragment extends LandscapeExpandedRou
|
||||
View rootView = inflater.inflate(R.layout.fragment_post_comment_sort_type_bottom_sheet, container, false);
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
String currentSortType = getArguments().getString(EXTRA_CURRENT_SORT_TYPE);
|
||||
if (currentSortType.equals(SortType.Type.BEST.value)) {
|
||||
bestTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(bestTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.CONFIDENCE.value)) {
|
||||
confidenceTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(confidenceTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.TOP.value)) {
|
||||
topTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(topTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.NEW.value)) {
|
||||
newTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(newTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.CONTROVERSIAL.value)) {
|
||||
controversialTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(controversialTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.OLD.value)) {
|
||||
oldTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(oldTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.RANDOM.value)) {
|
||||
randomTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(randomTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.QA.value)) {
|
||||
qaTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(qaTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.LIVE.value)) {
|
||||
liveTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(liveTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
|
@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import butterknife.BindView;
|
||||
@ -28,6 +29,8 @@ import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||
*/
|
||||
public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment {
|
||||
|
||||
public static final String EXTRA_CURRENT_SORT_TYPE = "ECST";
|
||||
|
||||
@BindView(R.id.relevance_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView relevanceTypeTextView;
|
||||
@BindView(R.id.hot_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
@ -43,12 +46,33 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static SearchPostSortTypeBottomSheetFragment getNewInstance(SortType currentSortType) {
|
||||
SearchPostSortTypeBottomSheetFragment fragment = new SearchPostSortTypeBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EXTRA_CURRENT_SORT_TYPE, currentSortType.getType().fullName);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_search_post_sort_type_bottom_sheet, container, false);
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
String currentSortType = getArguments().getString(EXTRA_CURRENT_SORT_TYPE);
|
||||
if (currentSortType.equals(SortType.Type.RELEVANCE.fullName)) {
|
||||
relevanceTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(relevanceTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.HOT.fullName)) {
|
||||
hotTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(hotTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.TOP.fullName)) {
|
||||
topTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(topTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.NEW.fullName)) {
|
||||
newTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(newTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.RISING.fullName)) {
|
||||
commentsTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(commentsTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
|
@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import butterknife.BindView;
|
||||
@ -29,21 +30,40 @@ import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||
public class SearchUserAndSubredditSortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment {
|
||||
|
||||
public static final String EXTRA_FRAGMENT_POSITION = "EFP";
|
||||
public static final String EXTRA_CURRENT_SORT_TYPE = "ECST";
|
||||
|
||||
@BindView(R.id.relevance_type_text_view_search_user_and_subreddit_sort_type_bottom_sheet_fragment)
|
||||
TextView relevanceTypeTextView;
|
||||
@BindView(R.id.activity_type_text_view_search_user_and_subreddit_sort_type_bottom_sheet_fragment)
|
||||
TextView activityTypeTextView;
|
||||
private BaseActivity activity;
|
||||
|
||||
public SearchUserAndSubredditSortTypeBottomSheetFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static SearchUserAndSubredditSortTypeBottomSheetFragment getNewInstance(int fragmentPosition, SortType currentSortType) {
|
||||
SearchUserAndSubredditSortTypeBottomSheetFragment fragment = new SearchUserAndSubredditSortTypeBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(EXTRA_FRAGMENT_POSITION, fragmentPosition);
|
||||
bundle.putString(EXTRA_CURRENT_SORT_TYPE, currentSortType.getType().fullName);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_search_user_and_subreddit_sort_type_bottom_sheet, container, false);
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
String currentSortType = getArguments().getString(EXTRA_CURRENT_SORT_TYPE);
|
||||
if (currentSortType.equals(SortType.Type.RELEVANCE.fullName)) {
|
||||
relevanceTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(relevanceTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.ACTIVITY.fullName)) {
|
||||
activityTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(activityTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
|
@ -49,11 +49,11 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static SortTypeBottomSheetFragment getNewInstance(boolean isNoBestType, String currentSortType) {
|
||||
public static SortTypeBottomSheetFragment getNewInstance(boolean isNoBestType, SortType currentSortType) {
|
||||
SortTypeBottomSheetFragment fragment = new SortTypeBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(EXTRA_NO_BEST_TYPE, isNoBestType);
|
||||
bundle.putString(EXTRA_CURRENT_SORT_TYPE, currentSortType);
|
||||
bundle.putString(EXTRA_CURRENT_SORT_TYPE, currentSortType.getType().fullName);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import butterknife.BindView;
|
||||
@ -28,6 +29,8 @@ import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||
*/
|
||||
public class UserThingSortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment {
|
||||
|
||||
public static final String EXTRA_CURRENT_SORT_TYPE = "ECST";
|
||||
|
||||
@BindView(R.id.new_type_text_view_user_thing_sort_type_bottom_sheet_fragment)
|
||||
TextView newTypeTextView;
|
||||
@BindView(R.id.hot_type_text_view_user_thing_sort_type_bottom_sheet_fragment)
|
||||
@ -42,6 +45,14 @@ public class UserThingSortTypeBottomSheetFragment extends LandscapeExpandedRound
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static UserThingSortTypeBottomSheetFragment getNewInstance(SortType currentSortType) {
|
||||
UserThingSortTypeBottomSheetFragment fragment = new UserThingSortTypeBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EXTRA_CURRENT_SORT_TYPE, currentSortType.getType().fullName);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
@ -49,6 +60,17 @@ public class UserThingSortTypeBottomSheetFragment extends LandscapeExpandedRound
|
||||
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
String currentSortType = getArguments().getString(EXTRA_CURRENT_SORT_TYPE);
|
||||
if (currentSortType.equals(SortType.Type.NEW.fullName)) {
|
||||
newTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(newTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.HOT.fullName)) {
|
||||
hotTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(hotTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.TOP.fullName)) {
|
||||
topTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(topTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.CONTROVERSIAL.fullName)) {
|
||||
controversialTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(controversialTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
|
@ -958,7 +958,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
||||
return true;
|
||||
} else if (itemId == R.id.action_sort_view_post_detail_fragment) {
|
||||
if (mPost != null) {
|
||||
PostCommentSortTypeBottomSheetFragment postCommentSortTypeBottomSheetFragment = new PostCommentSortTypeBottomSheetFragment();
|
||||
PostCommentSortTypeBottomSheetFragment postCommentSortTypeBottomSheetFragment = PostCommentSortTypeBottomSheetFragment.getNewInstance(sortType);
|
||||
postCommentSortTypeBottomSheetFragment.show(activity.getSupportFragmentManager(), postCommentSortTypeBottomSheetFragment.getTag());
|
||||
}
|
||||
return true;
|
||||
|
@ -339,7 +339,6 @@ public class DownloadRedditVideoService extends Service {
|
||||
}
|
||||
|
||||
private boolean muxVideoAndAudio(String videoFilePath, String audioFilePath, String outputFilePath) {
|
||||
Log.i("asdfasdf", "sasdfasdf");
|
||||
try {
|
||||
File file = new File(outputFilePath);
|
||||
file.createNewFile();
|
||||
|
Loading…
Reference in New Issue
Block a user