diff options
Diffstat (limited to 'app/src/main/java/ml')
115 files changed, 1231 insertions, 683 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java index 7cbb44b7..8498a4ea 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -28,6 +28,21 @@ import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.Fragment.PostFragment; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Fragment.UserThingSortTypeBottomSheetFragment; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; @@ -105,7 +120,7 @@ public class AccountPostsActivity extends AppCompatActivity implements UserThing } appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java index 367c7439..9d60f595 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -33,6 +33,21 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent; +import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.Fragment.PostFragment; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import retrofit2.Retrofit; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; @@ -113,7 +128,7 @@ public class AccountSavedThingActivity extends AppCompatActivity { } appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java index 6c8eb2f0..7acb26f9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Context; import android.content.Intent; @@ -39,6 +39,17 @@ import io.noties.markwon.AbstractMarkwonPlugin; import io.noties.markwon.Markwon; import io.noties.markwon.MarkwonConfiguration; import io.noties.markwon.linkify.LinkifyPlugin; +import ml.docilealligator.infinityforreddit.CommentData; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SendComment; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import retrofit2.Retrofit; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; @@ -48,13 +59,13 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; public class CommentActivity extends AppCompatActivity { - static final String EXTRA_COMMENT_PARENT_TEXT_KEY = "ECPTK"; - static final String EXTRA_PARENT_FULLNAME_KEY = "EPFK"; - static final String EXTRA_COMMENT_DATA_KEY = "ECDK"; - static final String EXTRA_PARENT_DEPTH_KEY = "EPDK"; - static final String EXTRA_PARENT_POSITION_KEY = "EPPK"; - static final String EXTRA_IS_REPLYING_KEY = "EIRK"; - static final int WRITE_COMMENT_REQUEST_CODE = 1; + public static final String EXTRA_COMMENT_PARENT_TEXT_KEY = "ECPTK"; + public static final String EXTRA_PARENT_FULLNAME_KEY = "EPFK"; + public static final String EXTRA_COMMENT_DATA_KEY = "ECDK"; + public static final String EXTRA_PARENT_DEPTH_KEY = "EPDK"; + public static final String EXTRA_PARENT_POSITION_KEY = "EPPK"; + public static final String EXTRA_IS_REPLYING_KEY = "EIRK"; + public static final int WRITE_COMMENT_REQUEST_CODE = 1; private static final String NULL_ACCESS_TOKEN_STATE = "NATS"; private static final String ACCESS_TOKEN_STATE = "ATS"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java index 242d6315..91551d24 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Context; import android.content.Intent; @@ -34,6 +34,15 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditAPI; +import ml.docilealligator.infinityforreddit.RedditUtils; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -46,10 +55,10 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; public class EditCommentActivity extends AppCompatActivity { - static final String EXTRA_CONTENT = "EC"; - static final String EXTRA_FULLNAME = "EF"; - static final String EXTRA_ACCESS_TOKEN = "EAT"; - static final String EXTRA_POSITION = "EP"; + public static final String EXTRA_CONTENT = "EC"; + public static final String EXTRA_FULLNAME = "EF"; + public static final String EXTRA_ACCESS_TOKEN = "EAT"; + public static final String EXTRA_POSITION = "EP"; static final String EXTRA_EDITED_COMMENT_CONTENT = "EECC"; static final String EXTRA_EDITED_COMMENT_POSITION = "EECP"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java index dc2a755b..e09466d4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Context; import android.content.Intent; @@ -35,6 +35,15 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditAPI; +import ml.docilealligator.infinityforreddit.RedditUtils; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java index d4e67189..9b0e1844 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -28,6 +28,23 @@ import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.Post; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.Fragment.PostFragment; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.Fragment.SearchPostSortTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Fragment.SortTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Fragment.UserThingSortTypeBottomSheetFragment; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; @@ -37,12 +54,12 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; public class FilteredThingActivity extends AppCompatActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback, SearchPostSortTypeBottomSheetFragment.SearchSortTypeSelectionCallback, UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback { - static final String EXTRA_NAME = "ESN"; - static final String EXTRA_QUERY = "EQ"; - static final String EXTRA_FILTER = "EF"; - static final String EXTRA_POST_TYPE = "EPT"; - static final String EXTRA_SORT_TYPE = "EST"; - static final String EXTRA_USER_WHERE = "EUW"; + public static final String EXTRA_NAME = "ESN"; + public static final String EXTRA_QUERY = "EQ"; + public static final String EXTRA_FILTER = "EF"; + public static final String EXTRA_POST_TYPE = "EPT"; + public static final String EXTRA_SORT_TYPE = "EST"; + public static final String EXTRA_USER_WHERE = "EUW"; private static final String IS_IN_LAZY_MODE_STATE = "IILMS"; private static final String NULL_ACCESS_TOKEN_STATE = "NATS"; @@ -116,7 +133,7 @@ public class FilteredThingActivity extends AppCompatActivity implements SortType } appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java index 8c5cde11..c20d5ba9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; @@ -19,6 +19,10 @@ import java.util.List; import javax.inject.Inject; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; + import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO; @@ -27,8 +31,8 @@ import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_C public class LinkResolverActivity extends AppCompatActivity { - static final String EXTRA_MESSAGE_FULLNAME = "ENF"; - static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; + public static final String EXTRA_MESSAGE_FULLNAME = "ENF"; + public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; private static final String POST_PATTERN = "/r/\\w+/comments/\\w+/{0,1}\\w+/{0,1}"; private static final String COMMENT_PATTERN = "/r/\\w+/comments/\\w+/{0,1}\\w+/\\w+/{0,1}"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/LoginActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java index fc19b2c4..87a8e72b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/LoginActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.app.Activity; import android.content.Intent; @@ -29,6 +29,15 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.FetchMyInfo; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.AsyncTask.ParseAndInsertNewAccountAsyncTask; +import ml.docilealligator.infinityforreddit.ParseAndSaveAccountInfo; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditAPI; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.RedditUtils; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java index dd18b59e..4e9345a1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.app.Activity; import android.content.Intent; @@ -59,12 +59,38 @@ import javax.inject.Named; import ml.docilealligator.infinityforreddit.Account.Account; import ml.docilealligator.infinityforreddit.Account.AccountViewModel; +import ml.docilealligator.infinityforreddit.Adapter.AccountRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.Event.ChangeFontSizeEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FetchMyInfo; +import ml.docilealligator.infinityforreddit.FetchSubscribedThing; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask; +import ml.docilealligator.infinityforreddit.ParseAndSaveAccountInfo; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.Fragment.PostFragment; +import ml.docilealligator.infinityforreddit.Fragment.PostTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.PullNotificationWorker; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.ReadMessage; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Fragment.SortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.AsyncTask.SwitchToAnonymousAccountAsyncTask; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; @@ -202,7 +228,7 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe View decorView = window.getDecorView(); appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if(state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java index 9fd5b45e..6320380a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Intent; import android.content.SharedPreferences; @@ -47,6 +47,20 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Event.SubmitImagePostEvent; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.Flair; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.SubmitPostService; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java index e5a2843a..fabb3b8c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Intent; import android.content.SharedPreferences; @@ -37,6 +37,21 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Event.SubmitTextOrLinkPostEvent; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.Flair; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.RedditUtils; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.SubmitPostService; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java index 2997282c..4fdf63ab 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Intent; import android.content.SharedPreferences; @@ -37,6 +37,21 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Event.SubmitTextOrLinkPostEvent; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.Flair; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.RedditUtils; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.SubmitPostService; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java index df0b5f25..8deb269a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Intent; import android.content.SharedPreferences; @@ -49,6 +49,20 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Flair; +import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.SubmitPostService; +import ml.docilealligator.infinityforreddit.Event.SubmitVideoPostEvent; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java index 20e3e4d9..d0d739a9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -36,6 +36,19 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Adapter.RulesRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.JSONUtils; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditAPI; +import ml.docilealligator.infinityforreddit.Rule; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Utils; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -107,7 +120,7 @@ public class RulesActivity extends AppCompatActivity { } appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if(state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java index a0192e36..03796d20 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.app.Activity; import android.content.Context; @@ -31,6 +31,13 @@ import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java index 5967066b..5f28d994 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Intent; import android.content.SharedPreferences; @@ -32,6 +32,24 @@ import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.Fragment.PostFragment; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.Fragment.SearchPostSortTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.Fragment.SearchUserAndSubredditSortTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Fragment.SubredditListingFragment; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; @@ -106,7 +124,7 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos View decorView = window.getDecorView(); appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if(state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java index f9ed0272..cc4bee19 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.app.Activity; import android.content.Intent; @@ -28,6 +28,17 @@ import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.Fragment.SubredditListingFragment; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; @@ -97,7 +108,7 @@ public class SearchSubredditsResultActivity extends AppCompatActivity { View decorView = window.getDecorView(); appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if(state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); @@ -177,7 +188,7 @@ public class SearchSubredditsResultActivity extends AppCompatActivity { }).execute(); } - void getSelectedSubreddit(String name, String iconUrl) { + public void getSelectedSubreddit(String name, String iconUrl) { Intent returnIntent = new Intent(); returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name); returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java index cf84d82f..98849878 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -19,10 +19,16 @@ import androidx.preference.PreferenceFragmentCompat; import javax.inject.Inject; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Settings.AboutPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ShareDataResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ShareDataResolverActivity.java index 92d2b290..3468ab66 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ShareDataResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ShareDataResolverActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Intent; import android.net.Uri; @@ -8,6 +8,12 @@ import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; +import ml.docilealligator.infinityforreddit.Activity.PostImageActivity; +import ml.docilealligator.infinityforreddit.Activity.PostLinkActivity; +import ml.docilealligator.infinityforreddit.Activity.PostTextActivity; +import ml.docilealligator.infinityforreddit.Activity.PostVideoActivity; +import ml.docilealligator.infinityforreddit.R; + public class ShareDataResolverActivity extends AppCompatActivity { @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java index 16054228..1b060e91 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.app.Activity; import android.content.Intent; @@ -31,11 +31,24 @@ import java.util.ArrayList; import javax.inject.Inject; import javax.inject.Named; +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.FetchSubscribedThing; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData; -import butterknife.BindView; -import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import retrofit2.Retrofit; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; @@ -119,7 +132,7 @@ public class SubredditSelectionActivity extends AppCompatActivity { } appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if(state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); @@ -258,7 +271,7 @@ public class SubredditSelectionActivity extends AppCompatActivity { return false; } - void getSelectedSubreddit(String name, String iconUrl, boolean subredditIsUser) { + public void getSelectedSubreddit(String name, String iconUrl, boolean subredditIsUser) { Intent returnIntent = new Intent(); returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name); returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java index f45b5f32..73e22730 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -31,11 +31,25 @@ import java.util.ArrayList; import javax.inject.Inject; import javax.inject.Named; +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.FetchSubscribedThing; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Fragment.FollowedUsersListingFragment; +import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData; -import butterknife.BindView; -import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import retrofit2.Retrofit; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; @@ -112,7 +126,7 @@ public class SubscribedThingListingActivity extends AppCompatActivity { } appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if(state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java index 6af5beb5..20a9318a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.Manifest; import android.animation.Animator; @@ -50,14 +50,20 @@ import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.TitleFontStyle; public class ViewImageActivity extends AppCompatActivity { private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0; - static final String TITLE_KEY = "TK"; - static final String IMAGE_URL_KEY = "IUK"; - static final String FILE_NAME_KEY = "FNK"; + public static final String TITLE_KEY = "TK"; + public static final String IMAGE_URL_KEY = "IUK"; + public static final String FILE_NAME_KEY = "FNK"; @BindView(R.id.parent_relative_layout_view_image_activity) RelativeLayout mRelativeLayout; @BindView(R.id.progress_bar_view_image_activity) ProgressBar mProgressBar; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java index fd45795d..e6999b7d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -39,6 +39,21 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.FetchMessages; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.Adapter.MessageRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.MessageViewModel; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import retrofit2.Retrofit; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; @@ -48,7 +63,7 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; public class ViewMessageActivity extends AppCompatActivity { - static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; + public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; private static final String NULL_ACCESS_TOKEN_STATE = "NATS"; private static final String ACCESS_TOKEN_STATE = "ATS"; @@ -126,7 +141,7 @@ public class ViewMessageActivity extends AppCompatActivity { } appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java index 91855a0d..f57fe4cb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Intent; import android.content.SharedPreferences; @@ -48,6 +48,36 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent; +import ml.docilealligator.infinityforreddit.Adapter.CommentAndPostRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.CommentData; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.DeleteThing; +import ml.docilealligator.infinityforreddit.FetchComment; +import ml.docilealligator.infinityforreddit.FetchPost; +import ml.docilealligator.infinityforreddit.Flair; +import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.HidePost; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.ParseComment; +import ml.docilealligator.infinityforreddit.ParsePost; +import ml.docilealligator.infinityforreddit.Post; +import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToDetailActivity; +import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.ReadMessage; +import ml.docilealligator.infinityforreddit.RedditAPI; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.RedditUtils; +import ml.docilealligator.infinityforreddit.SaveThing; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -57,20 +87,20 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; -import static ml.docilealligator.infinityforreddit.CommentActivity.EXTRA_COMMENT_DATA_KEY; -import static ml.docilealligator.infinityforreddit.CommentActivity.WRITE_COMMENT_REQUEST_CODE; +import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.EXTRA_COMMENT_DATA_KEY; +import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.WRITE_COMMENT_REQUEST_CODE; public class ViewPostDetailActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback { - static final String EXTRA_POST_DATA = "EPD"; - static final String EXTRA_POST_LIST_POSITION = "EPLI"; - static final String EXTRA_POST_ID = "EPI"; - static final String EXTRA_SINGLE_COMMENT_ID = "ESCI"; - static final String EXTRA_MESSAGE_FULLNAME = "ENI"; - static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; + public static final String EXTRA_POST_DATA = "EPD"; + public static final String EXTRA_POST_LIST_POSITION = "EPLI"; + public static final String EXTRA_POST_ID = "EPI"; + public static final String EXTRA_SINGLE_COMMENT_ID = "ESCI"; + public static final String EXTRA_MESSAGE_FULLNAME = "ENI"; + public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; private static final int EDIT_POST_REQUEST_CODE = 2; - static final int EDIT_COMMENT_REQUEST_CODE = 3; + public static final int EDIT_COMMENT_REQUEST_CODE = 3; private RequestManager mGlide; private Locale mLocale; @@ -180,7 +210,7 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo } appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); @@ -881,7 +911,7 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo }); } - void deleteComment(String fullName, int position) { + public void deleteComment(String fullName, int position) { new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) .setTitle(R.string.delete_this_comment) .setMessage(R.string.are_you_sure) @@ -902,7 +932,7 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo .show(); } - void changeToSingleThreadMode() { + public void changeToSingleThreadMode() { isSingleCommentThreadMode = false; mSingleCommentId = null; refresh(false, true); @@ -1241,7 +1271,7 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo @Override protected void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - comments = mAdapter.getVisibleComments(); + comments = mAdapter == null ? null : mAdapter.getVisibleComments(); Bridge.saveInstanceState(this, outState); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java index 24a292a2..d4661f47 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Intent; import android.content.SharedPreferences; @@ -39,12 +39,33 @@ import org.greenrobot.eventbus.Subscribe; import javax.inject.Inject; import javax.inject.Named; -import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditDao; -import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; -import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditViewModel; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsSubscribedToSubredditAsyncTask; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.FetchSubredditData; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Fragment.PostFragment; +import ml.docilealligator.infinityforreddit.Fragment.PostTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.Fragment.SortTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.ReadMessage; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditDao; +import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; +import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditViewModel; +import ml.docilealligator.infinityforreddit.SubredditSubscription; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; @@ -56,9 +77,9 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; public class ViewSubredditDetailActivity extends AppCompatActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback, PostTypeBottomSheetFragment.PostTypeSelectionCallback { - static final String EXTRA_SUBREDDIT_NAME_KEY = "ESN"; - static final String EXTRA_MESSAGE_FULLNAME = "ENF"; - static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; + public static final String EXTRA_SUBREDDIT_NAME_KEY = "ESN"; + public static final String EXTRA_MESSAGE_FULLNAME = "ENF"; + public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; private static final String FETCH_SUBREDDIT_INFO_STATE = "FSIS"; private static final String CURRENT_ONLINE_SUBSCRIBERS_STATE = "COSS"; @@ -155,7 +176,7 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So View decorView = window.getDecorView(); appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java index 32657fd7..c22f0df8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.content.Intent; import android.content.SharedPreferences; @@ -43,13 +43,35 @@ import org.greenrobot.eventbus.Subscribe; import javax.inject.Inject; import javax.inject.Named; +import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent; +import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsFollowingUserAsyncTask; +import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment; +import ml.docilealligator.infinityforreddit.ContentFontStyle; +import ml.docilealligator.infinityforreddit.DeleteThing; +import ml.docilealligator.infinityforreddit.FetchUserData; +import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.Fragment.PostFragment; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.ReadMessage; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserDao; +import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; +import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; +import ml.docilealligator.infinityforreddit.TitleFontStyle; import ml.docilealligator.infinityforreddit.User.UserDao; import ml.docilealligator.infinityforreddit.User.UserData; import ml.docilealligator.infinityforreddit.User.UserViewModel; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.UserFollowing; +import ml.docilealligator.infinityforreddit.Fragment.UserThingSortTypeBottomSheetFragment; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; @@ -60,9 +82,9 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; public class ViewUserDetailActivity extends AppCompatActivity implements UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback { - static final String EXTRA_USER_NAME_KEY = "EUNK"; - static final String EXTRA_MESSAGE_FULLNAME = "ENF"; - static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; + public static final String EXTRA_USER_NAME_KEY = "EUNK"; + public static final String EXTRA_MESSAGE_FULLNAME = "ENF"; + public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; private static final String FETCH_USER_INFO_STATE = "FSIS"; private static final String NULL_ACCESS_TOKEN_STATE = "NATS"; @@ -232,7 +254,7 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi View decorView = window.getDecorView(); appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.COLLAPSED) { if(finalLightNavBar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); @@ -255,7 +277,7 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi } else { appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override - void onStateChanged(AppBarLayout appBarLayout, State state) { + public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.EXPANDED) { tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor); tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor); @@ -492,7 +514,7 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi } } - void deleteComment(String fullName) { + public void deleteComment(String fullName) { new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) .setTitle(R.string.delete_this_comment) .setMessage(R.string.are_you_sure) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java index 0dbac0b4..bbc659a2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Activity; import android.Manifest; import android.animation.Animator; @@ -46,14 +46,15 @@ import com.google.android.exoplayer2.util.Util; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.R; public class ViewVideoActivity extends AppCompatActivity { private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0; - static final String TITLE_KEY = "TK"; - static final String SUBREDDIT_KEY = "SK"; - static final String ID_KEY = "IK"; + public static final String TITLE_KEY = "TK"; + public static final String SUBREDDIT_KEY = "SK"; + public static final String ID_KEY = "IK"; @BindView(R.id.relative_layout_view_video_activity) RelativeLayout relativeLayout; @BindView(R.id.player_view_view_video_activity) PlayerView videoPlayerView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/AccountRecyclerViewAdapter.java index b731be27..6be837fd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/AccountRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.content.Context; import android.view.LayoutInflater; @@ -19,11 +19,12 @@ import ml.docilealligator.infinityforreddit.Account.Account; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.R; import pl.droidsonroids.gif.GifImageView; -class AccountRecyclerViewAdapter extends RecyclerView.Adapter<AccountRecyclerViewAdapter.AccountViewHolder> { +public class AccountRecyclerViewAdapter extends RecyclerView.Adapter<AccountRecyclerViewAdapter.AccountViewHolder> { - interface ItemSelectedListener { + public interface ItemSelectedListener { void accountSelected(Account account); void addAccountSelected(); void anonymousSelected(); @@ -36,7 +37,7 @@ class AccountRecyclerViewAdapter extends RecyclerView.Adapter<AccountRecyclerVie private RequestManager mGlide; private ItemSelectedListener mItemSelectedListener; - AccountRecyclerViewAdapter(Context context, RequestManager glide, String currentAccountName, ItemSelectedListener itemSelectedListener) { + public AccountRecyclerViewAdapter(Context context, RequestManager glide, String currentAccountName, ItemSelectedListener itemSelectedListener) { mContext = context; mGlide = glide; mCurrentAccountName = currentAccountName; @@ -112,7 +113,7 @@ class AccountRecyclerViewAdapter extends RecyclerView.Adapter<AccountRecyclerVie holder.profileImageGifImageView.clearColorFilter(); } - void changeAccountsDataset(List<Account> accounts) { + public void changeAccountsDataset(List<Account> accounts) { mAccounts = accounts; notifyDataSetChanged(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 85b4d230..8ae2f13d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.app.Activity; import android.content.ActivityNotFoundException; @@ -39,6 +39,15 @@ import com.santalu.aspectratioimageview.AspectRatioImageView; import java.util.ArrayList; import java.util.Locale; +import ml.docilealligator.infinityforreddit.Activity.CommentActivity; +import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity; +import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewImageActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewVideoActivity; +import ml.docilealligator.infinityforreddit.CommentData; import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView; import butterknife.BindView; import butterknife.ButterKnife; @@ -50,11 +59,22 @@ import io.noties.markwon.linkify.LinkifyPlugin; import io.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute; import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.FetchComment; +import ml.docilealligator.infinityforreddit.Fragment.ModifyCommentBottomSheetFragment; +import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask; +import ml.docilealligator.infinityforreddit.AsyncTask.LoadUserDataAsyncTask; +import ml.docilealligator.infinityforreddit.Post; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.RedditUtils; +import ml.docilealligator.infinityforreddit.SaveThing; +import ml.docilealligator.infinityforreddit.VoteThing; import retrofit2.Retrofit; -import static ml.docilealligator.infinityforreddit.CommentActivity.WRITE_COMMENT_REQUEST_CODE; +import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.WRITE_COMMENT_REQUEST_CODE; -class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { +public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private static final int VIEW_TYPE_POST_DETAIL = 0; private static final int VIEW_TYPE_FIRST_LOADING = 1; private static final int VIEW_TYPE_FIRST_LOADING_FAILED = 2; @@ -87,18 +107,18 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie private boolean mHasMoreComments; private boolean loadMoreCommentsFailed; - interface CommentRecyclerViewAdapterCallback { + public interface CommentRecyclerViewAdapterCallback { void updatePost(Post post); void retryFetchingComments(); void retryFetchingMoreComments(); } - CommentAndPostRecyclerViewAdapter(Activity activity, Retrofit retrofit, Retrofit oauthRetrofit, - RedditDataRoomDatabase redditDataRoomDatabase, RequestManager glide, - String accessToken, String accountName, Post post, Locale locale, - String singleCommentId, boolean isSingleCommentThreadMode, - boolean needBlurNSFW, boolean needBlurSpoiler, - CommentRecyclerViewAdapterCallback commentRecyclerViewAdapterCallback) { + public CommentAndPostRecyclerViewAdapter(Activity activity, Retrofit retrofit, Retrofit oauthRetrofit, + RedditDataRoomDatabase redditDataRoomDatabase, RequestManager glide, + String accessToken, String accountName, Post post, Locale locale, + String singleCommentId, boolean isSingleCommentThreadMode, + boolean needBlurNSFW, boolean needBlurSpoiler, + CommentRecyclerViewAdapterCallback commentRecyclerViewAdapterCallback) { mActivity = activity; mRetrofit = retrofit; mOauthRetrofit = oauthRetrofit; @@ -951,7 +971,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie } } - void updatePost(Post post) { + public void updatePost(Post post) { mPost = post; notifyItemChanged(0); } @@ -1009,7 +1029,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie } } - void addComments(ArrayList<CommentData> comments, boolean hasMoreComments) { + public void addComments(ArrayList<CommentData> comments, boolean hasMoreComments) { if(mVisibleComments.size() == 0) { isInitiallyLoading = false; isInitiallyLoadingFailed = false; @@ -1046,7 +1066,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie mHasMoreComments = hasMoreComments; } - void addComment(CommentData comment) { + public void addComment(CommentData comment) { if(mVisibleComments.size() == 0 || isInitiallyLoadingFailed) { notifyItemRemoved(1); } @@ -1060,7 +1080,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie } } - void addChildComment(CommentData comment, String parentFullname, int parentPosition) { + public void addChildComment(CommentData comment, String parentFullname, int parentPosition) { if(!parentFullname.equals(mVisibleComments.get(parentPosition).getFullName())) { for(int i = 0; i < mVisibleComments.size(); i++) { if(parentFullname.equals(mVisibleComments.get(i).getFullName())) { @@ -1089,16 +1109,16 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie } } - void setSingleComment(String singleCommentId, boolean isSingleCommentThreadMode) { + public void setSingleComment(String singleCommentId, boolean isSingleCommentThreadMode) { mSingleCommentId = singleCommentId; mIsSingleCommentThreadMode = isSingleCommentThreadMode; } - ArrayList<CommentData> getVisibleComments() { + public ArrayList<CommentData> getVisibleComments() { return mVisibleComments; } - void initiallyLoading() { + public void initiallyLoading() { if(mVisibleComments.size() != 0) { int previousSize = mVisibleComments.size(); mVisibleComments.clear(); @@ -1120,13 +1140,13 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie } } - void initiallyLoadCommentsFailed() { + public void initiallyLoadCommentsFailed() { isInitiallyLoading = false; isInitiallyLoadingFailed = true; notifyItemChanged(1); } - void loadMoreCommentsFailed() { + public void loadMoreCommentsFailed() { loadMoreCommentsFailed = true; if(mIsSingleCommentThreadMode) { notifyItemChanged(mVisibleComments.size() + 2); @@ -1135,7 +1155,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie } } - void editComment(String commentContent, int position) { + public void editComment(String commentContent, int position) { mVisibleComments.get(position).setCommentContent(commentContent); if(mIsSingleCommentThreadMode) { notifyItemChanged(position + 2); @@ -1144,7 +1164,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie } } - void deleteComment(int position) { + public void deleteComment(int position) { if(mVisibleComments.get(position).hasReply()) { mVisibleComments.get(position).setAuthor("[deleted]"); mVisibleComments.get(position).setCommentContent("[deleted]"); @@ -1163,11 +1183,11 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie } } - void setBlurNSFW(boolean needBlurNSFW) { + public void setBlurNSFW(boolean needBlurNSFW) { mNeedBlurNSFW = needBlurNSFW; } - void setBlurSpoiler(boolean needBlurSpoiler) { + public void setBlurSpoiler(boolean needBlurSpoiler) { mNeedBlurSpoiler = needBlurSpoiler; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java index eac2211b..884cd9ca 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.content.ActivityNotFoundException; import android.content.Context; @@ -29,9 +29,20 @@ import io.noties.markwon.Markwon; import io.noties.markwon.MarkwonConfiguration; import io.noties.markwon.ext.strikethrough.StrikethroughPlugin; import io.noties.markwon.linkify.LinkifyPlugin; +import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; +import ml.docilealligator.infinityforreddit.CommentData; +import ml.docilealligator.infinityforreddit.Fragment.ModifyCommentBottomSheetFragment; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditUtils; +import ml.docilealligator.infinityforreddit.SaveThing; +import ml.docilealligator.infinityforreddit.VoteThing; import retrofit2.Retrofit; -class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, RecyclerView.ViewHolder> { +public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, RecyclerView.ViewHolder> { private Context mContext; private Retrofit mOauthRetrofit; private Markwon mMarkwon; @@ -47,11 +58,11 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R private NetworkState networkState; private RetryLoadingMoreCallback mRetryLoadingMoreCallback; - interface RetryLoadingMoreCallback { + public interface RetryLoadingMoreCallback { void retryLoadingMore(); } - protected CommentsListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, + public CommentsListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, String accessToken, String accountName, RetryLoadingMoreCallback retryLoadingMoreCallback) { super(DIFF_CALLBACK); @@ -370,7 +381,7 @@ class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, R return networkState != null && networkState.getStatus() != NetworkState.Status.SUCCESS; } - void setNetworkState(NetworkState newNetworkState) { + public void setNetworkState(NetworkState newNetworkState) { NetworkState previousState = this.networkState; boolean previousExtraRow = hasExtraRow(); this.networkState = newNetworkState; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FlairBottomSheetRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FlairBottomSheetRecyclerViewAdapter.java index d1eecf20..c7045138 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FlairBottomSheetRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FlairBottomSheetRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.app.Activity; import android.content.Context; @@ -19,9 +19,11 @@ import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Flair; +import ml.docilealligator.infinityforreddit.R; -class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<FlairBottomSheetRecyclerViewAdapter.FlairViewHolder> { - interface ItemClickListener { +public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<FlairBottomSheetRecyclerViewAdapter.FlairViewHolder> { + public interface ItemClickListener { void onClick(Flair flair); } @@ -29,7 +31,7 @@ class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<FlairBott private ArrayList<Flair> flairs; private ItemClickListener itemClickListener; - FlairBottomSheetRecyclerViewAdapter(Context context, ItemClickListener itemClickListener) { + public FlairBottomSheetRecyclerViewAdapter(Context context, ItemClickListener itemClickListener) { this.context = context; this.itemClickListener = itemClickListener; } @@ -86,7 +88,7 @@ class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<FlairBott holder.editFlairImageView.setVisibility(View.GONE); } - void changeDataset(ArrayList<Flair> flairs) { + public void changeDataset(ArrayList<Flair> flairs) { this.flairs = flairs; notifyDataSetChanged(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FollowedUsersRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java index 44d02068..c7a70472 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FollowedUsersRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.content.Context; import android.content.Intent; @@ -16,6 +16,8 @@ import com.bumptech.glide.request.RequestOptions; import java.util.List; +import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; +import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import pl.droidsonroids.gif.GifImageView; @@ -25,7 +27,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc private Context mContext; private RequestManager glide; - FollowedUsersRecyclerViewAdapter(Context context) { + public FollowedUsersRecyclerViewAdapter(Context context) { mContext = context; glide = Glide.with(context.getApplicationContext()); } @@ -70,7 +72,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc glide.clear(((UserViewHolder) holder).iconGifImageView); } - void setSubscribedUsers(List<SubscribedUserData> subscribedUsers){ + public void setSubscribedUsers(List<SubscribedUserData> subscribedUsers){ mSubscribedUserData = subscribedUsers; notifyDataSetChanged(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java index 6427d22b..1e9f6ee9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.content.Context; import android.content.Intent; @@ -23,9 +23,15 @@ import io.noties.markwon.Markwon; import io.noties.markwon.MarkwonConfiguration; import io.noties.markwon.ext.strikethrough.StrikethroughPlugin; import io.noties.markwon.linkify.LinkifyPlugin; +import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; +import ml.docilealligator.infinityforreddit.Message; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.ReadMessage; import retrofit2.Retrofit; -class MessageRecyclerViewAdapter extends PagedListAdapter<Message, RecyclerView.ViewHolder> { +public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, RecyclerView.ViewHolder> { private static final int VIEW_TYPE_DATA = 0; private static final int VIEW_TYPE_ERROR = 1; private static final int VIEW_TYPE_LOADING = 2; @@ -39,11 +45,11 @@ class MessageRecyclerViewAdapter extends PagedListAdapter<Message, RecyclerView. private NetworkState networkState; private RetryLoadingMoreCallback mRetryLoadingMoreCallback; - interface RetryLoadingMoreCallback { + public interface RetryLoadingMoreCallback { void retryLoadingMore(); } - MessageRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, String accessToken, + public MessageRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, String accessToken, RetryLoadingMoreCallback retryLoadingMoreCallback) { super(DIFF_CALLBACK); mContext = context; @@ -193,7 +199,7 @@ class MessageRecyclerViewAdapter extends PagedListAdapter<Message, RecyclerView. return networkState != null && networkState.getStatus() != NetworkState.Status.SUCCESS; } - void setNetworkState(NetworkState newNetworkState) { + public void setNetworkState(NetworkState newNetworkState) { NetworkState previousState = this.networkState; boolean previousExtraRow = hasExtraRow(); this.networkState = newNetworkState; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java index f6dc6970..cb4c5950 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.content.ActivityNotFoundException; import android.content.Context; @@ -38,19 +38,38 @@ import com.libRG.CustomTextView; import org.greenrobot.eventbus.EventBus; -import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView; -import ml.docilealligator.infinityforreddit.User.UserDao; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.Activity.CommentActivity; +import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity; +import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewImageActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewVideoActivity; +import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask; +import ml.docilealligator.infinityforreddit.AsyncTask.LoadUserDataAsyncTask; +import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView; +import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToDetailActivity; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.Post; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.RedditUtils; +import ml.docilealligator.infinityforreddit.SaveThing; +import ml.docilealligator.infinityforreddit.User.UserDao; +import ml.docilealligator.infinityforreddit.VoteThing; import retrofit2.Retrofit; /** * Created by alex on 2/25/18. */ -class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHolder> { +public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHolder> { private Context mContext; private Retrofit mOauthRetrofit; private Retrofit mRetrofit; @@ -71,15 +90,15 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo private NetworkState networkState; private Callback mCallback; - interface Callback { + public interface Callback { void retryLoadingMore(); void typeChipClicked(int filter); } - PostRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, Retrofit retrofit, - RedditDataRoomDatabase redditDataRoomDatabase, String accessToken, - int postType, boolean displaySubredditName, boolean needBlurNSFW, - boolean needBlurSpoiler, Callback callback) { + public PostRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, Retrofit retrofit, + RedditDataRoomDatabase redditDataRoomDatabase, String accessToken, + int postType, boolean displaySubredditName, boolean needBlurNSFW, + boolean needBlurSpoiler, Callback callback) { super(DIFF_CALLBACK); if(context != null) { mContext = context; @@ -111,7 +130,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo } }; - void setCanStartActivity(boolean canStartActivity) { + public void setCanStartActivity(boolean canStartActivity) { this.canStartActivity = canStartActivity; } @@ -742,11 +761,11 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo return super.getItemCount(); } - void setBlurNSFW(boolean needBlurNSFW) { + public void setBlurNSFW(boolean needBlurNSFW) { mNeedBlurNSFW = needBlurNSFW; } - void setBlurSpoiler(boolean needBlurSpoiler) { + public void setBlurSpoiler(boolean needBlurSpoiler) { mNeedBlurSpoiler = needBlurSpoiler; } @@ -754,7 +773,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo return networkState != null && networkState.getStatus() != NetworkState.Status.SUCCESS; } - void setNetworkState(NetworkState newNetworkState) { + public void setNetworkState(NetworkState newNetworkState) { NetworkState previousState = this.networkState; boolean previousExtraRow = hasExtraRow(); this.networkState = newNetworkState; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java index 4ab0f201..0cf5e337 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RulesRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.content.Context; import android.content.Intent; @@ -21,12 +21,15 @@ import io.noties.markwon.Markwon; import io.noties.markwon.MarkwonConfiguration; import io.noties.markwon.ext.strikethrough.StrikethroughPlugin; import io.noties.markwon.linkify.LinkifyPlugin; +import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.Rule; -class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecyclerViewAdapter.RuleViewHolder> { +public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecyclerViewAdapter.RuleViewHolder> { private Markwon markwon; private ArrayList<Rule> rules; - RulesRecyclerViewAdapter(Context context) { + public RulesRecyclerViewAdapter(Context context) { markwon = Markwon.builder(context) .usePlugin(new AbstractMarkwonPlugin() { @Override @@ -75,7 +78,7 @@ class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecyclerViewAda holder.descriptionMarkwonView.setVisibility(View.VISIBLE); } - void changeDataset(ArrayList<Rule> rules) { + public void changeDataset(ArrayList<Rule> rules) { this.rules = rules; notifyDataSetChanged(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubredditListingRecyclerViewAdapter.java index e3669e72..613d551d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubredditListingRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.content.Context; import android.view.LayoutInflater; @@ -20,15 +20,20 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; import com.bumptech.glide.request.RequestOptions; -import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsSubscribedToSubredditAsyncTask; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; +import ml.docilealligator.infinityforreddit.SubredditSubscription; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<SubredditData, RecyclerView.ViewHolder> { - interface Callback { + public interface Callback { void retryLoadingMore(); void subredditSelected(String subredditName, String iconUrl); } @@ -49,10 +54,10 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred private NetworkState networkState; private Callback callback; - SubredditListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, Retrofit retrofit, - String accessToken, String accountName, - RedditDataRoomDatabase redditDataRoomDatabase, - Callback callback) { + public SubredditListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, Retrofit retrofit, + String accessToken, String accountName, + RedditDataRoomDatabase redditDataRoomDatabase, + Callback callback) { super(DIFF_CALLBACK); this.context = context; this.oauthRetrofit = oauthRetrofit; @@ -169,7 +174,7 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred return networkState != null && networkState.getStatus() != NetworkState.Status.SUCCESS; } - void setNetworkState(NetworkState newNetworkState) { + public void setNetworkState(NetworkState newNetworkState) { NetworkState previousState = this.networkState; boolean previousExtraRow = hasExtraRow(); this.networkState = newNetworkState; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedSubredditsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java index 897b811d..4dadc468 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedSubredditsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.content.Context; import android.content.Intent; @@ -16,11 +16,13 @@ import com.bumptech.glide.request.RequestOptions; import java.util.List; +import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity; +import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import pl.droidsonroids.gif.GifImageView; -class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { +public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private Context mContext; private List<SubscribedSubredditData> mSubscribedSubredditData; private RequestManager glide; @@ -30,16 +32,16 @@ class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter<Recyc private String userIconUrl; private boolean hasClearSelectionRow; - interface ItemClickListener { + public interface ItemClickListener { void onClick(String name, String iconUrl, boolean subredditIsUser); } - SubscribedSubredditsRecyclerViewAdapter(Context context) { + public SubscribedSubredditsRecyclerViewAdapter(Context context) { mContext = context; glide = Glide.with(context.getApplicationContext()); } - SubscribedSubredditsRecyclerViewAdapter(Context context, boolean hasClearSelectionRow, ItemClickListener itemClickListener) { + public SubscribedSubredditsRecyclerViewAdapter(Context context, boolean hasClearSelectionRow, ItemClickListener itemClickListener) { mContext = context; this.hasClearSelectionRow = hasClearSelectionRow; glide = Glide.with(context.getApplicationContext()); @@ -129,12 +131,12 @@ class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter<Recyc glide.clear(((SubredditViewHolder) holder).iconGifImageView); } - void setSubscribedSubreddits(List<SubscribedSubredditData> subscribedSubreddits){ + public void setSubscribedSubreddits(List<SubscribedSubredditData> subscribedSubreddits){ mSubscribedSubredditData = subscribedSubreddits; notifyDataSetChanged(); } - void addUser(String username, String userIconUrl) { + public void addUser(String username, String userIconUrl) { this.username = username; this.userIconUrl = userIconUrl; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/UserListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/UserListingRecyclerViewAdapter.java index 2a8f53df..3cdf03c9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/UserListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/UserListingRecyclerViewAdapter.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Adapter; import android.content.Context; import android.content.Intent; @@ -21,16 +21,21 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; import com.bumptech.glide.request.RequestOptions; +import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; +import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsFollowingUserAsyncTask; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserDao; import ml.docilealligator.infinityforreddit.User.UserData; import butterknife.BindView; import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; +import ml.docilealligator.infinityforreddit.UserFollowing; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, RecyclerView.ViewHolder> { - interface RetryLoadingMoreCallback { + public interface RetryLoadingMoreCallback { void retryLoadingMore(); } @@ -50,7 +55,7 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R private NetworkState networkState; private UserListingRecyclerViewAdapter.RetryLoadingMoreCallback retryLoadingMoreCallback; - UserListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, Retrofit retrofit, + public UserListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, Retrofit retrofit, String accessToken, String accountName, SubscribedUserDao subscribedUserDao, UserListingRecyclerViewAdapter.RetryLoadingMoreCallback retryLoadingMoreCallback) { super(DIFF_CALLBACK); @@ -172,7 +177,7 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R return networkState != null && networkState.getStatus() != NetworkState.Status.SUCCESS; } - void setNetworkState(NetworkState newNetworkState) { + public void setNetworkState(NetworkState newNetworkState) { NetworkState previousState = this.networkState; boolean previousExtraRow = hasExtraRow(); this.networkState = newNetworkState; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppBarStateChangeListener.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppBarStateChangeListener.java index dcb034bf..56922cb1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppBarStateChangeListener.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppBarStateChangeListener.java @@ -2,7 +2,7 @@ package ml.docilealligator.infinityforreddit; import com.google.android.material.appbar.AppBarLayout; -abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener { +public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener { // State public enum State { EXPANDED, @@ -37,5 +37,5 @@ abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChanged * @param appBarLayout Layout * @param state Collapse state */ - abstract void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state); + public abstract void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java index 0dffadd8..d1009faa 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java @@ -2,6 +2,38 @@ package ml.docilealligator.infinityforreddit; import javax.inject.Singleton; +import ml.docilealligator.infinityforreddit.Activity.AccountPostsActivity; +import ml.docilealligator.infinityforreddit.Activity.AccountSavedThingActivity; +import ml.docilealligator.infinityforreddit.Activity.CommentActivity; +import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity; +import ml.docilealligator.infinityforreddit.Activity.EditPostActivity; +import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity; +import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.Activity.LoginActivity; +import ml.docilealligator.infinityforreddit.Activity.MainActivity; +import ml.docilealligator.infinityforreddit.Activity.PostImageActivity; +import ml.docilealligator.infinityforreddit.Activity.PostLinkActivity; +import ml.docilealligator.infinityforreddit.Activity.PostTextActivity; +import ml.docilealligator.infinityforreddit.Activity.PostVideoActivity; +import ml.docilealligator.infinityforreddit.Activity.RulesActivity; +import ml.docilealligator.infinityforreddit.Activity.SearchActivity; +import ml.docilealligator.infinityforreddit.Activity.SearchResultActivity; +import ml.docilealligator.infinityforreddit.Activity.SearchSubredditsResultActivity; +import ml.docilealligator.infinityforreddit.Activity.SettingsActivity; +import ml.docilealligator.infinityforreddit.Activity.SubredditSelectionActivity; +import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewImageActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewMessageActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; +import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment; +import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment; +import ml.docilealligator.infinityforreddit.Fragment.FollowedUsersListingFragment; +import ml.docilealligator.infinityforreddit.Fragment.PostFragment; +import ml.docilealligator.infinityforreddit.Fragment.SubredditListingFragment; +import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment; +import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment; import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment; import dagger.Component; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CheckIsFollowingUserAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/CheckIsFollowingUserAsyncTask.java index b823db11..17c0f676 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CheckIsFollowingUserAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/CheckIsFollowingUserAsyncTask.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; @@ -12,13 +12,13 @@ public class CheckIsFollowingUserAsyncTask extends AsyncTask<Void, Void, Void> { private SubscribedUserData subscribedUserData; private CheckIsFollowingUserListener checkIsFollowingUserListener; - interface CheckIsFollowingUserListener { + public interface CheckIsFollowingUserListener { void isSubscribed(); void isNotSubscribed(); } - CheckIsFollowingUserAsyncTask(SubscribedUserDao subscribedUserDao, String username, String accountName, - CheckIsFollowingUserListener checkIsFollowingUserListener) { + public CheckIsFollowingUserAsyncTask(SubscribedUserDao subscribedUserDao, String username, String accountName, + CheckIsFollowingUserListener checkIsFollowingUserListener) { this.subscribedUserDao = subscribedUserDao; this.username = username; this.accountName = accountName; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CheckIsSubscribedToSubredditAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/CheckIsSubscribedToSubredditAsyncTask.java index a1f304e9..0ea76144 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CheckIsSubscribedToSubredditAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/CheckIsSubscribedToSubredditAsyncTask.java @@ -1,10 +1,11 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData; -class CheckIsSubscribedToSubredditAsyncTask extends AsyncTask<Void, Void, Void> { +public class CheckIsSubscribedToSubredditAsyncTask extends AsyncTask<Void, Void, Void> { private RedditDataRoomDatabase redditDataRoomDatabase; private String subredditName; @@ -12,12 +13,12 @@ class CheckIsSubscribedToSubredditAsyncTask extends AsyncTask<Void, Void, Void> private SubscribedSubredditData subscribedSubredditData; private CheckIsSubscribedToSubredditListener checkIsSubscribedToSubredditListener; - interface CheckIsSubscribedToSubredditListener { + public interface CheckIsSubscribedToSubredditListener { void isSubscribed(); void isNotSubscribed(); } - CheckIsSubscribedToSubredditAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, + public CheckIsSubscribedToSubredditAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, String subredditName, String accountName, CheckIsSubscribedToSubredditListener checkIsSubscribedToSubredditListener) { this.redditDataRoomDatabase = redditDataRoomDatabase; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/GetCurrentAccountAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/GetCurrentAccountAsyncTask.java index 752c596a..b54fa104 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/GetCurrentAccountAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/GetCurrentAccountAsyncTask.java @@ -1,13 +1,13 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; import ml.docilealligator.infinityforreddit.Account.Account; import ml.docilealligator.infinityforreddit.Account.AccountDao; -class GetCurrentAccountAsyncTask extends AsyncTask<Void, Void, Void> { +public class GetCurrentAccountAsyncTask extends AsyncTask<Void, Void, Void> { - interface GetCurrentAccountAsyncTaskListener { + public interface GetCurrentAccountAsyncTaskListener { void success(Account account); } @@ -15,7 +15,7 @@ class GetCurrentAccountAsyncTask extends AsyncTask<Void, Void, Void> { AccountDao accountDao; GetCurrentAccountAsyncTaskListener getCurrentAccountAsyncTaskListener; - GetCurrentAccountAsyncTask(AccountDao accountDao, GetCurrentAccountAsyncTaskListener getCurrentAccountAsyncTaskListener) { + public GetCurrentAccountAsyncTask(AccountDao accountDao, GetCurrentAccountAsyncTaskListener getCurrentAccountAsyncTaskListener) { this.accountDao = accountDao; this.getCurrentAccountAsyncTaskListener = getCurrentAccountAsyncTaskListener; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/InsertSubscribedThingsAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/InsertSubscribedThingsAsyncTask.java index 2cb1e45e..ac4490fa 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/InsertSubscribedThingsAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/InsertSubscribedThingsAsyncTask.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; @@ -6,6 +6,7 @@ import androidx.annotation.Nullable; import java.util.List; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditDao; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditDao; @@ -13,9 +14,9 @@ import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.Subscrib import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserDao; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData; -class InsertSubscribedThingsAsyncTask extends AsyncTask<Void, Void, Void> { +public class InsertSubscribedThingsAsyncTask extends AsyncTask<Void, Void, Void> { - interface InsertSubscribedThingListener { + public interface InsertSubscribedThingListener { void insertSuccess(); } @@ -29,7 +30,7 @@ class InsertSubscribedThingsAsyncTask extends AsyncTask<Void, Void, Void> { private List<SubredditData> subredditData; private InsertSubscribedThingListener insertSubscribedThingListener; - InsertSubscribedThingsAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, @Nullable String accountName, + public InsertSubscribedThingsAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, @Nullable String accountName, List<SubscribedSubredditData> subscribedSubredditData, List<SubscribedUserData> subscribedUserData, List<SubredditData> subredditData, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/InsertUserDataAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/InsertUserDataAsyncTask.java index 90ea800b..949276e0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/InsertUserDataAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/InsertUserDataAsyncTask.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/LoadSubredditIconAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/LoadSubredditIconAsyncTask.java index 0e8f384c..2acc6bf5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/LoadSubredditIconAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/LoadSubredditIconAsyncTask.java @@ -1,15 +1,17 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; import java.util.ArrayList; +import ml.docilealligator.infinityforreddit.FetchSubredditData; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditDao; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; import retrofit2.Retrofit; -class LoadSubredditIconAsyncTask extends AsyncTask<Void, Void, Void> { - interface LoadSubredditIconAsyncTaskListener { +public class LoadSubredditIconAsyncTask extends AsyncTask<Void, Void, Void> { + public interface LoadSubredditIconAsyncTaskListener { void loadIconSuccess(String iconImageUrl); } @@ -21,7 +23,7 @@ class LoadSubredditIconAsyncTask extends AsyncTask<Void, Void, Void> { private boolean hasSubredditInDb; private LoadSubredditIconAsyncTaskListener loadSubredditIconAsyncTaskListener; - LoadSubredditIconAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, String subredditName, Retrofit retrofit, + public LoadSubredditIconAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, String subredditName, Retrofit retrofit, LoadSubredditIconAsyncTaskListener loadSubredditIconAsyncTaskListener) { this.redditDataRoomDatabase = redditDataRoomDatabase; this.subredditDao = redditDataRoomDatabase.subredditDao(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/LoadUserDataAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/LoadUserDataAsyncTask.java index b9dddf1d..e67ef190 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/LoadUserDataAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/LoadUserDataAsyncTask.java @@ -1,13 +1,14 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; +import ml.docilealligator.infinityforreddit.FetchUserData; import ml.docilealligator.infinityforreddit.User.UserData; import ml.docilealligator.infinityforreddit.User.UserDao; import retrofit2.Retrofit; public class LoadUserDataAsyncTask extends AsyncTask<Void, Void, Void> { - interface LoadUserDataAsyncTaskListener { + public interface LoadUserDataAsyncTaskListener { void loadUserDataSuccess(String iconImageUrl); } @@ -18,7 +19,7 @@ public class LoadUserDataAsyncTask extends AsyncTask<Void, Void, Void> { private Retrofit retrofit; private LoadUserDataAsyncTaskListener loadUserDataAsyncTaskListener; - LoadUserDataAsyncTask(UserDao userDao, String userName, Retrofit retrofit, LoadUserDataAsyncTaskListener loadUserDataAsyncTaskListener) { + public LoadUserDataAsyncTask(UserDao userDao, String userName, Retrofit retrofit, LoadUserDataAsyncTaskListener loadUserDataAsyncTaskListener) { this.userDao = userDao; this.userName = userName; this.retrofit = retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseAndInsertNewAccountAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/ParseAndInsertNewAccountAsyncTask.java index 48f15207..32d801d7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseAndInsertNewAccountAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/ParseAndInsertNewAccountAsyncTask.java @@ -1,13 +1,13 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; import ml.docilealligator.infinityforreddit.Account.Account; import ml.docilealligator.infinityforreddit.Account.AccountDao; -class ParseAndInsertNewAccountAsyncTask extends AsyncTask<Void, Void, Void> { +public class ParseAndInsertNewAccountAsyncTask extends AsyncTask<Void, Void, Void> { - interface ParseAndInsertAccountListener { + public interface ParseAndInsertAccountListener { void success(); } @@ -21,7 +21,7 @@ class ParseAndInsertNewAccountAsyncTask extends AsyncTask<Void, Void, Void> { private AccountDao accountDao; private ParseAndInsertAccountListener parseAndInsertAccountListener; - ParseAndInsertNewAccountAsyncTask(String username, String accessToken, String refreshToken, String profileImageUrl, String bannerImageUrl, + public ParseAndInsertNewAccountAsyncTask(String username, String accessToken, String refreshToken, String profileImageUrl, String bannerImageUrl, int karma, String code, AccountDao accountDao, ParseAndInsertAccountListener parseAndInsertAccountListener) { this.username = username; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SwitchAccountAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/SwitchAccountAsyncTask.java index 65801464..7b501bbc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SwitchAccountAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/SwitchAccountAsyncTask.java @@ -1,11 +1,12 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; import ml.docilealligator.infinityforreddit.Account.Account; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -class SwitchAccountAsyncTask extends AsyncTask<Void, Void, Void> { - interface SwitchAccountAsyncTaskListener { +public class SwitchAccountAsyncTask extends AsyncTask<Void, Void, Void> { + public interface SwitchAccountAsyncTaskListener { void switched(Account account); } @@ -14,8 +15,8 @@ class SwitchAccountAsyncTask extends AsyncTask<Void, Void, Void> { private Account account; private SwitchAccountAsyncTaskListener switchAccountAsyncTaskListener; - SwitchAccountAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, String newAccountName, - SwitchAccountAsyncTaskListener switchAccountAsyncTaskListener) { + public SwitchAccountAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, String newAccountName, + SwitchAccountAsyncTaskListener switchAccountAsyncTaskListener) { this.redditDataRoomDatabase = redditDataRoomDatabase; this.newAccountName = newAccountName; this.switchAccountAsyncTaskListener = switchAccountAsyncTaskListener; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SwitchToAnonymousAccountAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/SwitchToAnonymousAccountAsyncTask.java index 588131dd..da141ca5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SwitchToAnonymousAccountAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/SwitchToAnonymousAccountAsyncTask.java @@ -1,11 +1,12 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; import ml.docilealligator.infinityforreddit.Account.AccountDao; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -class SwitchToAnonymousAccountAsyncTask extends AsyncTask<Void, Void, Void> { - interface SwitchToAnonymousAccountAsyncTaskListener { +public class SwitchToAnonymousAccountAsyncTask extends AsyncTask<Void, Void, Void> { + public interface SwitchToAnonymousAccountAsyncTaskListener { void logoutSuccess(); } @@ -13,7 +14,7 @@ class SwitchToAnonymousAccountAsyncTask extends AsyncTask<Void, Void, Void> { private boolean removeCurrentAccount; private SwitchToAnonymousAccountAsyncTaskListener switchToAnonymousAccountAsyncTaskListener; - SwitchToAnonymousAccountAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, boolean removeCurrentAccount, + public SwitchToAnonymousAccountAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, boolean removeCurrentAccount, SwitchToAnonymousAccountAsyncTaskListener switchToAnonymousAccountAsyncTaskListener) { this.redditDataRoomDatabase = redditDataRoomDatabase; this.removeCurrentAccount = removeCurrentAccount; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java deleted file mode 100644 index 434ff7a4..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java +++ /dev/null @@ -1,3 +0,0 @@ -package ml.docilealligator.infinityforreddit; - -public class ChangeFontSizeEvent { } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java index f936aac0..aeb85ce9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java @@ -5,10 +5,10 @@ import android.os.Parcelable; import java.util.ArrayList; -class CommentData implements Parcelable { - static final int VOTE_TYPE_NO_VOTE = 0; - static final int VOTE_TYPE_UPVOTE = 1; - static final int VOTE_TYPE_DOWNVOTE = -1; +public class CommentData implements Parcelable { + public static final int VOTE_TYPE_NO_VOTE = 0; + public static final int VOTE_TYPE_UPVOTE = 1; + public static final int VOTE_TYPE_DOWNVOTE = -1; private String id; private String fullName; @@ -38,7 +38,7 @@ class CommentData implements Parcelable { private boolean isLoadingMoreChildren; private boolean loadMoreChildrenFailed; - CommentData(String id, String fullName, String author, String linkAuthor, String commentTime, + public CommentData(String id, String fullName, String author, String linkAuthor, String commentTime, String commentContent, String linkId, String subredditName, String parentId, int score, int voteType, boolean isSubmitter, String distinguished, String permalink, int depth, boolean collapsed, boolean hasReply, boolean scoreHidden, boolean saved) { @@ -66,7 +66,7 @@ class CommentData implements Parcelable { isPlaceHolder = false; } - CommentData(String parentFullName, int depth) { + public CommentData(String parentFullName, int depth) { this.fullName = parentFullName; this.depth = depth; isPlaceHolder = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentViewModel.java index e5c4519d..6fc2d1c7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentViewModel.java @@ -48,31 +48,31 @@ public class CommentViewModel extends ViewModel { }); } - LiveData<PagedList<CommentData>> getComments() { + public LiveData<PagedList<CommentData>> getComments() { return comments; } - LiveData<NetworkState> getPaginationNetworkState() { + public LiveData<NetworkState> getPaginationNetworkState() { return paginationNetworkState; } - LiveData<NetworkState> getInitialLoadingState() { + public LiveData<NetworkState> getInitialLoadingState() { return initialLoadingState; } - LiveData<Boolean> hasComment() { + public LiveData<Boolean> hasComment() { return hasCommentLiveData; } - void refresh() { + public void refresh() { commentDataSourceFactory.getCommentDataSource().invalidate(); } - void retryLoadingMore() { + public void retryLoadingMore() { commentDataSourceFactory.getCommentDataSource().retryLoadingMore(); } - void changeSortType(String sortType) { + public void changeSortType(String sortType) { sortTypeLiveData.postValue(sortType); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/DeleteThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/DeleteThing.java index e755e51f..69959679 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/DeleteThing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/DeleteThing.java @@ -10,13 +10,13 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class DeleteThing { - interface DeleteThingListener { +public class DeleteThing { + public interface DeleteThingListener { void deleteSuccess(); void deleteFailed(); } - static void delete(Retrofit oauthRetrofit, String fullname, String accessToken, DeleteThingListener deleteThingListener) { + public static void delete(Retrofit oauthRetrofit, String fullname, String accessToken, DeleteThingListener deleteThingListener) { Map<String, String> params = new HashMap<>(); params.put(RedditUtils.ID_KEY, fullname); oauthRetrofit.create(RedditAPI.class).delete(RedditUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeFontSizeEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeFontSizeEvent.java new file mode 100644 index 00000000..3dc4575e --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeFontSizeEvent.java @@ -0,0 +1,3 @@ +package ml.docilealligator.infinityforreddit.Event; + +public class ChangeFontSizeEvent { } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeNSFWBlurEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeNSFWBlurEvent.java index 506c1627..c2145f16 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeNSFWBlurEvent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeNSFWBlurEvent.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Event; public class ChangeNSFWBlurEvent { public boolean needBlurNSFW; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeNSFWEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeNSFWEvent.java index 5d4b5a5c..db261f52 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeNSFWEvent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeNSFWEvent.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Event; public class ChangeNSFWEvent { public boolean nsfw; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeSpoilerBlurEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeSpoilerBlurEvent.java index f8c22224..a0fde8a2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeSpoilerBlurEvent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeSpoilerBlurEvent.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Event; public class ChangeSpoilerBlurEvent { public boolean needBlurSpoiler; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostUpdateEventToDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/PostUpdateEventToDetailActivity.java index 4646ab84..0d502aa6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostUpdateEventToDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/PostUpdateEventToDetailActivity.java @@ -1,4 +1,6 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Event; + +import ml.docilealligator.infinityforreddit.Post; public class PostUpdateEventToDetailActivity { public final Post post; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostUpdateEventToPostList.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/PostUpdateEventToPostList.java index 937ab92b..10dadb7d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostUpdateEventToPostList.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/PostUpdateEventToPostList.java @@ -1,4 +1,6 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Event; + +import ml.docilealligator.infinityforreddit.Post; public class PostUpdateEventToPostList { public final Post post; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitImagePostEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/SubmitImagePostEvent.java index 3432628c..7c0f5064 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitImagePostEvent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/SubmitImagePostEvent.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Event; public class SubmitImagePostEvent { public boolean postSuccess; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitTextOrLinkPostEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/SubmitTextOrLinkPostEvent.java index 073298f5..3d43664e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitTextOrLinkPostEvent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/SubmitTextOrLinkPostEvent.java @@ -1,4 +1,6 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Event; + +import ml.docilealligator.infinityforreddit.Post; public class SubmitTextOrLinkPostEvent { public boolean postSuccess; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitVideoPostEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/SubmitVideoPostEvent.java index 6699135f..e30cb0e1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitVideoPostEvent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/SubmitVideoPostEvent.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Event; public class SubmitVideoPostEvent { public boolean postSuccess; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SwitchAccountEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/SwitchAccountEvent.java index 82b73d73..93068e71 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SwitchAccountEvent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/SwitchAccountEvent.java @@ -1,7 +1,7 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Event; public class SwitchAccountEvent { - String excludeActivityClassName; + public String excludeActivityClassName; public SwitchAccountEvent() {} public SwitchAccountEvent(String excludeActivityClassName) { this.excludeActivityClassName = excludeActivityClassName; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java index f3ac4944..caa0c82c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java @@ -11,19 +11,19 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class FetchComment { - interface FetchCommentListener { +public class FetchComment { + public interface FetchCommentListener { void onFetchCommentSuccess(ArrayList<CommentData> expandedComments, String parentId, ArrayList<String> children); void onFetchCommentFailed(); } - interface FetchMoreCommentListener { + public interface FetchMoreCommentListener { void onFetchMoreCommentSuccess(ArrayList<CommentData> expandedComments, int childrenStartingIndex); void onFetchMoreCommentFailed(); } - static void fetchComments(Retrofit retrofit, @Nullable String accessToken, String article, String commentId, - Locale locale, FetchCommentListener fetchCommentListener) { + public static void fetchComments(Retrofit retrofit, @Nullable String accessToken, String article, String commentId, + Locale locale, FetchCommentListener fetchCommentListener) { RedditAPI api = retrofit.create(RedditAPI.class); Call<String> comments; if(accessToken == null) { @@ -70,9 +70,9 @@ class FetchComment { }); } - static void fetchMoreComment(Retrofit retrofit, @Nullable String accessToken, - ArrayList<String> allChildren, int startingIndex, - int depth, Locale locale, FetchMoreCommentListener fetchMoreCommentListener) { + public static void fetchMoreComment(Retrofit retrofit, @Nullable String accessToken, + ArrayList<String> allChildren, int startingIndex, + int depth, Locale locale, FetchMoreCommentListener fetchMoreCommentListener) { StringBuilder stringBuilder = new StringBuilder(); for(int i = 0; i < 100; i++) { if(allChildren.size() <= startingIndex + i) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchFlairs.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchFlairs.java index 073067d2..946db033 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchFlairs.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchFlairs.java @@ -14,13 +14,13 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class FetchFlairs { - interface FetchFlairsInSubredditListener { +public class FetchFlairs { + public interface FetchFlairsInSubredditListener { void fetchSuccessful(ArrayList<Flair> flairs); void fetchFailed(); } - static void fetchFlairsInSubreddit(Retrofit oauthRetrofit, String accessToken, String subredditName, FetchFlairsInSubredditListener fetchFlairsInSubredditListener) { + public static void fetchFlairsInSubreddit(Retrofit oauthRetrofit, String accessToken, String subredditName, FetchFlairsInSubredditListener fetchFlairsInSubredditListener) { RedditAPI api = oauthRetrofit.create(RedditAPI.class); Call<String> flairsCall = api.getFlairs(RedditUtils.getOAuthHeader(accessToken), subredditName); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java index bc738b83..00611210 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java @@ -19,17 +19,17 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class FetchMessages { +public class FetchMessages { interface FetchMessagesListener { void fetchSuccess(ArrayList<Message> messages, @Nullable String after); void fetchFailed(); } - static final String WHERE_INBOX = "inbox"; - static final String WHERE_UNREAD = "unread"; - static final String WHERE_SENT = "sent"; - static final String WHERE_COMMENTS = "comments"; + public static final String WHERE_INBOX = "inbox"; + public static final String WHERE_UNREAD = "unread"; + public static final String WHERE_SENT = "sent"; + public static final String WHERE_COMMENTS = "comments"; static void fetchMessagesAsync(Retrofit oauthRetrofit, Locale locale, String accessToken, String where, String after, FetchMessagesListener fetchMessagesListener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMyInfo.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMyInfo.java index 1538a70e..644c78a2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMyInfo.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMyInfo.java @@ -8,15 +8,15 @@ import retrofit2.Call; import retrofit2.Callback; import retrofit2.Retrofit; -class FetchMyInfo { +public class FetchMyInfo { - interface FetchUserMyListener { + public interface FetchUserMyListener { void onFetchMyInfoSuccess(String response); void onFetchMyInfoFail(); } - static void fetchAccountInfo(final Retrofit retrofit, String accessToken, - final FetchUserMyListener fetchUserMyListener) { + public static void fetchAccountInfo(final Retrofit retrofit, String accessToken, + final FetchUserMyListener fetchUserMyListener) { RedditAPI api = retrofit.create(RedditAPI.class); Call<String> userInfo = api.getMyInfo(RedditUtils.getOAuthHeader(accessToken)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPost.java index 02901768..fa6c7891 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPost.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPost.java @@ -9,13 +9,13 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class FetchPost { - interface FetchPostListener { +public class FetchPost { + public interface FetchPostListener { void fetchPostSuccess(Post post); void fetchPostFailed(); } - static void fetchPost(Retrofit retrofit, String id, String accessToken, Locale locale, FetchPostListener fetchPostListener) { + public static void fetchPost(Retrofit retrofit, String id, String accessToken, Locale locale, FetchPostListener fetchPostListener) { Call<String> postCall; if(accessToken == null) { postCall = retrofit.create(RedditAPI.class).getPost(id); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubredditData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubredditData.java index 696a2dd6..bbb485cf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubredditData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubredditData.java @@ -10,8 +10,8 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class FetchSubredditData { - interface FetchSubredditDataListener { +public class FetchSubredditData { + public interface FetchSubredditDataListener { void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers); void onFetchSubredditDataFail(); } @@ -21,7 +21,7 @@ class FetchSubredditData { void onFetchSubredditListingDataFail(); } - static void fetchSubredditData(Retrofit retrofit, String subredditName, final FetchSubredditDataListener fetchSubredditDataListener) { + public static void fetchSubredditData(Retrofit retrofit, String subredditName, final FetchSubredditDataListener fetchSubredditDataListener) { RedditAPI api = retrofit.create(RedditAPI.class); Call<String> subredditData = api.getSubredditData(subredditName); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubscribedThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubscribedThing.java index d1a6977b..52fd2c66 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubscribedThing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubscribedThing.java @@ -12,19 +12,19 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class FetchSubscribedThing { - interface FetchSubscribedThingListener { +public class FetchSubscribedThing { + public interface FetchSubscribedThingListener { void onFetchSubscribedThingSuccess(ArrayList<SubscribedSubredditData> subscribedSubredditData, ArrayList<SubscribedUserData> subscribedUserData, ArrayList<SubredditData> subredditData); void onFetchSubscribedThingFail(); } - static void fetchSubscribedThing(final Retrofit retrofit, String accessToken, String accountName, - final String lastItem, final ArrayList<SubscribedSubredditData> subscribedSubredditData, - final ArrayList<SubscribedUserData> subscribedUserData, - final ArrayList<SubredditData> subredditData, - final FetchSubscribedThingListener fetchSubscribedThingListener) { + public static void fetchSubscribedThing(final Retrofit retrofit, String accessToken, String accountName, + final String lastItem, final ArrayList<SubscribedSubredditData> subscribedSubredditData, + final ArrayList<SubscribedUserData> subscribedUserData, + final ArrayList<SubredditData> subredditData, + final FetchSubscribedThingListener fetchSubscribedThingListener) { RedditAPI api = retrofit.create(RedditAPI.class); Call<String> subredditDataCall = api.getSubscribedThing(lastItem, RedditUtils.getOAuthHeader(accessToken)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Flair.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Flair.java index e60566ce..88ec4d90 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Flair.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Flair.java @@ -3,7 +3,7 @@ package ml.docilealligator.infinityforreddit; import android.os.Parcel; import android.os.Parcelable; -class Flair implements Parcelable { +public class Flair implements Parcelable { private String id; private String text; private boolean editable; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java index e90e032d..6b4da7ff 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentsListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -30,6 +30,15 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Adapter.CommentsListingRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.CommentViewModel; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import retrofit2.Retrofit; @@ -38,10 +47,10 @@ import retrofit2.Retrofit; */ public class CommentsListingFragment extends Fragment implements FragmentCommunicator { - static final String EXTRA_USERNAME = "EN"; - static final String EXTRA_ACCESS_TOKEN = "EAT"; - static final String EXTRA_ACCOUNT_NAME = "EAN"; - static final String EXTRA_ARE_SAVED_COMMENTS = "EISC"; + public static final String EXTRA_USERNAME = "EN"; + public static final String EXTRA_ACCESS_TOKEN = "EAT"; + public static final String EXTRA_ACCOUNT_NAME = "EAN"; + public static final String EXTRA_ARE_SAVED_COMMENTS = "EISC"; private static final String NULL_ACCESS_TOKEN_STATE = "NATS"; private static final String ACCESS_TOKEN_STATE = "ATS"; @@ -181,7 +190,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni mCommentViewModel.getPaginationNetworkState().observe(this, networkState -> mAdapter.setNetworkState(networkState)); } - void changeSortType(String sortType) { + public void changeSortType(String sortType) { mCommentViewModel.changeSortType(sortType); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FlairBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FlairBottomSheetFragment.java index 6087e350..0435cef7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FlairBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FlairBottomSheetFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -23,6 +23,11 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Adapter.FlairBottomSheetRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.FetchFlairs; +import ml.docilealligator.infinityforreddit.Flair; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; import retrofit2.Retrofit; @@ -31,12 +36,12 @@ import retrofit2.Retrofit; */ public class FlairBottomSheetFragment extends BottomSheetDialogFragment { - interface FlairSelectionCallback { + public interface FlairSelectionCallback { void flairSelected(Flair flair); } - static final String EXTRA_ACCESS_TOKEN = "EAT"; - static final String EXTRA_SUBREDDIT_NAME = "ESN"; + public static final String EXTRA_ACCESS_TOKEN = "EAT"; + public static final String EXTRA_SUBREDDIT_NAME = "ESN"; @BindView(R.id.progress_bar_flair_bottom_sheet_fragment) ProgressBar progressBar; @BindView(R.id.error_text_view_flair_bottom_sheet_fragment) TextView errorTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FollowedUsersListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java index cabbe6ed..3de48bb8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FollowedUsersListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -22,6 +22,10 @@ import com.bumptech.glide.RequestManager; import javax.inject.Inject; +import ml.docilealligator.infinityforreddit.Adapter.FollowedUsersRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserViewModel; import butterknife.BindView; import butterknife.ButterKnife; @@ -32,7 +36,7 @@ import butterknife.ButterKnife; */ public class FollowedUsersListingFragment extends Fragment { - static final String EXTRA_ACCOUNT_NAME = "EAN"; + public static final String EXTRA_ACCOUNT_NAME = "EAN"; @BindView(R.id.recycler_view_followed_users_listing_fragment) RecyclerView mRecyclerView; @BindView(R.id.no_subscriptions_linear_layout_followed_users_listing_fragment) LinearLayout mLinearLayout; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ModifyCommentBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ModifyCommentBottomSheetFragment.java index 7c39a8e4..cf3d99f0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ModifyCommentBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ModifyCommentBottomSheetFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -17,6 +17,10 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; +import ml.docilealligator.infinityforreddit.R; /** @@ -24,10 +28,10 @@ import butterknife.ButterKnife; */ public class ModifyCommentBottomSheetFragment extends RoundedBottomSheetDialogFragment { - static final String EXTRA_COMMENT_FULLNAME = "ECF"; - static final String EXTRA_COMMENT_CONTENT = "ECC"; - static final String EXTRA_ACCESS_TOKEN = "EAT"; - static final String EXTRA_POSITION = "EP"; + public static final String EXTRA_COMMENT_FULLNAME = "ECF"; + public static final String EXTRA_COMMENT_CONTENT = "ECC"; + public static final String EXTRA_ACCESS_TOKEN = "EAT"; + public static final String EXTRA_POSITION = "EP"; public ModifyCommentBottomSheetFragment() { // Required empty public constructor diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java index f6d653e6..21e130bd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -45,6 +45,22 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity; +import ml.docilealligator.infinityforreddit.Activity.MainActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity; +import ml.docilealligator.infinityforreddit.Adapter.PostRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent; +import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.Post; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.PostViewModel; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; import retrofit2.Retrofit; @@ -53,15 +69,15 @@ import retrofit2.Retrofit; */ public class PostFragment extends Fragment implements FragmentCommunicator { - static final String EXTRA_NAME = "EN"; - static final String EXTRA_USER_NAME = "EUN"; - static final String EXTRA_USER_WHERE = "EUW"; - static final String EXTRA_QUERY = "EQ"; - static final String EXTRA_POST_TYPE = "EPT"; - static final String EXTRA_SORT_TYPE = "EST"; - static final String EXTRA_FILTER = "EF"; - static final int EXTRA_NO_FILTER = -2; - static final String EXTRA_ACCESS_TOKEN = "EAT"; + public static final String EXTRA_NAME = "EN"; + public static final String EXTRA_USER_NAME = "EUN"; + public static final String EXTRA_USER_WHERE = "EUW"; + public static final String EXTRA_QUERY = "EQ"; + public static final String EXTRA_POST_TYPE = "EPT"; + public static final String EXTRA_SORT_TYPE = "EST"; + public static final String EXTRA_FILTER = "EF"; + public static final int EXTRA_NO_FILTER = -2; + public static final String EXTRA_ACCESS_TOKEN = "EAT"; private static final String IS_IN_LAZY_MODE_STATE = "IILMS"; private static final String RECYCLER_VIEW_POSITION_STATE = "RVPS"; @@ -428,7 +444,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { return rootView; } - void changeSortType(String sortType) { + public void changeSortType(String sortType) { mPostViewModel.changeSortType(sortType); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostTypeBottomSheetFragment.java index 338821c0..8f21ffd0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostTypeBottomSheetFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -16,6 +16,7 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.R; /** @@ -23,14 +24,14 @@ import butterknife.ButterKnife; */ public class PostTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { - interface PostTypeSelectionCallback { + public interface PostTypeSelectionCallback { void postTypeSelected(int postType); } - static final int TYPE_TEXT = 0; - static final int TYPE_LINK = 1; - static final int TYPE_IMAGE = 2; - static final int TYPE_VIDEO = 3; + public static final int TYPE_TEXT = 0; + public static final int TYPE_LINK = 1; + public static final int TYPE_IMAGE = 2; + public static final int TYPE_VIDEO = 3; @BindView(R.id.text_type_linear_layout_post_type_bottom_sheet_fragment) LinearLayout textTypeLinearLayout; @BindView(R.id.link_type_linear_layout_post_type_bottom_sheet_fragment) LinearLayout linkTypeLinearLayout; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchPostSortTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SearchPostSortTypeBottomSheetFragment.java index d0b2bf6b..181842d5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchPostSortTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SearchPostSortTypeBottomSheetFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -16,6 +16,8 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.R; /** @@ -23,7 +25,7 @@ import butterknife.ButterKnife; */ public class SearchPostSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { - interface SearchSortTypeSelectionCallback { + public interface SearchSortTypeSelectionCallback { void searchSortTypeSelected(String sortType); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchUserAndSubredditSortTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SearchUserAndSubredditSortTypeBottomSheetFragment.java index 5579d220..d75a964e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchUserAndSubredditSortTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SearchUserAndSubredditSortTypeBottomSheetFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -16,6 +16,8 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.R; /** @@ -23,11 +25,11 @@ import butterknife.ButterKnife; */ public class SearchUserAndSubredditSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { - interface SearchUserAndSubredditSortTypeSelectionCallback { + public interface SearchUserAndSubredditSortTypeSelectionCallback { void searchUserAndSubredditSortTypeSelected(String sortType, int fragmentPosition); } - static final String EXTRA_FRAGMENT_POSITION = "EFP"; + public static final String EXTRA_FRAGMENT_POSITION = "EFP"; @BindView(R.id.relevance_type_text_view_search_user_and_subreddit_sort_type_bottom_sheet_fragment) TextView relevanceTypeTextView; @BindView(R.id.activity_type_text_view_search_user_and_subreddit_sort_type_bottom_sheet_fragment) TextView activityTypeTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SortTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SortTypeBottomSheetFragment.java index b4825274..19305303 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SortTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SortTypeBottomSheetFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -17,6 +17,8 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.R; /** @@ -24,11 +26,11 @@ import butterknife.ButterKnife; */ public class SortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { - interface SortTypeSelectionCallback { + public interface SortTypeSelectionCallback { void sortTypeSelected(String sortType); } - static final String EXTRA_NO_BEST_TYPE = "ENBT"; + public static final String EXTRA_NO_BEST_TYPE = "ENBT"; @BindView(R.id.best_type_text_view_sort_type_bottom_sheet_fragment) TextView bestTypeTextView; @BindView(R.id.hot_type_text_view_sort_type_bottom_sheet_fragment) TextView hotTypeTextView; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubredditListingFragment.java index 03660f57..1d8719de 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubredditListingFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -29,6 +29,16 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Activity.SearchSubredditsResultActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.Adapter.SubredditListingRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.SubredditListingViewModel; import retrofit2.Retrofit; @@ -37,10 +47,10 @@ import retrofit2.Retrofit; */ public class SubredditListingFragment extends Fragment implements FragmentCommunicator { - static final String EXTRA_QUERY = "EQ"; - static final String EXTRA_IS_POSTING = "EIP"; - static final String EXTRA_ACCESS_TOKEN = "EAT"; - static final String EXTRA_ACCOUNT_NAME = "EAN"; + public static final String EXTRA_QUERY = "EQ"; + public static final String EXTRA_IS_POSTING = "EIP"; + public static final String EXTRA_ACCESS_TOKEN = "EAT"; + public static final String EXTRA_ACCOUNT_NAME = "EAN"; @BindView(R.id.coordinator_layout_subreddit_listing_fragment) CoordinatorLayout mCoordinatorLayout; @BindView(R.id.recycler_view_subreddit_listing_fragment) RecyclerView mSubredditListingRecyclerView; @@ -167,7 +177,7 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun } } - void changeSortType(String sortType) { + public void changeSortType(String sortType) { mSubredditListingViewModel.changeSortType(sortType); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedSubredditsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java index d5954501..e15f325d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedSubredditsListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -23,9 +23,14 @@ import com.bumptech.glide.RequestManager; import javax.inject.Inject; -import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditViewModel; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Activity.SubredditSelectionActivity; +import ml.docilealligator.infinityforreddit.Adapter.SubscribedSubredditsRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditViewModel; /** @@ -33,10 +38,10 @@ import butterknife.ButterKnife; */ public class SubscribedSubredditsListingFragment extends Fragment { - static final String EXTRA_ACCOUNT_NAME = "EAT"; - static final String EXTRA_ACCOUNT_PROFILE_IMAGE_URL = "EAPIU"; - static final String EXTRA_IS_SUBREDDIT_SELECTION = "EISS"; - static final String EXTRA_EXTRA_CLEAR_SELECTION = "EECS"; + public static final String EXTRA_ACCOUNT_NAME = "EAT"; + public static final String EXTRA_ACCOUNT_PROFILE_IMAGE_URL = "EAPIU"; + public static final String EXTRA_IS_SUBREDDIT_SELECTION = "EISS"; + public static final String EXTRA_EXTRA_CLEAR_SELECTION = "EECS"; @BindView(R.id.recycler_view_subscribed_subreddits_listing_fragment) RecyclerView mRecyclerView; @BindView(R.id.no_subscriptions_linear_layout_subreddits_listing_fragment) LinearLayout mLinearLayout; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/UserListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/UserListingFragment.java index ed62f453..8583a754 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/UserListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/UserListingFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.content.res.Configuration; @@ -26,6 +26,14 @@ 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.PostDataSource; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.Adapter.UserListingRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.UserListingViewModel; import retrofit2.Retrofit; @@ -34,9 +42,9 @@ import retrofit2.Retrofit; */ public class UserListingFragment extends Fragment implements FragmentCommunicator { - static final String EXTRA_QUERY = "EQ"; - static final String EXTRA_ACCESS_TOKEN = "EAT"; - static final String EXTRA_ACCOUNT_NAME = "EAN"; + public static final String EXTRA_QUERY = "EQ"; + public static final String EXTRA_ACCESS_TOKEN = "EAT"; + public static final String EXTRA_ACCOUNT_NAME = "EAN"; @BindView(R.id.coordinator_layout_user_listing_fragment) CoordinatorLayout mCoordinatorLayout; @BindView(R.id.recycler_view_user_listing_fragment) RecyclerView mUserListingRecyclerView; @@ -146,7 +154,7 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato } } - void changeSortType(String sortType) { + public void changeSortType(String sortType) { mUserListingViewModel.changeSortType(sortType); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/UserThingSortTypeBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/UserThingSortTypeBottomSheetFragment.java index dfbf297e..4e9171dc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/UserThingSortTypeBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/UserThingSortTypeBottomSheetFragment.java @@ -1,4 +1,4 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Fragment; import android.app.Activity; @@ -17,6 +17,8 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.PostDataSource; +import ml.docilealligator.infinityforreddit.R; /** @@ -24,7 +26,7 @@ import butterknife.ButterKnife; */ public class UserThingSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment { - interface UserThingSortTypeSelectionCallback { + public interface UserThingSortTypeSelectionCallback { void userThingSortTypeSelected(String sortType); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FragmentCommunicator.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FragmentCommunicator.java index c50ef12c..e6fc019f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FragmentCommunicator.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FragmentCommunicator.java @@ -1,6 +1,6 @@ package ml.docilealligator.infinityforreddit; -interface FragmentCommunicator { +public interface FragmentCommunicator { void refresh(); default void changeNSFW(boolean nsfw) {}; default boolean startLazyMode() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/HidePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/HidePost.java index ec6770d2..0ecee1bf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/HidePost.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/HidePost.java @@ -10,14 +10,14 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class HidePost { - interface HidePostListener { +public class HidePost { + public interface HidePostListener { void success(); void failed(); } - static void hidePost(Retrofit oauthRetrofit, String accessToken, String fullname, - HidePostListener hidePostListener) { + public static void hidePost(Retrofit oauthRetrofit, String accessToken, String fullname, + HidePostListener hidePostListener) { Map<String, String> params = new HashMap<>(); params.put(RedditUtils.ID_KEY, fullname); oauthRetrofit.create(RedditAPI.class).hide(RedditUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() { @@ -37,8 +37,8 @@ class HidePost { }); } - static void unhidePost(Retrofit oauthRetrofit, String accessToken, String fullname, - HidePostListener hidePostListener) { + public static void unhidePost(Retrofit oauthRetrofit, String accessToken, String fullname, + HidePostListener hidePostListener) { Map<String, String> params = new HashMap<>(); params.put(RedditUtils.ID_KEY, fullname); oauthRetrofit.create(RedditAPI.class).unhide(RedditUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/JSONUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/JSONUtils.java index 269e4f41..1e73bcb2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/JSONUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/JSONUtils.java @@ -5,84 +5,84 @@ package ml.docilealligator.infinityforreddit; */ public class JSONUtils { - static final String KIND_KEY = "kind"; - static final String DATA_KEY = "data"; - static final String AFTER_KEY = "after"; - static final String CHILDREN_KEY = "children"; - static final String COUNT_KEY = "count"; - static final String TITLE_KEY = "title"; - static final String NAME_KEY = "name"; - static final String SUBREDDIT_NAME_PREFIX_KEY = "subreddit_name_prefixed"; - static final String SELFTEXT_KEY = "selftext"; - static final String AUTHOR_KEY = "author"; - static final String LINK_AUTHOR_KEY = "link_author"; - static final String LINK_FLAIR_TEXT_KEY = "link_flair_text"; - static final String SCORE_KEY = "score"; - static final String LIKES_KEY = "likes"; - static final String NSFW_KEY = "over_18"; - static final String GILDED_KEY = "gilded"; - static final String PERMALINK_KEY = "permalink"; - static final String CREATED_UTC_KEY = "created_utc"; - static final String PREVIEW_KEY = "preview"; - static final String IMAGES_KEY = "images"; - static final String WIDTH_KEY = "width"; - static final String HEIGHT_KEY = "height"; - static final String VARIANTS_KEY = "variants"; - static final String GIF_KEY = "gif"; - static final String MP4_KEY = "mp4"; - static final String SOURCE_KEY = "source"; - static final String URL_KEY = "url"; - static final String MEDIA_KEY = "media"; - static final String REDDIT_VIDEO_KEY = "reddit_video"; - static final String HLS_URL_KEY = "hls_url"; - static final String IS_VIDEO_KEY = "is_video"; - static final String CROSSPOST_PARENT_LIST = "crosspost_parent_list"; - static final String REDDIT_VIDEO_PREVIEW_KEY = "reddit_video_preview"; - static final String STICKIED_KEY = "stickied"; - static final String BODY_KEY = "body"; - static final String COLLAPSED_KEY = "collapsed"; - static final String IS_SUBMITTER_KEY = "is_submitter"; - static final String REPLIES_KEY = "replies"; - static final String DEPTH_KEY = "depth"; - static final String ID_KEY = "id"; - static final String SCORE_HIDDEN_KEY = "score_hidden"; - static final String SUBREDDIT_KEY = "subreddit"; - static final String BANNER_IMG_KEY = "banner_img"; - static final String BANNER_BACKGROUND_IMAGE_KEY = "banner_background_image"; - static final String ICON_IMG_KEY = "icon_img"; - static final String COMMUNITY_ICON_KEY = "community_icon"; - static final String LINK_KARMA_KEY = "link_karma"; - static final String COMMENT_KARMA_KEY = "comment_karma"; - static final String DISPLAY_NAME = "display_name"; - static final String SUBREDDIT_TYPE_KEY = "subreddit_type"; - static final String SUBREDDIT_TYPE_VALUE_USER = "user"; - static final String SUBSCRIBERS_KEY = "subscribers"; - static final String PUBLIC_DESCRIPTION_KEY = "public_description"; - static final String ACTIVE_USER_COUNT_KEY = "active_user_count"; - static final String IS_GOLD_KEY = "is_gold"; - static final String IS_FRIEND_KEY = "is_friend"; - static final String JSON_KEY = "json"; - static final String PARENT_ID_KEY = "parent_id"; - static final String LINK_ID_KEY = "link_id"; - static final String LINK_TITLE_KEY = "link_title"; - static final String ERRORS_KEY = "errors"; - static final String ARGS_KEY = "args"; - static final String FIELDS_KEY = "fields"; - static final String VALUE_KEY = "value"; - static final String TEXT_KEY = "text"; - static final String SPOILER_KEY = "spoiler"; - static final String RULES_KEY = "rules"; - static final String SHORT_NAME_KEY = "short_name"; - static final String DESCRIPTION_KEY = "description"; - static final String ARCHIVED_KEY = "archived"; - static final String LOCKEC_KEY = "locked"; - static final String SAVED_KEY = "saved"; - static final String TEXT_EDITABLE_KEY = "text_editable"; - static final String SUBJECT_KEY = "subject"; - static final String CONTEXT_KEY = "context"; - static final String DISTINGUISHED_KEY = "distinguished"; - static final String WAS_COMMENT_KEY = "was_comment"; - static final String NEW_KEY = "new"; - static final String NUM_COMMENTS_KEY = "num_comments"; - static final String HIDDEN_KEY = "hidden"; + public static final String KIND_KEY = "kind"; + public static final String DATA_KEY = "data"; + public static final String AFTER_KEY = "after"; + public static final String CHILDREN_KEY = "children"; + public static final String COUNT_KEY = "count"; + public static final String TITLE_KEY = "title"; + public static final String NAME_KEY = "name"; + public static final String SUBREDDIT_NAME_PREFIX_KEY = "subreddit_name_prefixed"; + public static final String SELFTEXT_KEY = "selftext"; + public static final String AUTHOR_KEY = "author"; + public static final String LINK_AUTHOR_KEY = "link_author"; + public static final String LINK_FLAIR_TEXT_KEY = "link_flair_text"; + public static final String SCORE_KEY = "score"; + public static final String LIKES_KEY = "likes"; + public static final String NSFW_KEY = "over_18"; + public static final String GILDED_KEY = "gilded"; + public static final String PERMALINK_KEY = "permalink"; + public static final String CREATED_UTC_KEY = "created_utc"; + public static final String PREVIEW_KEY = "preview"; + public static final String IMAGES_KEY = "images"; + public static final String WIDTH_KEY = "width"; + public static final String HEIGHT_KEY = "height"; + public static final String VARIANTS_KEY = "variants"; + public static final String GIF_KEY = "gif"; + public static final String MP4_KEY = "mp4"; + public static final String SOURCE_KEY = "source"; + public static final String URL_KEY = "url"; + public static final String MEDIA_KEY = "media"; + public static final String REDDIT_VIDEO_KEY = "reddit_video"; + public static final String HLS_URL_KEY = "hls_url"; + public static final String IS_VIDEO_KEY = "is_video"; + public static final String CROSSPOST_PARENT_LIST = "crosspost_parent_list"; + public static final String REDDIT_VIDEO_PREVIEW_KEY = "reddit_video_preview"; + public static final String STICKIED_KEY = "stickied"; + public static final String BODY_KEY = "body"; + public static final String COLLAPSED_KEY = "collapsed"; + public static final String IS_SUBMITTER_KEY = "is_submitter"; + public static final String REPLIES_KEY = "replies"; + public static final String DEPTH_KEY = "depth"; + public static final String ID_KEY = "id"; + public static final String SCORE_HIDDEN_KEY = "score_hidden"; + public static final String SUBREDDIT_KEY = "subreddit"; + public static final String BANNER_IMG_KEY = "banner_img"; + public static final String BANNER_BACKGROUND_IMAGE_KEY = "banner_background_image"; + public static final String ICON_IMG_KEY = "icon_img"; + public static final String COMMUNITY_ICON_KEY = "community_icon"; + public static final String LINK_KARMA_KEY = "link_karma"; + public static final String COMMENT_KARMA_KEY = "comment_karma"; + public static final String DISPLAY_NAME = "display_name"; + public static final String SUBREDDIT_TYPE_KEY = "subreddit_type"; + public static final String SUBREDDIT_TYPE_VALUE_USER = "user"; + public static final String SUBSCRIBERS_KEY = "subscribers"; + public static final String PUBLIC_DESCRIPTION_KEY = "public_description"; + public static final String ACTIVE_USER_COUNT_KEY = "active_user_count"; + public static final String IS_GOLD_KEY = "is_gold"; + public static final String IS_FRIEND_KEY = "is_friend"; + public static final String JSON_KEY = "json"; + public static final String PARENT_ID_KEY = "parent_id"; + public static final String LINK_ID_KEY = "link_id"; + public static final String LINK_TITLE_KEY = "link_title"; + public static final String ERRORS_KEY = "errors"; + public static final String ARGS_KEY = "args"; + public static final String FIELDS_KEY = "fields"; + public static final String VALUE_KEY = "value"; + public static final String TEXT_KEY = "text"; + public static final String SPOILER_KEY = "spoiler"; + public static final String RULES_KEY = "rules"; + public static final String SHORT_NAME_KEY = "short_name"; + public static final String DESCRIPTION_KEY = "description"; + public static final String ARCHIVED_KEY = "archived"; + public static final String LOCKEC_KEY = "locked"; + public static final String SAVED_KEY = "saved"; + public static final String TEXT_EDITABLE_KEY = "text_editable"; + public static final String SUBJECT_KEY = "subject"; + public static final String CONTEXT_KEY = "context"; + public static final String DISTINGUISHED_KEY = "distinguished"; + public static final String WAS_COMMENT_KEY = "was_comment"; + public static final String NEW_KEY = "new"; + public static final String NUM_COMMENTS_KEY = "num_comments"; + public static final String HIDDEN_KEY = "hidden"; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Message.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Message.java index 8f4b7ae5..1ba1aea9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Message.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Message.java @@ -1,6 +1,6 @@ package ml.docilealligator.infinityforreddit; -class Message { +public class Message { static final String TYPE_COMMENT = "t1"; static final String TYPE_ACCOUNT = "t2"; static final String TYPE_LINK = "t3"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MessageViewModel.java index d111c8ad..e02c4296 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MessageViewModel.java @@ -46,27 +46,27 @@ public class MessageViewModel extends ViewModel { }); } - LiveData<PagedList<Message>> getMessages() { + public LiveData<PagedList<Message>> getMessages() { return messages; } - LiveData<NetworkState> getPaginationNetworkState() { + public LiveData<NetworkState> getPaginationNetworkState() { return paginationNetworkState; } - LiveData<NetworkState> getInitialLoadingState() { + public LiveData<NetworkState> getInitialLoadingState() { return initialLoadingState; } - LiveData<Boolean> hasMessage() { + public LiveData<Boolean> hasMessage() { return hasMessageLiveData; } - void refresh() { + public void refresh() { messageDataSourceFactory.getMessageDataSource().invalidate(); } - void retryLoadingMore() { + public void retryLoadingMore() { messageDataSourceFactory.getMessageDataSource().retryLoadingMore(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/NetworkState.java b/app/src/main/java/ml/docilealligator/infinityforreddit/NetworkState.java index 4e741025..0c550b7b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/NetworkState.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/NetworkState.java @@ -1,6 +1,6 @@ package ml.docilealligator.infinityforreddit; -class NetworkState { +public class NetworkState { public enum Status{ LOADING, SUCCESS, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseAndSaveAccountInfo.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseAndSaveAccountInfo.java index 2494192b..218b7af4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseAndSaveAccountInfo.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseAndSaveAccountInfo.java @@ -6,14 +6,14 @@ import android.text.Html; import org.json.JSONException; import org.json.JSONObject; -class ParseAndSaveAccountInfo { - interface ParseAndSaveAccountInfoListener { +public class ParseAndSaveAccountInfo { + public interface ParseAndSaveAccountInfoListener { void onParseMyInfoSuccess(String name, String profileImageUrl, String bannerImageUrl, int karma); void onParseMyInfoFail(); } - static void parseAndSaveAccountInfo(String response, RedditDataRoomDatabase redditDataRoomDatabase, - ParseAndSaveAccountInfoListener parseAndSaveAccountInfoListener) { + public static void parseAndSaveAccountInfo(String response, RedditDataRoomDatabase redditDataRoomDatabase, + ParseAndSaveAccountInfoListener parseAndSaveAccountInfoListener) { new ParseAndSaveAccountInfoAsyncTask(response, redditDataRoomDatabase, parseAndSaveAccountInfoListener).execute(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java index 41082a8c..7881803b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java @@ -18,8 +18,8 @@ import static ml.docilealligator.infinityforreddit.CommentData.VOTE_TYPE_DOWNVOT import static ml.docilealligator.infinityforreddit.CommentData.VOTE_TYPE_NO_VOTE; import static ml.docilealligator.infinityforreddit.CommentData.VOTE_TYPE_UPVOTE; -class ParseComment { - interface ParseCommentListener { +public class ParseComment { + public interface ParseCommentListener { void onParseCommentSuccess(ArrayList<CommentData> expandedComments, String parentId, ArrayList<String> moreChildrenFullnames); void onParseCommentFailed(); @@ -30,8 +30,8 @@ class ParseComment { void onParseSentCommentFailed(@Nullable String errorMessage); } - static void parseComment(String response, ArrayList<CommentData> commentData, Locale locale, - ParseCommentListener parseCommentListener) { + public static void parseComment(String response, ArrayList<CommentData> commentData, Locale locale, + ParseCommentListener parseCommentListener) { try { JSONArray childrenArray = new JSONArray(response); String parentId = childrenArray.getJSONObject(0).getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java index 69d1fa9b..ca593e0a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java @@ -12,17 +12,19 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Locale; +import ml.docilealligator.infinityforreddit.Fragment.PostFragment; + /** * Created by alex on 3/21/18. */ -class ParsePost { +public class ParsePost { interface ParsePostsListingListener { void onParsePostsListingSuccess(ArrayList<Post> newPostData, String lastItem); void onParsePostsListingFail(); } - interface ParsePostListener { + public interface ParsePostListener { void onParsePostSuccess(Post post); void onParsePostFail(); } @@ -32,7 +34,7 @@ class ParsePost { new ParsePostDataAsyncTask(response, locale, nPosts, filter, nsfw, parsePostsListingListener).execute(); } - static void parsePost(String response, Locale locale, ParsePostListener parsePostListener) { + public static void parsePost(String response, Locale locale, ParsePostListener parsePostListener) { new ParsePostDataAsyncTask(response, locale, true, parsePostListener).execute(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java index 7f1ba645..568c4779 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Post.java @@ -7,14 +7,14 @@ import android.os.Parcelable; * Created by alex on 3/1/18. */ -class Post implements Parcelable { - static final int NSFW_TYPE = -1; - static final int TEXT_TYPE = 0; - static final int IMAGE_TYPE = 1; - static final int LINK_TYPE = 2; - static final int VIDEO_TYPE = 3; - static final int GIF_VIDEO_TYPE = 4; - static final int NO_PREVIEW_LINK_TYPE = 5; +public class Post implements Parcelable { + public static final int NSFW_TYPE = -1; + public static final int TEXT_TYPE = 0; + public static final int IMAGE_TYPE = 1; + public static final int LINK_TYPE = 2; + public static final int VIDEO_TYPE = 3; + public static final int GIF_VIDEO_TYPE = 4; + public static final int NO_PREVIEW_LINK_TYPE = 5; private String id; private String fullName; @@ -49,7 +49,7 @@ class Post implements Parcelable { private boolean isCrosspost; private String crosspostParentId; - Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author, + public Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author, String postTime, String title, String previewUrl, String permalink, int score, int postType, int voteType, int gilded, int nComments, String flair, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved, boolean isCrosspost) { @@ -79,7 +79,7 @@ class Post implements Parcelable { this.isCrosspost = isCrosspost; } - Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author, + public Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author, String postTime, String title, String previewUrl, String url, String permalink, int score, int postType, int voteType, int gilded, int nComments, String flair, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked, @@ -111,7 +111,7 @@ class Post implements Parcelable { this.isCrosspost = isCrosspost; } - Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author, + public Post(String id, String fullName, String subredditName, String subredditNamePrefixed, String author, String postTime, String title, String permalink, int score, int postType, int voteType, int gilded, int nComments, String flair, boolean hidden, boolean spoiler, boolean nsfw, boolean stickied, boolean archived, boolean locked, boolean saved, boolean isCrosspost) { @@ -191,43 +191,43 @@ class Post implements Parcelable { return id; } - String getFullName() { + public String getFullName() { return fullName; } - String getSubredditName() { + public String getSubredditName() { return subredditName; } - String getSubredditNamePrefixed() { + public String getSubredditNamePrefixed() { return subredditNamePrefixed; } - String getSubredditIconUrl() { + public String getSubredditIconUrl() { return subredditIconUrl; } - void setSubredditIconUrl(String subredditIconUrl) { + public void setSubredditIconUrl(String subredditIconUrl) { this.subredditIconUrl = subredditIconUrl; } - String getAuthor() { + public String getAuthor() { return author; } - String getAuthorNamePrefixed() { + public String getAuthorNamePrefixed() { return authorNamePrefixed; } - String getAuthorIconUrl() { + public String getAuthorIconUrl() { return authorIconUrl; } - void setAuthorIconUrl(String authorIconUrl) { + public void setAuthorIconUrl(String authorIconUrl) { this.authorIconUrl = authorIconUrl; } - String getPostTime() { + public String getPostTime() { return postTime; } @@ -239,31 +239,31 @@ class Post implements Parcelable { return title; } - void setSelfText(String selfText) { + public void setSelfText(String selfText) { this.selfText = selfText; } - String getSelfText() { + public String getSelfText() { return selfText; } - String getPreviewUrl() { + public String getPreviewUrl() { return previewUrl; } - String getUrl() { + public String getUrl() { return url; } - void setVideoUrl(String videoUrl) { + public void setVideoUrl(String videoUrl) { this.videoUrl = videoUrl; } - String getVideoUrl() { + public String getVideoUrl() { return videoUrl; } - String getPermalink() { + public String getPermalink() { return permalink; } @@ -271,47 +271,47 @@ class Post implements Parcelable { return flair; } - void setFlair(String flair) { + public void setFlair(String flair) { this.flair = flair; } - void setScore(int score) { + public void setScore(int score) { this.score = score; } - int getScore() { + public int getScore() { return score; } - int getPostType() { + public int getPostType() { return postType; } - void setVoteType(int voteType) { + public void setVoteType(int voteType) { this.voteType = voteType; } - int getVoteType() { + public int getVoteType() { return voteType; } - int getGilded() { + public int getGilded() { return gilded; } - void setPreviewWidth(int previewWidth) { + public void setPreviewWidth(int previewWidth) { this.previewWidth = previewWidth; } - int getPreviewWidth() { + public int getPreviewWidth() { return previewWidth; } - void setPreviewHeight(int previewHeight) { + public void setPreviewHeight(int previewHeight) { this.previewHeight = previewHeight; } - int getPreviewHeight() { + public int getPreviewHeight() { return previewHeight; } @@ -323,27 +323,27 @@ class Post implements Parcelable { this.nComments = nComments; } - boolean isHidden() { + public boolean isHidden() { return hidden; } - void setHidden(boolean hidden) { + public void setHidden(boolean hidden) { this.hidden = hidden; } - boolean isSpoiler() { + public boolean isSpoiler() { return spoiler; } - void setSpoiler(boolean spoiler) { + public void setSpoiler(boolean spoiler) { this.spoiler = spoiler; } - boolean isNSFW() { + public boolean isNSFW() { return nsfw; } - void setNSFW(boolean nsfw) { + public void setNSFW(boolean nsfw) { this.nsfw = nsfw; } @@ -352,27 +352,27 @@ class Post implements Parcelable { return 0; } - boolean isStickied() { + public boolean isStickied() { return stickied; } - boolean isArchived() { + public boolean isArchived() { return archived; } - boolean isLocked() { + public boolean isLocked() { return locked; } - boolean isSaved() { + public boolean isSaved() { return saved; } - void setSaved(boolean saved) { + public void setSaved(boolean saved) { this.saved = saved; } - boolean isCrosspost() { + public boolean isCrosspost() { return isCrosspost; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java index 5a4f71ce..bf8fec96 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java @@ -11,29 +11,29 @@ import retrofit2.Call; import retrofit2.Callback; import retrofit2.Retrofit; -class PostDataSource extends PageKeyedDataSource<String, Post> { - - static final int TYPE_FRONT_PAGE = 0; - static final int TYPE_SUBREDDIT = 1; - static final int TYPE_USER = 2; - static final int TYPE_SEARCH = 3; - - static final String SORT_TYPE_BEST = "best"; - static final String SORT_TYPE_HOT = "hot"; - static final String SORT_TYPE_NEW = "new"; - static final String SORT_TYPE_RANDOM = "random"; - static final String SORT_TYPE_RISING = "rising"; - static final String SORT_TYPE_TOP = "top"; - static final String SORT_TYPE_CONTROVERSIAL = "controversial"; - static final String SORT_TYPE_RELEVANCE = "relevance"; - static final String SORT_TYPE_COMMENTS = "comments"; - - static final String USER_WHERE_SUBMITTED = "submitted"; - static final String USER_WHERE_UPVOTED = "upvoted"; - static final String USER_WHERE_DOWNVOTED = "downvoted"; - static final String USER_WHERE_HIDDEN = "hidden"; - static final String USER_WHERE_SAVED = "saved"; - static final String USER_WHERE_GILDED = "gilded"; +public class PostDataSource extends PageKeyedDataSource<String, Post> { + + public static final int TYPE_FRONT_PAGE = 0; + public static final int TYPE_SUBREDDIT = 1; + public static final int TYPE_USER = 2; + public static final int TYPE_SEARCH = 3; + + public static final String SORT_TYPE_BEST = "best"; + public static final String SORT_TYPE_HOT = "hot"; + public static final String SORT_TYPE_NEW = "new"; + public static final String SORT_TYPE_RANDOM = "random"; + public static final String SORT_TYPE_RISING = "rising"; + public static final String SORT_TYPE_TOP = "top"; + public static final String SORT_TYPE_CONTROVERSIAL = "controversial"; + public static final String SORT_TYPE_RELEVANCE = "relevance"; + public static final String SORT_TYPE_COMMENTS = "comments"; + + public static final String USER_WHERE_SUBMITTED = "submitted"; + public static final String USER_WHERE_UPVOTED = "upvoted"; + public static final String USER_WHERE_DOWNVOTED = "downvoted"; + public static final String USER_WHERE_HIDDEN = "hidden"; + public static final String USER_WHERE_SAVED = "saved"; + public static final String USER_WHERE_GILDED = "gilded"; private Retrofit retrofit; private String accessToken; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java index 9340e20b..c2df1797 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java @@ -1,7 +1,5 @@ package ml.docilealligator.infinityforreddit; -import android.util.Log; - import androidx.annotation.NonNull; import androidx.core.util.Pair; import androidx.lifecycle.LiveData; @@ -60,7 +58,6 @@ public class PostViewModel extends ViewModel { public PostViewModel(Retrofit retrofit, String accessToken, Locale locale, String subredditName, int postType, String sortType, int filter, boolean nsfw) { - Log.i("asfdasdf", "viewmodel: " + sortType); postDataSourceFactory = new PostDataSourceFactory(retrofit, accessToken, locale, subredditName, postType, sortType, filter, nsfw); @@ -152,35 +149,35 @@ public class PostViewModel extends ViewModel { }); } - LiveData<PagedList<Post>> getPosts() { + public LiveData<PagedList<Post>> getPosts() { return posts; } - LiveData<NetworkState> getPaginationNetworkState() { + public LiveData<NetworkState> getPaginationNetworkState() { return paginationNetworkState; } - LiveData<NetworkState> getInitialLoadingState() { + public LiveData<NetworkState> getInitialLoadingState() { return initialLoadingState; } - LiveData<Boolean> hasPost() { + public LiveData<Boolean> hasPost() { return hasPostLiveData; } - void refresh() { + public void refresh() { postDataSourceFactory.getPostDataSource().invalidate(); } - void retryLoadingMore() { + public void retryLoadingMore() { postDataSourceFactory.getPostDataSource().retryLoadingMore(); } - void changeSortType(String sortType) { + public void changeSortType(String sortType) { sortTypeLiveData.postValue(sortType); } - void changeNSFW(boolean nsfw) { + public void changeNSFW(boolean nsfw) { nsfwLiveData.postValue(nsfw); } @@ -209,7 +206,6 @@ public class PostViewModel extends ViewModel { public Factory(Retrofit retrofit, String accessToken, Locale locale, String subredditName, int postType, String sortType, int filter, boolean nsfw) { - Log.i("asfdasdf", "viewmodel factory: " + sortType); this.retrofit = retrofit; this.accessToken = accessToken; this.locale = locale; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java index 7fcb5088..93b5d4e1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java @@ -26,6 +26,8 @@ import javax.inject.Inject; import javax.inject.Named; import ml.docilealligator.infinityforreddit.Account.Account; +import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewMessageActivity; import retrofit2.Call; import retrofit2.Response; import retrofit2.Retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ReadMessage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ReadMessage.java index 900fb7eb..ce6c9ff7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ReadMessage.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ReadMessage.java @@ -10,14 +10,14 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class ReadMessage { - interface ReadMessageListener { +public class ReadMessage { + public interface ReadMessageListener { void readSuccess(); void readFailed(); } - static void readMessage(Retrofit oauthRetrofit, String accessToken, String commaSeparatedFullnames, - ReadMessageListener readMessageListener) { + public static void readMessage(Retrofit oauthRetrofit, String accessToken, String commaSeparatedFullnames, + ReadMessageListener readMessageListener) { Map<String, String> params = new HashMap<>(); params.put(RedditUtils.ID_KEY, commaSeparatedFullnames); oauthRetrofit.create(RedditAPI.class).readMessage(RedditUtils.getOAuthHeader(accessToken), params) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditUtils.java index 5279f97b..6facdfb3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditUtils.java @@ -13,73 +13,73 @@ import okhttp3.RequestBody; */ public class RedditUtils { - static final String OAUTH_URL ="https://www.reddit.com/api/v1/authorize.compact"; - static final String OAUTH_API_BASE_URI = "https://oauth.reddit.com"; - static final String API_BASE_URI = "https://www.reddit.com"; - static final String API_UPLOAD_MEDIA_URI = "https://reddit-uploaded-media.s3-accelerate.amazonaws.com"; - static final String API_UPLOAD_VIDEO_URI = "https://reddit-uploaded-video.s3-accelerate.amazonaws.com"; - - static final String CLIENT_ID_KEY = "client_id"; - static final String CLIENT_ID = ""; - static final String RESPONSE_TYPE_KEY = "response_type"; - static final String RESPONSE_TYPE = "code"; - static final String STATE_KEY = "state"; - static final String STATE = ""; - static final String REDIRECT_URI_KEY = "redirect_uri"; - static final String REDIRECT_URI = ""; - static final String DURATION_KEY = "duration"; - static final String DURATION = "permanent"; - static final String SCOPE_KEY = "scope"; - static final String SCOPE = "identity edit flair history modconfig modflair modlog modposts modwiki mysubreddits privatemessages read report save submit subscribe vote wikiedit wikiread"; - static final String ACCESS_TOKEN_KEY = "access_token"; - - static final String AUTHORIZATION_KEY = "Authorization"; - static final String AUTHORIZATION_BASE = "bearer "; - static final String USER_AGENT_KEY = "User-Agent"; - static final String USER_AGENT = ""; - - static final String GRANT_TYPE_KEY = "grant_type"; - static final String GRANT_TYPE_REFRESH_TOKEN = "refresh_token"; - static final String REFRESH_TOKEN_KEY = "refresh_token"; - - static final String DIR_KEY = "dir"; - static final String ID_KEY = "id"; - static final String RANK_KEY = "rank"; - static final String DIR_UPVOTE = "1"; - static final String DIR_UNVOTE = "0"; - static final String DIR_DOWNVOTE = "-1"; - static final String RANK = "10"; - - static final String ACTION_KEY = "action"; - static final String SR_NAME_KEY = "sr_name"; - - static final String API_TYPE_KEY = "api_type"; - static final String API_TYPE_JSON = "json"; - static final String RETURN_RTJSON_KEY = "return_rtjson"; - static final String TEXT_KEY = "text"; - static final String URL_KEY = "url"; - static final String VIDEO_POSTER_URL_KEY = "video_poster_url"; - static final String THING_ID_KEY = "thing_id"; - - static final String SR_KEY = "sr"; - static final String TITLE_KEY = "title"; - static final String FLAIR_TEXT_KEY = "flair_text"; - static final String SPOILER_KEY = "spoiler"; - static final String NSFW_KEY = "nsfw"; - static final String KIND_KEY = "kind"; - static final String KIND_SELF = "self"; - static final String KIND_LINK = "link"; - static final String KIND_IMAGE = "image"; - static final String KIND_VIDEO = "video"; - static final String KIND_VIDEOGIF = "videogif"; - - static final String FILEPATH_KEY = "filepath"; - static final String MIMETYPE_KEY = "mimetype"; - - static final String LINK_KEY = "link"; - static final String FLAIR_TEMPLATE_ID_KEY = "flair_template_id"; - - static Map<String, String> getHttpBasicAuthHeader() { + public static final String OAUTH_URL ="https://www.reddit.com/api/v1/authorize.compact"; + public static final String OAUTH_API_BASE_URI = "https://oauth.reddit.com"; + public static final String API_BASE_URI = "https://www.reddit.com"; + public static final String API_UPLOAD_MEDIA_URI = "https://reddit-uploaded-media.s3-accelerate.amazonaws.com"; + public static final String API_UPLOAD_VIDEO_URI = "https://reddit-uploaded-video.s3-accelerate.amazonaws.com"; + + public static final String CLIENT_ID_KEY = "client_id"; + public static final String CLIENT_ID = ""; + public static final String RESPONSE_TYPE_KEY = "response_type"; + public static final String RESPONSE_TYPE = "code"; + public static final String STATE_KEY = "state"; + public static final String STATE = ""; + public static final String REDIRECT_URI_KEY = "redirect_uri"; + public static final String REDIRECT_URI = ""; + public static final String DURATION_KEY = "duration"; + public static final String DURATION = "permanent"; + public static final String SCOPE_KEY = "scope"; + public static final String SCOPE = "identity edit flair history modconfig modflair modlog modposts modwiki mysubreddits privatemessages read report save submit subscribe vote wikiedit wikiread"; + public static final String ACCESS_TOKEN_KEY = "access_token"; + + public static final String AUTHORIZATION_KEY = "Authorization"; + public static final String AUTHORIZATION_BASE = "bearer "; + public static final String USER_AGENT_KEY = "User-Agent"; + public static final String USER_AGENT = ""; + + public static final String GRANT_TYPE_KEY = "grant_type"; + public static final String GRANT_TYPE_REFRESH_TOKEN = "refresh_token"; + public static final String REFRESH_TOKEN_KEY = "refresh_token"; + + public static final String DIR_KEY = "dir"; + public static final String ID_KEY = "id"; + public static final String RANK_KEY = "rank"; + public static final String DIR_UPVOTE = "1"; + public static final String DIR_UNVOTE = "0"; + public static final String DIR_DOWNVOTE = "-1"; + public static final String RANK = "10"; + + public static final String ACTION_KEY = "action"; + public static final String SR_NAME_KEY = "sr_name"; + + public static final String API_TYPE_KEY = "api_type"; + public static final String API_TYPE_JSON = "json"; + public static final String RETURN_RTJSON_KEY = "return_rtjson"; + public static final String TEXT_KEY = "text"; + public static final String URL_KEY = "url"; + public static final String VIDEO_POSTER_URL_KEY = "video_poster_url"; + public static final String THING_ID_KEY = "thing_id"; + + public static final String SR_KEY = "sr"; + public static final String TITLE_KEY = "title"; + public static final String FLAIR_TEXT_KEY = "flair_text"; + public static final String SPOILER_KEY = "spoiler"; + public static final String NSFW_KEY = "nsfw"; + public static final String KIND_KEY = "kind"; + public static final String KIND_SELF = "self"; + public static final String KIND_LINK = "link"; + public static final String KIND_IMAGE = "image"; + public static final String KIND_VIDEO = "video"; + public static final String KIND_VIDEOGIF = "videogif"; + + public static final String FILEPATH_KEY = "filepath"; + public static final String MIMETYPE_KEY = "mimetype"; + + public static final String LINK_KEY = "link"; + public static final String FLAIR_TEMPLATE_ID_KEY = "flair_template_id"; + + public static Map<String, String> getHttpBasicAuthHeader() { Map<String, String> params = new HashMap<>(); String credentials = String.format("%s:%s", RedditUtils.CLIENT_ID, ""); String auth = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP); @@ -94,7 +94,7 @@ public class RedditUtils { return params; } - static RequestBody getRequestBody(String s) { + public static RequestBody getRequestBody(String s) { return RequestBody.create(MediaType.parse("text/plain"), s); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Rule.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Rule.java index 89b4d26d..816ab714 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Rule.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Rule.java @@ -1,19 +1,19 @@ package ml.docilealligator.infinityforreddit; -class Rule { +public class Rule { private String shortName; private String descriptionHtml; - Rule(String shortName, String descriptionHtml) { + public Rule(String shortName, String descriptionHtml) { this.shortName = shortName; this.descriptionHtml = descriptionHtml; } - String getShortName() { + public String getShortName() { return shortName; } - String getDescriptionHtml() { + public String getDescriptionHtml() { return descriptionHtml; } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SaveThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SaveThing.java index 743fec29..bae1b1bc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SaveThing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SaveThing.java @@ -10,14 +10,14 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class SaveThing { - interface SaveThingListener { +public class SaveThing { + public interface SaveThingListener { void success(); void failed(); } - static void saveThing(Retrofit oauthRetrofit, String accessToken, String fullname, - SaveThingListener saveThingListener) { + public static void saveThing(Retrofit oauthRetrofit, String accessToken, String fullname, + SaveThingListener saveThingListener) { Map<String, String> params = new HashMap<>(); params.put(RedditUtils.ID_KEY, fullname); oauthRetrofit.create(RedditAPI.class).save(RedditUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() { @@ -37,8 +37,8 @@ class SaveThing { }); } - static void unsaveThing(Retrofit oauthRetrofit, String accessToken, String fullname, - SaveThingListener saveThingListener) { + public static void unsaveThing(Retrofit oauthRetrofit, String accessToken, String fullname, + SaveThingListener saveThingListener) { Map<String, String> params = new HashMap<>(); params.put(RedditUtils.ID_KEY, fullname); oauthRetrofit.create(RedditAPI.class).unsave(RedditUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SendComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SendComment.java index 6be33004..b27a70a2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SendComment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SendComment.java @@ -12,16 +12,16 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -class SendComment { +public class SendComment { - interface SendCommentListener { + public interface SendCommentListener { void sendCommentSuccess(CommentData commentData); void sendCommentFailed(String errorMessage); } - static void sendComment(String commentMarkdown, String thingFullname, int parentDepth, - Locale locale, Retrofit oauthRetrofit, String accessToken, - SendCommentListener sendCommentListener) { + public static void sendComment(String commentMarkdown, String thingFullname, int parentDepth, + Locale locale, Retrofit oauthRetrofit, String accessToken, + SendCommentListener sendCommentListener) { RedditAPI api = oauthRetrofit.create(RedditAPI.class); Map<String, String> headers = RedditUtils.getOAuthHeader(accessToken); Map<String, String> params = new HashMap<>(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java index 03b904d3..d32a9b06 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java @@ -10,7 +10,7 @@ import android.widget.Toast; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; -import ml.docilealligator.infinityforreddit.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementRecyclerViewAdapter.java index 6c3975ab..0c46c7f6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementRecyclerViewAdapter.java @@ -14,7 +14,7 @@ import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; import ml.docilealligator.infinityforreddit.R; class AcknowledgementRecyclerViewAdapter extends RecyclerView.Adapter<AcknowledgementRecyclerViewAdapter.AcknowledgementViewHolder> { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java index bbd98d13..a95d8eb7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java @@ -9,7 +9,7 @@ import android.os.Bundle; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; -import ml.docilealligator.infinityforreddit.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java index c1f89842..69a2a92f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java @@ -8,7 +8,7 @@ import androidx.preference.PreferenceFragmentCompat; import org.greenrobot.eventbus.EventBus; -import ml.docilealligator.infinityforreddit.ChangeFontSizeEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeFontSizeEvent; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java index 7f72da36..a20ecf55 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java @@ -15,9 +15,9 @@ import org.greenrobot.eventbus.EventBus; import javax.inject.Inject; -import ml.docilealligator.infinityforreddit.ChangeNSFWBlurEvent; -import ml.docilealligator.infinityforreddit.ChangeNSFWEvent; -import ml.docilealligator.infinityforreddit.ChangeSpoilerBlurEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SharedPreferencesUtils; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPostService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPostService.java index f3e42109..ebbf2829 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPostService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubmitPostService.java @@ -30,21 +30,24 @@ import java.io.IOException; import javax.inject.Inject; import javax.inject.Named; +import ml.docilealligator.infinityforreddit.Event.SubmitImagePostEvent; +import ml.docilealligator.infinityforreddit.Event.SubmitTextOrLinkPostEvent; +import ml.docilealligator.infinityforreddit.Event.SubmitVideoPostEvent; import retrofit2.Retrofit; public class SubmitPostService extends Service { - static final String EXTRA_ACCESS_TOKEN = "EAT"; - static final String EXTRA_SUBREDDIT_NAME = "ESN"; - static final String EXTRA_TITLE = "ET"; - static final String EXTRA_CONTENT = "EC"; - static final String EXTRA_KIND = "EK"; - static final String EXTRA_FLAIR = "EF"; - static final String EXTRA_IS_SPOILER = "EIS"; - static final String EXTRA_IS_NSFW = "EIN"; - static final String EXTRA_POST_TYPE = "EPT"; - static final int EXTRA_POST_TEXT_OR_LINK = 0; - static final int EXTRA_POST_TYPE_IMAGE = 1; - static final int EXTRA_POST_TYPE_VIDEO = 2; + public static final String EXTRA_ACCESS_TOKEN = "EAT"; + public static final String EXTRA_SUBREDDIT_NAME = "ESN"; + public static final String EXTRA_TITLE = "ET"; + public static final String EXTRA_CONTENT = "EC"; + public static final String EXTRA_KIND = "EK"; + public static final String EXTRA_FLAIR = "EF"; + public static final String EXTRA_IS_SPOILER = "EIS"; + public static final String EXTRA_IS_NSFW = "EIN"; + public static final String EXTRA_POST_TYPE = "EPT"; + public static final int EXTRA_POST_TEXT_OR_LINK = 0; + public static final int EXTRA_POST_TYPE_IMAGE = 1; + public static final int EXTRA_POST_TYPE_VIDEO = 2; private String mAccessToken; private String subredditName; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingViewModel.java index 4c721763..bf68dd82 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditListingViewModel.java @@ -45,31 +45,31 @@ public class SubredditListingViewModel extends ViewModel { }); } - LiveData<PagedList<SubredditData>> getSubreddits() { + public LiveData<PagedList<SubredditData>> getSubreddits() { return subreddits; } - LiveData<NetworkState> getPaginationNetworkState() { + public LiveData<NetworkState> getPaginationNetworkState() { return paginationNetworkState; } - LiveData<NetworkState> getInitialLoadingState() { + public LiveData<NetworkState> getInitialLoadingState() { return initialLoadingState; } - LiveData<Boolean> hasSubredditLiveData() { + public LiveData<Boolean> hasSubredditLiveData() { return hasSubredditLiveData; } - void refresh() { + public void refresh() { subredditListingDataSourceFactory.getSubredditListingDataSource().invalidate(); } - void retryLoadingMore() { + public void retryLoadingMore() { subredditListingDataSourceFactory.getSubredditListingDataSource().retryLoadingMore(); } - void changeSortType(String sortType) { + public void changeSortType(String sortType) { sortTypeLiveData.postValue(sortType); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSubscription.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSubscription.java index 349c6aed..b12ca826 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSubscription.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSubscription.java @@ -13,24 +13,24 @@ import retrofit2.Call; import retrofit2.Callback; import retrofit2.Retrofit; -class SubredditSubscription { - interface SubredditSubscriptionListener { +public class SubredditSubscription { + public interface SubredditSubscriptionListener { void onSubredditSubscriptionSuccess(); void onSubredditSubscriptionFail(); } - static void subscribeToSubreddit(Retrofit oauthRetrofit, Retrofit retrofit, - String accessToken, String subredditName, String accountName, - RedditDataRoomDatabase redditDataRoomDatabase, - SubredditSubscriptionListener subredditSubscriptionListener) { + public static void subscribeToSubreddit(Retrofit oauthRetrofit, Retrofit retrofit, + String accessToken, String subredditName, String accountName, + RedditDataRoomDatabase redditDataRoomDatabase, + SubredditSubscriptionListener subredditSubscriptionListener) { subredditSubscription(oauthRetrofit, retrofit, accessToken, subredditName, accountName, "sub", redditDataRoomDatabase, subredditSubscriptionListener); } - static void unsubscribeToSubreddit(Retrofit oauthRetrofit, String accessToken, - String subredditName, String accountName, - RedditDataRoomDatabase redditDataRoomDatabase, - SubredditSubscriptionListener subredditSubscriptionListener) { + public static void unsubscribeToSubreddit(Retrofit oauthRetrofit, String accessToken, + String subredditName, String accountName, + RedditDataRoomDatabase redditDataRoomDatabase, + SubredditSubscriptionListener subredditSubscriptionListener) { subredditSubscription(oauthRetrofit, null, accessToken, subredditName, accountName, "unsub", redditDataRoomDatabase,subredditSubscriptionListener); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/UserFollowing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/UserFollowing.java index 201e2ce0..f4743db5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/UserFollowing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/UserFollowing.java @@ -14,24 +14,24 @@ import retrofit2.Call; import retrofit2.Callback; import retrofit2.Retrofit; -class UserFollowing { - interface UserFollowingListener { +public class UserFollowing { + public interface UserFollowingListener { void onUserFollowingSuccess(); void onUserFollowingFail(); } - static void followUser(Retrofit oauthRetrofit, Retrofit retrofit, - String accessToken, String username, String accountName, - SubscribedUserDao subscribedUserDao, - UserFollowingListener userFollowingListener) { + public static void followUser(Retrofit oauthRetrofit, Retrofit retrofit, + String accessToken, String username, String accountName, + SubscribedUserDao subscribedUserDao, + UserFollowingListener userFollowingListener) { userFollowing(oauthRetrofit, retrofit, accessToken, username, accountName, "sub", subscribedUserDao, userFollowingListener); } - static void unfollowUser(Retrofit oauthRetrofit, Retrofit retrofit, - String accessToken, String username, String accountName, - SubscribedUserDao subscribedUserDao, - UserFollowingListener userFollowingListener) { + public static void unfollowUser(Retrofit oauthRetrofit, Retrofit retrofit, + String accessToken, String username, String accountName, + SubscribedUserDao subscribedUserDao, + UserFollowingListener userFollowingListener) { userFollowing(oauthRetrofit, retrofit, accessToken, username, accountName, "unsub", subscribedUserDao, userFollowingListener); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/UserListingViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/UserListingViewModel.java index 03c72ec2..70f53ebc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/UserListingViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/UserListingViewModel.java @@ -45,31 +45,31 @@ public class UserListingViewModel extends ViewModel { }); } - LiveData<PagedList<UserData>> getUsers() { + public LiveData<PagedList<UserData>> getUsers() { return users; } - LiveData<NetworkState> getPaginationNetworkState() { + public LiveData<NetworkState> getPaginationNetworkState() { return paginationNetworkState; } - LiveData<NetworkState> getInitialLoadingState() { + public LiveData<NetworkState> getInitialLoadingState() { return initialLoadingState; } - LiveData<Boolean> hasUser() { + public LiveData<Boolean> hasUser() { return hasUserLiveData; } - void refresh() { + public void refresh() { userListingDataSourceFactory.getUserListingDataSource().invalidate(); } - void retryLoadingMore() { + public void retryLoadingMore() { userListingDataSourceFactory.getUserListingDataSource().retryLoadingMore(); } - void changeSortType(String sortType) { + public void changeSortType(String sortType) { sortTypeLiveData.postValue(sortType); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java index bdd32364..5d30578e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java @@ -1,7 +1,7 @@ package ml.docilealligator.infinityforreddit; -class Utils { - static String addSubredditAndUserLink(String markdown) { +public class Utils { + public static String addSubredditAndUserLink(String markdown) { return markdown.replaceAll("(?<!\\s)/{0,1}u/\\w+/{0,1}(?<!\\s)$", "[$0]($0)") .replaceAll("(?<!\\s)/{0,1}r/\\w+/{0,1}(?<!\\s)$", "[$0]($0)"); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/VoteThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/VoteThing.java index 8c2d2f01..af71794a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/VoteThing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/VoteThing.java @@ -1,7 +1,5 @@ package ml.docilealligator.infinityforreddit; -import android.util.Log; - import androidx.annotation.NonNull; import java.util.HashMap; @@ -15,21 +13,21 @@ import retrofit2.Retrofit; * Created by alex on 3/14/18. */ -class VoteThing { +public class VoteThing { - interface VoteThingListener { + public interface VoteThingListener { void onVoteThingSuccess(int position); void onVoteThingFail(int position); } - interface VoteThingWithoutPositionListener { + public interface VoteThingWithoutPositionListener { void onVoteThingSuccess(); void onVoteThingFail(); } - static void voteThing(final Retrofit retrofit, String accessToken, - final VoteThingListener voteThingListener, final String fullName, - final String point, final int position) { + public static void voteThing(final Retrofit retrofit, String accessToken, + final VoteThingListener voteThingListener, final String fullName, + final String point, final int position) { RedditAPI api = retrofit.create(RedditAPI.class); Map<String, String> params = new HashMap<>(); @@ -55,7 +53,7 @@ class VoteThing { }); } - static void voteThing(final Retrofit retrofit, String accessToken, + public static void voteThing(final Retrofit retrofit, String accessToken, final VoteThingWithoutPositionListener voteThingWithoutPositionListener, final String fullName, final String point) { RedditAPI api = retrofit.create(RedditAPI.class); |