From 68e94fa92892bd952e31b068d57ef73d42a329d2 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sat, 9 Oct 2021 19:09:34 +0800 Subject: [PATCH] Maximize bottom sheet fragments. --- .../CommentMoreBottomSheetFragment.java | 5 ++--- .../CopyTextBottomSheetFragment.java | 4 ++-- .../CreateThemeBottomSheetFragment.java | 7 +++---- .../CustomThemeOptionsBottomSheetFragment.java | 7 +++---- .../FABMoreOptionsBottomSheetFragment.java | 5 ++--- ...dThingFABMoreOptionsBottomSheetFragment.java | 5 ++--- .../FlairBottomSheetFragment.java | 17 +++++++++++++---- .../MultiRedditOptionsBottomSheetFragment.java | 5 ++--- .../NewPostFilterUsageBottomSheetFragment.java | 5 ++--- .../PostCommentSortTypeBottomSheetFragment.java | 5 ++--- .../PostFilterOptionsBottomSheetFragment.java | 5 ++--- ...stFilterUsageOptionsBottomSheetFragment.java | 5 ++--- .../PostLayoutBottomSheetFragment.java | 5 ++--- .../PostTypeBottomSheetFragment.java | 5 ++--- .../RandomBottomSheetFragment.java | 5 ++--- .../SearchPostSortTypeBottomSheetFragment.java | 5 ++--- ...AndSubredditSortTypeBottomSheetFragment.java | 5 ++--- ...SelectOrCaptureImageBottomSheetFragment.java | 5 ++--- ...edditsOrUsersOptionsBottomSheetFragment.java | 5 ++--- .../SetAsWallpaperBottomSheetFragment.java | 5 ++--- .../ShareLinkBottomSheetFragment.java | 7 +++---- .../SortTimeBottomSheetFragment.java | 5 ++--- .../SortTypeBottomSheetFragment.java | 5 ++--- .../UploadedImagesBottomSheetFragment.java | 4 ++-- .../UrlMenuBottomSheetFragment.java | 7 +++---- .../UserThingSortTypeBottomSheetFragment.java | 5 ++--- ...xpandedRoundedBottomSheetDialogFragment.java | 16 ++++++++++++++++ 27 files changed, 83 insertions(+), 81 deletions(-) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LandscapeExpandedRoundedBottomSheetDialogFragment.java diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java index 6774b205..378a227b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CommentMoreBottomSheetFragment.java @@ -18,8 +18,6 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; @@ -31,12 +29,13 @@ import ml.docilealligator.infinityforreddit.activities.ReportActivity; import ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity; import ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity; import ml.docilealligator.infinityforreddit.comment.Comment; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class CommentMoreBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_COMMENT = "ECF"; public static final String EXTRA_ACCESS_TOKEN = "EAT"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CopyTextBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CopyTextBottomSheetFragment.java index 7b6452ec..d8cf1fe9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CopyTextBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CopyTextBottomSheetFragment.java @@ -15,17 +15,17 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class CopyTextBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class CopyTextBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_RAW_TEXT = "ERT"; public static final String EXTRA_MARKDOWN = "EM"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CreateThemeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CreateThemeBottomSheetFragment.java index 163c7732..ffa13115 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CreateThemeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CreateThemeBottomSheetFragment.java @@ -12,17 +12,16 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.activities.CustomizeThemeActivity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.activities.CustomizeThemeActivity; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class CreateThemeBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class CreateThemeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { @BindView(R.id.import_theme_text_view_create_theme_bottom_sheet_fragment) TextView importTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CustomThemeOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CustomThemeOptionsBottomSheetFragment.java index 45d08549..e06fbb12 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CustomThemeOptionsBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/CustomThemeOptionsBottomSheetFragment.java @@ -13,17 +13,16 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.activities.CustomizeThemeActivity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.activities.CustomizeThemeActivity; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class CustomThemeOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class CustomThemeOptionsBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_THEME_NAME = "ETN"; @BindView(R.id.theme_name_text_view_custom_theme_options_bottom_sheet_fragment) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FABMoreOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FABMoreOptionsBottomSheetFragment.java index 13cc45cf..720b8ce0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FABMoreOptionsBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FABMoreOptionsBottomSheetFragment.java @@ -9,13 +9,12 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; -public class FABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class FABMoreOptionsBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_ANONYMOUS_MODE = "EAM"; public static final int FAB_OPTION_SUBMIT_POST = 0; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FilteredThingFABMoreOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FilteredThingFABMoreOptionsBottomSheetFragment.java index af70869d..e2298a5b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FilteredThingFABMoreOptionsBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FilteredThingFABMoreOptionsBottomSheetFragment.java @@ -9,13 +9,12 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; -public class FilteredThingFABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class FilteredThingFABMoreOptionsBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final int FAB_OPTION_FILTER = 0; public static final int FAB_OPTION_HIDE_READ_POSTS = 1; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FlairBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FlairBottomSheetFragment.java index b7b651a6..82373398 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FlairBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FlairBottomSheetFragment.java @@ -14,6 +14,7 @@ import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import org.greenrobot.eventbus.EventBus; @@ -25,12 +26,12 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.adapters.FlairBottomSheetRecyclerViewAdapter; -import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.FetchFlairs; import ml.docilealligator.infinityforreddit.Flair; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.adapters.FlairBottomSheetRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.events.FlairSelectedEvent; import retrofit2.Retrofit; @@ -121,8 +122,12 @@ public class FlairBottomSheetFragment extends BottomSheetDialogFragment { }); } - public interface FlairSelectionCallback { - void flairSelected(Flair flair); + @Override + public void onStart() { + super.onStart(); + View parentView = (View) requireView().getParent(); + BottomSheetBehavior.from(parentView).setState(BottomSheetBehavior.STATE_EXPANDED); + BottomSheetBehavior.from(parentView).setSkipCollapsed(true); } @Override @@ -130,4 +135,8 @@ public class FlairBottomSheetFragment extends BottomSheetDialogFragment { super.onAttach(context); mActivity = (Activity) context; } + + public interface FlairSelectionCallback { + void flairSelected(Flair flair); + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/MultiRedditOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/MultiRedditOptionsBottomSheetFragment.java index 860cad46..6e9caa87 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/MultiRedditOptionsBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/MultiRedditOptionsBottomSheetFragment.java @@ -14,19 +14,18 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.EditMultiRedditActivity; import ml.docilealligator.infinityforreddit.activities.SubscribedThingListingActivity; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; import ml.docilealligator.infinityforreddit.multireddit.MultiReddit; /** * A simple {@link Fragment} subclass. */ -public class MultiRedditOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class MultiRedditOptionsBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_MULTI_REDDIT = "EMR"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java index fed822c4..7bb4baf5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java @@ -9,15 +9,14 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.PostFilterUsageListingActivity; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; -public class NewPostFilterUsageBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class NewPostFilterUsageBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { @BindView(R.id.home_text_view_new_post_filter_usage_bottom_sheet_fragment) TextView homeTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostCommentSortTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostCommentSortTypeBottomSheetFragment.java index 575ceeb8..47de159e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostCommentSortTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostCommentSortTypeBottomSheetFragment.java @@ -14,18 +14,17 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class PostCommentSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class PostCommentSortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { @BindView(R.id.best_type_text_view_post_comment_sort_type_bottom_sheet_fragment) TextView bestTypeTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterOptionsBottomSheetFragment.java index bf1aff0b..ab06f69f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterOptionsBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterOptionsBottomSheetFragment.java @@ -9,15 +9,14 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.PostFilterPreferenceActivity; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; import ml.docilealligator.infinityforreddit.postfilter.PostFilter; -public class PostFilterOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class PostFilterOptionsBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { @BindView(R.id.edit_text_view_post_filter_options_bottom_sheet_fragment) TextView editTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java index 6e9ccd15..c57a6f4d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java @@ -9,15 +9,14 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.PostFilterUsageListingActivity; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; -public class PostFilterUsageOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class PostFilterUsageOptionsBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_POST_FILTER_USAGE = "EPFU"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostLayoutBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostLayoutBottomSheetFragment.java index df1bf5e9..2172f27d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostLayoutBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostLayoutBottomSheetFragment.java @@ -12,17 +12,16 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; /** * A simple {@link Fragment} subclass. */ -public class PostLayoutBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class PostLayoutBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { @BindView(R.id.card_layout_text_view_post_layout_bottom_sheet_fragment) TextView cardLayoutTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostTypeBottomSheetFragment.java index 046c512b..a8d0ff54 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostTypeBottomSheetFragment.java @@ -14,17 +14,16 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class PostTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class PostTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final int TYPE_TEXT = 0; public static final int TYPE_LINK = 1; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/RandomBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/RandomBottomSheetFragment.java index fb10efed..15a1ac62 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/RandomBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/RandomBottomSheetFragment.java @@ -9,13 +9,12 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; -public class RandomBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class RandomBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_IS_NSFW = "EIN"; public static final int RANDOM_SUBREDDIT = 0; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SearchPostSortTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SearchPostSortTypeBottomSheetFragment.java index 98fe7801..415cf976 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SearchPostSortTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SearchPostSortTypeBottomSheetFragment.java @@ -14,19 +14,18 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class SearchPostSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { @BindView(R.id.relevance_type_text_view_search_sort_type_bottom_sheet_fragment) TextView relevanceTypeTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SearchUserAndSubredditSortTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SearchUserAndSubredditSortTypeBottomSheetFragment.java index 2c04b848..771c7a69 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SearchUserAndSubredditSortTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SearchUserAndSubredditSortTypeBottomSheetFragment.java @@ -14,19 +14,18 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class SearchUserAndSubredditSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class SearchUserAndSubredditSortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_FRAGMENT_POSITION = "EFP"; @BindView(R.id.relevance_type_text_view_search_user_and_subreddit_sort_type_bottom_sheet_fragment) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SelectOrCaptureImageBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SelectOrCaptureImageBottomSheetFragment.java index 4be9b51f..0497ecbf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SelectOrCaptureImageBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SelectOrCaptureImageBottomSheetFragment.java @@ -9,12 +9,11 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.PostGalleryActivity; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; -public class SelectOrCaptureImageBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class SelectOrCaptureImageBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { private PostGalleryActivity mActivity; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SelectSubredditsOrUsersOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SelectSubredditsOrUsersOptionsBottomSheetFragment.java index dd1b81ad..6adc6982 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SelectSubredditsOrUsersOptionsBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SelectSubredditsOrUsersOptionsBottomSheetFragment.java @@ -9,14 +9,13 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.SelectedSubredditsAndUsersActivity; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; -public class SelectSubredditsOrUsersOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class SelectSubredditsOrUsersOptionsBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { @BindView(R.id.select_subreddits_text_view_search_user_and_subreddit_sort_type_bottom_sheet_fragment) TextView selectSubredditsTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetAsWallpaperBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetAsWallpaperBottomSheetFragment.java index 1dd45fe2..4a4762aa 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetAsWallpaperBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetAsWallpaperBottomSheetFragment.java @@ -11,14 +11,13 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; -public class SetAsWallpaperBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class SetAsWallpaperBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_VIEW_PAGER_POSITION = "EVPP"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/ShareLinkBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/ShareLinkBottomSheetFragment.java index bf2f1cc9..f35e008a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/ShareLinkBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/ShareLinkBottomSheetFragment.java @@ -18,17 +18,16 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; +import ml.docilealligator.infinityforreddit.post.Post; /** * A simple {@link Fragment} subclass. */ -public class ShareLinkBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class ShareLinkBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_POST_LINK = "EPL"; public static final String EXTRA_MEDIA_LINK = "EML"; public static final String EXTRA_MEDIA_TYPE = "EMT"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SortTimeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SortTimeBottomSheetFragment.java index 65f5c172..38761791 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SortTimeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SortTimeBottomSheetFragment.java @@ -14,18 +14,17 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class SortTimeBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class SortTimeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_SORT_TYPE = "EST"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SortTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SortTypeBottomSheetFragment.java index 40549cd1..f2ab9a1b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SortTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SortTypeBottomSheetFragment.java @@ -14,19 +14,18 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class SortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_NO_BEST_TYPE = "ENBT"; @BindView(R.id.best_type_text_view_sort_type_bottom_sheet_fragment) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UploadedImagesBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UploadedImagesBottomSheetFragment.java index cc100c79..8b525ee8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UploadedImagesBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UploadedImagesBottomSheetFragment.java @@ -9,14 +9,14 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import com.google.android.material.button.MaterialButton; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.UploadImageEnabledActivity; import ml.docilealligator.infinityforreddit.adapters.UploadedImagesRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; -public class UploadedImagesBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class UploadedImagesBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_UPLOADED_IMAGES = "EUI"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java index c907f02b..6aba619a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UrlMenuBottomSheetFragment.java @@ -16,14 +16,13 @@ import android.widget.Toast; import androidx.annotation.NonNull; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; -public class UrlMenuBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class UrlMenuBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { public static final String EXTRA_URL = "EU"; @BindView(R.id.link_text_view_url_menu_bottom_sheet_fragment) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UserThingSortTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UserThingSortTypeBottomSheetFragment.java index 31524d30..510b92df 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UserThingSortTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/UserThingSortTypeBottomSheetFragment.java @@ -13,19 +13,18 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; -import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; - import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.customviews.LandscapeExpandedRoundedBottomSheetDialogFragment; /** * A simple {@link Fragment} subclass. */ -public class UserThingSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { +public class UserThingSortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomSheetDialogFragment { @BindView(R.id.new_type_text_view_user_thing_sort_type_bottom_sheet_fragment) TextView newTypeTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LandscapeExpandedRoundedBottomSheetDialogFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LandscapeExpandedRoundedBottomSheetDialogFragment.java new file mode 100644 index 00000000..9100ac16 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LandscapeExpandedRoundedBottomSheetDialogFragment.java @@ -0,0 +1,16 @@ +package ml.docilealligator.infinityforreddit.customviews; + +import android.view.View; + +import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; +import com.google.android.material.bottomsheet.BottomSheetBehavior; + +public class LandscapeExpandedRoundedBottomSheetDialogFragment extends RoundedBottomSheetDialogFragment { + @Override + public void onStart() { + super.onStart(); + View parentView = (View) requireView().getParent(); + BottomSheetBehavior.from(parentView).setState(BottomSheetBehavior.STATE_EXPANDED); + BottomSheetBehavior.from(parentView).setSkipCollapsed(true); + } +}