Disable clicking comment icon in a post to submit a comment. Enlarge the icons in comments. Fix regex used to linkify subreddits and users.

This commit is contained in:
Alex Ning 2019-10-25 21:16:09 +08:00
parent 6662f9af34
commit 75452b764d
12 changed files with 69 additions and 70 deletions

View File

@ -34,7 +34,7 @@ repositories {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'com.google.android.material:material:1.2.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
@ -45,9 +45,9 @@ dependencies {
implementation 'androidx.browser:browser:1.0.0'
implementation 'com.alexvasilkov:gesture-views:2.5.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.github.bumptech.glide:glide:4.10.0'
implementation 'com.github.pwittchen:swipe-rx2:0.3.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
// Room components
implementation "androidx.room:room-runtime:$rootProject.roomVersion"
annotationProcessor "androidx.room:room-compiler:$rootProject.roomVersion"
@ -55,21 +55,21 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion"
annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$rootProject.archLifecycleVersion"
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-scalars:2.6.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.13'
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'com.squareup.retrofit2:converter-scalars:2.6.2'
implementation 'jp.wasabeef:glide-transformations:4.0.0'
implementation 'com.google.dagger:dagger:2.24'
annotationProcessor 'com.google.dagger:dagger-compiler:2.24'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
implementation 'com.google.dagger:dagger:2.25.2'
annotationProcessor 'com.google.dagger:dagger-compiler:2.25.2'
implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
implementation 'com.github.santalu:aspect-ratio-imageview:1.0.6'
implementation 'androidx.paging:paging-runtime:2.1.0'
implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
implementation 'io.noties.markwon:core:4.1.1'
implementation 'io.noties.markwon:linkify:4.1.1'
implementation 'io.noties.markwon:ext-strikethrough:4.1.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.17'
implementation 'io.noties.markwon:core:4.1.2'
implementation 'io.noties.markwon:linkify:4.1.2'
implementation 'io.noties.markwon:ext-strikethrough:4.1.2'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
implementation 'com.github.Ferfalk:SimpleSearchView:0.1.3'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.libRG:customtextview:2.2'

View File

@ -661,7 +661,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (comment.hasReply()) {
if (comment.isExpanded()) {
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_black_22dp);
} else {
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_more_black_20dp);
}
@ -1741,7 +1741,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
} else {
expandChildren(commentPosition);
mVisibleComments.get(commentPosition).setExpanded(true);
expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
expandButton.setImageResource(R.drawable.ic_expand_less_black_22dp);
}
}
}

View File

