aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java133
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java14
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostCommentSortTypeBottomSheetFragment.java119
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SortType.java6
-rw-r--r--app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml144
-rw-r--r--app/src/main/res/menu/view_post_detail_activity.xml23
-rw-r--r--app/src/main/res/values/strings.xml7
9 files changed, 399 insertions, 57 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
index 12b4f908..1c497ea9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
@@ -61,6 +61,7 @@ import ml.docilealligator.infinityforreddit.FetchComment;
import ml.docilealligator.infinityforreddit.FetchPost;
import ml.docilealligator.infinityforreddit.Flair;
import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment;
+import ml.docilealligator.infinityforreddit.Fragment.PostCommentSortTypeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.HidePost;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.ParseComment;
@@ -73,6 +74,8 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.RedditUtils;
import ml.docilealligator.infinityforreddit.SaveThing;
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
+import ml.docilealligator.infinityforreddit.SortType;
+import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -81,7 +84,8 @@ import retrofit2.Retrofit;
import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.EXTRA_COMMENT_DATA_KEY;
import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.WRITE_COMMENT_REQUEST_CODE;
-public class ViewPostDetailActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
+public class ViewPostDetailActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback,
+ SortTypeSelectionCallback {
public static final String EXTRA_POST_DATA = "EPD";
public static final String EXTRA_POST_LIST_POSITION = "EPLI";
@@ -154,8 +158,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
private boolean mNeedBlurNsfw;
private boolean mNeedBlurSpoiler;
private boolean showToast = false;
+ private boolean isSortingComments = false;
private LinearLayoutManager mLinearLayoutManager;
private CommentAndPostRecyclerViewAdapter mAdapter;
+ private PostCommentSortTypeBottomSheetFragment postCommentSortTypeBottomSheetFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -251,6 +257,8 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
if (getIntent().hasExtra(EXTRA_POST_LIST_POSITION)) {
postListPosition = getIntent().getIntExtra(EXTRA_POST_LIST_POSITION, -1);
}
+
+ postCommentSortTypeBottomSheetFragment = new PostCommentSortTypeBottomSheetFragment();
}
@Override
@@ -321,6 +329,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity);
mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true);
+ mMenu.findItem(R.id.action_sort_view_post_detail_activity).setVisible(true);
if (mAccessToken != null) {
if (mPost.isSaved()) {
@@ -418,20 +427,25 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
mProgressBar.setVisibility(View.VISIBLE);
mGlide.clear(mFetchPostInfoImageView);
+ String sortType = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.BEST.value).toLowerCase();
+
+
Call<String> postAndComments;
if (mAccessToken == null) {
if (isSingleCommentThreadMode && mSingleCommentId != null) {
- postAndComments = mRetrofit.create(RedditAPI.class).getPostAndCommentsSingleThreadById(subredditId, mSingleCommentId);
+ postAndComments = mRetrofit.create(RedditAPI.class).getPostAndCommentsSingleThreadById(
+ subredditId, mSingleCommentId, sortType);
} else {
- postAndComments = mRetrofit.create(RedditAPI.class).getPostAndCommentsById(subredditId);
+ postAndComments = mRetrofit.create(RedditAPI.class).getPostAndCommentsById(subredditId,
+ sortType);
}
} else {
if (isSingleCommentThreadMode && mSingleCommentId != null) {
postAndComments = mOauthRetrofit.create(RedditAPI.class).getPostAndCommentsSingleThreadByIdOauth(subredditId,
- mSingleCommentId, RedditUtils.getOAuthHeader(mAccessToken));
+ mSingleCommentId, sortType, RedditUtils.getOAuthHeader(mAccessToken));
} else {
postAndComments = mOauthRetrofit.create(RedditAPI.class).getPostAndCommentsByIdOauth(subredditId,
- RedditUtils.getOAuthHeader(mAccessToken));
+ sortType, RedditUtils.getOAuthHeader(mAccessToken));
}
}
postAndComments.enqueue(new Callback<String>() {
@@ -450,6 +464,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity);
mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true);
+ mMenu.findItem(R.id.action_sort_view_post_detail_activity).setVisible(true);
if (mAccessToken != null) {
if (post.isSaved()) {
@@ -560,7 +575,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
});
}
- private void fetchComments(boolean changeRefreshState) {
+ private void fetchComments(boolean changeRefreshState, boolean checkSortState, String sortType) {
mAdapter.setSingleComment(mSingleCommentId, isSingleCommentThreadMode);
mAdapter.initiallyLoading();
String commentId = null;
@@ -569,47 +584,70 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
}
Retrofit retrofit = mAccessToken == null ? mRetrofit : mOauthRetrofit;
- FetchComment.fetchComments(retrofit, mAccessToken, mPost.getId(), commentId, mLocale, new FetchComment.FetchCommentListener() {
- @Override
- public void onFetchCommentSuccess(ArrayList<CommentData> expandedComments,
- String parentId, ArrayList<String> children) {
- ViewPostDetailActivity.this.children = children;
+ FetchComment.fetchComments(retrofit, mAccessToken, mPost.getId(), commentId, sortType, mLocale,
+ new FetchComment.FetchCommentListener() {
+ @Override
+ public void onFetchCommentSuccess(ArrayList<CommentData> expandedComments,
+ String parentId, ArrayList<String> children) {
+ if (checkSortState && isSortingComments) {
+ if (changeRefreshState) {
+ isRefreshing = false;
+ }
+
+ return;
+ }
- comments = expandedComments;
- hasMoreChildren = children.size() != 0;
- mAdapter.addComments(expandedComments, hasMoreChildren);
+ ViewPostDetailActivity.this.children = children;
- if (children.size() > 0) {
- mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
- @Override
- public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
- super.onScrolled(recyclerView, dx, dy);
+ comments = expandedComments;
+ hasMoreChildren = children.size() != 0;
+ mAdapter.addComments(expandedComments, hasMoreChildren);
- if (!isLoadingMoreChildren && loadMoreChildrenSuccess) {
- int visibleItemCount = mLinearLayoutManager.getChildCount();
- int totalItemCount = mLinearLayoutManager.getItemCount();
- int firstVisibleItemPosition = mLinearLayoutManager.findFirstVisibleItemPosition();
+ if (children.size() > 0) {
+ mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
+ @Override
+ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
+ super.onScrolled(recyclerView, dx, dy);
- if ((visibleItemCount + firstVisibleItemPosition >= totalItemCount) && firstVisibleItemPosition >= 0) {
- fetchMoreComments();
+ if (!isLoadingMoreChildren && loadMoreChildrenSuccess) {
+ int visibleItemCount = mLinearLayoutManager.getChildCount();
+ int totalItemCount = mLinearLayoutManager.getItemCount();
+ int firstVisibleItemPosition = mLinearLayoutManager.findFirstVisibleItemPosition();
+
+ if ((visibleItemCount + firstVisibleItemPosition >= totalItemCount) && firstVisibleItemPosition >= 0) {
+ fetchMoreComments();
+ }
+ }
}
+ });
+ }
+ if (changeRefreshState) {
+ isRefreshing = false;
+ }
+ }
+
+ @Override
+ public void onFetchCommentFailed() {
+ if (checkSortState && isSortingComments) {
+ if (changeRefreshState) {
+ isRefreshing = false;
}
+
+ return;
}
- });
- }
- if (changeRefreshState) {
- isRefreshing = false;
- }
- }
- @Override
- public void onFetchCommentFailed() {
- mAdapter.initiallyLoadCommentsFailed();
- if (changeRefreshState) {
- isRefreshing = false;
- }
- }
- });
+ mAdapter.initiallyLoadCommentsFailed();
+ if (changeRefreshState) {
+ isRefreshing = false;
+ }
+ }
+ });
+ }
+
+ private void fetchComments(boolean changeRefreshState) {
+ String sortType = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT,
+ SortType.Type.BEST.value).toLowerCase();
+ fetchComments(changeRefreshState, true, sortType);
}
void fetchMoreComments() {
@@ -676,6 +714,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity);
mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true);
+ mMenu.findItem(R.id.action_sort_view_post_detail_activity).setVisible(true);
if (mAccessToken != null) {
if (post.isSaved()) {
@@ -970,6 +1009,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity);
mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true);
+ mMenu.findItem(R.id.action_sort_view_post_detail_activity).setVisible(true);
if (mAccessToken != null) {
if (mPost.isSaved()) {
@@ -1098,6 +1138,11 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
}
}
return true;
+ case R.id.action_sort_view_post_detail_activity:
+ if (mPost != null) {
+ postCommentSortTypeBottomSheetFragment.show(getSupportFragmentManager(), postCommentSortTypeBottomSheetFragment.getTag());
+ }
+ return true;
case R.id.action_view_crosspost_parent_view_post_detail_activity:
Intent crosspostIntent = new Intent(this, ViewPostDetailActivity.class);
crosspostIntent.putExtra(ViewPostDetailActivity.EXTRA_POST_ID, mPost.getCrosspostParentId());
@@ -1286,4 +1331,14 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
}
});
}
+
+ @Override
+ public void sortTypeSelected(SortType sortType) {
+ mFetchPostInfoLinearLayout.setVisibility(View.GONE);
+ mGlide.clear(mFetchPostInfoImageView);
+ mChildrenStartingIndex = 0;
+ children.clear();
+ fetchComments(false, false, sortType.getType().value);
+ mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, sortType.getType().name()).apply();
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java
index b3cc8115..68255c21 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java
@@ -12,21 +12,23 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class FetchComment {
- public static void fetchComments(Retrofit retrofit, @Nullable String accessToken, String article, String commentId,
- Locale locale, FetchCommentListener fetchCommentListener) {
+ public static void fetchComments(Retrofit retrofit, @Nullable String accessToken, String article,
+ String commentId, String sortType, Locale locale,
+ FetchCommentListener fetchCommentListener) {
RedditAPI api = retrofit.create(RedditAPI.class);
Call<String> comments;
if (accessToken == null) {
if (commentId == null) {
- comments = api.getPostAndCommentsById(article);
+ comments = api.getPostAndCommentsById(article, sortType);
} else {
- comments = api.getPostAndCommentsSingleThreadById(article, commentId);
+ comments = api.getPostAndCommentsSingleThreadById(article, commentId, sortType);
}
} else {
if (commentId == null) {
- comments = api.getPostAndCommentsByIdOauth(article, RedditUtils.getOAuthHeader(accessToken));
+ comments = api.getPostAndCommentsByIdOauth(article, sortType, RedditUtils.getOAuthHeader(accessToken));
} else {
- comments = api.getPostAndCommentsSingleThreadByIdOauth(article, commentId, RedditUtils.getOAuthHeader(accessToken));
+ comments = api.getPostAndCommentsSingleThreadByIdOauth(article, commentId, sortType,
+ RedditUtils.getOAuthHeader(accessToken));
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostCommentSortTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostCommentSortTypeBottomSheetFragment.java
new file mode 100644
index 00000000..2b78a220
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostCommentSortTypeBottomSheetFragment.java
@@ -0,0 +1,119 @@
+package ml.docilealligator.infinityforreddit.Fragment;
+
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+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;
+
+/**
+ * A simple {@link Fragment} subclass.
+ */
+public class PostCommentSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment {
+
+ @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)
+ TextView confidenceTypeTextView;
+ @BindView(R.id.top_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
+ TextView topTypeTextView;
+ @BindView(R.id.new_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
+ TextView newTypeTextView;
+ @BindView(R.id.controversial_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
+ TextView controversialTypeTextView;
+ @BindView(R.id.old_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
+ TextView oldTypeTextView;
+ @BindView(R.id.random_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
+ TextView randomTypeTextView;
+ @BindView(R.id.qa_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
+ TextView qaTypeTextView;
+ @BindView(R.id.live_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
+ TextView liveTypeTextView;
+ private Activity activity;
+ public PostCommentSortTypeBottomSheetFragment() {
+ // Required empty public constructor
+ }
+
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View rootView = inflater.inflate(R.layout.fragment_post_comment_sort_type_bottom_sheet, container, false);
+ ButterKnife.bind(this, rootView);
+
+ 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);
+ }
+
+ bestTypeTextView.setOnClickListener(view -> {
+ ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.BEST));
+ dismiss();
+ });
+
+ confidenceTypeTextView.setOnClickListener(view -> {
+ ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.CONFIDENCE));
+ dismiss();
+ });
+
+ topTypeTextView.setOnClickListener(view -> {
+ ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.TOP));
+ dismiss();
+ });
+
+ newTypeTextView.setOnClickListener(view -> {
+ ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.NEW));
+ dismiss();
+ });
+
+ controversialTypeTextView.setOnClickListener(view -> {
+ ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.CONTROVERSIAL));
+ dismiss();
+ });
+
+ oldTypeTextView.setOnClickListener(view -> {
+ ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.OLD));
+ dismiss();
+ });
+
+ randomTypeTextView.setOnClickListener(view -> {
+ ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.RANDOM));
+ dismiss();
+ });
+
+ qaTypeTextView.setOnClickListener(view -> {
+ ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.QA));
+ dismiss();
+ });
+
+ liveTypeTextView.setOnClickListener(view -> {
+ ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.LIVE));
+ dismiss();
+ });
+
+ return rootView;
+ }
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ this.activity = (Activity) context;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java
index a5fd0844..52fdb0ed 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditAPI.java
@@ -193,16 +193,19 @@ public interface RedditAPI {
@GET("/comments/{id}/placeholder/{singleCommentId}.json?context=8&raw_json=1")
Call<String> getPostAndCommentsSingleThreadByIdOauth(@Path("id") String id, @Path("singleCommentId") String singleCommentId,
+ @Query("sort") String sortType,
@HeaderMap Map<String, String> headers);
@GET("/comments/{id}.json?raw_json=1")
- Call<String> getPostAndCommentsByIdOauth(@Path("id") String id, @HeaderMap Map<String, String> headers);
+ Call<String> getPostAndCommentsByIdOauth(@Path("id") String id, @Query("sort") String sortType,
+ @HeaderMap Map<String, String> headers);
@GET("/comments/{id}/placeholder/{singleCommentId}.json?context=8&raw_json=1")
- Call<String> getPostAndCommentsSingleThreadById(@Path("id") String id, @Path("singleCommentId") String singleCommentId);
+ Call<String> getPostAndCommentsSingleThreadById(@Path("id") String id, @Path("singleCommentId") String singleCommentId,
+ @Query("sort") String sortType);
@GET("/comments/{id}.json?raw_json=1")
- Call<String> getPostAndCommentsById(@Path("id") String id);
+ Call<String> getPostAndCommentsById(@Path("id") String id, @Query("sort") String sortType);
@Multipart
@POST(".")
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java
index 372eaabb..334aff47 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java
@@ -45,4 +45,5 @@ public class SharedPreferencesUtils {
public static final String SORT_TIME_USER_COMMENT = "sort_time_user_comment";
public static final String SORT_TYPE_SEARCH_SUBREDDIT = "sort_type_search_subreddit";
public static final String SORT_TYPE_SEARCH_USER = "sort_type_search_user";
+ public static final String SORT_TYPE_POST_COMMENT = "sort_type_post_comment";
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SortType.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SortType.java
index 39502a2d..fe50d884 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SortType.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SortType.java
@@ -32,7 +32,11 @@ public class SortType {
CONTROVERSIAL("controversial"),
RELEVANCE("relevance"),
COMMENTS("comments"),
- ACTIVITY("activity");
+ ACTIVITY("activity"),
+ CONFIDENCE("confidence"),
+ OLD("old"),
+ QA("qa"),
+ LIVE("live");
public final String value;
diff --git a/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml
new file mode 100644
index 00000000..7673abba
--- /dev/null
+++ b/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ tools:context=".Fragment.PostCommentSortTypeBottomSheetFragment">
+
+ <TextView
+ android:id="@+id/best_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sort_best"
+ android:textColor="@color/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/confidence_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sort_confidence"
+ android:textColor="@color/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/top_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sort_top"
+ android:textColor="@color/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/new_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sort_new"
+ android:textColor="@color/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/controversial_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sort_controversial"
+ android:textColor="@color/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/old_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sort_old"
+ android:textColor="@color/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/random_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sort_random"
+ android:textColor="@color/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/qa_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sort_qa"
+ android:textColor="@color/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+ <TextView
+ android:id="@+id/live_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/sort_live"
+ android:textColor="@color/primaryTextColor"
+ android:textSize="?attr/font_default"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:paddingStart="32dp"
+ android:paddingEnd="32dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/menu/view_post_detail_activity.xml b/app/src/main/res/menu/view_post_detail_activity.xml
index 63c2106f..4f33f387 100644
--- a/app/src/main/res/menu/view_post_detail_activity.xml
+++ b/app/src/main/res/menu/view_post_detail_activity.xml
@@ -17,53 +17,60 @@
android:visible="false" />
<item
- android:id="@+id/action_refresh_view_post_detail_activity"
+ android:id="@+id/action_sort_view_post_detail_activity"
android:orderInCategory="3"
+ android:title="@string/action_sort"
+ app:showAsAction="never"
+ android:visible="false" />
+
+ <item
+ android:id="@+id/action_refresh_view_post_detail_activity"
+ android:orderInCategory="4"
android:title="@string/action_refresh"
app:showAsAction="never" />
<item
android:id="@+id/action_view_crosspost_parent_view_post_detail_activity"
- android:orderInCategory="4"
+ android:orderInCategory="5"
android:title="@string/action_view_crosspost_parent"
app:showAsAction="never"
android:visible="false" />
<item
android:id="@+id/action_hide_view_post_detail_activity"
- android:orderInCategory="5"
+ android:orderInCategory="6"
app:showAsAction="never"
android:visible="false" />
<item
android:id="@+id/action_edit_view_post_detail_activity"
- android:orderInCategory="6"
+ android:orderInCategory="7"
android:title="@string/action_edit_post"
app:showAsAction="never"
android:visible="false" />
<item
android:id="@+id/action_delete_view_post_detail_activity"
- android:orderInCategory="7"
+ android:orderInCategory="8"
android:title="@string/action_delete_post"
app:showAsAction="never"
android:visible="false" />
<item
android:id="@+id/action_nsfw_view_post_detail_activity"
- android:orderInCategory="8"
+ android:orderInCategory="9"
app:showAsAction="never"
android:visible="false" />
<item
android:id="@+id/action_spoiler_view_post_detail_activity"
- android:orderInCategory="9"
+ android:orderInCategory="10"
app:showAsAction="never"
android:visible="false" />
<item
android:id="@+id/action_edit_flair_view_post_detail_activity"
- android:orderInCategory="10"
+ android:orderInCategory="11"
android:title="@string/action_edit_flair"
app:showAsAction="never"
android:visible="false" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d332d5e0..c0071a81 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -188,6 +188,10 @@
<string name="sort_relevance">Relevance</string>
<string name="sort_comments">Comments</string>
<string name="sort_activity">Activity</string>
+ <string name="sort_confidence">Confidence</string>
+ <string name="sort_old">Old</string>
+ <string name="sort_qa">QA</string>
+ <string name="sort_live">Live</string>
<string name="sort_time_hour">Hour</string>
<string name="sort_time_day">Day</string>
<string name="sort_time_week">Week</string>
@@ -343,4 +347,7 @@
<string name="favorites">Favorites</string>
<string name="all">All</string>
+
+ <!-- TODO: Remove or change this placeholder text -->
+ <string name="hello_blank_fragment">Hello blank fragment</string>
</resources>