aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.idea/caches/build_file_checksums.serbin533 -> 533 bytes
-rw-r--r--.idea/caches/gradle_models.serbin263220 -> 263220 bytes
-rw-r--r--app/src/main/AndroidManifest.xml17
-rw-r--r--app/src/main/java/CustomView/CustomMarkwonView.java17
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java59
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java68
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingFragment.java34
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingRecyclerViewAdapter.java19
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java76
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java1
-rw-r--r--app/src/main/res/layout/activity_post_image.xml16
-rw-r--r--app/src/main/res/layout/activity_post_link.xml16
-rw-r--r--app/src/main/res/layout/activity_post_text.xml16
-rw-r--r--app/src/main/res/layout/activity_post_video.xml16
-rw-r--r--app/src/main/res/layout/activity_search_subreddits_result.xml29
-rw-r--r--app/src/main/res/layout/activity_subreddit_selection.xml27
-rw-r--r--app/src/main/res/menu/subreddit_selection_activity.xml10
-rw-r--r--app/src/main/res/values/strings.xml1
25 files changed, 375 insertions, 86 deletions
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index 25e5051e..4e46c294 100644
--- a/.idea/caches/build_file_checksums.ser
+++ b/.idea/caches/build_file_checksums.ser
Binary files differ
diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser
index b2d6374e..52d3c3c9 100644
--- a/.idea/caches/gradle_models.ser
+++ b/.idea/caches/gradle_models.ser
Binary files differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 362a128d..ed7e1a17 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -19,6 +19,11 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
+ <activity
+ android:name=".SearchSubredditsResultActivity"
+ android:label="@string/search_subreddits_activity_label"
+ android:parentActivityName=".MainActivity"
+ android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".LinkResolverActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
@@ -44,17 +49,17 @@
android:name=".PostVideoActivity"
android:label="@string/post_video_activity_label"
android:parentActivityName=".MainActivity"
- android:windowSoftInputMode="adjustResize" />
+ android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".PostImageActivity"
android:label="@string/post_image_activity_label"
android:parentActivityName=".MainActivity"
- android:windowSoftInputMode="adjustResize" />
+ android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".PostLinkActivity"
android:label="@string/post_link_activity_label"
android:parentActivityName=".MainActivity"
- android:windowSoftInputMode="adjustResize" />
+ android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".SubscribedThingListingActivity"
android:label="@string/subscriptions"
@@ -63,12 +68,14 @@
<activity
android:name=".SubredditSelectionActivity"
android:label="@string/subreddit_selection_activity_label"
- android:parentActivityName=".MainActivity" />
+ android:parentActivityName=".MainActivity"
+ android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".PostTextActivity"
android:label="@string/post_text_activity_label"
android:parentActivityName=".MainActivity"
- android:windowSoftInputMode="adjustResize" />
+ android:windowSoftInputMode="adjustResize"
+ android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".CommentActivity"
android:label="@string/comment_activity_label"
diff --git a/app/src/main/java/CustomView/CustomMarkwonView.java b/app/src/main/java/CustomView/CustomMarkwonView.java
index c0d59f05..50ac4bbf 100644
--- a/app/src/main/java/CustomView/CustomMarkwonView.java
+++ b/app/src/main/java/CustomView/CustomMarkwonView.java
@@ -24,23 +24,24 @@ public class CustomMarkwonView extends MarkwonView {
super(context, attrs);
}
- public void setMarkdown(@Nullable String markdown, Context conte) {
- SpannableConfiguration configuration = SpannableConfiguration.builder(conte).linkResolver((view, link) -> {
+ public void setMarkdown(@Nullable String markdown, Context context) {
+ SpannableConfiguration configuration = SpannableConfiguration.builder(context).linkResolver((view, link) -> {
if(link.startsWith("/u/") || link.startsWith("u/")) {
- Intent intent = new Intent(conte, ViewUserDetailActivity.class);
+ Intent intent = new Intent(context, ViewUserDetailActivity.class);
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, link.substring(3));
- conte.startActivity(intent);
+ context.startActivity(intent);
} else if(link.startsWith("/r/") || link.startsWith("r/")) {
- Intent intent = new Intent(conte, ViewSubredditDetailActivity.class);
+ Intent intent = new Intent(context, ViewSubredditDetailActivity.class);
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, link.substring(3));
- conte.startActivity(intent);
+ context.startActivity(intent);
} else {
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
// add share action to menu list
builder.addDefaultShareMenuItem();
- builder.setToolbarColor(conte.getResources().getColor(R.color.colorPrimary));
+ builder.setToolbarColor(context.getResources().getColor(R.color.colorPrimary));
CustomTabsIntent customTabsIntent = builder.build();
- customTabsIntent.launchUrl(conte, Uri.parse(link));
+ customTabsIntent.intent.setPackage(context.getPackageName());
+ customTabsIntent.launchUrl(context, Uri.parse(link));
}
}).build();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
index 3810ed96..64662e0a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
@@ -300,6 +300,7 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
return true;
case R.id.action_search_main_activity:
Intent intent = new Intent(this, SearchActivity.class);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, false);
startActivity(intent);
return true;
case R.id.action_refresh_main_activity:
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java
index cd4e84dc..212f3fa5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java
@@ -19,8 +19,8 @@ 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.constraintlayout.widget.ConstraintLayout;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.FileProvider;
@@ -69,6 +69,7 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
private static final int CAPTURE_IMAGE_REQUEST_CODE = 2;
@BindView(R.id.coordinator_layout_post_image_activity) CoordinatorLayout coordinatorLayout;
+ @BindView(R.id.toolbar_post_image_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_image_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_image_activity) TextView subreditNameTextView;
@BindView(R.id.rules_button_post_image_activity) Button rulesButton;
@@ -126,9 +127,8 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
((Infinity) getApplication()).getmAppComponent().inject(this);
- ActionBar actionBar = getSupportActionBar();
- Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
- actionBar.setHomeAsUpIndicator(upArrow);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mGlide = Glide.with(this);
mLocale = getResources().getConfiguration().locale;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
index af507488..6c240293 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
@@ -2,7 +2,6 @@ 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;
@@ -13,8 +12,8 @@ import android.widget.TextView;
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.coordinatorlayout.widget.CoordinatorLayout;
import com.bumptech.glide.Glide;
@@ -51,6 +50,7 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
@BindView(R.id.coordinator_layout_post_link_activity) CoordinatorLayout coordinatorLayout;
+ @BindView(R.id.toolbar_post_link_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_link_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_link_activity) TextView subredditNameTextView;
@BindView(R.id.rules_button_post_link_activity) Button rulesButton;
@@ -95,9 +95,8 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
((Infinity) getApplication()).getmAppComponent().inject(this);
- ActionBar actionBar = getSupportActionBar();
- Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
- actionBar.setHomeAsUpIndicator(upArrow);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mGlide = Glide.with(this);
mLocale = getResources().getConfiguration().locale;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
index 1f4abf27..e5601697 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
@@ -2,7 +2,6 @@ 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;
@@ -13,8 +12,8 @@ import android.widget.TextView;
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.coordinatorlayout.widget.CoordinatorLayout;
import com.bumptech.glide.Glide;
@@ -51,6 +50,7 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
@BindView(R.id.coordinator_layout_post_text_activity) CoordinatorLayout coordinatorLayout;
+ @BindView(R.id.toolbar_post_text_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_search_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_search_activity) TextView subreditNameTextView;
@BindView(R.id.rules_button_post_text_activity) Button rulesButton;
@@ -95,9 +95,8 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
((Infinity) getApplication()).getmAppComponent().inject(this);
- ActionBar actionBar = getSupportActionBar();
- Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
- actionBar.setHomeAsUpIndicator(upArrow);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mGlide = Glide.with(this);
mLocale = getResources().getConfiguration().locale;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java
index e57a65c4..349d1c46 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java
@@ -19,8 +19,8 @@ import android.widget.VideoView;
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.constraintlayout.widget.ConstraintLayout;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
@@ -66,6 +66,7 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
private static final int CAPTURE_VIDEO_REQUEST_CODE = 2;
@BindView(R.id.coordinator_layout_post_video_activity) CoordinatorLayout coordinatorLayout;
+ @BindView(R.id.toolbar_post_video_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_video_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_video_activity) TextView subreditNameTextView;
@BindView(R.id.rules_button_post_video_activity) Button rulesButton;
@@ -127,9 +128,8 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
((Infinity) getApplication()).getmAppComponent().inject(this);
- ActionBar actionBar = getSupportActionBar();
- Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
- actionBar.setHomeAsUpIndicator(upArrow);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mGlide = Glide.with(this);
mLocale = getResources().getConfiguration().locale;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java
index 113b9835..e0bedcdf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java
@@ -1,9 +1,11 @@
package ml.docilealligator.infinityforreddit;
+import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -22,11 +24,15 @@ public class SearchActivity extends AppCompatActivity {
static final String EXTRA_SUBREDDIT_NAME = "ESN";
static final String EXTRA_SUBREDDIT_IS_USER = "ESIU";
+ static final String EXTRA_SEARCH_ONLY_SUBREDDITS = "ESOS";
+ static final String EXTRA_RETURN_SUBREDDIT_NAME = "ERSN";
+ static final String EXTRA_RETURN_SUBREDDIT_ICON_URL = "ERSIURL";
private static final String SUBREDDIT_NAME_STATE = "SNS";
private static final String SUBREDDIT_IS_USER_STATE = "SIUS";
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
+ private static final int SUBREDDIT_SEARCH_REQUEST_CODE = 1;
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.search_view_search_activity) SimpleSearchView simpleSearchView;
@@ -45,6 +51,8 @@ public class SearchActivity extends AppCompatActivity {
setSupportActionBar(toolbar);
+ boolean searchOnlySubreddits = getIntent().getExtras().getBoolean(EXTRA_SEARCH_ONLY_SUBREDDITS);
+
simpleSearchView.setOnSearchViewListener(new SimpleSearchView.SearchViewListener() {
@Override
public void onSearchViewShown() {
@@ -70,19 +78,24 @@ public class SearchActivity extends AppCompatActivity {
simpleSearchView.setOnQueryTextListener(new SimpleSearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
- Intent intent = new Intent(SearchActivity.this, SearchResultActivity.class);
- intent.putExtra(SearchResultActivity.EXTRA_QUERY, query);
- if(subredditName != null) {
- if(subredditIsUser) {
- intent.putExtra(SearchResultActivity.EXTRA_SUBREDDIT_NAME, "u_" + subredditName);
- } else {
- intent.putExtra(SearchResultActivity.EXTRA_SUBREDDIT_NAME, subredditName);
+ if(searchOnlySubreddits) {
+ Intent intent = new Intent(SearchActivity.this, SearchSubredditsResultActivity.class);
+ intent.putExtra(SearchSubredditsResultActivity.EXTRA_QUERY, query);
+ startActivityForResult(intent, SUBREDDIT_SEARCH_REQUEST_CODE);
+ } else {
+ Intent intent = new Intent(SearchActivity.this, SearchResultActivity.class);
+ intent.putExtra(SearchResultActivity.EXTRA_QUERY, query);
+ if(subredditName != null) {
+ if(subredditIsUser) {
+ intent.putExtra(SearchResultActivity.EXTRA_SUBREDDIT_NAME, "u_" + subredditName);
+ } else {
+ intent.putExtra(SearchResultActivity.EXTRA_SUBREDDIT_NAME, subredditName);
+ }
}
+ startActivity(intent);
+ finish();
}
-
- finish();
- startActivity(intent);
- return false;
+ return true;
}
@Override
@@ -107,11 +120,15 @@ public class SearchActivity extends AppCompatActivity {
}
}
- subredditNameRelativeLayout.setOnClickListener(view -> {
- Intent intent = new Intent(this, SubredditSelectionActivity.class);
- intent.putExtra(SubredditSelectionActivity.EXTRA_EXTRA_CLEAR_SELECTION, true);
- startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
- });
+ if(searchOnlySubreddits) {
+ subredditNameRelativeLayout.setVisibility(View.GONE);
+ } else {
+ subredditNameRelativeLayout.setOnClickListener(view -> {
+ Intent intent = new Intent(this, SubredditSelectionActivity.class);
+ intent.putExtra(SubredditSelectionActivity.EXTRA_EXTRA_CLEAR_SELECTION, true);
+ startActivityForResult(intent, SUBREDDIT_SELECTION_REQUEST_CODE);
+ });
+ }
Intent intent = getIntent();
if(intent.hasExtra(EXTRA_SUBREDDIT_NAME)) {
@@ -146,6 +163,16 @@ public class SearchActivity extends AppCompatActivity {
subredditNameTextView.setText(subredditName);
}
}
+ } else if(requestCode == SUBREDDIT_SEARCH_REQUEST_CODE) {
+ if(resultCode == RESULT_OK) {
+ String name = data.getExtras().getString(SearchSubredditsResultActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ String iconUrl = data.getExtras().getString(SearchSubredditsResultActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
+ Intent returnIntent = new Intent();
+ returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name);
+ returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl);
+ setResult(Activity.RESULT_OK, returnIntent);
+ finish();
+ }
}
super.onActivityResult(requestCode, resultCode, data);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java
index a63f1de2..c8010021 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java
@@ -149,7 +149,8 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
case 1: {
SubredditListingFragment mFragment = new SubredditListingFragment();
Bundle bundle = new Bundle();
- bundle.putString(SubredditListingFragment.QUERY_KEY, mQuery);
+ bundle.putString(SubredditListingFragment.EXTRA_QUERY_KEY, mQuery);
+ bundle.putBoolean(SubredditListingFragment.EXTRA_IS_POSTING, false);
mFragment.setArguments(bundle);
return mFragment;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java
new file mode 100644
index 00000000..e8029bf9
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java
@@ -0,0 +1,68 @@
+package ml.docilealligator.infinityforreddit;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import androidx.fragment.app.Fragment;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class SearchSubredditsResultActivity extends AppCompatActivity {
+
+ static final String EXTRA_QUERY = "EQ";
+ static final String EXTRA_RETURN_SUBREDDIT_NAME = "ERSN";
+ static final String EXTRA_RETURN_SUBREDDIT_ICON_URL = "ERSIURL";
+
+ private static final String FRAGMENT_OUT_STATE = "FOS";
+
+ @BindView(R.id.toolbar_search_subreddits_result_activity) Toolbar toolbar;
+
+ Fragment mFragment;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_search_subreddits_result);
+
+ ButterKnife.bind(this);
+
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ String query = getIntent().getExtras().getString(EXTRA_QUERY);
+
+ if(savedInstanceState == null) {
+ mFragment = new SubredditListingFragment();
+ Bundle bundle = new Bundle();
+ bundle.putString(SubredditListingFragment.EXTRA_QUERY_KEY, query);
+ bundle.putBoolean(SubredditListingFragment.EXTRA_IS_POSTING, true);
+ mFragment.setArguments(bundle);
+ getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_search_subreddits_result_activity, mFragment).commit();
+ } else {
+ mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
+ getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_search_subreddits_result_activity, mFragment).commit();
+
+ }
+ }
+
+ void getSelectedSubreddit(String name, String iconUrl) {
+ Intent returnIntent = new Intent();
+ returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name);
+ returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl);
+ setResult(Activity.RESULT_OK, returnIntent);
+ finish();
+ }
+
+ @Override
+ protected void onSaveInstanceState(@NonNull Bundle outState) {
+ super.onSaveInstanceState(outState);
+ if (mFragment != null) {
+ getSupportFragmentManager().putFragment(outState, FRAGMENT_OUT_STATE, mFragment);
+ }
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingFragment.java
index 2168bddd..7c250cdf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingFragment.java
@@ -1,6 +1,8 @@
package ml.docilealligator.infinityforreddit;
+import android.app.Activity;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -33,7 +35,8 @@ import retrofit2.Retrofit;
*/
public class SubredditListingFragment extends Fragment implements FragmentCommunicator {
- static final String QUERY_KEY = "QK";
+ static final String EXTRA_QUERY_KEY = "EQK";
+ static final String EXTRA_IS_POSTING = "EIP";
@BindView(R.id.coordinator_layout_subreddit_listing_fragment) CoordinatorLayout mCoordinatorLayout;
@BindView(R.id.recycler_view_subreddit_listing_fragment) RecyclerView mSubredditListingRecyclerView;
@@ -44,8 +47,6 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
private LinearLayoutManager mLinearLayoutManager;
- private String mQuery;
-
private SubredditListingRecyclerViewAdapter mAdapter;
SubredditListingViewModel mSubredditListingViewModel;
@@ -70,16 +71,19 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_subreddit_listing, container, false);
- ((Infinity) getActivity().getApplication()).getmAppComponent().inject(this);
+ Activity activity = getActivity();
+
+ ((Infinity) activity.getApplication()).getmAppComponent().inject(this);
ButterKnife.bind(this, rootView);
mLinearLayoutManager = new LinearLayoutManager(getActivity());
mSubredditListingRecyclerView.setLayoutManager(mLinearLayoutManager);
- mQuery = getArguments().getString(QUERY_KEY);
+ String query = getArguments().getString(EXTRA_QUERY_KEY);
+ boolean isPosting = getArguments().getBoolean(EXTRA_IS_POSTING);
- SubredditListingViewModel.Factory factory = new SubredditListingViewModel.Factory(mRetrofit, mQuery,
+ SubredditListingViewModel.Factory factory = new SubredditListingViewModel.Factory(mRetrofit, query,
PostDataSource.SORT_TYPE_RELEVANCE, new SubredditListingDataSource.OnSubredditListingDataFetchedCallback() {
@Override
public void hasSubreddit() {
@@ -98,7 +102,23 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
mAdapter = new SubredditListingRecyclerViewAdapter(getActivity(), mOauthRetrofit, mRetrofit,
mAuthInfoSharedPreferences,
SubscribedSubredditRoomDatabase.getDatabase(getContext()).subscribedSubredditDao(),
- () -> mSubredditListingViewModel.retryLoadingMore());
+ new SubredditListingRecyclerViewAdapter.Callback() {
+ @Override
+ public void retryLoadingMore() {
+ mSubredditListingViewModel.retryLoadingMore();
+ }
+
+ @Override
+ public void subredditSelected(String subredditName, String iconUrl) {
+ if(isPosting) {
+ ((SearchSubredditsResultActivity) activity).getSelectedSubreddit(subredditName, iconUrl);
+ } else {
+ Intent intent = new Intent(activity, ViewSubredditDetailActivity.class);
+ intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditName);
+ activity.startActivity(intent);
+ }
+ }
+ });
mSubredditListingRecyclerView.setAdapter(mAdapter);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingRecyclerViewAdapter.java
index 4de52062..d18e48b6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingRecyclerViewAdapter.java
@@ -1,7 +1,6 @@
package ml.docilealligator.infinityforreddit;
import android.content.Context;
-import android.content.Intent;
import android.content.SharedPreferences;
import android.view.LayoutInflater;
import android.view.View;
@@ -31,8 +30,9 @@ import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit;
public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<SubredditData, RecyclerView.ViewHolder> {
- interface RetryLoadingMoreCallback {
+ interface Callback {
void retryLoadingMore();
+ void subredditSelected(String subredditName, String iconUrl);
}
private RequestManager glide;
@@ -48,19 +48,19 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
private SubscribedSubredditDao subscribedSubredditDao;
private NetworkState networkState;
- private RetryLoadingMoreCallback retryLoadingMoreCallback;
+ private Callback callback;
SubredditListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, Retrofit retrofit,
SharedPreferences authInfoSharedPreferences,
SubscribedSubredditDao subscribedSubredditDao,
- RetryLoadingMoreCallback retryLoadingMoreCallback) {
+ Callback callback) {
super(DIFF_CALLBACK);
this.context = context;
this.oauthRetrofit = oauthRetrofit;
this.retrofit = retrofit;
this.authInfoSharedPreferences = authInfoSharedPreferences;
this.subscribedSubredditDao = subscribedSubredditDao;
- this.retryLoadingMoreCallback = retryLoadingMoreCallback;
+ this.callback = callback;
glide = Glide.with(context.getApplicationContext());
}
@@ -95,11 +95,8 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if(holder instanceof DataViewHolder) {
SubredditData subredditData = getItem(position);
- ((DataViewHolder) holder).constraintLayout.setOnClickListener(view -> {
- Intent intent = new Intent(context, ViewSubredditDetailActivity.class);
- intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditData.getName());
- context.startActivity(intent);
- });
+ ((DataViewHolder) holder).constraintLayout.setOnClickListener(view ->
+ callback.subredditSelected(subredditData.getName(), subredditData.getIconUrl()));
if(!subredditData.getIconUrl().equals("")) {
glide.load(subredditData.getIconUrl())
@@ -207,7 +204,7 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
ErrorViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
- retryButton.setOnClickListener(view -> retryLoadingMoreCallback.retryLoadingMore());
+ retryButton.setOnClickListener(view -> callback.retryLoadingMore());
errorTextView.setText(R.string.load_comments_failed);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
index 8dce836d..4367d19e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
@@ -2,14 +2,17 @@ package ml.docilealligator.infinityforreddit;
import android.app.Activity;
import android.content.Intent;
-import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.view.Menu;
import android.view.MenuItem;
import androidx.annotation.NonNull;
-import androidx.appcompat.app.ActionBar;
+import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import androidx.fragment.app.Fragment;
+import butterknife.BindView;
import butterknife.ButterKnife;
public class SubredditSelectionActivity extends AppCompatActivity {
@@ -19,6 +22,13 @@ public class SubredditSelectionActivity extends AppCompatActivity {
static final String EXTRA_RETURN_SUBREDDIT_ICON_URL = "ERSIURL";
static final String EXTRA_RETURN_SUBREDDIT_IS_USER = "ERSIU";
+ private static final int SUBREDDIT_SEARCH_REQUEST_CODE = 0;
+ private static final String FRAGMENT_OUT_STATE = "FOS";
+
+ @BindView(R.id.toolbar_subreddit_selection_activity) Toolbar toolbar;
+
+ private Fragment mFragment;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -26,19 +36,29 @@ public class SubredditSelectionActivity extends AppCompatActivity {
ButterKnife.bind(this);
- ActionBar actionBar = getSupportActionBar();
- Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
- actionBar.setHomeAsUpIndicator(upArrow);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- SubscribedSubredditsListingFragment fragment = new SubscribedSubredditsListingFragment();
- Bundle bundle = new Bundle();
- bundle.putBoolean(SubscribedSubredditsListingFragment.EXTRA_IS_SUBREDDIT_SELECTION, true);
- if(getIntent().hasExtra(EXTRA_EXTRA_CLEAR_SELECTION)) {
- bundle.putBoolean(SubscribedSubredditsListingFragment.EXTRA_EXTRA_CLEAR_SELECTION,
- getIntent().getExtras().getBoolean(EXTRA_EXTRA_CLEAR_SELECTION));
+ if(savedInstanceState == null) {
+ mFragment = new SubscribedSubredditsListingFragment();
+ Bundle bundle = new Bundle();
+ bundle.putBoolean(SubscribedSubredditsListingFragment.EXTRA_IS_SUBREDDIT_SELECTION, true);
+ if(getIntent().hasExtra(EXTRA_EXTRA_CLEAR_SELECTION)) {
+ bundle.putBoolean(SubscribedSubredditsListingFragment.EXTRA_EXTRA_CLEAR_SELECTION,
+ getIntent().getExtras().getBoolean(EXTRA_EXTRA_CLEAR_SELECTION));
+ }
+ mFragment.setArguments(bundle);
+ getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
+ } else {
+ mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
+ getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit();
}
- fragment.setArguments(bundle);
- getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, fragment).commit();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.subreddit_selection_activity, menu);
+ return true;
}
@Override
@@ -47,6 +67,11 @@ public class SubredditSelectionActivity extends AppCompatActivity {
case android.R.id.home:
finish();
return true;
+ case R.id.action_search_subreddit_selection_activity:
+ Intent intent = new Intent(this, SearchActivity.class);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, true);
+ startActivityForResult(intent, SUBREDDIT_SEARCH_REQUEST_CODE);
+ return true;
}
return false;
@@ -60,4 +85,29 @@ public class SubredditSelectionActivity extends AppCompatActivity {
setResult(Activity.RESULT_OK, returnIntent);
finish();
}
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+ if(requestCode == SUBREDDIT_SEARCH_REQUEST_CODE) {
+ if(resultCode == RESULT_OK) {
+ String name = data.getExtras().getString(SearchActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ String iconUrl = data.getExtras().getString(SearchActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
+ Intent returnIntent = new Intent();
+ returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name);
+ returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl);
+ returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_IS_USER, false);
+ setResult(Activity.RESULT_OK, returnIntent);
+ finish();
+ }
+ }
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+
+ @Override
+ protected void onSaveInstanceState(@NonNull Bundle outState) {
+ super.onSaveInstanceState(outState);
+ if (mFragment != null) {
+ getSupportFragmentManager().putFragment(outState, FRAGMENT_OUT_STATE, mFragment);
+ }
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
index fb5664ad..4b9a0984 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
@@ -312,6 +312,7 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_IS_USER, false);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, false);
startActivity(intent);
break;
case R.id.action_refresh_view_subreddit_detail_activity:
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
index b5c11f1c..47c4faee 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
@@ -328,6 +328,7 @@ public class ViewUserDetailActivity extends AppCompatActivity {
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, userName);
intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_IS_USER, true);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, false);
startActivity(intent);
break;
case R.id.action_refresh_view_user_detail_activity:
diff --git a/app/src/main/res/layout/activity_post_image.xml b/app/src/main/res/layout/activity_post_image.xml
index ce345d58..5ca123f7 100644
--- a/app/src/main/res/layout/activity_post_image.xml
+++ b/app/src/main/res/layout/activity_post_image.xml
@@ -7,10 +7,24 @@
android:id="@+id/coordinator_layout_post_image_activity"
tools:context=".PostImageActivity">
+ <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_post_image_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:layout_width="match_parent"
android:layout_height="match_parent"
- android:fillViewport="true">
+ app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/activity_post_link.xml b/app/src/main/res/layout/activity_post_link.xml
index bc24d8c5..52d1215e 100644
--- a/app/src/main/res/layout/activity_post_link.xml
+++ b/app/src/main/res/layout/activity_post_link.xml
@@ -7,10 +7,24 @@
android:id="@+id/coordinator_layout_post_link_activity"
tools:context=".PostTextActivity">
+ <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_post_link_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:layout_width="match_parent"
android:layout_height="match_parent"
- android:fillViewport="true">
+ app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/activity_post_text.xml b/app/src/main/res/layout/activity_post_text.xml
index b3066f1f..e002f0a3 100644
--- a/app/src/main/res/layout/activity_post_text.xml
+++ b/app/src/main/res/layout/activity_post_text.xml
@@ -7,10 +7,24 @@
android:id="@+id/coordinator_layout_post_text_activity"
tools:context=".PostTextActivity">
+ <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_post_text_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:layout_width="match_parent"
android:layout_height="match_parent"
- android:fillViewport="true">
+ app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/activity_post_video.xml b/app/src/main/res/layout/activity_post_video.xml
index d1c3ed58..ce497f44 100644
--- a/app/src/main/res/layout/activity_post_video.xml
+++ b/app/src/main/res/layout/activity_post_video.xml
@@ -7,10 +7,24 @@
android:id="@+id/coordinator_layout_post_video_activity"
tools:context=".PostImageActivity">
+ <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_post_video_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:layout_width="match_parent"
android:layout_height="match_parent"
- android:fillViewport="true">
+ app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/activity_search_subreddits_result.xml b/app/src/main/res/layout/activity_search_subreddits_result.xml
new file mode 100644
index 00000000..6dc3ca23
--- /dev/null
+++ b/app/src/main/res/layout/activity_search_subreddits_result.xml
@@ -0,0 +1,29 @@
+<?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=".SearchSubredditsResultActivity">
+
+ <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_search_subreddits_result_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>
+
+ <FrameLayout
+ android:id="@+id/frame_layout_search_subreddits_result_activity"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/activity_subreddit_selection.xml b/app/src/main/res/layout/activity_subreddit_selection.xml
index 6e844466..6c0e6061 100644
--- a/app/src/main/res/layout/activity_subreddit_selection.xml
+++ b/app/src/main/res/layout/activity_subreddit_selection.xml
@@ -1,8 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<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/frame_layout_subreddit_selection_activity"
- tools:context=".SubredditSelectionActivity" /> \ No newline at end of file
+ tools:context=".SubredditSelectionActivity">
+
+ <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_subreddit_selection_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>
+
+ <FrameLayout
+ android:id="@+id/frame_layout_subreddit_selection_activity"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/menu/subreddit_selection_activity.xml b/app/src/main/res/menu/subreddit_selection_activity.xml
new file mode 100644
index 00000000..f3a40a77
--- /dev/null
+++ b/app/src/main/res/menu/subreddit_selection_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_search_subreddit_selection_activity"
+ android:orderInCategory="1"
+ android:title="@string/action_search"
+ android:icon="@drawable/ic_search_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 49e60111..74646a29 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -10,6 +10,7 @@
<string name="post_image_activity_label">Image Post</string>
<string name="post_video_activity_label">Video Post</string>
<string name="rules_activity_label">Rules</string>
+ <string name="search_subreddits_activity_label">Subreddits</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>