Compact post layout is available. Fixed WebView cannot be inflated on Android Lollipop. Tweak the comment item UI.

This commit is contained in:
Alex Ning 2019-11-09 00:40:14 +08:00
parent b62ab6f443
commit 0839249644
16 changed files with 1454 additions and 213 deletions

View File

@ -43,6 +43,8 @@ public class LoginActivity extends BaseActivity {
@BindView(R.id.toolbar_login_activity)
Toolbar toolbar;
@BindView(R.id.webview_login_activity)
WebView webView;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@ -68,7 +70,6 @@ public class LoginActivity extends BaseActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
WebView webView = findViewById(R.id.webview_login_activity);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);

View File

@ -73,6 +73,7 @@ import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FetchMyInfo;
import ml.docilealligator.infinityforreddit.FetchSubscribedThing;
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
import ml.docilealligator.infinityforreddit.Fragment.PostLayoutBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.PostTypeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.SortTimeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.SortTypeBottomSheetFragment;
@ -94,7 +95,7 @@ import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit;
public class MainActivity extends BaseActivity implements SortTypeSelectionCallback,
PostTypeBottomSheetFragment.PostTypeSelectionCallback {
PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback {
static final String EXTRA_POST_TYPE = "EPT";
static final String EXTRA_MESSSAGE_FULLNAME = "ENF";
@ -181,6 +182,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
private SortTypeBottomSheetFragment bestSortTypeBottomSheetFragment;
private SortTypeBottomSheetFragment popularAndAllSortTypeBottomSheetFragment;
private SortTimeBottomSheetFragment sortTimeBottomSheetFragment;
private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
@ -283,6 +285,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
popularAndAllSortTypeBottomSheetFragment.setArguments(popularBundle);
sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment();
postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
setSupportActionBar(toolbar);
@ -845,6 +848,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
}
}
return true;
case R.id.action_change_post_layout_main_activity:
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
}
return false;
}
@ -917,6 +922,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
}
}
@Override
public void postLayoutSelected(int postLayout) {
sectionsPagerAdapter.changePostLayout(postLayout);
}
public void postScrollUp() {
fab.show();
}
@ -1261,5 +1271,41 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
allPostFragment.changeNSFW(nsfw);
}
}
void changePostLayout(int postLayout) {
if (mAccessToken == null) {
if (viewPager.getCurrentItem() == 0) {
if (popularPostFragment != null) {
mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_POPULAR_POST, postLayout).apply();
((FragmentCommunicator) popularPostFragment).changePostLayout(postLayout);
}
} else {
if (allPostFragment != null) {
mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_ALL_POST, postLayout).apply();
((FragmentCommunicator) allPostFragment).changePostLayout(postLayout);
}
}
} else {
switch (viewPager.getCurrentItem()) {
case 0:
if (frontPagePostFragment != null) {
mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_FRONT_PAGE_POST, postLayout).apply();
((FragmentCommunicator) frontPagePostFragment).changePostLayout(postLayout);
}
break;
case 1:
if (popularPostFragment != null) {
mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_POPULAR_POST, postLayout).apply();
((FragmentCommunicator) popularPostFragment).changePostLayout(postLayout);
}
break;
case 2:
if (allPostFragment != null) {
mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_ALL_POST, postLayout).apply();
((FragmentCommunicator) allPostFragment).changePostLayout(postLayout);
}
}
}
}
}
}

View File

