aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/AndroidManifest.xml8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomThemeListingActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomizeThemeActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/InboxActivity.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java)44
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SelectedSubredditsActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java165
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/InboxFragment.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewMessagesFragment.java)16
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Message.java67
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java22
-rw-r--r--app/src/main/res/layout/activity_inbox.xml (renamed from app/src/main/res/layout/activity_view_message.xml)16
-rw-r--r--app/src/main/res/layout/activity_view_private_messages.xml52
-rw-r--r--app/src/main/res/layout/fragment_inbox.xml (renamed from app/src/main/res/layout/fragment_view_messages.xml)12
-rw-r--r--app/src/main/res/menu/inbox_activity.xml (renamed from app/src/main/res/menu/view_message_activity.xml)2
44 files changed, 394 insertions, 102 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5b4d7d0a..d1ff8e5d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -24,6 +24,10 @@
android:usesCleartextTraffic="true"
tools:replace="android:label">
+ <activity android:name=".Activity.ViewPrivateMessagesActivity"
+ android:parentActivityName=".Activity.MainActivity"
+ android:theme="@style/AppTheme.Slidable" />
+
<service
android:name=".Service.DownloadRedditVideoService"
android:enabled="true"
@@ -118,7 +122,7 @@
android:parentActivityName=".Activity.MainActivity"
android:theme="@style/PreferenceActivityTheme" />
<activity
- android:name=".Activity.ViewMessageActivity"
+ android:name=".Activity.InboxActivity"
android:label="@string/view_message_activity_label"
android:parentActivityName=".Activity.MainActivity"
android:theme="@style/AppTheme.Slidable" />
@@ -324,4 +328,4 @@
android:exported="false" />
</application>
-</manifest>
+</manifest> \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java
index 97cc5967..2c144bd4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java
@@ -156,7 +156,7 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java
index 42e89abc..36a61624 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java
@@ -147,7 +147,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
index 883d0ce8..6f24bc3f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
@@ -58,7 +58,7 @@ public abstract class BaseActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
customThemeWrapper = getCustomThemeWrapper();
- SharedPreferences mSharedPreferences = getSharedPreferences();
+ SharedPreferences mSharedPreferences = getDefaultSharedPreferences();
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
int systemThemeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
immersiveInterface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
@@ -174,7 +174,7 @@ public abstract class BaseActivity extends AppCompatActivity {
}
}
- protected abstract SharedPreferences getSharedPreferences();
+ protected abstract SharedPreferences getDefaultSharedPreferences();
protected abstract CustomThemeWrapper getCustomThemeWrapper();
@@ -229,7 +229,7 @@ public abstract class BaseActivity extends AppCompatActivity {
}
public int getNavBarHeight() {
- if (getSharedPreferences().getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY, false)) {
+ if (getDefaultSharedPreferences().getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY, false)) {
return 0;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java
index 95804f88..c87fd263 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java
@@ -259,7 +259,7 @@ public class CommentActivity extends BaseActivity {
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java
index 86669de9..1d413026 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java
@@ -210,7 +210,7 @@ public class CreateMultiRedditActivity extends BaseActivity {
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomThemeListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomThemeListingActivity.java
index 4e937cf6..304a2a0a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomThemeListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomThemeListingActivity.java
@@ -135,7 +135,7 @@ public class CustomThemeListingActivity extends BaseActivity implements
}
@Override
- protected SharedPreferences getSharedPreferences() {
+ protected SharedPreferences getDefaultSharedPreferences() {
return sharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomizeThemeActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomizeThemeActivity.java
index 0853700b..27823944 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomizeThemeActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomizeThemeActivity.java
@@ -229,7 +229,7 @@ public class CustomizeThemeActivity extends BaseActivity {
}
@Override
- protected SharedPreferences getSharedPreferences() {
+ protected SharedPreferences getDefaultSharedPreferences() {
return sharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java
index 1d807d13..abe86b66 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java
@@ -113,7 +113,7 @@ public class EditCommentActivity extends BaseActivity {
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java
index 1eb815b6..c12683ed 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java
@@ -244,7 +244,7 @@ public class EditMultiRedditActivity extends BaseActivity {
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java
index d886f91f..9615c4a9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java
@@ -116,7 +116,7 @@ public class EditPostActivity extends BaseActivity {
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java
index 1ed02b61..b274c314 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java
@@ -174,7 +174,7 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/InboxActivity.java
index ecc33a6c..4a94d3ab 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/InboxActivity.java
@@ -39,14 +39,14 @@ import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FetchMessages;
-import ml.docilealligator.infinityforreddit.Fragment.ViewMessagesFragment;
+import ml.docilealligator.infinityforreddit.Fragment.InboxFragment;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import retrofit2.Retrofit;
-public class ViewMessageActivity extends BaseActivity implements ActivityToolbarInterface {
+public class InboxActivity extends BaseActivity implements ActivityToolbarInterface {
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
@@ -54,17 +54,17 @@ public class ViewMessageActivity extends BaseActivity implements ActivityToolbar
private static final String ACCESS_TOKEN_STATE = "ATS";
private static final String NEW_ACCOUNT_NAME_STATE = "NANS";
- @BindView(R.id.coordinator_layout_view_message_activity)
+ @BindView(R.id.coordinator_layout_inbox_activity)
CoordinatorLayout mCoordinatorLayout;
- @BindView(R.id.collapsing_toolbar_layout_view_message_activity)
+ @BindView(R.id.collapsing_toolbar_layout_inbox_activity)
CollapsingToolbarLayout collapsingToolbarLayout;
- @BindView(R.id.appbar_layout_view_message_activity)
+ @BindView(R.id.appbar_layout_inbox_activity)
AppBarLayout mAppBarLayout;
- @BindView(R.id.toolbar_view_message_activity)
+ @BindView(R.id.toolbar_inbox_activity)
Toolbar mToolbar;
- @BindView(R.id.tab_layout_view_message_activity)
+ @BindView(R.id.tab_layout_inbox_activity)
TabLayout tabLayout;
- @BindView(R.id.view_pager_view_message_activity)
+ @BindView(R.id.view_pager_inbox_activity)
ViewPager viewPager;
@Inject
@Named("oauth")
@@ -88,7 +88,7 @@ public class ViewMessageActivity extends BaseActivity implements ActivityToolbar
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_view_message);
+ setContentView(R.layout.activity_inbox);
ButterKnife.bind(this);
@@ -134,7 +134,7 @@ public class ViewMessageActivity extends BaseActivity implements ActivityToolbar
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
@@ -202,14 +202,14 @@ public class ViewMessageActivity extends BaseActivity implements ActivityToolbar
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.view_message_activity, menu);
+ getMenuInflater().inflate(R.menu.inbox_activity, menu);
applyMenuItemTheme(menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
- if (item.getItemId() == R.id.action_refresh_view_message_activity) {
+ if (item.getItemId() == R.id.action_refresh_inbox_activity) {
if (sectionsPagerAdapter != null) {
sectionsPagerAdapter.refresh();
}
@@ -262,8 +262,8 @@ public class ViewMessageActivity extends BaseActivity implements ActivityToolbar
}
private class SectionsPagerAdapter extends FragmentPagerAdapter {
- private ViewMessagesFragment tab1;
- private ViewMessagesFragment tab2;
+ private InboxFragment tab1;
+ private InboxFragment tab2;
public SectionsPagerAdapter(@NonNull FragmentManager fm) {
super(fm, FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
@@ -273,17 +273,17 @@ public class ViewMessageActivity extends BaseActivity implements ActivityToolbar
@Override
public Fragment getItem(int position) {
if (position == 0) {
- ViewMessagesFragment fragment = new ViewMessagesFragment();
+ InboxFragment fragment = new InboxFragment();
Bundle bundle = new Bundle();
- bundle.putString(ViewMessagesFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
- bundle.putString(ViewMessagesFragment.EXTRA_MESSAGE_WHERE, FetchMessages.WHERE_INBOX);
+ bundle.putString(InboxFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
+ bundle.putString(InboxFragment.EXTRA_MESSAGE_WHERE, FetchMessages.WHERE_INBOX);
fragment.setArguments(bundle);
return fragment;
} else {
- ViewMessagesFragment fragment = new ViewMessagesFragment();
+ InboxFragment fragment = new InboxFragment();
Bundle bundle = new Bundle();
- bundle.putString(ViewMessagesFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
- bundle.putString(ViewMessagesFragment.EXTRA_MESSAGE_WHERE, FetchMessages.WHERE_MESSAGES);
+ bundle.putString(InboxFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
+ bundle.putString(InboxFragment.EXTRA_MESSAGE_WHERE, FetchMessages.WHERE_MESSAGES);
fragment.setArguments(bundle);
return fragment;
}
@@ -309,9 +309,9 @@ public class ViewMessageActivity extends BaseActivity implements ActivityToolbar
public Object instantiateItem(@NonNull ViewGroup container, int position) {
Fragment fragment = (Fragment) super.instantiateItem(container, position);
if (position == 0) {
- tab1 = (ViewMessagesFragment) fragment;
+ tab1 = (InboxFragment) fragment;
} else if (position == 1) {
- tab2 = (ViewMessagesFragment) fragment;
+ tab2 = (InboxFragment) fragment;
}
return fragment;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java
index 0fa06f4f..a15536a9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java
@@ -218,7 +218,7 @@ public class LoginActivity extends BaseActivity {
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
index fbc3c9f1..04c1ff41 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
@@ -292,7 +292,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
@@ -444,7 +444,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
});
messageBottomAppBar.setOnClickListener(view -> {
- Intent intent = new Intent(this, ViewMessageActivity.class);
+ Intent intent = new Intent(this, InboxActivity.class);
startActivity(intent);
});
@@ -483,7 +483,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
intent = new Intent(MainActivity.this, MultiRedditListingActivity.class);
break;
case R.string.inbox:
- intent = new Intent(MainActivity.this, ViewMessageActivity.class);
+ intent = new Intent(MainActivity.this, InboxActivity.class);
break;
case R.string.upvoted:
intent = new Intent(MainActivity.this, AccountPostsActivity.class);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java
index e636572d..83b34001 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java
@@ -252,7 +252,7 @@ public class MultiRedditListingActivity extends BaseActivity {
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java
index 07952f79..ca204bd7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java
@@ -371,7 +371,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java
index c041f64e..e3e7dc48 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java
@@ -310,7 +310,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java
index a3e3accc..f6d972da 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java
@@ -314,7 +314,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java
index 68068775..aeb8b70d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java
@@ -376,7 +376,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java
index b816b505..b05d41ab 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java
@@ -202,7 +202,7 @@ public class ReportActivity extends BaseActivity {
}
@Override
- protected SharedPreferences getSharedPreferences() {
+ protected SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java
index f90dedf3..809fafa2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java
@@ -136,7 +136,7 @@ public class RulesActivity extends BaseActivity {
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java
index 8b603451..d46bfce0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java
@@ -184,7 +184,7 @@ public class SearchActivity extends BaseActivity {
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java
index 5ea80f8f..fa2ceaa9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java
@@ -176,7 +176,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java
index b7b2730d..21c80e60 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java
@@ -117,7 +117,7 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SelectedSubredditsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SelectedSubredditsActivity.java
index 3d17ecbf..9145f102 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SelectedSubredditsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SelectedSubredditsActivity.java
@@ -150,7 +150,7 @@ public class SelectedSubredditsActivity extends BaseActivity implements Activity
}
@Override
- protected SharedPreferences getSharedPreferences() {
+ protected SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java
index 3c50caf8..4a1be2c3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java
@@ -91,7 +91,7 @@ public class SettingsActivity extends BaseActivity implements
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java
index 88825dc5..18aeed17 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java
@@ -235,7 +235,7 @@ public class SubredditMultiselectionActivity extends BaseActivity implements Act
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java
index b6aa045d..18601f89 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java
@@ -138,7 +138,7 @@ public class SubredditSelectionActivity extends BaseActivity implements Activity
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java
index 994d19e7..cf8e5bfc 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java
@@ -149,7 +149,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java
index 1317e133..e709b991 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java
@@ -332,7 +332,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
index 81e1ba8a..6586dd08 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
@@ -377,7 +377,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java
new file mode 100644
index 00000000..0d666658
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java
@@ -0,0 +1,165 @@
+package ml.docilealligator.infinityforreddit.Activity;
+
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.Window;
+import android.view.WindowManager;
+
+import androidx.appcompat.widget.Toolbar;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.google.android.material.appbar.AppBarLayout;
+import com.google.android.material.appbar.CollapsingToolbarLayout;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import com.r0adkll.slidr.Slidr;
+
+import java.util.ArrayList;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
+import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
+import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.Message;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
+import retrofit2.Retrofit;
+
+public class ViewPrivateMessagesActivity extends BaseActivity implements ActivityToolbarInterface {
+
+ public static final String EXTRA_PRIVATE_MESSAGES = "EPM";
+ public static final String EXTRA_SENDER_USERNAME = "ESU";
+ private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
+ private static final String ACCESS_TOKEN_STATE = "ATS";
+ @BindView(R.id.coordinator_layout_view_private_messages_activity)
+ CoordinatorLayout mCoordinatorLayout;
+ @BindView(R.id.collapsing_toolbar_layout_view_private_messages_activity)
+ CollapsingToolbarLayout collapsingToolbarLayout;
+ @BindView(R.id.appbar_layout_view_private_messages_activity)
+ AppBarLayout mAppBarLayout;
+ @BindView(R.id.toolbar_view_private_messages_activity)
+ Toolbar mToolbar;
+ @BindView(R.id.recycler_view_view_private_messages)
+ RecyclerView mRecyclerView;
+ @BindView(R.id.fab_view_private_messages_activity)
+ FloatingActionButton mFab;
+ @Inject
+ @Named("oauth")
+ Retrofit mOauthRetrofit;
+ @Inject
+ RedditDataRoomDatabase mRedditDataRoomDatabase;
+ @Inject
+ @Named("default")
+ SharedPreferences mSharedPreferences;
+ @Inject
+ CustomThemeWrapper mCustomThemeWrapper;
+ private LinearLayoutManager mLinearLayoutManager;
+ private ArrayList<Message> privateMessages;
+ private boolean mNullAccessToken = false;
+ private String mAccessToken;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ ((Infinity) getApplication()).getAppComponent().inject(this);
+
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.activity_view_private_messages);
+
+ ButterKnife.bind(this);
+
+ applyCustomTheme();
+
+ if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) {
+ Slidr.attach(this);
+ }
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ Window window = getWindow();
+
+ if (isChangeStatusBarIconColor()) {
+ addOnOffsetChangedListener(mAppBarLayout);
+ }
+
+ if (isImmersiveInterface()) {
+ 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) mFab.getLayoutParams();
+ params.bottomMargin = navBarHeight;
+ mFab.setLayoutParams(params);
+ }
+ }
+ }
+
+ Intent intent = getIntent();
+ privateMessages = intent.getParcelableArrayListExtra(EXTRA_PRIVATE_MESSAGES);
+
+ mToolbar.setTitle(intent.getStringExtra(EXTRA_SENDER_USERNAME));
+ setSupportActionBar(mToolbar);
+ setToolbarGoToTop(mToolbar);
+
+ if (savedInstanceState != null) {
+ mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE);
+ mAccessToken = savedInstanceState.getString(ACCESS_TOKEN_STATE);
+
+ if (!mNullAccessToken && mAccessToken == null) {
+ getCurrentAccountAndBindView();
+ } else {
+ bindView();
+ }
+ } else {
+ getCurrentAccountAndBindView();
+ }
+ }
+
+ private void getCurrentAccountAndBindView() {
+ new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
+ if (account == null) {
+ mNullAccessToken = true;
+ } else {
+ mAccessToken = account.getAccessToken();
+ }
+ bindView();
+ }).execute();
+ }
+
+ private void bindView() {
+
+ }
+
+ @Override
+ protected SharedPreferences getDefaultSharedPreferences() {
+ return mSharedPreferences;
+ }
+
+ @Override
+ protected CustomThemeWrapper getCustomThemeWrapper() {
+ return mCustomThemeWrapper;
+ }
+
+ @Override
+ protected void applyCustomTheme() {
+ mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
+ applyAppBarLayoutAndToolbarTheme(mAppBarLayout, mToolbar);
+ applyFABTheme(mFab);
+ }
+
+ @Override
+ public void onLongPress() {
+ if (mLinearLayoutManager != null) {
+ mLinearLayoutManager.scrollToPositionWithOffset(0, 0);
+ }
+ }
+} \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
index 6f122bee..2b516549 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
@@ -413,7 +413,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
@@ -542,7 +542,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
goBackToMainPageBottomAppBar.setOnClickListener(view -> EventBus.getDefault().post(new GoBackToMainPageEvent()));
messageBottomAppBar.setOnClickListener(view -> {
- Intent intent = new Intent(this, ViewMessageActivity.class);
+ Intent intent = new Intent(this, InboxActivity.class);
startActivity(intent);
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
index c3d4c345..cbcd54be 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
@@ -430,7 +430,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
}
@Override
- public SharedPreferences getSharedPreferences() {
+ public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java
index 0a9c9e5f..4deefed2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java
@@ -12,7 +12,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
-import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.paging.PagedListAdapter;
@@ -28,6 +27,7 @@ import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
import io.noties.markwon.linkify.LinkifyPlugin;
import io.noties.markwon.simple.ext.SimpleExtPlugin;
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
+import ml.docilealligator.infinityforreddit.Activity.ViewPrivateMessagesActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.FetchMessages;
@@ -155,7 +155,10 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
intent.setData(uri);
mContext.startActivity(intent);
} else if (mMessageType == FetchMessages.MESSAGE_TYPE_PRIVATE_MESSAGE) {
- Toast.makeText(mContext, "To be implemented", Toast.LENGTH_SHORT).show();
+ Intent intent = new Intent(mContext, ViewPrivateMessagesActivity.class);
+ intent.putExtra(ViewPrivateMessagesActivity.EXTRA_SENDER_USERNAME, message.getAuthor());
+ intent.putExtra(ViewPrivateMessagesActivity.EXTRA_PRIVATE_MESSAGES, message.getReplies());
+ mContext.startActivity(intent);
}
if (message.isNew()) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
index 847afb43..db9b4ddb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
@@ -34,15 +34,17 @@ import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActiv
import ml.docilealligator.infinityforreddit.Activity.ThemePreviewActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewImageOrGifActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewImgurMediaActivity;
-import ml.docilealligator.infinityforreddit.Activity.ViewMessageActivity;
+import ml.docilealligator.infinityforreddit.Activity.InboxActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewMultiRedditDetailActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
+import ml.docilealligator.infinityforreddit.Activity.ViewPrivateMessagesActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewVideoActivity;
import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment;
import ml.docilealligator.infinityforreddit.BottomSheetFragment.FlairBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.FollowedUsersListingFragment;
+import ml.docilealligator.infinityforreddit.Fragment.InboxFragment;
import ml.docilealligator.infinityforreddit.Fragment.MultiRedditListingFragment;
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
import ml.docilealligator.infinityforreddit.Fragment.SidebarFragment;
@@ -50,7 +52,6 @@ import ml.docilealligator.infinityforreddit.Fragment.SubredditListingFragment;
import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment;
import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment;
import ml.docilealligator.infinityforreddit.Fragment.ViewImgurVideoFragment;
-import ml.docilealligator.infinityforreddit.Fragment.ViewMessagesFragment;
import ml.docilealligator.infinityforreddit.Service.DownloadRedditVideoService;
import ml.docilealligator.infinityforreddit.Service.SubmitPostService;
import ml.docilealligator.infinityforreddit.Settings.AdvancedPreferenceFragment;
@@ -119,7 +120,7 @@ public interface AppComponent {
void inject(PullNotificationWorker pullNotificationWorker);
- void inject(ViewMessageActivity viewMessageActivity);
+ void inject(InboxActivity inboxActivity);
void inject(NotificationPreferenceFragment notificationPreferenceFragment);
@@ -175,5 +176,7 @@ public interface AppComponent {
void inject(MultiRedditListingFragment multiRedditListingFragment);
- void inject(ViewMessagesFragment viewMessagesFragment);
+ void inject(InboxFragment inboxFragment);
+
+ void inject(ViewPrivateMessagesActivity viewPrivateMessagesActivity);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewMessagesFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/InboxFragment.java
index 8f7cdd4f..f8b9ad31 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewMessagesFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/InboxFragment.java
@@ -37,19 +37,19 @@ import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import retrofit2.Retrofit;
-public class ViewMessagesFragment extends Fragment implements FragmentCommunicator {
+public class InboxFragment extends Fragment implements FragmentCommunicator {
public static final String EXTRA_ACCESS_TOKEN = "EAT";
public static final String EXTRA_MESSAGE_WHERE = "EMT";
- @BindView(R.id.swipe_refresh_layout_view_messages_fragment)
+ @BindView(R.id.swipe_refresh_layout_inbox_fragment)
SwipeRefreshLayout mSwipeRefreshLayout;
- @BindView(R.id.recycler_view_view_messages_fragment)
+ @BindView(R.id.recycler_view_inbox_fragment)
RecyclerView mRecyclerView;
- @BindView(R.id.fetch_messages_info_linear_layout_view_messages_fragment)
+ @BindView(R.id.fetch_messages_info_linear_layout_inbox_fragment)
LinearLayout mFetchMessageInfoLinearLayout;
- @BindView(R.id.fetch_messages_info_image_view_view_messages_fragment)
+ @BindView(R.id.fetch_messages_info_image_view_inbox_fragment)
ImageView mFetchMessageInfoImageView;
- @BindView(R.id.fetch_messages_info_text_view_view_messages_fragment)
+ @BindView(R.id.fetch_messages_info_text_view_inbox_fragment)
TextView mFetchMessageInfoTextView;
MessageViewModel mMessageViewModel;
@Inject
@@ -68,14 +68,14 @@ public class ViewMessagesFragment extends Fragment implements FragmentCommunicat
private LinearLayoutManager mLinearLayoutManager;
private BaseActivity mActivity;
- public ViewMessagesFragment() {
+ public InboxFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.fragment_view_messages, container, false);
+ View rootView = inflater.inflate(R.layout.fragment_inbox, container, false);
((Infinity) mActivity.getApplication()).getAppComponent().inject(this);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Message.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Message.java
index d45385a1..0aa2c439 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Message.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Message.java
@@ -1,8 +1,11 @@
package ml.docilealligator.infinityforreddit;
+import android.os.Parcel;
+import android.os.Parcelable;
+
import java.util.ArrayList;
-public class Message {
+public class Message implements Parcelable {
static final String TYPE_COMMENT = "t1";
static final String TYPE_ACCOUNT = "t2";
static final String TYPE_LINK = "t3";
@@ -55,6 +58,40 @@ public class Message {
}
+ protected Message(Parcel in) {
+ kind = in.readString();
+ subredditName = in.readString();
+ subredditNamePrefixed = in.readString();
+ id = in.readString();
+ fullname = in.readString();
+ subject = in.readString();
+ author = in.readString();
+ parentFullName = in.readString();
+ title = in.readString();
+ body = in.readString();
+ context = in.readString();
+ distinguished = in.readString();
+ formattedTime = in.readString();
+ wasComment = in.readByte() != 0;
+ isNew = in.readByte() != 0;
+ score = in.readInt();
+ nComments = in.readInt();
+ timeUTC = in.readLong();
+ replies = in.createTypedArrayList(Message.CREATOR);
+ }
+
+ public static final Creator<Message> CREATOR = new Creator<Message>() {
+ @Override
+ public Message createFromParcel(Parcel in) {
+ return new Message(in);
+ }
+
+ @Override
+ public Message[] newArray(int size) {
+ return new Message[size];
+ }
+ };
+
public String getKind() {
return kind;
}
@@ -138,4 +175,32 @@ public class Message {
public void setReplies(ArrayList<Message> replies) {
this.replies = replies;
}
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int i) {
+ parcel.writeString(kind);
+ parcel.writeString(subredditName);
+ parcel.writeString(subredditNamePrefixed);
+ parcel.writeString(id);
+ parcel.writeString(fullname);
+ parcel.writeString(subject);
+ parcel.writeString(author);
+ parcel.writeString(parentFullName);
+ parcel.writeString(title);
+ parcel.writeString(body);
+ parcel.writeString(context);
+ parcel.writeString(distinguished);
+ parcel.writeString(formattedTime);
+ parcel.writeByte((byte) (wasComment ? 1 : 0));
+ parcel.writeByte((byte) (isNew ? 1 : 0));
+ parcel.writeInt(score);
+ parcel.writeInt(nComments);
+ parcel.writeLong(timeUTC);
+ parcel.writeTypedList(replies);
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java
index ef831e4b..a2b37d99 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java
@@ -28,8 +28,8 @@ import javax.inject.Named;
import ml.docilealligator.infinityforreddit.API.RedditAPI;
import ml.docilealligator.infinityforreddit.Account.Account;
+import ml.docilealligator.infinityforreddit.Activity.InboxActivity;
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
-import ml.docilealligator.infinityforreddit.Activity.ViewMessageActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Utils.APIUtils;
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
@@ -149,8 +149,8 @@ public class PullNotificationWorker extends Worker {
PendingIntent pendingIntent = PendingIntent.getActivity(context, accountIndex * 6, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pendingIntent);
} else if (kind.equals(Message.TYPE_ACCOUNT)) {
- Intent intent = new Intent(context, ViewMessageActivity.class);
- intent.putExtra(ViewMessageActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
+ Intent intent = new Intent(context, InboxActivity.class);
+ intent.putExtra(InboxActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
PendingIntent summaryPendingIntent = PendingIntent.getActivity(context, accountIndex * 6 + 1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(summaryPendingIntent);
} else if (kind.equals(Message.TYPE_LINK)) {
@@ -162,18 +162,18 @@ public class PullNotificationWorker extends Worker {
PendingIntent pendingIntent = PendingIntent.getActivity(context, accountIndex * 6 + 2, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pendingIntent);
} else if (kind.equals(Message.TYPE_MESSAGE)) {
- Intent intent = new Intent(context, ViewMessageActivity.class);
- intent.putExtra(ViewMessageActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
+ Intent intent = new Intent(context, InboxActivity.class);
+ intent.putExtra(InboxActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
PendingIntent summaryPendingIntent = PendingIntent.getActivity(context, accountIndex * 6 + 3, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(summaryPendingIntent);
} else if (kind.equals(Message.TYPE_SUBREDDIT)) {
- Intent intent = new Intent(context, ViewMessageActivity.class);
- intent.putExtra(ViewMessageActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
+ Intent intent = new Intent(context, InboxActivity.class);
+ intent.putExtra(InboxActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
PendingIntent summaryPendingIntent = PendingIntent.getActivity(context, accountIndex * 6 + 4, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(summaryPendingIntent);
} else {
- Intent intent = new Intent(context, ViewMessageActivity.class);
- intent.putExtra(ViewMessageActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
+ Intent intent = new Intent(context, InboxActivity.class);
+ intent.putExtra(InboxActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
PendingIntent summaryPendingIntent = PendingIntent.getActivity(context, accountIndex * 6 + 5, intent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(summaryPendingIntent);
}
@@ -186,8 +186,8 @@ public class PullNotificationWorker extends Worker {
summaryBuilder.setStyle(inboxStyle);
- Intent summaryIntent = new Intent(context, ViewMessageActivity.class);
- summaryIntent.putExtra(ViewMessageActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
+ Intent summaryIntent = new Intent(context, InboxActivity.class);
+ summaryIntent.putExtra(InboxActivity.EXTRA_NEW_ACCOUNT_NAME, accountName);
PendingIntent summaryPendingIntent = PendingIntent.getActivity(context, accountIndex * 6 + 6, summaryIntent, PendingIntent.FLAG_UPDATE_CURRENT);
summaryBuilder.setContentIntent(summaryPendingIntent);
diff --git a/app/src/main/res/layout/activity_view_message.xml b/app/src/main/res/layout/activity_inbox.xml
index 8d357f52..b1c31795 100644
--- a/app/src/main/res/layout/activity_view_message.xml
+++ b/app/src/main/res/layout/activity_inbox.xml
@@ -4,25 +4,25 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:id="@+id/coordinator_layout_view_message_activity"
- tools:context=".Activity.ViewMessageActivity">
+ android:id="@+id/coordinator_layout_inbox_activity"
+ tools:context=".Activity.InboxActivity">
<com.google.android.material.appbar.AppBarLayout
- android:id="@+id/appbar_layout_view_message_activity"
+ android:id="@+id/appbar_layout_inbox_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
- android:id="@+id/collapsing_toolbar_layout_view_message_activity"
+ android:id="@+id/collapsing_toolbar_layout_inbox_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false"
- app:toolbarId="@+id/toolbar_view_message_activity">
+ app:toolbarId="@+id/toolbar_inbox_activity">
<androidx.appcompat.widget.Toolbar
- android:id="@+id/toolbar_view_message_activity"
+ android:id="@+id/toolbar_inbox_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
@@ -32,7 +32,7 @@
</com.google.android.material.appbar.CollapsingToolbarLayout>
<com.google.android.material.tabs.TabLayout
- android:id="@+id/tab_layout_view_message_activity"
+ android:id="@+id/tab_layout_inbox_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
@@ -46,7 +46,7 @@
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
- android:id="@+id/view_pager_view_message_activity"
+ android:id="@+id/view_pager_inbox_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
diff --git a/app/src/main/res/layout/activity_view_private_messages.xml b/app/src/main/res/layout/activity_view_private_messages.xml
new file mode 100644
index 00000000..bc663b3a
--- /dev/null
+++ b/app/src/main/res/layout/activity_view_private_messages.xml
@@ -0,0 +1,52 @@
+<?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_view_private_messages_activity"
+ tools:context=".Activity.ViewPrivateMessagesActivity">
+
+ <com.google.android.material.appbar.AppBarLayout
+ android:id="@+id/appbar_layout_view_private_messages_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:theme="@style/AppTheme.AppBarOverlay">
+
+ <com.google.android.material.appbar.CollapsingToolbarLayout
+ android:id="@+id/collapsing_toolbar_layout_view_private_messages_activity"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ app:layout_scrollFlags="scroll|enterAlways"
+ app:titleEnabled="false"
+ app:toolbarId="@+id/toolbar_view_private_messages_activity">
+
+ <androidx.appcompat.widget.Toolbar
+ android:id="@+id/toolbar_view_private_messages_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?attr/actionBarSize"
+ app:popupTheme="@style/AppTheme.PopupOverlay"
+ app:navigationIcon="?attr/homeAsUpIndicator" />
+
+ </com.google.android.material.appbar.CollapsingToolbarLayout>
+
+ </com.google.android.material.appbar.AppBarLayout>
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/recycler_view_view_private_messages"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipToPadding="false"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+
+ <com.google.android.material.floatingactionbutton.FloatingActionButton
+ android:id="@+id/fab_view_private_messages_activity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|end"
+ android:layout_margin="@dimen/fab_margin"
+ app:srcCompat="@drawable/ic_add_day_night_24dp"
+ app:tint="@android:color/white" />
+
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_view_messages.xml b/app/src/main/res/layout/fragment_inbox.xml
index a8f8439d..c064a90e 100644
--- a/app/src/main/res/layout/fragment_view_messages.xml
+++ b/app/src/main/res/layout/fragment_inbox.xml
@@ -3,15 +3,15 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".Fragment.ViewMessagesFragment">
+ tools:context=".Fragment.InboxFragment">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
- android:id="@+id/swipe_refresh_layout_view_messages_fragment"
+ android:id="@+id/swipe_refresh_layout_inbox_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
- android:id="@+id/recycler_view_view_messages_fragment"
+ android:id="@+id/recycler_view_inbox_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false" />
@@ -19,7 +19,7 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<LinearLayout
- android:id="@+id/fetch_messages_info_linear_layout_view_messages_fragment"
+ android:id="@+id/fetch_messages_info_linear_layout_inbox_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
@@ -28,12 +28,12 @@
android:visibility="gone">
<ImageView
- android:id="@+id/fetch_messages_info_image_view_view_messages_fragment"
+ android:id="@+id/fetch_messages_info_image_view_inbox_fragment"
android:layout_width="150dp"
android:layout_height="wrap_content" />
<TextView
- android:id="@+id/fetch_messages_info_text_view_view_messages_fragment"
+ android:id="@+id/fetch_messages_info_text_view_inbox_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
diff --git a/app/src/main/res/menu/view_message_activity.xml b/app/src/main/res/menu/inbox_activity.xml
index ae1bdfdc..f7d06665 100644
--- a/app/src/main/res/menu/view_message_activity.xml
+++ b/app/src/main/res/menu/inbox_activity.xml
@@ -2,7 +2,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
- android:id="@+id/action_refresh_view_message_activity"
+ android:id="@+id/action_refresh_inbox_activity"
android:orderInCategory="1"
android:title="@string/action_refresh"
app:showAsAction="never" />