diff options
Diffstat (limited to '')
14 files changed, 187 insertions, 32 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a0d209a4..744a48ea 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -19,10 +19,13 @@ android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true"> + <activity android:name=".PostTextActivity" + android:label="@string/post_text_activity" + android:parentActivityName=".MainActivity" /> <activity android:name=".CommentActivity" - android:theme="@style/AppTheme.NoActionBar" android:label="@string/comment_activity_label" + android:theme="@style/AppTheme.NoActionBar" android:windowSoftInputMode="adjustResize" /> <activity android:name=".SearchActivity" @@ -54,7 +57,7 @@ <activity android:name=".ViewPostDetailActivity" android:parentActivityName=".MainActivity" - android:theme="@style/AppTheme.NoActionBar"/> + android:theme="@style/AppTheme.NoActionBar" /> <activity android:name=".ViewSubredditDetailActivity" android:parentActivityName=".MainActivity" 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(); diff --git a/app/src/main/res/layout/activity_post_text.xml b/app/src/main/res/layout/activity_post_text.xml new file mode 100644 index 00000000..cb08e1f2 --- /dev/null +++ b/app/src/main/res/layout/activity_post_text.xml @@ -0,0 +1,94 @@ +<?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=".PostTextActivity"> + + <androidx.core.widget.NestedScrollView + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp"> + + <pl.droidsonroids.gif.GifImageView + android:id="@+id/subreddit_icon_gif_image_view_post_text_activity" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_alignParentStart="true" + android:layout_centerVertical="true" + android:src="@drawable/subreddit_default_icon" /> + + <TextView + android:id="@+id/subreddit_name_text_view_post_text_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toStartOf="@id/rules_button_post_text_activity" + android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_text_activity" + android:layout_centerVertical="true" + android:layout_marginStart="32dp" + android:layout_marginEnd="16dp" + android:text="@string/choose_a_subreddit" /> + + <Button + android:id="@+id/rules_button_post_text_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentEnd="true" + android:layout_centerVertical="true" + android:text="@string/rules" + android:textColor="@color/colorAccent" /> + + </RelativeLayout> + + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/dividerColor" /> + + <EditText + android:id="@+id/post_title_edit_text_post_text_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="top" + android:padding="16dp" + android:hint="@string/post_title_hint" + android:inputType="textCapSentences|textMultiLine" + android:textSize="18sp" + android:background="#00000000" + android:textColor="@color/primaryTextColor" /> + + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/dividerColor" /> + + <EditText + android:id="@+id/post_text_content_edit_text_post_text_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="top" + android:padding="16dp" + android:hint="@string/post_text_content_hint" + android:inputType="textCapSentences|textMultiLine" + android:textSize="18sp" + android:background="#00000000" + android:textColor="@color/primaryTextColor" /> + + </LinearLayout> + + </androidx.core.widget.NestedScrollView> + +</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index 1407326c..50f1384f 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -62,4 +62,12 @@ <include layout="@layout/content_main" /> + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/fab_main_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom|end" + android:layout_margin="@dimen/fab_margin" + app:srcCompat="@drawable/baseline_add_white_24" /> + </androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/exo_playback_control_view.xml b/app/src/main/res/layout/exo_playback_control_view.xml index 752826fb..93a801af 100644 --- a/app/src/main/res/layout/exo_playback_control_view.xml +++ b/app/src/main/res/layout/exo_playback_control_view.xml @@ -4,6 +4,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" + android:paddingStart="16dp" + android:paddingEnd="16dp" + android:paddingBottom="16dp" android:background="@color/transparentActionBarColor" android:orientation="vertical"> diff --git a/app/src/main/res/layout/item_load_comments.xml b/app/src/main/res/layout/item_load_comments.xml index 06bc8c38..00bd5877 100644 --- a/app/src/main/res/layout/item_load_comments.xml +++ b/app/src/main/res/layout/item_load_comments.xml @@ -9,8 +9,7 @@ android:id="@+id/comment_progress_bar_view_post_detail" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="16dp" - android:layout_marginBottom="16dp" + android:layout_margin="16dp" app:mlpb_progress_stoke_width="3dp" app:mlpb_progress_color="@color/colorAccent" app:mlpb_background_color="@color/circularProgressBarBackground" diff --git a/app/src/main/res/layout/item_load_comments_failed_placeholder.xml b/app/src/main/res/layout/item_load_comments_failed_placeholder.xml index 25af5d14..d81cdb97 100644 --- a/app/src/main/res/layout/item_load_comments_failed_placeholder.xml +++ b/app/src/main/res/layout/item_load_comments_failed_placeholder.xml @@ -2,7 +2,7 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="36dp" + android:layout_margin="36dp" android:orientation="vertical"> <ImageView diff --git a/app/src/main/res/layout/item_no_comment_placeholder.xml b/app/src/main/res/layout/item_no_comment_placeholder.xml index 707243c6..a4d85501 100644 --- a/app/src/main/res/layout/item_no_comment_placeholder.xml +++ b/app/src/main/res/layout/item_no_comment_placeholder.xml @@ -2,7 +2,7 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="36dp" + android:layout_margin="36dp" android:orientation="vertical"> <ImageView diff --git a/app/src/main/res/layout/item_post_detail.xml b/app/src/main/res/layout/item_post_detail.xml index 870d21ef..4a40eb1b 100644 --- a/app/src/main/res/layout/item_post_detail.xml +++ b/app/src/main/res/layout/item_post_detail.xml @@ -26,7 +26,7 @@ app:layout_constraintTop_toTopOf="parent"> <CustomView.AspectRatioGifImageView - android:id="@+id/subreddit_icon_circle_image_view_item_post_detail" + android:id="@+id/subreddit_icon_gif_image_view_item_post_detail" android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="center"/> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 29b0c4e3..726e34b6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,6 +4,7 @@ <string name="search_activity_label">Search</string> <string name="comment_activity_label">Add Comment</string> <string name="comment_activity_label_is_replying">Reply</string> + <string name="post_text_activity">Text Post</string> <string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string> @@ -84,4 +85,10 @@ <string name="comment_load_more_comments_failed">Load failed. Tap to retry.</string> <string name="loading">Loading</string> + + <string name="post_title_hint">Title</string> + <string name="post_text_content_hint">Content</string> + <string name="post_url_hint">URL</string> + <string name="choose_a_subreddit">Choose a subreddit</string> + <string name="rules">Rules</string> </resources> |