@ -606,7 +606,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mMarkwon.setMarkdown(((CommentViewHolder) holder).commentMarkdownView, comment.getCommentContent());
((CommentViewHolder) holder).scoreTextView.setText(Integer.toString(comment.getScore() + comment.getVoteType()));
((CommentViewHolder) holder).itemView.setPadding(comment.getDepth() * 16, 0, 0, 0);
((CommentViewHolder) holder).itemView.setPadding(comment.getDepth() * 8, 0, 0, 0);
if (comment.getDepth() > 0) {
switch (comment.getDepth() % 7) {
case 0:
@ -639,7 +639,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
break;
}
ViewGroup.LayoutParams params = ((CommentViewHolder) holder).verticalBlock.getLayoutParams();
params.width = 16;
params.width = 8;
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
}
@ -944,7 +944,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
placeholder = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getAdapterPosition() - 2)
: mVisibleComments.get(holder.getAdapterPosition() - 1);
((LoadMoreChildCommentsViewHolder) holder).itemView.setPadding(placeholder.getDepth() * 16, 0, 0, 0);
((LoadMoreChildCommentsViewHolder) holder).itemView.setPadding(placeholder.getDepth() * 8, 0, 0, 0);
if (placeholder.getDepth() > 0) {
switch (placeholder.getDepth() % 7) {
case 0:
@ -978,7 +978,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
ViewGroup.LayoutParams params = ((LoadMoreChildCommentsViewHolder) holder).verticalBlock.getLayoutParams();
params.width = 16;
params.width = 8;
((LoadMoreChildCommentsViewHolder) holder).verticalBlock.setLayoutParams(params);
}

View File

@ -0,0 +1,28 @@
package ml.docilealligator.infinityforreddit.CustomView;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.util.AttributeSet;
import android.webkit.WebView;
public class LollipopBugFixedWebView extends WebView{
public LollipopBugFixedWebView(Context context) {
super(getFixedContext(context));
}
public LollipopBugFixedWebView(Context context, AttributeSet attrs) {
super(getFixedContext(context), attrs);
}
public LollipopBugFixedWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(getFixedContext(context), attrs, defStyleAttr);
}
// To fix Android Lollipop WebView problem create a new configuration on that Android version only
private static Context getFixedContext(Context context) {
if (Build.VERSION.SDK_INT == 21 || Build.VERSION.SDK_INT == 22) // Android Lollipop 5.0 & 5.1
return context.createConfigurationContext(new Configuration());
return context;
}
}

View File

