aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-07-12 01:35:05 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-07-12 01:35:05 +0000
commit68d3a7b09f42aef6c3ec1874af3c9dee4c3eef8c (patch)
tree7af5b7763e947e0cf6398d95552d3f6cf2810a36 /app/src/main
parent2b9b8fddfabc40c41152db529ec9311226db7669 (diff)
downloadinfinity-for-reddit-68d3a7b09f42aef6c3ec1874af3c9dee4c3eef8c.tar
infinity-for-reddit-68d3a7b09f42aef6c3ec1874af3c9dee4c3eef8c.tar.gz
infinity-for-reddit-68d3a7b09f42aef6c3ec1874af3c9dee4c3eef8c.tar.bz2
infinity-for-reddit-68d3a7b09f42aef6c3ec1874af3c9dee4c3eef8c.tar.lz
infinity-for-reddit-68d3a7b09f42aef6c3ec1874af3c9dee4c3eef8c.tar.xz
infinity-for-reddit-68d3a7b09f42aef6c3ec1874af3c9dee4c3eef8c.tar.zst
infinity-for-reddit-68d3a7b09f42aef6c3ec1874af3c9dee4c3eef8c.zip
Submitting link posts is available. Fixed force stop when a user has no post in ViewUserDetailActivity.
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/AndroidManifest.xml5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java24
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java223
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RedditUtils.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPost.java14
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java3
-rw-r--r--app/src/main/res/layout/activity_post_link.xml95
-rw-r--r--app/src/main/res/layout/activity_post_text.xml2
-rw-r--r--app/src/main/res/menu/post_link_activity.xml10
-rw-r--r--app/src/main/res/values/strings.xml10
13 files changed, 386 insertions, 16 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 55c5dcb6..e5b7a4cf 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -20,6 +20,11 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
+ android:name=".PostLinkActivity"
+ android:label="@string/post_link_activity_label"
+ android:parentActivityName=".MainActivity"
+ android:windowSoftInputMode="adjustResize" />
+ <activity
android:name=".SubscribedThingListingActivity"
android:label="@string/subscriptions"
android:parentActivityName=".MainActivity"
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
index ac6eca67..93862875 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
@@ -19,4 +19,5 @@ interface AppComponent {
void inject(SubscribedThingListingActivity subscribedThingListingActivity);
void inject(PostTextActivity postTextActivity);
void inject(SubscribedSubredditsListingFragment subscribedSubredditsListingFragment);
+ void inject(PostLinkActivity postLinkActivity);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
index a711091c..bdcfece5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
@@ -11,9 +11,11 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
+import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
+import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.GravityCompat;
@@ -220,8 +222,26 @@ public class MainActivity extends AppCompatActivity {
}
fab.setOnClickListener(view -> {
- Intent intent = new Intent(this, PostTextActivity.class);
- this.startActivity(intent);
+ new AlertDialog.Builder(this).setTitle(R.string.dialog_post_type)
+ .setItems(R.array.dialog_post_types_array, (dialog, which) -> {
+ Intent intent;
+ switch (which) {
+ case 0:
+ intent = new Intent(this, PostTextActivity.class);
+ break;
+ case 1:
+ intent = new Intent(this, PostLinkActivity.class);
+ break;
+ case 2:
+ Toast.makeText(this, "Not implemented yet", Toast.LENGTH_SHORT).show();
+ return;
+ default:
+ Toast.makeText(this, "Not implemented yet", Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ startActivity(intent);
+ }).show();
});
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java
index e91d2ab9..5f6bd33c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java
@@ -25,6 +25,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView;
+import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.lsjwzh.widget.materialloadingprogressbar.CircleProgressBar;
@@ -55,7 +56,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
@BindView(R.id.fetch_post_info_image_view_post_fragment) ImageView mFetchPostInfoImageView;
@BindView(R.id.fetch_post_info_text_view_post_fragment) TextView mFetchPostInfoTextView;
- private RequestManager glide;
+ private RequestManager mGlide;
private Activity activity;
private LinearLayoutManager mLinearLayoutManager;
@@ -117,6 +118,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
window = activity.getWindow();
+ mGlide = Glide.with(activity);
+
lazyModeRunnable = new Runnable() {
@Override
public void run() {
@@ -255,7 +258,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
if(activity != null && isAdded()) {
mFetchPostInfoLinearLayout.setVisibility(View.VISIBLE);
mFetchPostInfoTextView.setText(stringResId);
- glide.load(R.drawable.load_post_error_indicator).into(mFetchPostInfoImageView);
+ mGlide.load(R.drawable.load_post_error_indicator).into(mFetchPostInfoImageView);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
new file mode 100644
index 00000000..193fabbc
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
@@ -0,0 +1,223 @@
+package ml.docilealligator.infinityforreddit;
+
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
+
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.RequestManager;
+import com.bumptech.glide.request.RequestOptions;
+import com.google.android.material.snackbar.Snackbar;
+
+import java.util.Locale;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
+import pl.droidsonroids.gif.GifImageView;
+import retrofit2.Retrofit;
+
+public class PostLinkActivity extends AppCompatActivity {
+
+ static final String EXTRA_SUBREDDIT_NAME = "ESN";
+ static final String EXTRA_SUBREDDIT_ICON = "ESI";
+
+ private static final String SUBREDDIT_NAME_STATE = "SNS";
+ private static final String SUBREDDIT_ICON_STATE = "SIS";
+ private static final String SUBREDDIT_SELECTED_STATE = "SSS";
+ private static final String SUBREDDIT_IS_USER_STATE = "SIUS";
+
+ private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
+
+ @BindView(R.id.coordinator_layout_post_link_activity) CoordinatorLayout coordinatorLayout;
+ @BindView(R.id.subreddit_icon_gif_image_view_post_link_activity) GifImageView iconGifImageView;
+ @BindView(R.id.subreddit_name_text_view_post_link_activity) TextView subreditNameTextView;
+ @BindView(R.id.rules_button_post_link_activity) Button rulesButton;
+ @BindView(R.id.post_title_edit_text_post_link_activity) EditText titleEditText;
+ @BindView(R.id.post_link_edit_text_post_link_activity) EditText contentEditText;
+
+ private String iconUrl;
+ private String subredditName;
+ private boolean subredditSelected = false;
+ private boolean subredditIsUser;
+
+ private RequestManager mGlide;
+ private Locale mLocale;
+
+ @Inject
+ @Named("oauth")
+ Retrofit mOauthRetrofit;
+
+ @Inject
+ @Named("auth_info")
+ SharedPreferences sharedPreferences;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_post_link);
+
+ ButterKnife.bind(this);
+
+ ((Infinity) getApplication()).getmAppComponent().inject(this);
+
+ ActionBar actionBar = getSupportActionBar();
+ Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
+ actionBar.setHomeAsUpIndicator(upArrow);
+
+ mGlide = Glide.with(this);
+ mLocale = getResources().getConfiguration().locale;
+
+ if(savedInstanceState != null) {
+ subredditName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
+ iconUrl = savedInstanceState.getString(SUBREDDIT_ICON_STATE);
+ subredditSelected = savedInstanceState.getBoolean(SUBREDDIT_SELECTED_STATE);
+ subredditIsUser = savedInstanceState.getBoolean(SUBREDDIT_IS_USER_STATE);
+
+ if(subredditName != null) {
+ subreditNameTextView.setText(subredditName);
+ }
+ if(iconUrl != null && !iconUrl.equals("")) {
+ mGlide.load(iconUrl)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .error(mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
+ .into(iconGifImageView);
+ } else {
+ mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .into(iconGifImageView);
+ }
+ } else {
+ if(getIntent().hasExtra(EXTRA_SUBREDDIT_NAME)) {
+ subredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME);
+ iconUrl = getIntent().getExtras().getString(EXTRA_SUBREDDIT_ICON);
+ subreditNameTextView.setText(subredditName);
+ } else {
+ mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .into(iconGifImageView);
+ }
+ }
+
+ iconGifImageView.setOnClickListener(view -> {
+ Intent intent = new Intent(this, SubredditSelectionActivity.class);
+ startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
+ });
+
+ subreditNameTextView.setOnClickListener(view -> {
+ Intent intent = new Intent(this, SubredditSelectionActivity.class);
+ startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
+ });
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.post_link_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_post_link_activity:
+ if(!subredditSelected) {
+ Snackbar.make(coordinatorLayout, R.string.select_a_subreddit, Snackbar.LENGTH_SHORT).show();
+ return true;
+ }
+
+ item.setEnabled(false);
+ item.getIcon().setAlpha(130);
+ Snackbar postingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE);
+ postingSnackbar.show();
+
+ String subredditName;
+ if(subredditIsUser) {
+ subredditName = "u_" + subreditNameTextView.getText().toString();
+ } else {
+ subredditName = subreditNameTextView.getText().toString();
+ }
+
+ SubmitPost.submitTextOrLinkPost(mOauthRetrofit, sharedPreferences, mLocale, subredditName,
+ titleEditText.getText().toString(), contentEditText.getText().toString(),
+ false, RedditUtils.KIND_LINK, new SubmitPost.SubmitPostListener() {
+ @Override
+ public void submitSuccessful(Post post) {
+ Intent intent = new Intent(PostLinkActivity.this, ViewPostDetailActivity.class);
+ intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, post);
+ startActivity(intent);
+ finish();
+ }
+
+ @Override
+ public void submitFailed(@Nullable String errorMessage) {
+ postingSnackbar.dismiss();
+ item.setEnabled(true);
+ item.getIcon().setAlpha(255);
+ if(errorMessage == null) {
+ Snackbar.make(coordinatorLayout, R.string.post_failed, Snackbar.LENGTH_SHORT).show();
+ } else {
+ Snackbar.make(coordinatorLayout, errorMessage, Snackbar.LENGTH_SHORT).show();
+ }
+ }
+ });
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected void onSaveInstanceState(@NonNull Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putString(SUBREDDIT_NAME_STATE, subredditName);
+ outState.putString(SUBREDDIT_ICON_STATE, iconUrl);
+ outState.putBoolean(SUBREDDIT_SELECTED_STATE, subredditSelected);
+ outState.putBoolean(SUBREDDIT_IS_USER_STATE, subredditIsUser);
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if(requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
+ if(resultCode == RESULT_OK) {
+ subredditName = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME_KEY);
+ iconUrl = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL_KEY);
+ subredditSelected = true;
+ subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER_KEY);
+
+ subreditNameTextView.setTextColor(getResources().getColor(R.color.primaryTextColor));
+ subreditNameTextView.setText(subredditName);
+ if(!iconUrl.equals("")) {
+ mGlide.load(iconUrl)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .error(mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
+ .into(iconGifImageView);
+ } else {
+ mGlide.load(R.drawable.subreddit_default_icon)
+ .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
+ .into(iconGifImageView);
+ }
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
index 75db3a73..ea6e655d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
@@ -44,7 +44,7 @@ public class PostTextActivity extends AppCompatActivity {
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
- @BindView(R.id.coordinator_layout_post_detail_activity) CoordinatorLayout coordinatorLayout;
+ @BindView(R.id.coordinator_layout_post_text_activity) CoordinatorLayout coordinatorLayout;
@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;
@@ -156,9 +156,9 @@ public class PostTextActivity extends AppCompatActivity {
subredditName = subreditNameTextView.getText().toString();
}
- SubmitPost.submitPostText(mOauthRetrofit, sharedPreferences, mLocale, subredditName,
+ SubmitPost.submitTextOrLinkPost(mOauthRetrofit, sharedPreferences, mLocale, subredditName,
titleEditText.getText().toString(), contentEditText.getText().toString(),
- false, new SubmitPost.SubmitPostListener() {
+ false, RedditUtils.KIND_SELF, new SubmitPost.SubmitPostListener() {
@Override
public void submitSuccessful(Post post) {
Intent intent = new Intent(PostTextActivity.this, ViewPostDetailActivity.class);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditUtils.java
index faf58e4a..b3b989f0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditUtils.java
@@ -52,6 +52,7 @@ public class RedditUtils {
static final String API_TYPE_JSON = "json";
static final String RETURN_RTJSON_KEY = "return_rtjson";
static final String TEXT_KEY = "text";
+ static final String URL_KEY = "url";
static final String THING_ID_KEY = "thing_id";
static final String SR_KEY = "sr";
@@ -60,6 +61,7 @@ public class RedditUtils {
static final String KIND_KEY = "kind";
static final String KIND_TEXT = "text";
static final String KIND_SELF = "self";
+ static final String KIND_LINK = "link";
static Map<String, String> getHttpBasicAuthHeader() {
Map<String, String> params = new HashMap<>();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPost.java
index d493c66a..4a03398d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPost.java
@@ -24,9 +24,9 @@ class SubmitPost {
void submitFailed(@Nullable String errorMessage);
}
- static void submitPostText(Retrofit oauthRetrofit, SharedPreferences authInfoSharedPreferences,
- Locale locale, String subredditName, String title, String text, boolean isNSFW,
- SubmitPostListener submitPostListener) {
+ static void submitTextOrLinkPost(Retrofit oauthRetrofit, SharedPreferences authInfoSharedPreferences,
+ Locale locale, String subredditName, String title, String content, boolean isNSFW,
+ String kind, SubmitPostListener submitPostListener) {
RedditAPI api = oauthRetrofit.create(RedditAPI.class);
String accessToken = authInfoSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN_KEY, "");
@@ -34,8 +34,12 @@ class SubmitPost {
params.put(RedditUtils.API_TYPE_KEY, RedditUtils.API_TYPE_JSON);
params.put(RedditUtils.SR_KEY, subredditName);
params.put(RedditUtils.TITLE_KEY, title);
- params.put(RedditUtils.KIND_KEY, RedditUtils.KIND_SELF);
- params.put(RedditUtils.TEXT_KEY, text);
+ params.put(RedditUtils.KIND_KEY, kind);
+ if(kind.equals(RedditUtils.KIND_SELF)) {
+ params.put(RedditUtils.TEXT_KEY, content);
+ } else if(kind.equals(RedditUtils.KIND_LINK)) {
+ params.put(RedditUtils.URL_KEY, content);
+ }
params.put(RedditUtils.NSFW_KEY, Boolean.toString(isNSFW));
Call<String> submitPostCall = api.submit(RedditUtils.getOAuthHeader(accessToken), params);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
index 0411eea0..7e8e4d7d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
@@ -10,7 +10,6 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
-import SubscribedSubredditDatabase.SubscribedSubredditViewModel;
import butterknife.ButterKnife;
public class SubredditSelectionActivity extends AppCompatActivity {
@@ -19,8 +18,6 @@ public class SubredditSelectionActivity extends AppCompatActivity {
static final String EXTRA_RETURN_SUBREDDIT_ICON_URL_KEY = "ERSIURLK";
static final String EXTRA_RETURN_SUBREDDIT_IS_USER_KEY = "ERSIUK";
- private SubscribedSubredditViewModel mSubscribedSubredditViewModel;
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
diff --git a/app/src/main/res/layout/activity_post_link.xml b/app/src/main/res/layout/activity_post_link.xml
new file mode 100644
index 00000000..2d57c57b
--- /dev/null
+++ b/app/src/main/res/layout/activity_post_link.xml
@@ -0,0 +1,95 @@
+<?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"
+ android:id="@+id/coordinator_layout_post_link_activity"
+ tools:context=".PostTextActivity">
+
+ <androidx.core.widget.NestedScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true">
+
+ <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_link_activity"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_alignParentStart="true"
+ android:layout_centerVertical="true" />
+
+ <TextView
+ android:id="@+id/subreddit_name_text_view_post_link_activity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toStartOf="@id/rules_button_post_link_activity"
+ android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_link_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_link_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_link_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_link_edit_text_post_link_activity"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="top"
+ android:padding="16dp"
+ android:hint="@string/post_link_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/activity_post_text.xml b/app/src/main/res/layout/activity_post_text.xml
index 2b16fc33..86455f8b 100644
--- a/app/src/main/res/layout/activity_post_text.xml
+++ b/app/src/main/res/layout/activity_post_text.xml
@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:id="@+id/coordinator_layout_post_detail_activity"
+ android:id="@+id/coordinator_layout_post_text_activity"
tools:context=".PostTextActivity">
<androidx.core.widget.NestedScrollView
diff --git a/app/src/main/res/menu/post_link_activity.xml b/app/src/main/res/menu/post_link_activity.xml
new file mode 100644
index 00000000..8b9f2e69
--- /dev/null
+++ b/app/src/main/res/menu/post_link_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_post_link_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/values/strings.xml b/app/src/main/res/values/strings.xml
index 26bfb24c..d2b3a8a8 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -6,6 +6,7 @@
<string name="comment_activity_label_is_replying">Reply</string>
<string name="post_text_activity_label">Text Post</string>
<string name="subreddit_selection_activity_label">Select a Subreddit</string>
+ <string name="post_link_activity_label">Link Post</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
@@ -97,7 +98,16 @@
<string name="post_url_hint">URL</string>
<string name="choose_a_subreddit">Choose a subreddit</string>
<string name="rules">Rules</string>
+ <string name="post_link_hint">URL</string>
<string name="subreddits">Subreddits</string>
<string name="users">Users</string>
+
+ <string name="dialog_post_type">Post</string>
+ <string-array name="dialog_post_types_array">
+ <item>Text</item>
+ <item>Link</item>
+ <item>Image</item>
+ <item>Video</item>
+ </string-array>
</resources>