aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-07-09 09:47:40 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-07-09 09:47:40 +0000
commit117a33be3b3c112bcde45fce3974851a8ae58c47 (patch)
tree3bb9aa0cd13378dacc2b867caed991b823b8f79a /app/src/main/java
parent4338dbd2774925d9ecbe6a29616d330d5f2602a2 (diff)
downloadinfinity-for-reddit-117a33be3b3c112bcde45fce3974851a8ae58c47.tar
infinity-for-reddit-117a33be3b3c112bcde45fce3974851a8ae58c47.tar.gz
infinity-for-reddit-117a33be3b3c112bcde45fce3974851a8ae58c47.tar.bz2
infinity-for-reddit-117a33be3b3c112bcde45fce3974851a8ae58c47.tar.lz
infinity-for-reddit-117a33be3b3c112bcde45fce3974851a8ae58c47.tar.xz
infinity-for-reddit-117a33be3b3c112bcde45fce3974851a8ae58c47.tar.zst
infinity-for-reddit-117a33be3b3c112bcde45fce3974851a8ae58c47.zip
Minor UI tweaks. Preparing for submitting text posts.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java54
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java16
5 files changed, 66 insertions, 25 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentRecyclerViewAdapter.java
index b7ebf9c1..8cc218b5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentRecyclerViewAdapter.java
@@ -632,7 +632,7 @@ class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
class PostDetailViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.subreddit_icon_name_linear_layout_item_post_detail) LinearLayout mSubredditIconNameLinearLayout;
- @BindView(R.id.subreddit_icon_circle_image_view_item_post_detail) AspectRatioGifImageView mSubredditIconGifImageView;
+ @BindView(R.id.subreddit_icon_gif_image_view_item_post_detail) AspectRatioGifImageView mSubredditIconGifImageView;
@BindView(R.id.subreddit_text_view_item_post_detail) TextView mSubredditTextView;
@BindView(R.id.post_time_text_view_item_post_detail) TextView mPostTimeTextView;
@BindView(R.id.title_text_view_item_post_detail) TextView mTitleTextView;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
index 0192acea..4bc6870d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
@@ -29,6 +29,7 @@ import com.bumptech.glide.request.RequestOptions;
import com.ferfalk.simplesearchview.SimpleSearchView;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
@@ -67,6 +68,7 @@ public class MainActivity extends AppCompatActivity {
@BindView(R.id.subscribed_user_recycler_view_main_activity) RecyclerView subscribedUserRecyclerView;
@BindView(R.id.following_label_main_activity) TextView followingLabelTextView;
@BindView(R.id.profile_linear_layout_main_activity) LinearLayout profileLinearLayout;
+ @BindView(R.id.fab_main_activity) FloatingActionButton fab;
private TextView mNameTextView;
private TextView mKarmaTextView;
@@ -260,6 +262,11 @@ public class MainActivity extends AppCompatActivity {
userAdapter.setSubscribedUsers(subscribedUserData);
});
}
+
+ fab.setOnClickListener(view -> {
+ Intent intent = new Intent(this, PostTextActivity.class);
+ this.startActivity(intent);
+ });
}
private void loadUserData() {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
new file mode 100644
index 00000000..d7aa6e1d
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
@@ -0,0 +1,54 @@
+package ml.docilealligator.infinityforreddit;
+
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.view.MenuItem;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import pl.droidsonroids.gif.GifImageView;
+
+public class PostTextActivity extends AppCompatActivity {
+
+ static final String EXTRA_SUBREDDIT_NAME = "ESN";
+
+ @BindView(R.id.subreddit_icon_gif_image_view_post_text_activity) GifImageView iconGifImageView;
+ @BindView(R.id.subreddit_name_text_view_post_text_activity) TextView subreditNameTextView;
+ @BindView(R.id.rules_button_post_text_activity) Button rulesButton;
+ @BindView(R.id.post_title_edit_text_post_text_activity) EditText titleEditText;
+ @BindView(R.id.post_text_content_edit_text_post_text_activity) EditText contentEditText;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_post_text);
+
+ ButterKnife.bind(this);
+
+ ActionBar actionBar = getSupportActionBar();
+ Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
+ actionBar.setHomeAsUpIndicator(upArrow);
+
+ if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
+ subreditNameTextView.setText(getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME));
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
index 08dc356c..1dcba0c1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
@@ -8,7 +8,6 @@ import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
-import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
@@ -16,9 +15,6 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.style.ForegroundColorSpan;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
@@ -95,16 +91,12 @@ public class ViewImageActivity extends AppCompatActivity {
Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
actionBar.setHomeAsUpIndicator(upArrow);
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarColor)));
+ setTitle("");
Intent intent = getIntent();
mImageUrl = intent.getExtras().getString(IMAGE_URL_KEY);
mImageFileName = intent.getExtras().getString(FILE_NAME_KEY);
- String title = intent.getExtras().getString(TITLE_KEY);
- Spannable text = new SpannableString(title);
- text.setSpan(new ForegroundColorSpan(Color.WHITE), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- setTitle(text);
-
mLoadErrorLinearLayout.setOnClickListener(view -> {
if(!isSwiping) {
mProgressBar.setVisibility(View.VISIBLE);
@@ -133,8 +125,6 @@ public class ViewImageActivity extends AppCompatActivity {
actionBarColorAnimation.addUpdateListener(valueAnimator -> actionBar.setBackgroundDrawable(new ColorDrawable((int) valueAnimator.getAnimatedValue())));
actionBarElementColorAnimation.addUpdateListener(valueAnimator -> {
- text.setSpan(new ForegroundColorSpan((int) valueAnimator.getAnimatedValue()), 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
- actionBar.setTitle(text);
upArrow.setColorFilter((int) valueAnimator.getAnimatedValue(), PorterDuff.Mode.SRC_IN);
if(mMenu != null) {
Drawable drawable = mMenu.getItem(0).getIcon();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java
index 1d164bb3..976ff8c5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java
@@ -8,7 +8,6 @@ import android.app.DownloadManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
-import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
@@ -17,9 +16,6 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.style.ForegroundColorSpan;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
@@ -94,9 +90,10 @@ public class ViewVideoActivity extends AppCompatActivity {
setVolumeControlStream(AudioManager.STREAM_MUSIC);
ActionBar actionBar = getSupportActionBar();
- actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarColor)));
Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
- getSupportActionBar().setHomeAsUpIndicator(upArrow);
+ actionBar.setHomeAsUpIndicator(upArrow);
+ actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarColor)));
+ setTitle("");
//Set player controller margin bottom in order to display it above the navbar
int resourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
@@ -108,11 +105,6 @@ public class ViewVideoActivity extends AppCompatActivity {
mVideoUri = intent.getData();
mIsDashVideo = intent.getExtras().getBoolean(IS_DASH_VIDEO_KEY);
- String title = intent.getExtras().getString(TITLE_KEY);
- Spannable text = new SpannableString(title);
- text.setSpan(new ForegroundColorSpan(Color.WHITE), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- setTitle(text);
-
if(intent.getExtras().getBoolean(IS_DOWNLOADABLE_KEY)) {
mGifOrVideoFileName = intent.getExtras().getString(SUBREDDIT_KEY).substring(2)
+ "-" + intent.getExtras().getString(ID_KEY).substring(3) + ".gif";
@@ -139,8 +131,6 @@ public class ViewVideoActivity extends AppCompatActivity {
actionBarColorAnimation.addUpdateListener(valueAnimator -> actionBar.setBackgroundDrawable(new ColorDrawable((int) valueAnimator.getAnimatedValue())));
actionBarElementColorAnimation.addUpdateListener(valueAnimator -> {
- text.setSpan(new ForegroundColorSpan((int) valueAnimator.getAnimatedValue()), 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
- actionBar.setTitle(text);
upArrow.setColorFilter((int) valueAnimator.getAnimatedValue(), PorterDuff.Mode.SRC_IN);
if(mMenu != null) {
Drawable drawable = mMenu.getItem(0).getIcon();