@ -28,6 +28,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.paging.PagedList;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView;
@ -118,6 +119,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
private LazyModeRunnable lazyModeRunnable;
private CountDownTimer resumeLazyModeCountDownTimer;
private float lazyModeInterval;
private int postLayout;
public PostFragment() {
// Required empty public constructor
@ -287,9 +289,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
String sort = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_POST, SortType.Type.RELEVANCE.name());
String sortTime = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, SortType.Time.ALL.name());
SortType sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SEARCH_POST, SharedPreferencesUtils.POST_LAYOUT_CARD);
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
accessToken, postType, true, needBlurNsfw, needBlurSpoiler,
accessToken, postType, postLayout, true, needBlurNsfw, needBlurSpoiler,
voteButtonsOnTheRight, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
@ -329,17 +332,20 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
sortTime = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_POPULAR_POST, SortType.Time.ALL.name());
}
postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_POPULAR_POST, SharedPreferencesUtils.POST_LAYOUT_CARD);
} else {
sort = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_ALL_POST, SortType.Type.HOT.name());
if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
sortTime = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_ALL_POST, SortType.Time.ALL.name());
}
postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_ALL_POST, SharedPreferencesUtils.POST_LAYOUT_CARD);
}
} else {
sort = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST, SortType.Type.HOT.name());
if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
sortTime = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST, SortType.Time.ALL.name());
}
postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST, SharedPreferencesUtils.POST_LAYOUT_CARD);
}
if(sortTime != null) {
@ -349,7 +355,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
}
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
accessToken, postType, displaySubredditName, needBlurNsfw, needBlurSpoiler,
accessToken, postType, postLayout, displaySubredditName, needBlurNsfw, needBlurSpoiler,
voteButtonsOnTheRight, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
@ -392,9 +398,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
} else {
sortType = new SortType(SortType.Type.valueOf(sort));
}
postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST, SharedPreferencesUtils.POST_LAYOUT_CARD);
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
accessToken, postType, true, needBlurNsfw, needBlurSpoiler,
accessToken, postType, postLayout, true, needBlurNsfw, needBlurSpoiler,
voteButtonsOnTheRight, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
@ -430,9 +437,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
} else {
sortType = new SortType(SortType.Type.valueOf(sort));
}
postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_FRONT_PAGE_POST, SharedPreferencesUtils.POST_LAYOUT_CARD);
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
accessToken, postType, true, needBlurNsfw, needBlurSpoiler,
accessToken, postType, postLayout, true, needBlurNsfw, needBlurSpoiler,
voteButtonsOnTheRight, new PostRecyclerViewAdapter.Callback() {
@Override
public void retryLoadingMore() {
@ -608,6 +616,14 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
return isInLazyMode;
}
@Override
public void changePostLayout(int postLayout) {
if (mAdapter != null) {
mAdapter.setPostLayout(postLayout);
refreshAdapter();
}
}
@Subscribe
public void onPostUpdateEvent(PostUpdateEventToPostList event) {
PagedList<Post> posts = mAdapter.getCurrentList();

View File

@ -0,0 +1,65 @@
package ml.docilealligator.infinityforreddit.Fragment;
import android.app.Activity;
import android.content.Context;
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.SharedPreferencesUtils;
/**
* A simple {@link Fragment} subclass.
*/
public class PostLayoutBottomSheetFragment extends RoundedBottomSheetDialogFragment {
@BindView(R.id.card_layout_text_view_post_layout_bottom_sheet_fragment)
TextView cardLayoutTextView;
@BindView(R.id.compact_layout_text_view_post_layout_bottom_sheet_fragment)
TextView compactLayoutTextView;
private Activity activity;
public PostLayoutBottomSheetFragment() {
// 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_layot_bottom_sheet, container, false);
ButterKnife.bind(this, rootView);
cardLayoutTextView.setOnClickListener(view -> {
((PostLayoutSelectionCallback) activity).postLayoutSelected(SharedPreferencesUtils.POST_LAYOUT_CARD);
dismiss();
});
compactLayoutTextView.setOnClickListener(view -> {
((PostLayoutSelectionCallback) activity).postLayoutSelected(SharedPreferencesUtils.POST_LAYOUT_COMPACT);
dismiss();
});
return rootView;
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
this.activity = (Activity) context;
}
public interface PostLayoutSelectionCallback {
void postLayoutSelected(int postLayout);
}
}

View File

@ -2,6 +2,7 @@ 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;
@ -10,6 +11,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
@ -36,6 +38,7 @@ public class PostTypeBottomSheetFragment extends RoundedBottomSheetDialogFragmen
LinearLayout imageTypeLinearLayout;
@BindView(R.id.video_type_linear_layout_post_type_bottom_sheet_fragment)
LinearLayout videoTypeLinearLayout;
private Activity activity;
public PostTypeBottomSheetFragment() {
// Required empty public constructor
}
@ -46,38 +49,39 @@ public class PostTypeBottomSheetFragment extends RoundedBottomSheetDialogFragmen
View rootView = inflater.inflate(R.layout.fragment_post_type_bottom_sheet, container, false);
ButterKnife.bind(this, rootView);
Activity activity = getActivity();
if (activity != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
}
textTypeLinearLayout.setOnClickListener(view -> {
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_TEXT);
dismiss();
});
linkTypeLinearLayout.setOnClickListener(view -> {
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_LINK);
dismiss();
});
imageTypeLinearLayout.setOnClickListener(view -> {
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_IMAGE);
dismiss();
});
videoTypeLinearLayout.setOnClickListener(view -> {
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_VIDEO);
dismiss();
});
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);
}
textTypeLinearLayout.setOnClickListener(view -> {
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_TEXT);
dismiss();
});
linkTypeLinearLayout.setOnClickListener(view -> {
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_LINK);
dismiss();
});
imageTypeLinearLayout.setOnClickListener(view -> {
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_IMAGE);
dismiss();
});
videoTypeLinearLayout.setOnClickListener(view -> {
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_VIDEO);
dismiss();
});
return rootView;
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
this.activity = (Activity) context;
}
public interface PostTypeSelectionCallback {
void postTypeSelected(int postType);

View File

@ -23,4 +23,6 @@ public interface FragmentCommunicator {
return false;
}
default void changePostLayout(int postLayout) { }
}

