aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RecyclerViewContentScrollingInterface.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/PostFragmentContentScrollingInterface.java)2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java86
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java16
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java16
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java16
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java16
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/InboxFragment.java24
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java8
-rw-r--r--app/src/main/res/layout/activity_inbox.xml8
-rw-r--r--app/src/main/res/layout/dialog_go_to_thing_edit_text.xml27
-rw-r--r--app/src/main/res/values/strings.xml2
15 files changed, 189 insertions, 60 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragmentContentScrollingInterface.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RecyclerViewContentScrollingInterface.java
index 75d5271d..8d0e65cb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragmentContentScrollingInterface.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RecyclerViewContentScrollingInterface.java
@@ -1,6 +1,6 @@
package ml.docilealligator.infinityforreddit;
-public interface PostFragmentContentScrollingInterface {
+public interface RecyclerViewContentScrollingInterface {
void contentScrollUp();
void contentScrollDown();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java
index 10864fbb..e360315e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java
@@ -36,7 +36,7 @@ import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface;
-import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
@@ -60,7 +60,7 @@ import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
public class FilteredPostsActivity extends BaseActivity implements SortTypeSelectionCallback,
PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface,
MarkPostAsReadInterface, FilteredThingFABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback,
- PostFragmentContentScrollingInterface {
+ RecyclerViewContentScrollingInterface {
public static final String EXTRA_NAME = "ESN";
public static final String EXTRA_QUERY = "EQ";
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java
index 22d22c8c..60906ec5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java
@@ -1,5 +1,7 @@
package ml.docilealligator.infinityforreddit.activities;
+import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
@@ -10,6 +12,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
+import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
import androidx.annotation.NonNull;
@@ -23,7 +26,10 @@ import androidx.viewpager.widget.ViewPager;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout;
+import com.google.android.material.textfield.TextInputEditText;
import com.r0adkll.slidr.Slidr;
import com.r0adkll.slidr.model.SlidrInterface;
@@ -40,6 +46,7 @@ import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.apis.RedditAPI;
import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccount;
@@ -55,7 +62,7 @@ import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
-public class InboxActivity extends BaseActivity implements ActivityToolbarInterface {
+public class InboxActivity extends BaseActivity implements ActivityToolbarInterface, RecyclerViewContentScrollingInterface {
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
public static final String EXTRA_VIEW_MESSAGE = "EVM";
@@ -63,6 +70,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
private static final String ACCESS_TOKEN_STATE = "ATS";
private static final String NEW_ACCOUNT_NAME_STATE = "NANS";
+ private static final int SEARCH_USER_REQUEST_CODE = 1;
@BindView(R.id.coordinator_layout_inbox_activity)
CoordinatorLayout mCoordinatorLayout;
@@ -76,6 +84,8 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
TabLayout tabLayout;
@BindView(R.id.view_pager_inbox_activity)
ViewPager viewPager;
+ @BindView(R.id.fab_inbox_activity)
+ FloatingActionButton fab;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@@ -128,6 +138,13 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
adjustToolbar(mToolbar);
+
+ int navBarHeight = getNavBarHeight();
+ if (navBarHeight > 0) {
+ CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
+ params.bottomMargin += navBarHeight;
+ fab.setLayoutParams(params);
+ }
}
}
@@ -149,6 +166,51 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
mNewAccountName = getIntent().getStringExtra(EXTRA_NEW_ACCOUNT_NAME);
getCurrentAccountAndFetchMessage(savedInstanceState);
}
+
+ viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
+ @Override
+ public void onPageSelected(int position) {
+ fab.show();
+ }
+ });
+
+ fab.setOnClickListener(view -> {
+ View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, mCoordinatorLayout, false);
+ TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text);
+ thingEditText.requestFocus();
+ InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+ if (imm != null) {
+ imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
+ }
+ new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
+ .setTitle(R.string.choose_a_user)
+ .setView(rootView)
+ .setPositiveButton(R.string.ok, (dialogInterface, i)
+ -> {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ Intent pmIntent = new Intent(this, SendPrivateMessageActivity.class);
+ pmIntent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, thingEditText.getText().toString());
+ startActivity(pmIntent);
+ })
+ .setNegativeButton(R.string.cancel, null)
+ .setNeutralButton(R.string.search, (dialogInterface, i) -> {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+
+ Intent intent = new Intent(this, SearchActivity.class);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_USERS, true);
+ startActivityForResult(intent, SEARCH_USER_REQUEST_CODE);
+ })
+ .setOnDismissListener(dialogInterface -> {
+ if (imm != null) {
+ imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0);
+ }
+ })
+ .show();
+ });
}
@Override
@@ -166,6 +228,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndToolbarTheme(mAppBarLayout, mToolbar);
applyTabLayoutTheme(tabLayout);
+ applyFABTheme(fab);
}
private void getCurrentAccountAndFetchMessage(Bundle savedInstanceState) {
@@ -270,6 +333,17 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
}
@Override
+ protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (resultCode == RESULT_OK && requestCode == SEARCH_USER_REQUEST_CODE && data != null) {
+ String username = data.getStringExtra(SearchActivity.EXTRA_RETURN_USER_NAME);
+ Intent intent = new Intent(this, SendPrivateMessageActivity.class);
+ intent.putExtra(SendPrivateMessageActivity.EXTRA_RECIPIENT_USERNAME, username);
+ startActivity(intent);
+ }
+ }
+
+ @Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(NULL_ACCESS_TOKEN_STATE, mNullAccessToken);
@@ -309,6 +383,16 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
}
}
+ @Override
+ public void contentScrollUp() {
+ fab.show();
+ }
+
+ @Override
+ public void contentScrollDown() {
+ fab.hide();
+ }
+
private class SectionsPagerAdapter extends FragmentPagerAdapter {
private InboxFragment tab1;
private InboxFragment tab2;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
index 6ace8b65..625be3e3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
@@ -17,7 +17,6 @@ import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
@@ -53,6 +52,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
+import com.google.android.material.textfield.TextInputEditText;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -72,7 +72,7 @@ import ml.docilealligator.infinityforreddit.FetchMyInfo;
import ml.docilealligator.infinityforreddit.FetchSubscribedThing;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface;
-import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.PullNotificationWorker;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
@@ -118,7 +118,7 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
public class MainActivity extends BaseActivity implements SortTypeSelectionCallback,
PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback,
ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback,
- RandomBottomSheetFragment.RandomOptionSelectionCallback, MarkPostAsReadInterface, PostFragmentContentScrollingInterface {
+ RandomBottomSheetFragment.RandomOptionSelectionCallback, MarkPostAsReadInterface, RecyclerViewContentScrollingInterface {
static final String EXTRA_MESSSAGE_FULLNAME = "ENF";
static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
@@ -1232,7 +1232,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
}
private void goToSubreddit() {
- EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
+ View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false);
+ TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text);
thingEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
@@ -1240,7 +1241,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
}
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_subreddit)
- .setView(thingEditText)
+ .setView(rootView)
.setPositiveButton(R.string.ok, (dialogInterface, i)
-> {
if (imm != null) {
@@ -1260,7 +1261,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
}
private void goToUser() {
- EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
+ View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false);
+ TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text);
thingEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
@@ -1268,7 +1270,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
}
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_user)
- .setView(thingEditText)
+ .setView(rootView)
.setPositiveButton(R.string.ok, (dialogInterface, i)
-> {
if (imm != null) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java
index 2b5b2141..f75e3f5f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java
@@ -13,7 +13,6 @@ import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -30,6 +29,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
+import com.google.android.material.textfield.TextInputEditText;
import com.r0adkll.slidr.Slidr;
import com.r0adkll.slidr.model.SlidrInterface;
@@ -46,7 +46,7 @@ import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
-import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
@@ -73,7 +73,7 @@ import ml.docilealligator.infinityforreddit.utils.Utils;
public class SearchResultActivity extends BaseActivity implements SortTypeSelectionCallback,
PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface,
FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, RandomBottomSheetFragment.RandomOptionSelectionCallback,
- PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostFragmentContentScrollingInterface {
+ PostTypeBottomSheetFragment.PostTypeSelectionCallback, RecyclerViewContentScrollingInterface {
static final String EXTRA_QUERY = "QK";
static final String EXTRA_SUBREDDIT_NAME = "ESN";
@@ -565,7 +565,8 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
}
private void goToSubreddit() {
- EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
+ View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false);
+ TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text);
thingEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
@@ -573,7 +574,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
}
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_subreddit)
- .setView(thingEditText)
+ .setView(rootView)
.setPositiveButton(R.string.ok, (dialogInterface, i)
-> {
if (imm != null) {
@@ -593,7 +594,8 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
}
private void goToUser() {
- EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
+ View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false);
+ TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text);
thingEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
@@ -601,7 +603,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
}
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_user)
- .setView(thingEditText)
+ .setView(rootView)
.setPositiveButton(R.string.ok, (dialogInterface, i)
-> {
if (imm != null) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
index aa4732fa..bc5cb1d7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
@@ -15,7 +15,6 @@ import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -44,6 +43,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
+import com.google.android.material.textfield.TextInputEditText;
import com.r0adkll.slidr.Slidr;
import com.r0adkll.slidr.model.SlidrInterface;
@@ -65,7 +65,7 @@ import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface;
-import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
@@ -104,7 +104,7 @@ import retrofit2.Retrofit;
public class ViewSubredditDetailActivity extends BaseActivity implements SortTypeSelectionCallback,
PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback,
ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback,
- RandomBottomSheetFragment.RandomOptionSelectionCallback, MarkPostAsReadInterface, PostFragmentContentScrollingInterface {
+ RandomBottomSheetFragment.RandomOptionSelectionCallback, MarkPostAsReadInterface, RecyclerViewContentScrollingInterface {
public static final String EXTRA_SUBREDDIT_NAME_KEY = "ESN";
public static final String EXTRA_MESSAGE_FULLNAME = "ENF";
@@ -1199,7 +1199,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
private void goToSubreddit() {
- EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
+ View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false);
+ TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text);
thingEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
@@ -1207,7 +1208,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_subreddit)
- .setView(thingEditText)
+ .setView(rootView)
.setPositiveButton(R.string.ok, (dialogInterface, i)
-> {
if (imm != null) {
@@ -1227,7 +1228,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
private void goToUser() {
- EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
+ View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false);
+ TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text);
thingEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
@@ -1235,7 +1237,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_user)
- .setView(thingEditText)
+ .setView(rootView)
.setPositiveButton(R.string.ok, (dialogInterface, i)
-> {
if (imm != null) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
index 4756eea6..9884d797 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
@@ -18,7 +18,6 @@ import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
-import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -47,6 +46,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
+import com.google.android.material.textfield.TextInputEditText;
import com.r0adkll.slidr.Slidr;
import com.r0adkll.slidr.model.SlidrInterface;
@@ -69,7 +69,7 @@ import ml.docilealligator.infinityforreddit.DeleteThing;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface;
-import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
@@ -110,7 +110,7 @@ import retrofit2.Retrofit;
public class ViewUserDetailActivity extends BaseActivity implements SortTypeSelectionCallback,
PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback,
ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback,
- RandomBottomSheetFragment.RandomOptionSelectionCallback, MarkPostAsReadInterface, PostFragmentContentScrollingInterface {
+ RandomBottomSheetFragment.RandomOptionSelectionCallback, MarkPostAsReadInterface, RecyclerViewContentScrollingInterface {
public static final String EXTRA_USER_NAME_KEY = "EUNK";
public static final String EXTRA_MESSAGE_FULLNAME = "ENF";
@@ -1165,7 +1165,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
}
private void goToSubreddit() {
- EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
+ View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false);
+ TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text);
thingEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
@@ -1173,7 +1174,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
}
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_subreddit)
- .setView(thingEditText)
+ .setView(rootView)
.setPositiveButton(R.string.ok, (dialogInterface, i)
-> {
if (imm != null) {
@@ -1193,7 +1194,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
}
private void goToUser() {
- EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null);
+ View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false);
+ TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text);
thingEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
@@ -1201,7 +1203,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
}
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.go_to_user)
- .setView(thingEditText)
+ .setView(rootView)
.setPositiveButton(R.string.ok, (dialogInterface, i)
-> {
if (imm != null) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java
index cd1febb1..35e8290c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java
@@ -42,7 +42,7 @@ import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.NetworkState;
-import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
@@ -295,14 +295,14 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
mCommentRecyclerView.setAdapter(mAdapter);
- if (mActivity instanceof PostFragmentContentScrollingInterface) {
+ if (mActivity instanceof RecyclerViewContentScrollingInterface) {
mCommentRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (dy > 0) {
- ((PostFragmentContentScrollingInterface) mActivity).contentScrollDown();
+ ((RecyclerViewContentScrollingInterface) mActivity).contentScrollDown();
} else if (dy < 0) {
- ((PostFragmentContentScrollingInterface) mActivity).contentScrollUp();
+ ((RecyclerViewContentScrollingInterface) mActivity).contentScrollUp();
}
}
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/InboxFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/InboxFragment.java
index d97ad1ff..b9879c3e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/InboxFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/InboxFragment.java
@@ -29,17 +29,18 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.FragmentCommunicator;
+import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.NetworkState;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.activities.BaseActivity;
import ml.docilealligator.infinityforreddit.adapters.MessageRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.events.RepliedToPrivateMessageEvent;
import ml.docilealligator.infinityforreddit.message.FetchMessage;
-import ml.docilealligator.infinityforreddit.FragmentCommunicator;
-import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.message.MessageViewModel;
-import ml.docilealligator.infinityforreddit.NetworkState;
-import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import retrofit2.Retrofit;
public class InboxFragment extends Fragment implements FragmentCommunicator {
@@ -111,6 +112,19 @@ public class InboxFragment extends Fragment implements FragmentCommunicator {
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mActivity, mLinearLayoutManager.getOrientation());
mRecyclerView.addItemDecoration(dividerItemDecoration);
+ if (mActivity instanceof RecyclerViewContentScrollingInterface) {
+ mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
+ @Override
+ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
+ if (dy > 0) {
+ ((RecyclerViewContentScrollingInterface) mActivity).contentScrollDown();
+ } else if (dy < 0) {
+ ((RecyclerViewContentScrollingInterface) mActivity).contentScrollUp();
+ }
+ }
+ });
+ }
+
MessageViewModel.Factory factory = new MessageViewModel.Factory(mOauthRetrofit,
getResources().getConfiguration().locale, mAccessToken, mWhere);
mMessageViewModel = new ViewModelProvider(this, factory).get(MessageViewModel.class);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
index f8a5a9d7..bf2bdd6b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
@@ -68,7 +68,7 @@ import ml.docilealligator.infinityforreddit.FetchPostFilterAndReadPosts;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.NetworkState;
-import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
@@ -400,14 +400,14 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
return false;
});
- if (activity instanceof PostFragmentContentScrollingInterface) {
+ if (activity instanceof RecyclerViewContentScrollingInterface) {
mPostRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (dy > 0) {
- ((PostFragmentContentScrollingInterface) activity).contentScrollDown();
+ ((RecyclerViewContentScrollingInterface) activity).contentScrollDown();
} else if (dy < 0) {
- ((PostFragmentContentScrollingInterface) activity).contentScrollUp();
+ ((RecyclerViewContentScrollingInterface) activity).contentScrollUp();
}
}
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java
index ef0d7a89..996739dc 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java
@@ -33,7 +33,7 @@ import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.NetworkState;
-import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
@@ -157,14 +157,14 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
mSubredditListingRecyclerView.setAdapter(mAdapter);
- if (mActivity instanceof PostFragmentContentScrollingInterface) {
+ if (mActivity instanceof RecyclerViewContentScrollingInterface) {
mSubredditListingRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (dy > 0) {
- ((PostFragmentContentScrollingInterface) mActivity).contentScrollDown();
+ ((RecyclerViewContentScrollingInterface) mActivity).contentScrollDown();
} else if (dy < 0) {
- ((PostFragmentContentScrollingInterface) mActivity).contentScrollUp();
+ ((RecyclerViewContentScrollingInterface) mActivity).contentScrollUp();
}
}
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java
index ecd16441..f6d9ceb1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java
@@ -33,7 +33,7 @@ import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.NetworkState;
-import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface;
+import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
@@ -157,14 +157,14 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato
mUserListingRecyclerView.setAdapter(mAdapter);
- if (mActivity instanceof PostFragmentContentScrollingInterface) {
+ if (mActivity instanceof RecyclerViewContentScrollingInterface) {
mUserListingRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (dy > 0) {
- ((PostFragmentContentScrollingInterface) mActivity).contentScrollDown();
+ ((RecyclerViewContentScrollingInterface) mActivity).contentScrollDown();
} else if (dy < 0) {
- ((PostFragmentContentScrollingInterface) mActivity).contentScrollUp();
+ ((RecyclerViewContentScrollingInterface) mActivity).contentScrollUp();
}
}
});
diff --git a/app/src/main/res/layout/activity_inbox.xml b/app/src/main/res/layout/activity_inbox.xml
index dee4ab8c..b65c0d89 100644
--- a/app/src/main/res/layout/activity_inbox.xml
+++ b/app/src/main/res/layout/activity_inbox.xml
@@ -51,4 +51,12 @@
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+ <com.google.android.material.floatingactionbutton.FloatingActionButton
+ android:id="@+id/fab_inbox_activity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/fab_margin"
+ android:layout_gravity="bottom|end"
+ app:srcCompat="@drawable/ic_add_day_night_24dp" />
+
</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_go_to_thing_edit_text.xml b/app/src/main/res/layout/dialog_go_to_thing_edit_text.xml
index 748376bf..2175b284 100644
--- a/app/src/main/res/layout/dialog_go_to_thing_edit_text.xml
+++ b/app/src/main/res/layout/dialog_go_to_thing_edit_text.xml
@@ -1,10 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
-<EditText xmlns:android="http://schemas.android.com/apk/res/android"
+<com.google.android.material.textfield.TextInputLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="24dp"
- android:background="#00000000"
- android:hint="@string/go_to_thing_hint"
- android:textColor="?attr/primaryTextColor"
- android:textSize="?attr/font_default"
- android:fontFamily="?attr/font_family" /> \ No newline at end of file
+ android:paddingStart="16dp"
+ android:paddingTop="8dp"
+ android:paddingEnd="16dp"
+ android:paddingBottom="8dp"
+ app:boxStrokeColor="?attr/primaryTextColor"
+ app:hintTextColor="?attr/primaryTextColor">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/text_input_edit_text_go_to_thing_edit_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:fontFamily="?attr/font_family"
+ android:hint="@string/go_to_thing_hint"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_default" />
+
+</com.google.android.material.textfield.TextInputLayout> \ 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 640db5b0..29d5930c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1004,4 +1004,6 @@
<string name="add_subreddit_or_user_to_multireddit_success">%1$s is added to multireddit %2$s</string>
<string name="add_subreddit_or_user_to_multireddit_failed">Unable to add %1$s to multireddit %2$s</string>
+ <string name="choose_a_user">Choose a user</string>
+
</resources>