@ -42,7 +42,6 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.BlurTransformation;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import ml.docilealligator.infinityforreddit.Activity.CommentActivity;
import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity;
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewGIFActivity;
@ -469,6 +468,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
break;
case Post.TEXT_TYPE:
((DataViewHolder) holder).typeTextView.setText(R.string.text);
if (post.getSelfText() != null && !post.getSelfText().equals("")) {
((DataViewHolder) holder).contentTextView.setVisibility(View.VISIBLE);
((DataViewHolder) holder).contentTextView.setText(post.getSelfText());
}
break;
}
@ -614,20 +617,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}, fullName, newVoteType, holder.getAdapterPosition());
});
((DataViewHolder) holder).commentButton.setOnClickListener(view -> {
if (mAccessToken == null) {
Toast.makeText(mContext, R.string.login_first, Toast.LENGTH_SHORT).show();
return;
}
Intent intent = new Intent(mContext, CommentActivity.class);
intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, post.getFullName());
intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, post.getTitle());
intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, false);
intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, 0);
mContext.startActivity(intent);
});
((DataViewHolder) holder).commentsCountTextView.setText(Integer.toString(post.getnComments()));
if (post.isSaved()) {
@ -801,6 +790,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((DataViewHolder) holder).imageView.setVisibility(View.GONE);
((DataViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
((DataViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE);
((DataViewHolder) holder).contentTextView.setVisibility(View.GONE);
((DataViewHolder) holder).upvoteButton.clearColorFilter();
((DataViewHolder) holder).scoreTextView.setTextColor(ContextCompat.getColor(mContext, R.color.defaultTextColor));
((DataViewHolder) holder).downvoteButton.clearColorFilter();
@ -860,14 +850,14 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
RelativeLayout errorRelativeLayout;
@BindView(R.id.image_view_no_preview_link_item_post)
ImageView noPreviewLinkImageView;
@BindView(R.id.content_text_view_item_post)
TextView contentTextView;
@BindView(R.id.plus_button_item_post)
ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post)
TextView scoreTextView;
@BindView(R.id.minus_button_item_post)
ImageView downvoteButton;
@BindView(R.id.comment_button_item_post)
ImageView commentButton;
@BindView(R.id.comments_count_item_post)
TextView commentsCountTextView;
@BindView(R.id.save_button_item_post)

View File

@ -2,7 +2,7 @@ package ml.docilealligator.infinityforreddit;
public class Utils {
public static String addSubredditAndUserLink(String markdown) {
return markdown.replaceAll("(?<!\\s)/{0,1}u/\\w+/{0,1}(?<!\\s)$", "[$0]($0)")
.replaceAll("(?<!\\s)/{0,1}r/\\w+/{0,1}(?<!\\s)$", "[$0]($0)");
return markdown.replaceAll("\n", " ")
.replaceAll("((?<=[\\s])|^)/{0,1}[ru]/\\w+/{0,1}", "[$0]($0)");
}
}

View File

@ -1,4 +1,4 @@
<vector android:height="20dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
<vector android:height="24dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#010101" android:pathData="M20,12l-1.41,-1.41L13,16.17V4h-2v12.17l-5.58,-5.59L4,12l8,8 8,-8z"/>
</vector>

View File

@ -1,4 +1,4 @@
<vector android:height="20dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
<vector android:height="24dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M4,12l1.41,1.41L11,7.83V20h2V7.83l5.58,5.59L20,12l-8,-8 -8,8z"/>
</vector>

View File

@ -1,4 +1,4 @@
<vector android:height="20dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
<vector android:height="24dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/>
</vector>

View File

@ -1,4 +1,4 @@
<vector android:height="20dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
<vector android:height="24dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92s2.92,-1.31 2.92,-2.92c0,-1.61 -1.31,-2.92 -2.92,-2.92zM18,4c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM6,13c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM18,20.02c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1z"/>
</vector>

View File

@ -1,4 +1,4 @@
<vector android:height="20dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
<vector android:height="24dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M10,9V5l-7,7 7,7v-4.1c5,0 8.5,1.6 11,5.1 -1,-5 -4,-10 -11,-11z"/>
</vector>

View File

@ -79,11 +79,11 @@
android:id="@+id/up_vote_button_item_post_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginStart="12dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_arrow_upward_black_20dp"
android:src="@drawable/ic_arrow_upward_black_22dp"
android:tint="@android:color/tab_indicator_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
@ -110,7 +110,7 @@
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_arrow_downward_black_20dp"
android:src="@drawable/ic_arrow_downward_black_22dp"
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"
@ -129,6 +129,21 @@
android:src="@drawable/ic_outline_more_vert_24px"
android:tint="@android:color/tab_indicator_text"
android:visibility="gone"
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:layout_marginEnd="16dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_expand_less_black_22dp"
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"/>
@ -142,21 +157,6 @@
android:clickable="true"
android:focusable="true"
android:tint="@android:color/tab_indicator_text"
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:layout_marginEnd="16dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_expand_less_black_20dp"
android:tint="@android:color/tab_indicator_text"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/share_button_item_post_comment"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
@ -179,7 +179,7 @@
android:id="@+id/reply_button_item_post_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginEnd="12dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"

View File

@ -80,7 +80,19 @@
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textSize="?attr/title_font_18"
android:textColor="@color/primaryTextColor"/>
android:textColor="@color/primaryTextColor" />
<TextView
android:id="@+id/content_text_view_item_post"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:maxLines="4"
android:visibility="gone"
android:textSize="?attr/content_font_default"
android:ellipsize="end" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -336,9 +348,6 @@
android:padding="12dp"
android:src="@drawable/ic_comment_white_24dp"
android:tint="@android:color/tab_indicator_text"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"

View File

@ -31,6 +31,6 @@ task clean(type: Delete) {
}
ext {
roomVersion = '2.2.0-rc01'
archLifecycleVersion = '2.2.0-alpha05'
roomVersion = '2.2.1'
archLifecycleVersion = '2.2.0-rc01'
}