View File

@ -47,4 +47,12 @@ public class SharedPreferencesUtils {
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";
public static final String POST_LAYOUT_FRONT_PAGE_POST = "post_layout_best_post";
public static final String POST_LAYOUT_POPULAR_POST = "post_layout_popular_post";
public static final String POST_LAYOUT_ALL_POST = "post_layout_all_post";
public static final String POST_LAYOUT_SUBREDDIT_POST = "post_layout_subreddit_post";
public static final String POST_LAYOUT_USER_POST = "post_layout_user_post";
public static final String POST_LAYOUT_SEARCH_POST = "post_layout_search_post";
public static final int POST_LAYOUT_CARD = 0;
public static final int POST_LAYOUT_COMPACT = 1;
}

View File

@ -22,7 +22,7 @@
</com.google.android.material.appbar.AppBarLayout>
<WebView
<ml.docilealligator.infinityforreddit.CustomView.LollipopBugFixedWebView
android:id="@+id/webview_login_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="8dp"
android:overScrollMode="never"
tools:context=".Fragment.PostLayoutBottomSheetFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/card_layout_text_view_post_layout_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="32dp"
android:paddingBottom="16dp"
android:text="@string/post_layout_card"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_default" />
<TextView
android:id="@+id/compact_layout_text_view_post_layout_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="32dp"
android:paddingBottom="16dp"
android:text="@string/post_layout_compact"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_default" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -89,8 +89,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/content_font_default" />

View File

