diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-02-20 07:10:50 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-02-20 07:10:50 +0000 |
commit | d9b9a7c3c13303e2f61b2cb557ab96ec1a23a7ac (patch) | |
tree | 2aab31e5591df0378283fee51ce53f44690c3030 | |
parent | 59465390a9e5ec06bfd8d3b46fbcaeedf560f563 (diff) | |
download | infinity-for-reddit-d9b9a7c3c13303e2f61b2cb557ab96ec1a23a7ac.tar infinity-for-reddit-d9b9a7c3c13303e2f61b2cb557ab96ec1a23a7ac.tar.gz infinity-for-reddit-d9b9a7c3c13303e2f61b2cb557ab96ec1a23a7ac.tar.bz2 infinity-for-reddit-d9b9a7c3c13303e2f61b2cb557ab96ec1a23a7ac.tar.lz infinity-for-reddit-d9b9a7c3c13303e2f61b2cb557ab96ec1a23a7ac.tar.xz infinity-for-reddit-d9b9a7c3c13303e2f61b2cb557ab96ec1a23a7ac.tar.zst infinity-for-reddit-d9b9a7c3c13303e2f61b2cb557ab96ec1a23a7ac.zip |
Add an option to show comment dividers. Put theme option to InterfacePreferenceFragment.
12 files changed, 336 insertions, 280 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 a3123182..65711954 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -176,6 +176,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS private boolean mLockFab; private boolean mSwipeUpToHideFab; private boolean mExpandChildren; + private boolean mShowCommentDivider; private LinearLayoutManager mLinearLayoutManager; private CommentAndPostRecyclerViewAdapter mAdapter; private RecyclerView.SmoothScroller mSmoothScroller; @@ -263,6 +264,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS mLockFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false); mSwipeUpToHideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false); mExpandChildren = !mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_TOP_LEVEL_COMMENTS_FIRST, false); + mShowCommentDivider = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_COMMENT_DIVIDER, false); mGlide = Glide.with(this); mLocale = getResources().getConfiguration().locale; @@ -508,7 +510,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS mAdapter = new CommentAndPostRecyclerViewAdapter(ViewPostDetailActivity.this, mRetrofit, mOauthRetrofit, mRedditDataRoomDatabase, mGlide, mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId, isSingleCommentThreadMode, mNeedBlurNsfw, mNeedBlurSpoiler, - mVoteButtonsOnTheRight, mShowElapsedTime, mExpandChildren, + mVoteButtonsOnTheRight, mShowElapsedTime, mExpandChildren, mShowCommentDivider, new CommentAndPostRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() { @Override public void updatePost(Post post) { @@ -631,7 +633,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS mRetrofit, mOauthRetrofit, mRedditDataRoomDatabase, mGlide, mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId, isSingleCommentThreadMode, mNeedBlurNsfw, mNeedBlurSpoiler, - mVoteButtonsOnTheRight, mShowElapsedTime, mExpandChildren, + mVoteButtonsOnTheRight, mShowElapsedTime, mExpandChildren, mShowCommentDivider, new CommentAndPostRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() { @Override public void updatePost(Post post) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 80887700..82270285 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -123,6 +123,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy private boolean mVoteButtonsOnTheRight; private boolean mShowElapsedTime; private boolean mExpandChildren; + private boolean mShowCommentDivider; private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback; private boolean isInitiallyLoading; private boolean isInitiallyLoadingFailed; @@ -138,7 +139,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy String accessToken, String accountName, Post post, Locale locale, String singleCommentId, boolean isSingleCommentThreadMode, boolean needBlurNSFW, boolean needBlurSpoiler, boolean voteButtonsOnTheRight, - boolean showElapsedTime, boolean expandChildren, + boolean showElapsedTime, boolean expandChildren, boolean showCommentDivider, CommentRecyclerViewAdapterCallback commentRecyclerViewAdapterCallback) { mActivity = activity; mRetrofit = retrofit; @@ -229,6 +230,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mVoteButtonsOnTheRight = voteButtonsOnTheRight; mShowElapsedTime = showElapsedTime; mExpandChildren = expandChildren; + mShowCommentDivider = showCommentDivider; mCommentRecyclerViewAdapterCallback = commentRecyclerViewAdapterCallback; isInitiallyLoading = true; isInitiallyLoadingFailed = false; @@ -1940,6 +1942,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy ImageView replyButton; @BindView(R.id.vertical_block_item_post_comment) View verticalBlock; + @BindView(R.id.divider_item_comment) + View commentDivider; CommentViewHolder(View itemView) { super(itemView); @@ -1964,6 +1968,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy constraintSet.setHorizontalBias(moreButton.getId(), 0); constraintSet.applyTo(bottomConstraintLayout); } + + if (mShowCommentDivider) { + commentDivider.setVisibility(View.VISIBLE); + } } } @@ -1972,10 +1980,16 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy View verticalBlock; @BindView(R.id.placeholder_text_view_item_load_more_comments) TextView placeholderTextView; + @BindView(R.id.divider_item_load_more_comments_placeholder) + View commentDivider; LoadMoreChildCommentsViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); + + if (mShowCommentDivider) { + commentDivider.setVisibility(View.VISIBLE); + } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java index a9ee3f9e..1221fff8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java @@ -70,13 +70,15 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment private int mColorAccent; private boolean mVoteButtonsOnTheRight; private boolean mShowElapsedTime; + private boolean mShowCommentDivider; private NetworkState networkState; private RetryLoadingMoreCallback mRetryLoadingMoreCallback; public CommentsListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, String accessToken, String accountName, - boolean voteButtonsOnTheRight, - boolean showElapsedTime, RetryLoadingMoreCallback retryLoadingMoreCallback) { + boolean voteButtonsOnTheRight, boolean showElapsedTime, + boolean showCommentDivider, + RetryLoadingMoreCallback retryLoadingMoreCallback) { super(DIFF_CALLBACK); mContext = context; mOauthRetrofit = oauthRetrofit; @@ -109,6 +111,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment mAccountName = accountName; mVoteButtonsOnTheRight = voteButtonsOnTheRight; mShowElapsedTime = showElapsedTime; + mShowCommentDivider = showCommentDivider; mRetryLoadingMoreCallback = retryLoadingMoreCallback; mTextColorPrimaryDark = mContext.getResources().getColor(R.color.colorPrimaryDarkDayNightTheme); mColorAccent = mContext.getResources().getColor(R.color.colorAccent); @@ -429,6 +432,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment ImageView expandButton; @BindView(R.id.reply_button_item_post_comment) ImageView replyButton; + @BindView(R.id.divider_item_comment) + View commentDivider; DataViewHolder(View itemView) { super(itemView); @@ -452,6 +457,10 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment constraintSet.setHorizontalBias(moreButton.getId(), 0); constraintSet.applyTo(bottomConstraintLayout); } + + if (mShowCommentDivider) { + commentDivider.setVisibility(View.VISIBLE); + } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java index aa5edb94..11a80379 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java @@ -87,6 +87,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni private Activity mActivity; private CommentsListingRecyclerViewAdapter mAdapter; private boolean mShowElapsedTime; + private boolean mShowCommentDivider; public CommentsListingFragment() { // Required empty public constructor @@ -116,6 +117,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni } mShowElapsedTime = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY, false); + mShowCommentDivider = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_COMMENT_DIVIDER, false); if (savedInstanceState == null) { getCurrentAccountAndBindView(resources); @@ -150,7 +152,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni boolean voteButtonsOnTheRight = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY, false); mAdapter = new CommentsListingRecyclerViewAdapter(mActivity, mOauthRetrofit, getArguments().getString(EXTRA_ACCESS_TOKEN), getArguments().getString(EXTRA_ACCOUNT_NAME), - voteButtonsOnTheRight, mShowElapsedTime, () -> mCommentViewModel.retryLoadingMore()); + voteButtonsOnTheRight, mShowElapsedTime, mShowCommentDivider, () -> mCommentViewModel.retryLoadingMore()); String username = getArguments().getString(EXTRA_USERNAME); String sort = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_USER_COMMENT, SortType.Type.NEW.value); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java index 3ce67392..4123f276 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java @@ -1,9 +1,14 @@ package ml.docilealligator.infinityforreddit.Settings; +import android.app.Activity; +import android.content.Context; +import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatDelegate; import androidx.fragment.app.Fragment; import androidx.preference.ListPreference; import androidx.preference.PreferenceFragmentCompat; @@ -19,15 +24,24 @@ import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPref import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; +import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; +import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; +import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO; +import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; + /** * A simple {@link Fragment} subclass. */ public class InterfacePreferenceFragment extends PreferenceFragmentCompat { + private Activity activity; + @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.interface_preference, rootKey); + ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY); + SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY); SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY); SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY); SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY); @@ -35,6 +49,45 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat { ListPreference defaultPostLayoutSwitch = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY); SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT); + boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q; + + if (themePreference != null) { + if (systemDefault) { + themePreference.setEntries(R.array.settings_theme_q); + } else { + themePreference.setEntries(R.array.settings_theme); + } + + themePreference.setOnPreferenceChangeListener((preference, newValue) -> { + int option = Integer.parseInt((String) newValue); + switch (option) { + case 0: + AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); + break; + case 1: + AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); + break; + case 2: + if (systemDefault) { + AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM); + } else { + AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY); + } + } + return true; + }); + } + + if (amoledDarkSwitch != null) { + amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> { + if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) { + EventBus.getDefault().post(new RecreateActivityEvent()); + activity.recreate(); + } + return true; + }); + } + if (immersiveInterfaceSwitch != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { immersiveInterfaceSwitch.setVisible(true); @@ -82,4 +135,10 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat { }); } } + + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + activity = (Activity) context; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java index 58bd8cf1..5733c32e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java @@ -4,13 +4,9 @@ package ml.docilealligator.infinityforreddit.Settings; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; -import android.content.res.Configuration; -import android.os.Build; import android.os.Bundle; import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.preference.ListPreference; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.SwitchPreference; @@ -27,11 +23,6 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; -import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; -import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; -import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO; -import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; - /** * A simple {@link PreferenceFragmentCompat} subclass. */ @@ -46,22 +37,10 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat { setPreferencesFromResource(R.xml.main_preferences, rootKey); ((Infinity) activity.getApplication()).getAppComponent().inject(this); - SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY); SwitchPreference confirmToExitSwitch = findPreference(SharedPreferencesUtils.CONFIRM_TO_EXIT); SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY); SwitchPreference blurNSFWSwitch = findPreference(SharedPreferencesUtils.BLUR_NSFW_KEY); SwitchPreference blurSpoilerSwitch = findPreference(SharedPreferencesUtils.BLUR_SPOILER_KEY); - ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY); - - if (amoledDarkSwitch != null) { - amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> { - if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) { - EventBus.getDefault().post(new RecreateActivityEvent()); - activity.recreate(); - } - return true; - }); - } if (confirmToExitSwitch != null) { confirmToExitSwitch.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @@ -104,35 +83,6 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat { return true; }); } - - boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q; - - if (themePreference != null) { - if (systemDefault) { - themePreference.setEntries(R.array.settings_theme_q); - } else { - themePreference.setEntries(R.array.settings_theme); - } - - themePreference.setOnPreferenceChangeListener((preference, newValue) -> { - int option = Integer.parseInt((String) newValue); - switch (option) { - case 0: - AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); - break; - case 1: - AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); - break; - case 2: - if (systemDefault) { - AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM); - } else { - AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY); - } - } - return true; - }); - } } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java index 3717a6cd..357ee2a5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java @@ -74,4 +74,5 @@ public class SharedPreferencesUtils { public static final String SHOW_TOP_LEVEL_COMMENTS_FIRST = "show_top_level_comments_first"; public static final String CONFIRM_TO_EXIT = "confirm_to_exit"; public static final String LOCK_BOTTOM_APP_BAR = "lock_bottom_app_bar"; + public static final String SHOW_COMMENT_DIVIDER = "show_comment_divider"; } diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml index c303efaa..f80d6bfb 100644 --- a/app/src/main/res/layout/item_comment.xml +++ b/app/src/main/res/layout/item_comment.xml @@ -4,219 +4,219 @@ android:id="@+id/linear_layout_item_comment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:orientation="vertical" android:background="?attr/cardViewBackgroundColor"> - <View - android:id="@+id/vertical_block_item_post_comment" - android:layout_width="0dp" - android:layout_height="match_parent" - android:background="@color/colorPrimaryDarkDayNightTheme"/> - <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="12dp" - android:layout_marginBottom="12dp" - android:orientation="vertical"> + android:layout_height="wrap_content"> - <androidx.constraintlayout.widget.ConstraintLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="16dp" - android:paddingEnd="16dp"> - - <ImageView - android:id="@+id/author_type_image_view_item_comment" - android:layout_width="?attr/font_default" - android:layout_height="?attr/font_default" - android:layout_marginEnd="4dp" - android:visibility="gone" - app:layout_constraintBottom_toTopOf="@id/author_flair_text_view_item_post_comment" - app:layout_constraintEnd_toStartOf="@id/author_text_view_item_post_comment" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/author_text_view_item_post_comment" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginEnd="8dp" - android:ellipsize="end" - android:maxLines="2" - android:textColor="@color/colorPrimaryDarkDayNightTheme" - android:textSize="?attr/font_default" - app:layout_constraintBottom_toTopOf="@id/author_flair_text_view_item_post_comment" - app:layout_constraintEnd_toStartOf="@+id/barrier" - app:layout_constraintStart_toEndOf="@id/author_type_image_view_item_comment" - app:layout_constraintTop_toTopOf="parent" /> + <View + android:id="@+id/vertical_block_item_post_comment" + android:layout_width="0dp" + android:layout_height="match_parent" + android:background="@color/colorPrimaryDarkDayNightTheme"/> - <TextView - android:id="@+id/author_flair_text_view_item_post_comment" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginEnd="8dp" - android:ellipsize="end" - android:maxLines="2" - android:textColor="@color/authorFlairTextColor" - android:textSize="?attr/font_12" - android:visibility="gone" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/barrier" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/author_text_view_item_post_comment" /> - - <TextView - android:id="@+id/comment_time_text_view_item_post_comment" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:gravity="end" - android:textSize="?attr/font_default" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <androidx.constraintlayout.widget.Barrier - android:id="@+id/barrier" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:barrierDirection="start" - app:constraint_referenced_ids="comment_time_text_view_item_post_comment" /> - - </androidx.constraintlayout.widget.ConstraintLayout> - - <TextView - android:id="@+id/comment_markdown_view_item_post_comment" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="8dp" - android:textColor="@color/primaryTextColor" - android:textSize="?attr/content_font_default" /> - - <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/bottom_constraint_layout_item_post_comment" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingStart="4dp" - android:paddingEnd="4dp"> + android:layout_marginTop="12dp" + android:layout_marginBottom="12dp" + android:orientation="vertical"> - <ImageView - android:id="@+id/up_vote_button_item_post_comment" - android:layout_width="wrap_content" + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingStart="8dp" - android:paddingEnd="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_arrow_upward_grey_24dp" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" /> + android:paddingStart="16dp" + android:paddingEnd="16dp"> + + <ImageView + android:id="@+id/author_type_image_view_item_comment" + android:layout_width="?attr/font_default" + android:layout_height="?attr/font_default" + android:layout_marginEnd="4dp" + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@id/author_flair_text_view_item_post_comment" + app:layout_constraintEnd_toStartOf="@id/author_text_view_item_post_comment" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/author_text_view_item_post_comment" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:ellipsize="end" + android:maxLines="2" + android:textColor="@color/colorPrimaryDarkDayNightTheme" + android:textSize="?attr/font_default" + app:layout_constraintBottom_toTopOf="@id/author_flair_text_view_item_post_comment" + app:layout_constraintEnd_toStartOf="@+id/barrier" + app:layout_constraintStart_toEndOf="@id/author_type_image_view_item_comment" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/author_flair_text_view_item_post_comment" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:ellipsize="end" + android:maxLines="2" + android:textColor="@color/authorFlairTextColor" + android:textSize="?attr/font_12" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/barrier" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/author_text_view_item_post_comment" /> + + <TextView + android:id="@+id/comment_time_text_view_item_post_comment" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:gravity="end" + android:textSize="?attr/font_default" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <androidx.constraintlayout.widget.Barrier + android:id="@+id/barrier" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:barrierDirection="start" + app:constraint_referenced_ids="comment_time_text_view_item_post_comment" /> + + </androidx.constraintlayout.widget.ConstraintLayout> <TextView - android:id="@+id/score_text_view_item_post_comment" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - app:layout_constraintStart_toEndOf="@+id/up_vote_button_item_post_comment" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - <ImageView - android:id="@+id/down_vote_button_item_post_comment" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingStart="8dp" - android:paddingEnd="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_arrow_downward_grey_24dp" - android:tint="@android:color/tab_indicator_text" - app:layout_constraintStart_toEndOf="@+id/score_text_view_item_post_comment" - app:layout_constraintEnd_toStartOf="@id/more_button_item_post_comment" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintHorizontal_bias="0" /> - - <ImageView - android:id="@+id/more_button_item_post_comment" - android:layout_width="wrap_content" + android:id="@+id/comment_markdown_view_item_post_comment" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingStart="8dp" - android:paddingEnd="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_more_vert_grey_24dp" - app:layout_constraintEnd_toStartOf="@+id/expand_button_item_post_comment" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - <ImageView - android:id="@+id/expand_button_item_post_comment" - android:layout_width="wrap_content" + android:layout_marginTop="8dp" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="8dp" + android:textColor="@color/primaryTextColor" + android:textSize="?attr/content_font_default" /> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottom_constraint_layout_item_post_comment" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingStart="8dp" - android:paddingEnd="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_expand_less_grey_24dp" - android:tint="@android:color/tab_indicator_text" - android:visibility="gone" - app:layout_constraintEnd_toStartOf="@+id/save_button_item_post_comment" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - <ImageView - android:id="@+id/save_button_item_post_comment" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingStart="8dp" - android:paddingEnd="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - app:layout_constraintEnd_toStartOf="@+id/reply_button_item_post_comment" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - <ImageView - android:id="@+id/reply_button_item_post_comment" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingStart="8dp" - android:paddingEnd="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_reply_grey_24dp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - <!--<ImageView - android:id="@+id/share_button_item_post_comment" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingStart="8dp" - android:paddingEnd="8dp" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:src="@drawable/ic_share_grey_24dp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/>--> - - </androidx.constraintlayout.widget.ConstraintLayout> + android:paddingStart="4dp" + android:paddingEnd="4dp"> + + <ImageView + android:id="@+id/up_vote_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:src="@drawable/ic_arrow_upward_grey_24dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" /> + + <TextView + android:id="@+id/score_text_view_item_post_comment" + android:layout_width="64dp" + android:layout_height="wrap_content" + android:gravity="center" + android:textSize="?attr/font_12" + android:textStyle="bold" + app:layout_constraintStart_toEndOf="@+id/up_vote_button_item_post_comment" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + + <ImageView + android:id="@+id/down_vote_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:src="@drawable/ic_arrow_downward_grey_24dp" + android:tint="@android:color/tab_indicator_text" + app:layout_constraintStart_toEndOf="@+id/score_text_view_item_post_comment" + app:layout_constraintEnd_toStartOf="@id/more_button_item_post_comment" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintHorizontal_bias="0" /> + + <ImageView + android:id="@+id/more_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:src="@drawable/ic_more_vert_grey_24dp" + app:layout_constraintEnd_toStartOf="@+id/expand_button_item_post_comment" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + + <ImageView + android:id="@+id/expand_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:src="@drawable/ic_expand_less_grey_24dp" + android:tint="@android:color/tab_indicator_text" + android:visibility="gone" + app:layout_constraintEnd_toStartOf="@+id/save_button_item_post_comment" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + + <ImageView + android:id="@+id/save_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + app:layout_constraintEnd_toStartOf="@+id/reply_button_item_post_comment" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + + <ImageView + android:id="@+id/reply_button_item_post_comment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingStart="8dp" + android:paddingEnd="8dp" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:src="@drawable/ic_reply_grey_24dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent"/> + + </androidx.constraintlayout.widget.ConstraintLayout> + + </LinearLayout> </LinearLayout> + <View + android:id="@+id/divider_item_comment" + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/dividerColor" + android:visibility="gone" /> + </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_load_more_comments_placeholder.xml b/app/src/main/res/layout/item_load_more_comments_placeholder.xml index 9d10a62b..099e4a9a 100644 --- a/app/src/main/res/layout/item_load_more_comments_placeholder.xml +++ b/app/src/main/res/layout/item_load_more_comments_placeholder.xml @@ -2,22 +2,35 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" + android:orientation="vertical" android:background="?attr/cardViewBackgroundColor"> - <View - android:id="@+id/vertical_block_item_load_more_comments" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:background="@color/colorPrimaryDarkDayNightTheme" /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <View + android:id="@+id/vertical_block_item_load_more_comments" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:background="@color/colorPrimaryDarkDayNightTheme" /> - <TextView - android:id="@+id/placeholder_text_view_item_load_more_comments" + <TextView + android:id="@+id/placeholder_text_view_item_load_more_comments" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:padding="8dp" + android:text="@string/comment_load_more_comments" + android:textColor="@color/primaryTextColor" + android:textSize="?attr/font_default" /> + + </LinearLayout> + + <View + android:id="@+id/divider_item_load_more_comments_placeholder" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center" - android:padding="8dp" - android:text="@string/comment_load_more_comments" - android:textColor="@color/primaryTextColor" - android:textSize="?attr/font_default" /> + android:layout_height="1dp" + android:background="@color/dividerColor" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 17975d8a..ebc48af0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -308,6 +308,7 @@ <string name="settings_mute_video_title">Mute Video</string> <string name="settings_confirm_to_exit">Confirm to Exit</string> <string name="settings_show_top_level_comments_first_title">Show Top-level Comments First</string> + <string name="settings_show_comment_divider_title">Show comment divider</string> <string name="settings_show_elapsed_time">Show Elapsed Time in Posts and Comments</string> <string name="settings_default_post_layout">Default Post Layout</string> <string name="settings_show_divider_in_compact_layout">Show Divider in Compact Layout</string> diff --git a/app/src/main/res/xml/interface_preference.xml b/app/src/main/res/xml/interface_preference.xml index 626f1333..f3e1dabe 100644 --- a/app/src/main/res/xml/interface_preference.xml +++ b/app/src/main/res/xml/interface_preference.xml @@ -2,6 +2,19 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> + <ListPreference + app:defaultValue="2" + app:entryValues="@array/settings_theme_values" + app:key="theme" + app:icon="@drawable/ic_outline_color_lens_24px" + app:title="@string/settings_theme_title" + app:useSimpleSummaryProvider="true" /> + + <SwitchPreference + app:defaultValue="false" + app:key="amoled_dark" + app:title="@string/settings_amoled_dark_title" /> + <Preference app:title="@string/settings_font_size_title" app:icon="@drawable/ic_font_size_24dp" @@ -46,4 +59,9 @@ app:key="show_top_level_comments_first" app:title="@string/settings_show_top_level_comments_first_title" /> + <SwitchPreference + app:defaultValue="false" + app:key="show_comment_divider" + app:title="@string/settings_show_comment_divider_title" /> + </PreferenceScreen>
\ No newline at end of file diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml index 550525ef..d95e675f 100644 --- a/app/src/main/res/xml/main_preferences.xml +++ b/app/src/main/res/xml/main_preferences.xml @@ -7,19 +7,6 @@ app:title="@string/settings_notification_master_title" app:fragment="ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment" /> - <ListPreference - app:defaultValue="2" - app:entryValues="@array/settings_theme_values" - app:key="theme" - app:icon="@drawable/ic_outline_color_lens_24px" - app:title="@string/settings_theme_title" - app:useSimpleSummaryProvider="true" /> - - <SwitchPreference - app:defaultValue="false" - app:key="amoled_dark" - app:title="@string/settings_amoled_dark_title" /> - <Preference app:icon="@drawable/ic_interface_24dp" app:title="@string/settings_interface_title" |