aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-06-13 04:16:04 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-06-13 04:16:04 +0000
commit42c7b316f37b17178518cbf9649a788fcdf0895c (patch)
tree907e829a37a3534691f968179a7d8d43af91329d /app/src/main
parentef8daed5714cd02f57774c86aab6bd0ca454fcb7 (diff)
downloadinfinity-for-reddit-42c7b316f37b17178518cbf9649a788fcdf0895c.tar
infinity-for-reddit-42c7b316f37b17178518cbf9649a788fcdf0895c.tar.gz
infinity-for-reddit-42c7b316f37b17178518cbf9649a788fcdf0895c.tar.bz2
infinity-for-reddit-42c7b316f37b17178518cbf9649a788fcdf0895c.tar.lz
infinity-for-reddit-42c7b316f37b17178518cbf9649a788fcdf0895c.tar.xz
infinity-for-reddit-42c7b316f37b17178518cbf9649a788fcdf0895c.tar.zst
infinity-for-reddit-42c7b316f37b17178518cbf9649a788fcdf0895c.zip
Add CommentActivity for sending comments (not implemented yet). Minor UI tweaks.
Diffstat (limited to '')
-rw-r--r--app/src/main/AndroidManifest.xml15
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java127
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java57
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java35
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java33
-rw-r--r--app/src/main/res/drawable/ic_insert_comment_white_24dp.xml5
-rw-r--r--app/src/main/res/drawable/ic_send_white_24dp.xml5
-rw-r--r--app/src/main/res/layout/activity_comment.xml56
-rw-r--r--app/src/main/res/layout/activity_view_post_detail.xml18
-rw-r--r--app/src/main/res/menu/comment_activity.xml10
-rw-r--r--app/src/main/res/menu/view_post_detail_activity.xml10
-rw-r--r--app/src/main/res/values/strings.xml5
13 files changed, 342 insertions, 41 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e1c3adf1..a0d209a4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -19,17 +19,23 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
- <activity android:name=".SearchActivity"
+ <activity
+ android:name=".CommentActivity"
android:theme="@style/AppTheme.NoActionBar"
+ android:label="@string/comment_activity_label"
+ android:windowSoftInputMode="adjustResize" />
+ <activity
+ android:name=".SearchActivity"
android:label="@string/search_activity_label"
- android:parentActivityName=".MainActivity">
- </activity>
+ android:parentActivityName=".MainActivity"
+ android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBarWithTransparentStatusBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
+
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
@@ -47,7 +53,8 @@
android:theme="@style/AppTheme.ActionBar.Transparent" />
<activity
android:name=".ViewPostDetailActivity"
- android:parentActivityName=".MainActivity" />
+ android:parentActivityName=".MainActivity"
+ android:theme="@style/AppTheme.NoActionBar"/>
<activity
android:name=".ViewSubredditDetailActivity"
android:parentActivityName=".MainActivity"
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
new file mode 100644
index 00000000..0e885b80
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
@@ -0,0 +1,127 @@
+package ml.docilealligator.infinityforreddit;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+
+import com.chinalwb.are.AREditText;
+import com.chinalwb.are.styles.toolbar.IARE_Toolbar;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_AlignmentCenter;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_AlignmentLeft;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_AlignmentRight;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_At;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Bold;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Hr;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Image;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Italic;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Link;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_ListBullet;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_ListNumber;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Quote;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Strikethrough;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Subscript;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Superscript;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Underline;
+import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Video;
+import com.chinalwb.are.styles.toolitems.IARE_ToolItem;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class CommentActivity extends AppCompatActivity {
+
+ static final String COMMENT_PARENT_TEXT = "CPT";
+ static final String EXTRA_COMMENT_DATA = "ECD";
+ static final int WRITE_COMMENT_REQUEST_CODE = 1;
+
+ @BindView(R.id.toolbar_comment_activity) Toolbar toolbar;
+ @BindView(R.id.comment_parent_text_view_comment_activity) TextView commentParentTextView;
+ @BindView(R.id.arEditText) AREditText commentEditor;
+ @BindView(R.id.areToolbar) IARE_Toolbar editorToolbar;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_comment);
+
+ ButterKnife.bind(this);
+
+ setSupportActionBar(toolbar);
+
+ commentParentTextView.setText(getIntent().getExtras().getString(COMMENT_PARENT_TEXT));
+
+ commentEditor.setBackgroundColor(getResources().getColor(android.R.color.transparent));
+
+ initToolbar();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.comment_activity, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ return true;
+ case R.id.action_send_comment_activity:
+ CommentData commentData = null;
+ Intent returnIntent = new Intent();
+ returnIntent.putExtra(EXTRA_COMMENT_DATA, commentData);
+ setResult(RESULT_OK, returnIntent);
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ private void initToolbar() {
+ IARE_ToolItem bold = new ARE_ToolItem_Bold();
+ IARE_ToolItem italic = new ARE_ToolItem_Italic();
+ IARE_ToolItem underline = new ARE_ToolItem_Underline();
+ IARE_ToolItem strikethrough = new ARE_ToolItem_Strikethrough();
+ IARE_ToolItem quote = new ARE_ToolItem_Quote();
+ IARE_ToolItem listNumber = new ARE_ToolItem_ListNumber();
+ IARE_ToolItem listBullet = new ARE_ToolItem_ListBullet();
+ IARE_ToolItem hr = new ARE_ToolItem_Hr();
+ IARE_ToolItem link = new ARE_ToolItem_Link();
+ IARE_ToolItem subscript = new ARE_ToolItem_Subscript();
+ IARE_ToolItem superscript = new ARE_ToolItem_Superscript();
+ IARE_ToolItem left = new ARE_ToolItem_AlignmentLeft();
+ IARE_ToolItem center = new ARE_ToolItem_AlignmentCenter();
+ IARE_ToolItem right = new ARE_ToolItem_AlignmentRight();
+ IARE_ToolItem image = new ARE_ToolItem_Image();
+ IARE_ToolItem video = new ARE_ToolItem_Video();
+ IARE_ToolItem at = new ARE_ToolItem_At();
+ editorToolbar.addToolbarItem(bold);
+ editorToolbar.addToolbarItem(italic);
+ editorToolbar.addToolbarItem(underline);
+ editorToolbar.addToolbarItem(strikethrough);
+ editorToolbar.addToolbarItem(quote);
+ editorToolbar.addToolbarItem(listNumber);
+ editorToolbar.addToolbarItem(listBullet);
+ editorToolbar.addToolbarItem(hr);
+ editorToolbar.addToolbarItem(link);
+ editorToolbar.addToolbarItem(subscript);
+ editorToolbar.addToolbarItem(superscript);
+ editorToolbar.addToolbarItem(left);
+ editorToolbar.addToolbarItem(center);
+ editorToolbar.addToolbarItem(right);
+ editorToolbar.addToolbarItem(image);
+ editorToolbar.addToolbarItem(video);
+ editorToolbar.addToolbarItem(at);
+
+ commentEditor.setToolbar(editorToolbar);
+
+ /*setHtml();
+
+ initToolbarArrow();*/
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java
index ec8befee..57e95bae 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java
@@ -1,8 +1,11 @@
package ml.docilealligator.infinityforreddit;
+import android.os.Parcel;
+import android.os.Parcelable;
+
import com.multilevelview.models.RecyclerViewItem;
-class CommentData extends RecyclerViewItem {
+class CommentData extends RecyclerViewItem implements Parcelable {
private String id;
private String fullName;
private String author;
@@ -35,6 +38,36 @@ class CommentData extends RecyclerViewItem {
this.scoreHidden = scoreHidden;
}
+ protected CommentData(Parcel in) {
+ super(0);
+ id = in.readString();
+ fullName = in.readString();
+ author = in.readString();
+ commentTime = in.readString();
+ commentContent = in.readString();
+ score = in.readInt();
+ voteType = in.readInt();
+ isSubmitter = in.readByte() != 0;
+ permalink = in.readString();
+ depth = in.readInt();
+ collapsed = in.readByte() != 0;
+ hasReply = in.readByte() != 0;
+ scoreHidden = in.readByte() != 0;
+ super.setLevel(depth);
+ }
+
+ public static final Creator<CommentData> CREATOR = new Creator<CommentData>() {
+ @Override
+ public CommentData createFromParcel(Parcel in) {
+ return new CommentData(in);
+ }
+
+ @Override
+ public CommentData[] newArray(int size) {
+ return new CommentData[size];
+ }
+ };
+
public String getId() {
return id;
}
@@ -98,4 +131,26 @@ class CommentData extends RecyclerViewItem {
public void setVoteType(int voteType) {
this.voteType = voteType;
}
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int i) {
+ parcel.writeString(id);
+ parcel.writeString(fullName);
+ parcel.writeString(author);
+ parcel.writeString(commentTime);
+ parcel.writeString(commentContent);
+ parcel.writeInt(score);
+ parcel.writeInt(voteType);
+ parcel.writeByte((byte) (isSubmitter ? 1 : 0));
+ parcel.writeString(permalink);
+ parcel.writeInt(depth);
+ parcel.writeByte((byte) (collapsed ? 1 : 0));
+ parcel.writeByte((byte) (hasReply ? 1 : 0));
+ parcel.writeByte((byte) (scoreHidden ? 1 : 0));
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java
index 6191b334..10a89be2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentMultiLevelRecyclerViewAdapter.java
@@ -258,6 +258,11 @@ class CommentMultiLevelRecyclerViewAdapter extends MultiLevelAdapter {
notifyItemRangeInserted(sizeBefore, mCommentData.size() - sizeBefore);
}
+ void addComment(CommentData comment) {
+ mCommentData.add(0, comment);
+ notifyItemInserted(0);
+ }
+
private void setExpandButton(ImageView expandButton, boolean isExpanded) {
// set the icon based on the current state
expandButton.setVisibility(View.VISIBLE);
@@ -265,26 +270,16 @@ class CommentMultiLevelRecyclerViewAdapter extends MultiLevelAdapter {
}
class CommentViewHolder extends RecyclerView.ViewHolder {
- @BindView(R.id.author_text_view_item_post_comment)
- TextView authorTextView;
- @BindView(R.id.comment_time_text_view_item_post_comment)
- TextView commentTimeTextView;
- @BindView(R.id.comment_markdown_view_item_post_comment)
- MarkwonView commentMarkdownView;
- @BindView(R.id.plus_button_item_post_comment)
- ImageView upvoteButton;
- @BindView(R.id.score_text_view_item_post_comment)
- TextView scoreTextView;
- @BindView(R.id.minus_button_item_post_comment)
- ImageView downvoteButton;
- @BindView(R.id.expand_button_item_post_comment)
- ImageView expandButton;
- @BindView(R.id.load_more_comments_progress_bar)
- ProgressBar loadMoreCommentsProgressBar;
- @BindView(R.id.reply_button_item_post_comment)
- ImageView replyButton;
- @BindView(R.id.vertical_block_item_post_comment)
- View verticalBlock;
+ @BindView(R.id.author_text_view_item_post_comment) TextView authorTextView;
+ @BindView(R.id.comment_time_text_view_item_post_comment) TextView commentTimeTextView;
+ @BindView(R.id.comment_markdown_view_item_post_comment) MarkwonView commentMarkdownView;
+ @BindView(R.id.plus_button_item_post_comment) ImageView upvoteButton;
+ @BindView(R.id.score_text_view_item_post_comment) TextView scoreTextView;
+ @BindView(R.id.minus_button_item_post_comment) ImageView downvoteButton;
+ @BindView(R.id.expand_button_item_post_comment) ImageView expandButton;
+ @BindView(R.id.load_more_comments_progress_bar) ProgressBar loadMoreCommentsProgressBar;
+ @BindView(R.id.reply_button_item_post_comment) ImageView replyButton;
+ @BindView(R.id.vertical_block_item_post_comment) View verticalBlock;
CommentViewHolder(View itemView) {
super(itemView);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
index 0192acea..57f44cc3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
@@ -382,10 +382,13 @@ public class MainActivity extends AppCompatActivity {
if (mFragment instanceof FragmentCommunicator) {
switch (item.getItemId()) {
case R.id.action_refresh_main_activity:
- ((FragmentCommunicator) mFragment).refresh();
+ /*((FragmentCommunicator) mFragment).refresh();
mFetchUserInfoSuccess = false;
mInsertSuccess = false;
- loadUserData();
+ loadUserData();*/
+ Intent intent = new Intent(this, CommentActivity.class);
+ intent.putExtra(CommentActivity.EXTRA_COMMENT_DATA, "asdfasdfas");
+ startActivity(intent);
return true;
case R.id.action_lazy_mode_main_activity:
MenuItem lazyModeItem = mMenu.findItem(R.id.action_lazy_mode_main_activity);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
index 2196b783..ea8e8b4c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
@@ -5,7 +5,6 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
-import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
@@ -19,9 +18,10 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
+import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.ContextCompat;
@@ -64,6 +64,9 @@ import retrofit2.Retrofit;
import ru.noties.markwon.SpannableConfiguration;
import ru.noties.markwon.view.MarkwonView;
+import static ml.docilealligator.infinityforreddit.CommentActivity.EXTRA_COMMENT_DATA;
+import static ml.docilealligator.infinityforreddit.CommentActivity.WRITE_COMMENT_REQUEST_CODE;
+
public class ViewPostDetailActivity extends AppCompatActivity {
static final String EXTRA_TITLE = "ET";
@@ -91,6 +94,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
private LoadSubredditIconAsyncTask mLoadSubredditIconAsyncTask;
@BindView(R.id.coordinator_layout_view_post_detail) CoordinatorLayout mCoordinatorLayout;
+ @BindView(R.id.toolbar_view_post_detail_activity) Toolbar toolbar;
@BindView(R.id.nested_scroll_view_view_post_detail_activity) NestedScrollView mNestedScrollView;
@BindView(R.id.subreddit_icon_name_linear_layout_view_post_detail) LinearLayout mSubredditIconNameLinearLayout;
@BindView(R.id.subreddit_icon_circle_image_view_view_post_detail) AspectRatioGifImageView mSubredditIconGifImageView;
@@ -105,22 +109,18 @@ public class ViewPostDetailActivity extends AppCompatActivity {
@BindView(R.id.nsfw_text_view_view_post_detail) Chip mNSFWChip;
@BindView(R.id.link_text_view_view_post_detail) TextView linkTextView;
@BindView(R.id.image_view_wrapper_view_post_detail) RelativeLayout mRelativeLayout;
-
@BindView(R.id.load_wrapper_view_post_detail) RelativeLayout mLoadWrapper;
@BindView(R.id.progress_bar_view_post_detail) ProgressBar mLoadImageProgressBar;
@BindView(R.id.load_image_error_text_view_view_post_detail) TextView mLoadImageErrorTextView;
@BindView(R.id.image_view_view_post_detail) AspectRatioImageView mImageView;
@BindView(R.id.image_view_no_preview_link_view_post_detail) ImageView mNoPreviewLinkImageView;
-
@BindView(R.id.plus_button_view_post_detail) ImageView mUpvoteButton;
@BindView(R.id.score_text_view_view_post_detail) TextView mScoreTextView;
@BindView(R.id.minus_button_view_post_detail) ImageView mDownvoteButton;
@BindView(R.id.share_button_view_post_detail) ImageView mShareButton;
-
@BindView(R.id.comment_progress_bar_view_post_detail) CircleProgressBar mCommentProgressbar;
@BindView(R.id.comment_card_view_view_post_detail) MaterialCardView mCommentCardView;
@BindView(R.id.recycler_view_view_post_detail) MultiLevelRecyclerView mRecyclerView;
-
@BindView(R.id.no_comment_wrapper_linear_layout_view_post_detail) LinearLayout mNoCommentWrapperLinearLayout;
@BindView(R.id.no_comment_image_view_view_post_detail) ImageView mNoCommentImageView;
@@ -144,9 +144,8 @@ public class ViewPostDetailActivity extends AppCompatActivity {
((Infinity) getApplication()).getmAppComponent().inject(this);
- ActionBar actionBar = getSupportActionBar();
- actionBar.setDisplayHomeAsUpEnabled(true);
- actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary)));
+ toolbar.setTitle("");
+ setSupportActionBar(toolbar);
mGlide = Glide.with(this);
mLocale = getResources().getConfiguration().locale;
@@ -684,6 +683,11 @@ public class ViewPostDetailActivity extends AppCompatActivity {
case R.id.action_refresh_view_post_detail_activity:
refresh();
return true;
+ case R.id.action_comment_view_post_detail_activity:
+ Intent intent = new Intent(this, CommentActivity.class);
+ intent.putExtra(CommentActivity.COMMENT_PARENT_TEXT, mPost.getTitle());
+ startActivityForResult(intent, WRITE_COMMENT_REQUEST_CODE);
+ return true;
case android.R.id.home:
onBackPressed();
return true;
@@ -692,7 +696,16 @@ public class ViewPostDetailActivity extends AppCompatActivity {
}
@Override
- protected void onSaveInstanceState(Bundle outState) {
+ protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if(resultCode == RESULT_OK && requestCode == WRITE_COMMENT_REQUEST_CODE) {
+ CommentData comment = data.getExtras().getParcelable(EXTRA_COMMENT_DATA);
+ mAdapter.addComment(comment);
+ }
+ }
+
+ @Override
+ protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(ORIENTATION_STATE, orientation);
outState.putParcelable(POST_STATE, mPost);
diff --git a/app/src/main/res/drawable/ic_insert_comment_white_24dp.xml b/app/src/main/res/drawable/ic_insert_comment_white_24dp.xml
new file mode 100644
index 00000000..8ab8d733
--- /dev/null
+++ b/app/src/main/res/drawable/ic_insert_comment_white_24dp.xml
@@ -0,0 +1,5 @@
+<vector android:autoMirrored="true" android:height="24dp"
+ android:tint="#FFFFFF" 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="M20,2L4,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4L22,4c0,-1.1 -0.9,-2 -2,-2zM18,14L6,14v-2h12v2zM18,11L6,11L6,9h12v2zM18,8L6,8L6,6h12v2z"/>
+</vector>
diff --git a/app/src/main/res/drawable/ic_send_white_24dp.xml b/app/src/main/res/drawable/ic_send_white_24dp.xml
new file mode 100644
index 00000000..33efc5c9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_send_white_24dp.xml
@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#FFFFFF"
+ 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="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
+</vector>
diff --git a/app/src/main/res/layout/activity_comment.xml b/app/src/main/res/layout/activity_comment.xml
new file mode 100644
index 00000000..3beff433
--- /dev/null
+++ b/app/src/main/res/layout/activity_comment.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".CommentActivity">
+
+ <com.google.android.material.appbar.AppBarLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:theme="@style/AppTheme.AppBarOverlay">
+
+ <androidx.appcompat.widget.Toolbar
+ android:id="@+id/toolbar_comment_activity"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ app:navigationIcon="?attr/homeAsUpIndicator"
+ app:popupTheme="@style/AppTheme.PopupOverlay" />
+
+ </com.google.android.material.appbar.AppBarLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior">
+
+ <TextView
+ android:id="@+id/comment_parent_text_view_comment_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="16dp"
+ android:textSize="16sp" />
+
+ <com.chinalwb.are.AREditText
+ android:id="@+id/arEditText"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_margin="8dp"
+ android:layout_weight="1"
+ android:gravity="top"
+ android:hint="@string/write_comment_hint"
+ android:inputType="textMultiLine|textCapSentences"
+ android:textSize="18sp"
+ android:textColor="@color/primaryTextColor"/>
+
+ <com.chinalwb.are.styles.toolbar.ARE_ToolbarDefault
+ android:id="@+id/areToolbar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical" />
+
+ </LinearLayout>
+
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/activity_view_post_detail.xml b/app/src/main/res/layout/activity_view_post_detail.xml
index f70949ce..1810f995 100644
--- a/app/src/main/res/layout/activity_view_post_detail.xml
+++ b/app/src/main/res/layout/activity_view_post_detail.xml
@@ -7,10 +7,25 @@
android:layout_height="match_parent"
tools:context=".ViewPostDetailActivity">
+ <com.google.android.material.appbar.AppBarLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:theme="@style/AppTheme.AppBarOverlay">
+
+ <androidx.appcompat.widget.Toolbar
+ android:id="@+id/toolbar_view_post_detail_activity"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ app:popupTheme="@style/AppTheme.PopupOverlay"
+ app:navigationIcon="?attr/homeAsUpIndicator" />
+
+ </com.google.android.material.appbar.AppBarLayout>
+
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_scroll_view_view_post_detail_activity"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
@@ -339,7 +354,6 @@
</LinearLayout>
-
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/menu/comment_activity.xml b/app/src/main/res/menu/comment_activity.xml
new file mode 100644
index 00000000..640f6a43
--- /dev/null
+++ b/app/src/main/res/menu/comment_activity.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ <item
+ android:id="@+id/action_send_comment_activity"
+ android:orderInCategory="1"
+ android:title="@string/action_send"
+ android:icon="@drawable/ic_send_white_24dp"
+ app:showAsAction="ifRoom" />
+</menu> \ 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 c0f667f9..f5b327d8 100644
--- a/app/src/main/res/menu/view_post_detail_activity.xml
+++ b/app/src/main/res/menu/view_post_detail_activity.xml
@@ -2,9 +2,15 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
+ android:id="@+id/action_comment_view_post_detail_activity"
+ android:orderInCategory="1"
+ android:title="@string/action_add_comment"
+ android:icon="@drawable/ic_insert_comment_white_24dp"
+ app:showAsAction="ifRoom" />
+
+ <item
android:id="@+id/action_refresh_view_post_detail_activity"
android:orderInCategory="2"
android:title="@string/action_refresh"
- android:icon="@drawable/ic_refresh_white_24dp"
- app:showAsAction="always" />
+ app:showAsAction="never" />
</menu> \ 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 5dd09c72..7a3985eb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -2,6 +2,7 @@
<string name="app_name">Infinity</string>
<string name="login_activity_label">Login</string>
<string name="search_activity_label">Search</string>
+ <string name="comment_activity_label">Add Comment</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
@@ -9,9 +10,11 @@
<string name="action_settings">Settings</string>
<string name="action_download">Download</string>
<string name="action_refresh">Refresh</string>
+ <string name="action_add_comment">Add a comment</string>
<string name="action_search">Search</string>
<string name="action_start_lazy_mode">Start Lazy Mode</string>
<string name="action_stop_lazy_mode">Stop Lazy Mode</string>
+ <string name="action_send">Send</string>
<string name="tap_to_retry">Error loading image. Tap to retry.</string>
<string name="load_posts_error">Error loading posts.\nTap to retry.</string>
@@ -68,4 +71,6 @@
<string name="lazy_mode_start">Lazy Mode starts in %1$.1fs</string>
<string name="lazy_mode_stop">Lazy Mode stopped</string>
+ <string name="write_comment_hint">Your interesting thoughts here</string>
+
</resources>