@ -0,0 +1,358 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView
android:id="@+id/icon_gif_image_view_item_post_compact"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/name_text_view_item_post_compact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:textColor="#E91E63"
android:textSize="?attr/font_default"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_compact"
app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_compact"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/stickied_post_image_view_item_post_compact"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:tint="@color/backgroundColorPrimaryDark"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintStart_toEndOf="@id/name_text_view_item_post_compact"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/post_time_text_view_best_item_post_compact"
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_constraintStart_toEndOf="@id/guideline2"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.6" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/title_text_view_best_item_post_compact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/title_font_18"
app:layout_constraintBottom_toTopOf="@id/flow_layout_item_post_compact"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/barrier2"
app:layout_constraintTop_toTopOf="parent"
tools:text="asdfas fas dfa sdfa sdfa sdfasdfasdf asdfasdfasdf" />
<com.nex3z.flowlayout.FlowLayout
android:id="@+id/flow_layout_item_post_compact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="16dp"
app:layout_constraintTop_toBottomOf="@id/title_text_view_best_item_post_compact"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/barrier2"
app:layout_constraintBottom_toTopOf="@id/link_text_view_item_post_compact"
app:flChildSpacing="16dp"
app:flChildSpacingForLastRow="align"
app:flRowSpacing="8dp">
<com.libRG.CustomTextView
android:id="@+id/type_text_view_item_post_compact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
android:textColor="@android:color/white"
android:textSize="?attr/font_12"
app:lib_setRadius="3dp"
app:lib_setRoundedBGColor="@color/backgroundColorPrimaryDark"
app:lib_setRoundedBorderColor="@color/backgroundColorPrimaryDark"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
android:id="@+id/spoiler_custom_text_view_item_post_compact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="4dp"
android:text="@string/spoiler"
android:textColor="@android:color/white"
android:textSize="?attr/font_12"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBGColor="@color/spoilerBackgroundColor"
app:lib_setRoundedBorderColor="@color/spoilerBackgroundColor"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
android:id="@+id/nsfw_text_view_item_post_compact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
android:text="@string/nsfw"
android:textColor="@android:color/white"
android:textSize="?attr/font_12"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBGColor="@color/colorAccent"
app:lib_setRoundedBorderColor="@color/colorAccent"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
<com.libRG.CustomTextView
android:id="@+id/flair_custom_text_view_item_post_compact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="4dp"
android:textColor="@android:color/white"
android:textSize="?attr/font_12"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBGColor="@color/flairBackgroundColor"
app:lib_setRoundedBorderColor="@color/flairBackgroundColor"
app:lib_setRoundedView="true"
app:lib_setShape="rectangle" />
<TextView
android:id="@+id/gilded_number_text_view_item_post_compact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/gold"
android:drawablePadding="4dp"
android:textColor="@color/gold"
android:textSize="?attr/font_default"
android:visibility="gone" />
<ImageView
android:id="@+id/archived_image_view_item_post_compact"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_archive_outline"
android:tint="@color/archivedTint"
android:visibility="gone" />
<ImageView
android:id="@+id/locked_image_view_item_post_compact"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_outline_lock"
android:tint="@color/lockedIconTint"
android:visibility="gone" />
<ImageView
android:id="@+id/crosspost_image_view_item_post_compact"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/crosspost"
android:tint="@color/colorAccent"
android:visibility="gone" />
</com.nex3z.flowlayout.FlowLayout>
<TextView
android:id="@+id/link_text_view_item_post_compact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textSize="?attr/font_12"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/flow_layout_item_post_compact"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/barrier2"
app:layout_constraintBottom_toBottomOf="parent"
tools:text="www.example.com"
tools:visibility="visible" />
<RelativeLayout
android:id="@+id/image_view_wrapper_item_post_compact"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginEnd="16dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/barrier2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible">
<ProgressBar
android:id="@+id/progress_bar_item_post_compact"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_centerInParent="true" />
<ImageView
android:id="@+id/image_view_best_post_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</RelativeLayout>
<ImageView
android:id="@+id/image_view_no_preview_link_item_post_compact"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_marginEnd="16dp"
android:scaleType="center"
android:src="@drawable/ic_link"
android:tint="@android:color/tab_indicator_text"
android:background="@color/grey"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/barrier2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="image_view_wrapper_item_post_compact,image_view_no_preview_link_item_post_compact"
tools:layout_editor_absoluteX="411dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bottom_constraint_layout_item_post_compact"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/plus_button_item_post_compact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="12dp"
android:src="@drawable/ic_arrow_upward_grey_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/score_text_view_item_post_compact"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/plus_button_item_post_compact"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/minus_button_item_post_compact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="12dp"
android:src="@drawable/ic_arrow_downward_grey_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_compact"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/comments_count_item_post_compact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_comment_grey_24dp"
android:drawablePadding="12dp"
android:gravity="center_vertical"
android:padding="12dp"
android:textSize="?attr/font_12"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_compact"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/save_button_item_post_compact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/share_button_item_post_compact"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toEndOf="@id/comments_count_item_post_compact"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/share_button_item_post_compact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="12dp"
android:src="@drawable/ic_share_grey_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dividerColor" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -36,4 +36,10 @@
android:orderInCategory="5"
android:title="@string/action_start_lazy_mode"
app:showAsAction="never" />
<item
android:id="@+id/action_change_post_layout_main_activity"
android:orderInCategory="6"
android:title="@string/action_change_post_layout"
app:showAsAction="never" />
</menu>

View File

@ -41,6 +41,7 @@
<string name="action_mark_spoiler">Mark Spoiler</string>
<string name="action_unmark_spoiler">Unmark Spoiler</string>
<string name="action_edit_flair">Edit Flair</string>
<string name="action_change_post_layout">Change Post Layout</string>
<string name="parse_json_response_error">Error occurred when parsing the JSON response</string>
<string name="retrieve_token_error">Error Retrieving the token</string>
@ -349,6 +350,6 @@
<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>
<string name="post_layout_card">Card Layout</string>
<string name="post_layout_compact">Compact Layout</string>
</resources>