Clean up code.

This commit is contained in:
Alex Ning 2019-09-29 22:11:34 +08:00
parent 456429725b
commit 76204ac044
127 changed files with 3781 additions and 3564 deletions

View File

@ -29,20 +29,20 @@ 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.ContentFontStyle;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FontStyle;
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
import ml.docilealligator.infinityforreddit.Fragment.UserThingSortTypeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
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;
@ -59,26 +59,25 @@ public class AccountPostsActivity extends AppCompatActivity implements UserThing
private static final String ACCOUNT_NAME_STATE = "ANS";
private static final String FRAGMENT_OUT_STATE = "FOS";
@BindView(R.id.collapsing_toolbar_layout_account_posts_activity) CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.appbar_layout_account_posts_activity) AppBarLayout appBarLayout;
@BindView(R.id.toolbar_account_posts_activity) Toolbar toolbar;
@BindView(R.id.collapsing_toolbar_layout_account_posts_activity)
CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.appbar_layout_account_posts_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_account_posts_activity)
Toolbar toolbar;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean isInLazyMode = false;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
private String mUserWhere;
private Fragment mFragment;
private Menu mMenu;
private AppBarLayout.LayoutParams params;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -34,19 +34,19 @@ 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.ContentFontStyle;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FontStyle;
import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment;
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
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;
@ -62,31 +62,31 @@ public class AccountSavedThingActivity extends AppCompatActivity {
private static final String ACCOUNT_NAME_STATE = "ANS";
private static final String IS_IN_LAZY_MODE_STATE = "IILMS";
@BindView(R.id.collapsing_toolbar_layout_account_saved_thing_activity) CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.appbar_layout_account_saved_thing_activity) AppBarLayout appBarLayout;
@BindView(R.id.toolbar_account_saved_thing_activity) Toolbar toolbar;
@BindView(R.id.tab_layout_tab_layout_account_saved_thing_activity_activity) TabLayout tabLayout;
@BindView(R.id.view_pager_account_saved_thing_activity) ViewPager viewPager;
@BindView(R.id.collapsing_toolbar_layout_account_saved_thing_activity)
CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.appbar_layout_account_saved_thing_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_account_saved_thing_activity)
Toolbar toolbar;
@BindView(R.id.tab_layout_tab_layout_account_saved_thing_activity_activity)
TabLayout tabLayout;
@BindView(R.id.view_pager_account_saved_thing_activity)
ViewPager viewPager;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private SectionsPagerAdapter sectionsPagerAdapter;
private Menu mMenu;
private AppBarLayout.LayoutParams params;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
private boolean isInLazyMode = false;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -39,16 +39,16 @@ 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.AsyncTask.GetCurrentAccountAsyncTask;
import ml.docilealligator.infinityforreddit.CommentData;
import ml.docilealligator.infinityforreddit.ContentFontStyle;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
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;
@ -70,11 +70,21 @@ public class CommentActivity extends AppCompatActivity {
private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
private static final String ACCESS_TOKEN_STATE = "ATS";
@BindView(R.id.coordinator_layout_comment_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_comment_activity) Toolbar toolbar;
@BindView(R.id.comment_parent_markwon_view_comment_activity) TextView commentParentMarkwonView;
@BindView(R.id.comment_edit_text_comment_activity) EditText commentEditText;
@BindView(R.id.coordinator_layout_comment_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_comment_activity)
Toolbar toolbar;
@BindView(R.id.comment_parent_markwon_view_comment_activity)
TextView commentParentMarkwonView;
@BindView(R.id.comment_edit_text_comment_activity)
EditText commentEditText;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String parentFullname;
@ -82,16 +92,6 @@ public class CommentActivity extends AppCompatActivity {
private int parentPosition;
private boolean isReplying;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -35,13 +35,13 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
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.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;
@ -63,20 +63,20 @@ public class EditCommentActivity extends AppCompatActivity {
static final String EXTRA_EDITED_COMMENT_CONTENT = "EECC";
static final String EXTRA_EDITED_COMMENT_POSITION = "EECP";
@BindView(R.id.coordinator_layout_edit_comment_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_edit_comment_activity) Toolbar toolbar;
@BindView(R.id.post_text_content_edit_text_edit_comment_activity) EditText contentEditText;
private String mFullName;
private String mAccessToken;
private boolean isSubmitting = false;
@BindView(R.id.coordinator_layout_edit_comment_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_edit_comment_activity)
Toolbar toolbar;
@BindView(R.id.post_text_content_edit_text_edit_comment_activity)
EditText contentEditText;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
SharedPreferences mSharedPreferences;
private String mFullName;
private String mAccessToken;
private boolean isSubmitting = false;
@Override
protected void onCreate(Bundle savedInstanceState) {

View File

@ -36,13 +36,13 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
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.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;
@ -61,21 +61,22 @@ public class EditPostActivity extends AppCompatActivity {
static final String EXTRA_FULLNAME = "EF";
static final String EXTRA_ACCESS_TOKEN = "EAT";
@BindView(R.id.coordinator_layout_edit_post_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_edit_post_activity) Toolbar toolbar;
@BindView(R.id.post_title_text_view_edit_post_activity) TextView titleTextView;
@BindView(R.id.post_text_content_edit_text_edit_post_activity) EditText contentEditText;
private String mFullName;
private String mAccessToken;
private boolean isSubmitting = false;
@BindView(R.id.coordinator_layout_edit_post_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_edit_post_activity)
Toolbar toolbar;
@BindView(R.id.post_title_text_view_edit_post_activity)
TextView titleTextView;
@BindView(R.id.post_text_content_edit_text_edit_post_activity)
EditText contentEditText;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
SharedPreferences mSharedPreferences;
private String mFullName;
private String mAccessToken;
private boolean isSubmitting = false;
@Override
protected void onCreate(Bundle savedInstanceState) {

View File

@ -29,22 +29,22 @@ 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.ContentFontStyle;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FontStyle;
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
import ml.docilealligator.infinityforreddit.Fragment.SearchPostSortTypeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.SortTypeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.UserThingSortTypeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
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;
@ -66,32 +66,30 @@ public class FilteredThingActivity extends AppCompatActivity implements SortType
private static final String ACCESS_TOKEN_STATE = "ATS";
private static final String FRAGMENT_OUT_STATE = "FOS";
@BindView(R.id.appbar_layout_filtered_posts_activity) AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar_layout_filtered_posts_activity) CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.toolbar_filtered_posts_activity) Toolbar toolbar;
@BindView(R.id.appbar_layout_filtered_posts_activity)
AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar_layout_filtered_posts_activity)
CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.toolbar_filtered_posts_activity)
Toolbar toolbar;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean isInLazyMode = false;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String name;
private int postType;
private Fragment mFragment;
private Menu mMenu;
private AppBarLayout.LayoutParams params;
private SortTypeBottomSheetFragment bestSortTypeBottomSheetFragment;
private SortTypeBottomSheetFragment popularAndAllSortTypeBottomSheetFragment;
private SortTypeBottomSheetFragment subredditSortTypeBottomSheetFragment;
private UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment;
private SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -43,6 +43,10 @@ public class LinkResolverActivity extends AppCompatActivity {
@Inject
SharedPreferences mSharedPreferences;
public static Uri getRedditUriByPath(String path) {
return Uri.parse("https://www.reddit.com" + path);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -208,8 +212,4 @@ public class LinkResolverActivity extends AppCompatActivity {
Toast.makeText(this, R.string.no_browser_found, Toast.LENGTH_SHORT).show();
}
}
public static Uri getRedditUriByPath(String path) {
return Uri.parse("https://www.reddit.com" + path);
}
}

View File

@ -29,9 +29,9 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.AsyncTask.ParseAndInsertNewAccountAsyncTask;
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;
@ -50,23 +50,19 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
public class LoginActivity extends AppCompatActivity {
@BindView(R.id.toolbar_login_activity) Toolbar toolbar;
private String authCode;
@BindView(R.id.toolbar_login_activity)
Toolbar toolbar;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private String authCode;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -114,7 +110,8 @@ public class LoginActivity extends AppCompatActivity {
String url = uriBuilder.toString();
CookieManager.getInstance().removeAllCookies(aBoolean -> {});
CookieManager.getInstance().removeAllCookies(aBoolean -> {
});
webView.loadUrl(url);
webView.setWebViewClient(new WebViewClient() {

View File

@ -57,39 +57,39 @@ import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
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.AsyncTask.GetCurrentAccountAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchToAnonymousAccountAsyncTask;
import ml.docilealligator.infinityforreddit.ContentFontStyle;
import ml.docilealligator.infinityforreddit.Event.ChangeFontSizeEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
import ml.docilealligator.infinityforreddit.ContentFontStyle;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
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.Fragment.SortTypeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.ParseAndSaveAccountInfo;
import ml.docilealligator.infinityforreddit.PostDataSource;
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;
@ -121,44 +121,71 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
private static final int LOGIN_ACTIVITY_REQUEST_CODE = 0;
@BindView(R.id.drawer_layout) DrawerLayout drawer;
@BindView(R.id.coordinator_layout_main_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.appbar_layout_main_activity) AppBarLayout appBarLayout;
@BindView(R.id.view_pager_main_activity) ViewPager viewPager;
@BindView(R.id.collapsing_toolbar_layout_main_activity) CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.nested_scroll_view_main_activity) NestedScrollView nestedScrollView;
@BindView(R.id.all_drawer_items_linear_layout_main_activity) LinearLayout allDrawerItemsLinearLayout;
@BindView(R.id.account_label_main_activity) TextView accountLabelTextView;
@BindView(R.id.profile_linear_layout_main_activity) LinearLayout profileLinearLayout;
@BindView(R.id.subscriptions_linear_layout_main_activity) LinearLayout subscriptionLinearLayout;
@BindView(R.id.inbox_linear_layout_main_activity) LinearLayout inboxLinearLayout;
@BindView(R.id.post_label_main_activity) TextView postLabelTextView;
@BindView(R.id.upvoted_linear_layout_main_activity) LinearLayout upvotedLinearLayout;
@BindView(R.id.downvoted_linear_layout_main_activity) LinearLayout downvotedLinearLayout;
@BindView(R.id.hidden_linear_layout_main_activity) LinearLayout hiddenLinearLayout;
@BindView(R.id.saved_linear_layout_main_activity) LinearLayout savedLinearLayout;
@BindView(R.id.gilded_linear_layout_main_activity) LinearLayout gildedLinearLayout;
@BindView(R.id.divider_main_activity) View divider;
@BindView(R.id.settings_linear_layout_main_activity) LinearLayout settingsLinearLayout;
@BindView(R.id.account_recycler_view_main_activity) RecyclerView accountRecyclerView;
@BindView(R.id.tab_layout_main_activity) TabLayout tabLayout;
@BindView(R.id.fab_main_activity) FloatingActionButton fab;
@BindView(R.id.drawer_layout)
DrawerLayout drawer;
@BindView(R.id.coordinator_layout_main_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.appbar_layout_main_activity)
AppBarLayout appBarLayout;
@BindView(R.id.view_pager_main_activity)
ViewPager viewPager;
@BindView(R.id.collapsing_toolbar_layout_main_activity)
CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.nested_scroll_view_main_activity)
NestedScrollView nestedScrollView;
@BindView(R.id.all_drawer_items_linear_layout_main_activity)
LinearLayout allDrawerItemsLinearLayout;
@BindView(R.id.account_label_main_activity)
TextView accountLabelTextView;
@BindView(R.id.profile_linear_layout_main_activity)
LinearLayout profileLinearLayout;
@BindView(R.id.subscriptions_linear_layout_main_activity)
LinearLayout subscriptionLinearLayout;
@BindView(R.id.inbox_linear_layout_main_activity)
LinearLayout inboxLinearLayout;
@BindView(R.id.post_label_main_activity)
TextView postLabelTextView;
@BindView(R.id.upvoted_linear_layout_main_activity)
LinearLayout upvotedLinearLayout;
@BindView(R.id.downvoted_linear_layout_main_activity)
LinearLayout downvotedLinearLayout;
@BindView(R.id.hidden_linear_layout_main_activity)
LinearLayout hiddenLinearLayout;
@BindView(R.id.saved_linear_layout_main_activity)
LinearLayout savedLinearLayout;
@BindView(R.id.gilded_linear_layout_main_activity)
LinearLayout gildedLinearLayout;
@BindView(R.id.divider_main_activity)
View divider;
@BindView(R.id.settings_linear_layout_main_activity)
LinearLayout settingsLinearLayout;
@BindView(R.id.account_recycler_view_main_activity)
RecyclerView accountRecyclerView;
@BindView(R.id.tab_layout_main_activity)
TabLayout tabLayout;
@BindView(R.id.fab_main_activity)
FloatingActionButton fab;
AccountViewModel accountViewModel;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private SectionsPagerAdapter sectionsPagerAdapter;
private TextView mAccountNameTextView;
private TextView mKarmaTextView;
private GifImageView mProfileImageView;
private ImageView mBannerImageView;
private ImageView mDropIconImageView;
private RequestManager glide;
private AppBarLayout.LayoutParams params;
private PostTypeBottomSheetFragment postTypeBottomSheetFragment;
private SortTypeBottomSheetFragment bestSortTypeBottomSheetFragment;
private SortTypeBottomSheetFragment popularAndAllSortTypeBottomSheetFragment;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
@ -170,23 +197,9 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
private boolean mDrawerOnAccountSwitch = false;
private String mMessageFullname;
private String mNewAccountName;
private Menu mMenu;
private boolean isInLazyMode = false;
AccountViewModel accountViewModel;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.AppTheme_NoActionBarWithTransparentStatusBar);
@ -469,7 +482,8 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {}
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
@ -484,7 +498,8 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
}
@Override
public void onPageScrollStateChanged(int state) {}
public void onPageScrollStateChanged(int state) {
}
});
loadSubscriptions();
@ -1002,8 +1017,7 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
}
@Override
public int getCount()
{
public int getCount() {
if (mAccessToken == null) {
return 2;
}

View File

@ -91,21 +91,47 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
private static final int PICK_IMAGE_REQUEST_CODE = 1;
private static final int CAPTURE_IMAGE_REQUEST_CODE = 2;
@BindView(R.id.coordinator_layout_post_image_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_image_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_image_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_image_activity) TextView subredditNameTextView;
@BindView(R.id.rules_button_post_image_activity) Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_image_activity) CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_image_activity) CustomTextView spoilerTextView;
@BindView(R.id.nsfw_custom_text_view_post_image_activity) CustomTextView nsfwTextView;
@BindView(R.id.post_title_edit_text_post_image_activity) EditText titleEditText;
@BindView(R.id.select_image_constraint_layout_post_image_activity) ConstraintLayout constraintLayout;
@BindView(R.id.capture_fab_post_image_activity) FloatingActionButton captureFab;
@BindView(R.id.select_from_library_fab_post_image_activity) FloatingActionButton selectFromLibraryFab;
@BindView(R.id.select_again_text_view_post_image_activity) TextView selectAgainTextView;
@BindView(R.id.image_view_post_image_activity) ImageView imageView;
@BindView(R.id.coordinator_layout_post_image_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_image_activity)
Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_image_activity)
GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_image_activity)
TextView subredditNameTextView;
@BindView(R.id.rules_button_post_image_activity)
Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_image_activity)
CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_image_activity)
CustomTextView spoilerTextView;
@BindView(R.id.nsfw_custom_text_view_post_image_activity)
CustomTextView nsfwTextView;
@BindView(R.id.post_title_edit_text_post_image_activity)
EditText titleEditText;
@BindView(R.id.select_image_constraint_layout_post_image_activity)
ConstraintLayout constraintLayout;
@BindView(R.id.capture_fab_post_image_activity)
FloatingActionButton captureFab;
@BindView(R.id.select_from_library_fab_post_image_activity)
FloatingActionButton selectFromLibraryFab;
@BindView(R.id.select_again_text_view_post_image_activity)
TextView selectAgainTextView;
@BindView(R.id.image_view_post_image_activity)
ImageView imageView;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
@Named("upload_media")
Retrofit mUploadMediaRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
@ -116,34 +142,14 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
private boolean loadSubredditIconSuccessful = true;
private boolean isPosting;
private Uri imageUri;
private Flair flair;
private boolean isSpoiler = false;
private boolean isNSFW = false;
private Menu mMemu;
private RequestManager mGlide;
private FlairBottomSheetFragment flairSelectionBottomSheetFragment;
private Snackbar mPostingSnackbar;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
@Named("upload_media")
Retrofit mUploadMediaRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -79,17 +79,36 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
@BindView(R.id.coordinator_layout_post_link_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_link_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_link_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_link_activity) TextView subredditNameTextView;
@BindView(R.id.rules_button_post_link_activity) Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_link_activity) CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_link_activity) CustomTextView spoilerTextView;
@BindView(R.id.nsfw_custom_text_view_post_link_activity) CustomTextView nsfwTextView;
@BindView(R.id.post_title_edit_text_post_link_activity) EditText titleEditText;
@BindView(R.id.post_link_edit_text_post_link_activity) EditText contentEditText;
@BindView(R.id.coordinator_layout_post_link_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_link_activity)
Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_link_activity)
GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_link_activity)
TextView subredditNameTextView;
@BindView(R.id.rules_button_post_link_activity)
Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_link_activity)
CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_link_activity)
CustomTextView spoilerTextView;
@BindView(R.id.nsfw_custom_text_view_post_link_activity)
CustomTextView nsfwTextView;
@BindView(R.id.post_title_edit_text_post_link_activity)
EditText titleEditText;
@BindView(R.id.post_link_edit_text_post_link_activity)
EditText contentEditText;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String iconUrl;
@ -98,30 +117,14 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
private boolean subredditIsUser;
private boolean loadSubredditIconSuccessful = true;
private boolean isPosting;
private Flair flair;
private boolean isSpoiler = false;
private boolean isNSFW = false;
private Menu mMemu;
private RequestManager mGlide;
private FlairBottomSheetFragment flairSelectionBottomSheetFragment;
private Snackbar mPostingSnackbar;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -79,17 +79,36 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
@BindView(R.id.coordinator_layout_post_text_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_text_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_search_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_search_activity) TextView subredditNameTextView;
@BindView(R.id.rules_button_post_text_activity) Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_text_activity) CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_text_activity) CustomTextView spoilerTextView;
@BindView(R.id.nsfw_custom_text_view_post_text_activity) CustomTextView nsfwTextView;
@BindView(R.id.post_title_edit_text_post_text_activity) EditText titleEditText;
@BindView(R.id.post_text_content_edit_text_post_text_activity) EditText contentEditText;
@BindView(R.id.coordinator_layout_post_text_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_text_activity)
Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_search_activity)
GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_search_activity)
TextView subredditNameTextView;
@BindView(R.id.rules_button_post_text_activity)
Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_text_activity)
CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_text_activity)
CustomTextView spoilerTextView;
@BindView(R.id.nsfw_custom_text_view_post_text_activity)
CustomTextView nsfwTextView;
@BindView(R.id.post_title_edit_text_post_text_activity)
EditText titleEditText;
@BindView(R.id.post_text_content_edit_text_post_text_activity)
EditText contentEditText;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String iconUrl;
@ -98,30 +117,14 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
private boolean subredditIsUser;
private boolean loadSubredditIconSuccessful = true;
private boolean isPosting;
private Flair flair;
private boolean isSpoiler = false;
private boolean isNSFW = false;
private Menu mMemu;
private RequestManager mGlide;
private FlairBottomSheetFragment flairSelectionBottomSheetFragment;
private Snackbar mPostingSnackbar;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -49,19 +49,19 @@ 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.ContentFontStyle;
import ml.docilealligator.infinityforreddit.Event.SubmitVideoPostEvent;
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.Event.SubmitVideoPostEvent;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.TitleFontStyle;
import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit;
@ -93,21 +93,50 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
private static final int PICK_VIDEO_REQUEST_CODE = 1;
private static final int CAPTURE_VIDEO_REQUEST_CODE = 2;
@BindView(R.id.coordinator_layout_post_video_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_video_activity) Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_video_activity) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_video_activity) TextView subredditNameTextView;
@BindView(R.id.rules_button_post_video_activity) Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_video_activity) CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_video_activity) CustomTextView spoilerTextView;
@BindView(R.id.nsfw_custom_text_view_post_video_activity) CustomTextView nsfwTextView;
@BindView(R.id.post_title_edit_text_post_video_activity) EditText titleEditText;
@BindView(R.id.select_video_constraint_layout_post_video_activity) ConstraintLayout constraintLayout;
@BindView(R.id.capture_fab_post_video_activity) FloatingActionButton captureFab;
@BindView(R.id.select_from_library_fab_post_video_activity) FloatingActionButton selectFromLibraryFab;
@BindView(R.id.select_again_text_view_post_video_activity) TextView selectAgainTextView;
@BindView(R.id.player_view_post_video_activity) PlayerView videoPlayerView;
@BindView(R.id.coordinator_layout_post_video_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.toolbar_post_video_activity)
Toolbar toolbar;
@BindView(R.id.subreddit_icon_gif_image_view_post_video_activity)
GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_post_video_activity)
TextView subredditNameTextView;
@BindView(R.id.rules_button_post_video_activity)
Button rulesButton;
@BindView(R.id.flair_custom_text_view_post_video_activity)
CustomTextView flairTextView;
@BindView(R.id.spoiler_custom_text_view_post_video_activity)
CustomTextView spoilerTextView;
@BindView(R.id.nsfw_custom_text_view_post_video_activity)
CustomTextView nsfwTextView;
@BindView(R.id.post_title_edit_text_post_video_activity)
EditText titleEditText;
@BindView(R.id.select_video_constraint_layout_post_video_activity)
ConstraintLayout constraintLayout;
@BindView(R.id.capture_fab_post_video_activity)
FloatingActionButton captureFab;
@BindView(R.id.select_from_library_fab_post_video_activity)
FloatingActionButton selectFromLibraryFab;
@BindView(R.id.select_again_text_view_post_video_activity)
TextView selectAgainTextView;
@BindView(R.id.player_view_post_video_activity)
PlayerView videoPlayerView;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
@Named("upload_media")
Retrofit mUploadMediaRetrofit;
@Inject
@Named("upload_video")
Retrofit mUploadVideoRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
@ -119,41 +148,16 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
private boolean loadSubredditIconSuccessful = true;
private boolean isPosting;
private boolean wasPlaying;
private Flair flair;
private boolean isSpoiler = false;
private boolean isNSFW = false;
private Menu mMemu;
private RequestManager mGlide;
private FlairBottomSheetFragment mFlairSelectionBottomSheetFragment;
private Snackbar mPostingSnackbar;
private DataSource.Factory dataSourceFactory;
private SimpleExoPlayer player;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
@Named("upload_media")
Retrofit mUploadMediaRetrofit;
@Inject
@Named("upload_video")
Retrofit mUploadVideoRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -63,22 +63,23 @@ public class RulesActivity extends AppCompatActivity {
static final String EXTRA_SUBREDDIT_NAME = "ESN";
@BindView(R.id.appbar_layout_rules_activity) AppBarLayout appBarLayout;
@BindView(R.id.toolbar_rules_activity) Toolbar toolbar;
@BindView(R.id.progress_bar_rules_activity) ProgressBar progressBar;
@BindView(R.id.recycler_view_rules_activity) RecyclerView recyclerView;
@BindView(R.id.error_text_view_rules_activity) TextView errorTextView;
private String mSubredditName;
private RulesRecyclerViewAdapter mAdapter;
@BindView(R.id.appbar_layout_rules_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_rules_activity)
Toolbar toolbar;
@BindView(R.id.progress_bar_rules_activity)
ProgressBar progressBar;
@BindView(R.id.recycler_view_rules_activity)
RecyclerView recyclerView;
@BindView(R.id.error_text_view_rules_activity)
TextView errorTextView;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
SharedPreferences mSharedPreferences;
private String mSubredditName;
private RulesRecyclerViewAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -196,7 +197,8 @@ public class RulesActivity extends AppCompatActivity {
if (rules == null || rules.size() == 0) {
errorTextView.setVisibility(View.VISIBLE);
errorTextView.setText(R.string.no_rule);
errorTextView.setOnClickListener(view -> {});
errorTextView.setOnClickListener(view -> {
});
}
mAdapter.changeDataset(rules);
}
@ -250,11 +252,6 @@ public class RulesActivity extends AppCompatActivity {
private String response;
private ParseRulesAsyncTaskListener parseRulesAsyncTaskListener;
interface ParseRulesAsyncTaskListener {
void parseSuccessful(ArrayList<Rule> rules);
void parseFailed();
}
ParseRulesAsyncTask(String response, ParseRulesAsyncTaskListener parseRulesAsyncTaskListener) {
this.response = response;
this.parseRulesAsyncTaskListener = parseRulesAsyncTaskListener;
@ -288,5 +285,11 @@ public class RulesActivity extends AppCompatActivity {
parseRulesAsyncTaskListener.parseFailed();
}
}
interface ParseRulesAsyncTaskListener {
void parseSuccessful(ArrayList<Rule> rules);
void parseFailed();
}
}
}

View File

@ -32,11 +32,11 @@ import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
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.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;
@ -59,18 +59,20 @@ public class SearchActivity extends AppCompatActivity {
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
private static final int SUBREDDIT_SEARCH_REQUEST_CODE = 1;
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.search_view_search_activity) SimpleSearchView simpleSearchView;
@BindView(R.id.subreddit_name_relative_layout_search_activity) RelativeLayout subredditNameRelativeLayout;
@BindView(R.id.subreddit_name_text_view_search_activity) TextView subredditNameTextView;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.search_view_search_activity)
SimpleSearchView simpleSearchView;
@BindView(R.id.subreddit_name_relative_layout_search_activity)
RelativeLayout subredditNameRelativeLayout;
@BindView(R.id.subreddit_name_text_view_search_activity)
TextView subredditNameTextView;
@Inject
SharedPreferences mSharedPreferences;
private String query;
private String subredditName;
private boolean subredditIsUser;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -33,23 +33,23 @@ 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.ContentFontStyle;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FontStyle;
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 ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.PostDataSource;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
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;
@ -64,29 +64,27 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
private static final String ACCESS_TOKEN_STATE = "ATS";
private static final String ACCOUNT_NAME_STATE = "ANS";
@BindView(R.id.appbar_layout_search_result_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_search_result_activity)
Toolbar toolbar;
@BindView(R.id.tab_layout_search_result_activity)
TabLayout tabLayout;
@BindView(R.id.view_pager_search_result_activity)
ViewPager viewPager;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
private String mQuery;
private String mSubredditName;
@BindView(R.id.appbar_layout_search_result_activity) AppBarLayout appBarLayout;
@BindView(R.id.toolbar_search_result_activity) Toolbar toolbar;
@BindView(R.id.tab_layout_search_result_activity) TabLayout tabLayout;
@BindView(R.id.view_pager_search_result_activity) ViewPager viewPager;
private SectionsPagerAdapter sectionsPagerAdapter;
private SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment;
private SearchUserAndSubredditSortTypeBottomSheetFragment searchUserAndSubredditSortTypeBottomSheetFragment;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -29,15 +29,15 @@ 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.ContentFontStyle;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FontStyle;
import ml.docilealligator.infinityforreddit.Fragment.SubredditListingFragment;
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;
@ -56,21 +56,19 @@ public class SearchSubredditsResultActivity extends AppCompatActivity {
private static final String ACCOUNT_NAME_STATE = "ANS";
private static final String FRAGMENT_OUT_STATE = "FOS";
@BindView(R.id.appbar_layout_search_subreddits_result_activity) AppBarLayout appBarLayout;
@BindView(R.id.toolbar_search_subreddits_result_activity) Toolbar toolbar;
@BindView(R.id.appbar_layout_search_subreddits_result_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_search_subreddits_result_activity)
Toolbar toolbar;
Fragment mFragment;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
Fragment mFragment;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -19,14 +19,14 @@ import androidx.preference.PreferenceFragmentCompat;
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.Settings.AboutPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.TitleFontStyle;
@ -40,7 +40,8 @@ public class SettingsActivity extends AppCompatActivity implements
private static final String TITLE_STATE = "TS";
@BindView(R.id.toolbar_settings_activity) Toolbar toolbar;
@BindView(R.id.toolbar_settings_activity)
Toolbar toolbar;
@Inject
SharedPreferences mSharedPreferences;

View File

@ -8,10 +8,6 @@ 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 {

View File

@ -71,27 +71,24 @@ public class SubredditSelectionActivity extends AppCompatActivity {
private static final String ACCOUNT_PROFILE_IMAGE_URL = "APIU";
private static final String FRAGMENT_OUT_STATE = "FOS";
@BindView(R.id.appbar_layout_subreddit_selection_activity) AppBarLayout appBarLayout;
@BindView(R.id.toolbar_subreddit_selection_activity) Toolbar toolbar;
@BindView(R.id.appbar_layout_subreddit_selection_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_subreddit_selection_activity)
Toolbar toolbar;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
private String mAccountProfileImageUrl;
private boolean mInsertSuccess = false;
private Fragment mFragment;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -64,28 +64,27 @@ public class SubscribedThingListingActivity extends AppCompatActivity {
private static final String ACCESS_TOKEN_STATE = "ATS";
private static final String ACCOUNT_NAME_STATE = "ANS";
@BindView(R.id.appbar_layout_subscribed_thing_listing_activity) AppBarLayout appBarLayout;
@BindView(R.id.toolbar_subscribed_thing_listing_activity) Toolbar toolbar;
@BindView(R.id.tab_layout_subscribed_thing_listing_activity) TabLayout tabLayout;
@BindView(R.id.view_pager_subscribed_thing_listing_activity) ViewPager viewPager;
@BindView(R.id.appbar_layout_subscribed_thing_listing_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_subscribed_thing_listing_activity)
Toolbar toolbar;
@BindView(R.id.tab_layout_subscribed_thing_listing_activity)
TabLayout tabLayout;
@BindView(R.id.view_pager_subscribed_thing_listing_activity)
ViewPager viewPager;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
private boolean mInsertSuccess = false;
private SectionsPagerAdapter sectionsPagerAdapter;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -280,8 +279,7 @@ public class SubscribedThingListingActivity extends AppCompatActivity {
fragment.setArguments(bundle);
return fragment;
}
default:
{
default: {
FollowedUsersListingFragment fragment = new FollowedUsersListingFragment();
Bundle bundle = new Bundle();
bundle.putString(FollowedUsersListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);

View File

@ -59,35 +59,31 @@ import ml.docilealligator.infinityforreddit.TitleFontStyle;
public class ViewImageActivity extends AppCompatActivity {
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
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;
@BindView(R.id.image_view_view_image_activity) GestureImageView mImageView;
@BindView(R.id.load_image_error_linear_layout_view_image_activity) LinearLayout mLoadErrorLinearLayout;
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
@BindView(R.id.parent_relative_layout_view_image_activity)
RelativeLayout mRelativeLayout;
@BindView(R.id.progress_bar_view_image_activity)
ProgressBar mProgressBar;
@BindView(R.id.image_view_view_image_activity)
GestureImageView mImageView;
@BindView(R.id.load_image_error_linear_layout_view_image_activity)
LinearLayout mLoadErrorLinearLayout;
@Inject
SharedPreferences mSharedPreferences;
private boolean isActionBarHidden = false;
private boolean isDownloading = false;
private Menu mMenu;
private Swipe swipe;
private String mImageUrl;
private String mImageFileName;
private float totalLengthY = 0.0f;
private float touchY = -1.0f;
private float zoom = 1.0f;
private boolean isSwiping = false;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

View File

@ -39,20 +39,20 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Adapter.MessageRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
import ml.docilealligator.infinityforreddit.ContentFontStyle;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
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;
@ -69,34 +69,35 @@ public class ViewMessageActivity extends AppCompatActivity {
private static final String ACCESS_TOKEN_STATE = "ATS";
private static final String NEW_ACCOUNT_NAME_STATE = "NANS";
@BindView(R.id.collapsing_toolbar_layout_view_message_activity) CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.appbar_layout_view_message_activity) AppBarLayout appBarLayout;
@BindView(R.id.toolbar_view_message_activity) Toolbar toolbar;
@BindView(R.id.progress_bar_view_message_activity) CircleProgressBar mProgressBar;
@BindView(R.id.recycler_view_view_message_activity) RecyclerView recyclerView;
@BindView(R.id.fetch_messages_info_linear_layout_view_message_activity) LinearLayout mFetchMessageInfoLinearLayout;
@BindView(R.id.fetch_messages_info_image_view_view_message_activity) ImageView mFetchMessageInfoImageView;
@BindView(R.id.fetch_messages_info_text_view_view_message_activity) TextView mFetchMessageInfoTextView;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mNewAccountName;
private MessageRecyclerViewAdapter mAdapter;
private RequestManager mGlide;
@BindView(R.id.collapsing_toolbar_layout_view_message_activity)
CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.appbar_layout_view_message_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_view_message_activity)
Toolbar toolbar;
@BindView(R.id.progress_bar_view_message_activity)
CircleProgressBar mProgressBar;
@BindView(R.id.recycler_view_view_message_activity)
RecyclerView recyclerView;
@BindView(R.id.fetch_messages_info_linear_layout_view_message_activity)
LinearLayout mFetchMessageInfoLinearLayout;
@BindView(R.id.fetch_messages_info_image_view_view_message_activity)
ImageView mFetchMessageInfoImageView;
@BindView(R.id.fetch_messages_info_text_view_view_message_activity)
TextView mFetchMessageInfoTextView;
MessageViewModel mMessageViewModel;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mNewAccountName;
private MessageRecyclerViewAdapter mAdapter;
private RequestManager mGlide;
@Override
protected void onCreate(Bundle savedInstanceState) {

View File

@ -48,26 +48,28 @@ 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.AppBarStateChangeListener;
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
import ml.docilealligator.infinityforreddit.CommentData;
import ml.docilealligator.infinityforreddit.ContentFontStyle;
import ml.docilealligator.infinityforreddit.DeleteThing;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent;
import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToDetailActivity;
import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
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.Fragment.FlairBottomSheetFragment;
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;
@ -75,8 +77,6 @@ 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;
@ -98,20 +98,8 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
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;
public static final int EDIT_COMMENT_REQUEST_CODE = 3;
private RequestManager mGlide;
private Locale mLocale;
private Menu mMenu;
private int orientation;
private int postListPosition = -1;
private String mSingleCommentId;
private boolean mNeedBlurNsfw;
private boolean mNeedBlurSpoiler;
private static final int EDIT_POST_REQUEST_CODE = 2;
@State
boolean mNullAccessToken = false;
@State
@ -140,32 +128,43 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
String mMessageFullname;
@State
String mNewAccountName;
private boolean showToast = false;
private LinearLayoutManager mLinearLayoutManager;
private CommentAndPostRecyclerViewAdapter mAdapter;
@BindView(R.id.coordinator_layout_view_post_detail) CoordinatorLayout mCoordinatorLayout;
@BindView(R.id.appbar_layout_view_post_detail_activity) AppBarLayout appBarLayout;
@BindView(R.id.toolbar_view_post_detail_activity) Toolbar toolbar;
@BindView(R.id.progress_bar_view_post_detail_activity) ProgressBar mProgressBar;
@BindView(R.id.recycler_view_view_post_detail) RecyclerView mRecyclerView;
@BindView(R.id.fetch_post_info_linear_layout_view_post_detail_activity) LinearLayout mFetchPostInfoLinearLayout;
@BindView(R.id.fetch_post_info_image_view_view_post_detail_activity) ImageView mFetchPostInfoImageView;
@BindView(R.id.fetch_post_info_text_view_view_post_detail_activity) TextView mFetchPostInfoTextView;
@Inject @Named("no_oauth")
@BindView(R.id.coordinator_layout_view_post_detail)
CoordinatorLayout mCoordinatorLayout;
@BindView(R.id.appbar_layout_view_post_detail_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_view_post_detail_activity)
Toolbar toolbar;
@BindView(R.id.progress_bar_view_post_detail_activity)
ProgressBar mProgressBar;
@BindView(R.id.recycler_view_view_post_detail)
RecyclerView mRecyclerView;
@BindView(R.id.fetch_post_info_linear_layout_view_post_detail_activity)
LinearLayout mFetchPostInfoLinearLayout;
@BindView(R.id.fetch_post_info_image_view_view_post_detail_activity)
ImageView mFetchPostInfoImageView;
@BindView(R.id.fetch_post_info_text_view_view_post_detail_activity)
TextView mFetchPostInfoTextView;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject @Named("oauth")
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private RequestManager mGlide;
private Locale mLocale;
private Menu mMenu;
private int orientation;
private int postListPosition = -1;
private String mSingleCommentId;
private boolean mNeedBlurNsfw;
private boolean mNeedBlurSpoiler;
private boolean showToast = false;
private LinearLayoutManager mLinearLayoutManager;
private CommentAndPostRecyclerViewAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {

View File

@ -91,19 +91,40 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
private static final String MESSAGE_FULLNAME_STATE = "MFS";
private static final String NEW_ACCOUNT_NAME_STATE = "NANS";
@BindView(R.id.coordinator_layout_view_subreddit_detail_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.appbar_layout_view_subreddit_detail) AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar_layout_view_subreddit_detail_activity) CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.banner_image_view_view_subreddit_detail_activity) GifImageView bannerImageView;
@BindView(R.id.icon_gif_image_view_view_subreddit_detail_activity) GifImageView iconGifImageView;
@BindView(R.id.subscribe_subreddit_chip_view_subreddit_detail_activity) Chip subscribeSubredditChip;
@BindView(R.id.subreddit_name_text_view_view_subreddit_detail_activity) TextView subredditNameTextView;
@BindView(R.id.subscriber_count_text_view_view_subreddit_detail_activity) TextView nSubscribersTextView;
@BindView(R.id.online_subscriber_count_text_view_view_subreddit_detail_activity) TextView nOnlineSubscribersTextView;
@BindView(R.id.description_text_view_view_subreddit_detail_activity) TextView descriptionTextView;
@BindView(R.id.fab_view_subreddit_detail_activity) FloatingActionButton fab;
@BindView(R.id.coordinator_layout_view_subreddit_detail_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.appbar_layout_view_subreddit_detail)
AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar_layout_view_subreddit_detail_activity)
CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.banner_image_view_view_subreddit_detail_activity)
GifImageView bannerImageView;
@BindView(R.id.icon_gif_image_view_view_subreddit_detail_activity)
GifImageView iconGifImageView;
@BindView(R.id.subscribe_subreddit_chip_view_subreddit_detail_activity)
Chip subscribeSubredditChip;
@BindView(R.id.subreddit_name_text_view_view_subreddit_detail_activity)
TextView subredditNameTextView;
@BindView(R.id.subscriber_count_text_view_view_subreddit_detail_activity)
TextView nSubscribersTextView;
@BindView(R.id.online_subscriber_count_text_view_view_subreddit_detail_activity)
TextView nOnlineSubscribersTextView;
@BindView(R.id.description_text_view_view_subreddit_detail_activity)
TextView descriptionTextView;
@BindView(R.id.fab_view_subreddit_detail_activity)
FloatingActionButton fab;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
@ -115,30 +136,14 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
private boolean showToast = false;
private String mMessageFullname;
private String mNewAccountName;
private RequestManager glide;
private Fragment mFragment;
private Menu mMenu;
private AppBarLayout.LayoutParams params;
private PostTypeBottomSheetFragment postTypeBottomSheetFragment;
private SortTypeBottomSheetFragment sortTypeBottomSheetFragment;
private SubredditViewModel mSubredditViewModel;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -647,14 +652,9 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
private static class InsertSubredditDataAsyncTask extends AsyncTask<Void, Void, Void> {
interface InsertSubredditDataAsyncTaskListener {
void insertSuccess();
}
private SubredditDao mSubredditDao;
private SubredditData subredditData;
private InsertSubredditDataAsyncTaskListener insertSubredditDataAsyncTaskListener;
InsertSubredditDataAsyncTask(RedditDataRoomDatabase db, SubredditData subredditData,
InsertSubredditDataAsyncTaskListener insertSubredditDataAsyncTaskListener) {
mSubredditDao = db.subredditDao();
@ -672,5 +672,9 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
protected void onPostExecute(Void aVoid) {
insertSubredditDataAsyncTaskListener.insertSuccess();
}
interface InsertSubredditDataAsyncTaskListener {
void insertSuccess();
}
}
}

View File

@ -43,35 +43,35 @@ import org.greenrobot.eventbus.Subscribe;
import javax.inject.Inject;
import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
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.AsyncTask.GetCurrentAccountAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
import ml.docilealligator.infinityforreddit.ContentFontStyle;
import ml.docilealligator.infinityforreddit.DeleteThing;
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FetchUserData;
import ml.docilealligator.infinityforreddit.FontStyle;
import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment;
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
import ml.docilealligator.infinityforreddit.Fragment.UserThingSortTypeBottomSheetFragment;
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;
@ -94,27 +94,43 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi
private static final String MESSAGE_FULLNAME_STATE = "MFS";
private static final String NEW_ACCOUNT_NAME_STATE = "NANS";
@BindView(R.id.coordinator_layout_view_user_detail_activity) CoordinatorLayout coordinatorLayout;
@BindView(R.id.view_pager_view_user_detail_activity) ViewPager viewPager;
@BindView(R.id.appbar_layout_view_user_detail) AppBarLayout appBarLayout;
@BindView(R.id.tab_layout_view_user_detail_activity) TabLayout tabLayout;
@BindView(R.id.collapsing_toolbar_layout_view_user_detail_activity) CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.banner_image_view_view_user_detail_activity) GifImageView bannerImageView;
@BindView(R.id.icon_gif_image_view_view_user_detail_activity) GifImageView iconGifImageView;
@BindView(R.id.user_name_text_view_view_user_detail_activity) TextView userNameTextView;
@BindView(R.id.subscribe_user_chip_view_user_detail_activity) Chip subscribeUserChip;
@BindView(R.id.karma_text_view_view_user_detail_activity) TextView karmaTextView;
@BindView(R.id.coordinator_layout_view_user_detail_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.view_pager_view_user_detail_activity)
ViewPager viewPager;
@BindView(R.id.appbar_layout_view_user_detail)
AppBarLayout appBarLayout;
@BindView(R.id.tab_layout_view_user_detail_activity)
TabLayout tabLayout;
@BindView(R.id.collapsing_toolbar_layout_view_user_detail_activity)
CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.banner_image_view_view_user_detail_activity)
GifImageView bannerImageView;
@BindView(R.id.icon_gif_image_view_view_user_detail_activity)
GifImageView iconGifImageView;
@BindView(R.id.user_name_text_view_view_user_detail_activity)
TextView userNameTextView;
@BindView(R.id.subscribe_user_chip_view_user_detail_activity)
Chip subscribeUserChip;
@BindView(R.id.karma_text_view_view_user_detail_activity)
TextView karmaTextView;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private SectionsPagerAdapter sectionsPagerAdapter;
private SubscribedUserDao subscribedUserDao;
private RequestManager glide;
private UserViewModel userViewModel;
private Menu mMenu;
private AppBarLayout.LayoutParams params;
private UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment;
private boolean mNullAccessToken = false;
private String mAccessToken;
private String mAccountName;
@ -132,20 +148,6 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi
private String mMessageFullname;
private String mNewAccountName;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -652,14 +654,9 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi
private static class InsertUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
interface InsertUserDataAsyncTaskListener {
void insertSuccess();
}
private UserDao userDao;
private UserData subredditData;
private InsertUserDataAsyncTaskListener insertUserDataAsyncTaskListener;
InsertUserDataAsyncTask(UserDao userDao, UserData userData,
InsertUserDataAsyncTaskListener insertUserDataAsyncTaskListener) {
this.userDao = userDao;
@ -677,6 +674,10 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi
protected void onPostExecute(Void aVoid) {
insertUserDataAsyncTaskListener.insertSuccess();
}
interface InsertUserDataAsyncTaskListener {
void insertSuccess();
}
}
private class SectionsPagerAdapter extends FragmentPagerAdapter {

View File

@ -50,14 +50,14 @@ import ml.docilealligator.infinityforreddit.R;
public class ViewVideoActivity extends AppCompatActivity {
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
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;
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
@BindView(R.id.relative_layout_view_video_activity)
RelativeLayout relativeLayout;
@BindView(R.id.player_view_view_video_activity)
PlayerView videoPlayerView;
private Uri mVideoUri;
private SimpleExoPlayer player;
@ -172,10 +172,12 @@ public class ViewVideoActivity extends AppCompatActivity {
}
@Override
public void onAnimationCancel(Animator animator) {}
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {}
public void onAnimationRepeat(Animator animator) {
}
})
.start();
} else {
@ -227,10 +229,12 @@ public class ViewVideoActivity extends AppCompatActivity {
}
@Override
public void onAnimationCancel(Animator animator) {}
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {}
public void onAnimationRepeat(Animator animator) {
}
})
.start();
} else {

View File

@ -15,28 +15,20 @@ import com.bumptech.glide.request.RequestOptions;
import java.util.List;
import ml.docilealligator.infinityforreddit.Account.Account;
import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import ml.docilealligator.infinityforreddit.Account.Account;
import ml.docilealligator.infinityforreddit.R;
import pl.droidsonroids.gif.GifImageView;
public class AccountRecyclerViewAdapter extends RecyclerView.Adapter<AccountRecyclerViewAdapter.AccountViewHolder> {
public interface ItemSelectedListener {
void accountSelected(Account account);
void addAccountSelected();
void anonymousSelected();
void logoutSelected();
}
private List<Account> mAccounts;
private String mCurrentAccountName;
private Context mContext;
private RequestManager mGlide;
private ItemSelectedListener mItemSelectedListener;
public AccountRecyclerViewAdapter(Context context, RequestManager glide, String currentAccountName, ItemSelectedListener itemSelectedListener) {
mContext = context;
mGlide = glide;
@ -118,9 +110,21 @@ public class AccountRecyclerViewAdapter extends RecyclerView.Adapter<AccountRecy
notifyDataSetChanged();
}
public interface ItemSelectedListener {
void accountSelected(Account account);
void addAccountSelected();
void anonymousSelected();
void logoutSelected();
}
class AccountViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.profile_image_item_account) GifImageView profileImageGifImageView;
@BindView(R.id.username_text_view_item_account) TextView usernameTextView;
@BindView(R.id.profile_image_item_account)
GifImageView profileImageGifImageView;
@BindView(R.id.username_text_view_item_account)
TextView usernameTextView;
AccountViewHolder(@NonNull View itemView) {
super(itemView);

View File

@ -39,16 +39,6 @@ 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;
import io.noties.markwon.AbstractMarkwonPlugin;
@ -59,10 +49,20 @@ 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.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.CommentData;
import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView;
import ml.docilealligator.infinityforreddit.FetchComment;
import ml.docilealligator.infinityforreddit.Fragment.ModifyCommentBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Post;
import ml.docilealligator.infinityforreddit.PostDataSource;
import ml.docilealligator.infinityforreddit.R;
@ -107,12 +107,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private boolean mHasMoreComments;
private boolean loadMoreCommentsFailed;
public interface CommentRecyclerViewAdapterCallback {
void updatePost(Post post);
void retryFetchingComments();
void retryFetchingMoreComments();
}
public CommentAndPostRecyclerViewAdapter(Activity activity, Retrofit retrofit, Retrofit oauthRetrofit,
RedditDataRoomDatabase redditDataRoomDatabase, RequestManager glide,
String accessToken, String accountName, Post post, Locale locale,
@ -783,7 +777,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
@Override
public void onVoteThingFail(int position) { }
public void onVoteThingFail(int position) {
}
}, mVisibleComments.get(commentPosition).getFullName(), newVoteType, holder.getAdapterPosition());
});
@ -839,7 +834,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
@Override
public void onVoteThingFail(int position1) { }
public void onVoteThingFail(int position1) {
}
}, mVisibleComments.get(commentPosition).getFullName(), newVoteType, holder.getAdapterPosition());
});
@ -1247,37 +1243,75 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}
public interface CommentRecyclerViewAdapterCallback {
void updatePost(Post post);
void retryFetchingComments();
void retryFetchingMoreComments();
}
class PostDetailViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.icon_gif_image_view_item_post_detail) AspectRatioGifImageView mIconGifImageView;
@BindView(R.id.subreddit_text_view_item_post_detail) TextView mSubredditTextView;
@BindView(R.id.user_text_view_item_post_detail) TextView mUserTextView;
@BindView(R.id.post_time_text_view_item_post_detail) TextView mPostTimeTextView;
@BindView(R.id.title_text_view_item_post_detail) TextView mTitleTextView;
@BindView(R.id.content_markdown_view_item_post_detail) TextView mContentMarkdownView;
@BindView(R.id.type_text_view_item_post_detail) CustomTextView mTypeTextView;
@BindView(R.id.gilded_image_view_item_post_detail) ImageView mGildedImageView;
@BindView(R.id.gilded_number_text_view_item_post_detail) TextView mGildedNumberTextView;
@BindView(R.id.crosspost_image_view_item_post_detail) ImageView mCrosspostImageView;
@BindView(R.id.archived_image_view_item_post_detail) ImageView mArchivedImageView;
@BindView(R.id.locked_image_view_item_post_detail) ImageView mLockedImageView;
@BindView(R.id.nsfw_text_view_item_post_detail) CustomTextView mNSFWTextView;
@BindView(R.id.spoiler_flair_linear_layout_item_post_detail) LinearLayout spoilerFlairlinearLayout;
@BindView(R.id.spoiler_custom_text_view_item_post_detail) CustomTextView spoilerTextView;
@BindView(R.id.flair_custom_text_view_item_post_detail) CustomTextView flairTextView;
@BindView(R.id.link_text_view_item_post_detail) TextView linkTextView;
@BindView(R.id.image_view_wrapper_item_post_detail) RelativeLayout mRelativeLayout;
@BindView(R.id.load_wrapper_item_post_detail) RelativeLayout mLoadWrapper;
@BindView(R.id.progress_bar_item_post_detail) ProgressBar mLoadImageProgressBar;
@BindView(R.id.load_image_error_text_view_item_post_detail) TextView mLoadImageErrorTextView;
@BindView(R.id.image_view_item_post_detail) AspectRatioImageView mImageView;
@BindView(R.id.image_view_no_preview_link_item_post_detail) ImageView mNoPreviewLinkImageView;
@BindView(R.id.plus_button_item_post_detail) ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail) TextView mScoreTextView;
@BindView(R.id.minus_button_item_post_detail) ImageView mDownvoteButton;
@BindView(R.id.comment_button_item_post_detail) ImageView commentButton;
@BindView(R.id.comments_count_item_post_detail) TextView commentsCountTextView;
@BindView(R.id.save_button_item_post_detail) ImageView saveButton;
@BindView(R.id.share_button_item_post_detail) ImageView mShareButton;
@BindView(R.id.icon_gif_image_view_item_post_detail)
AspectRatioGifImageView mIconGifImageView;
@BindView(R.id.subreddit_text_view_item_post_detail)
TextView mSubredditTextView;
@BindView(R.id.user_text_view_item_post_detail)
TextView mUserTextView;
@BindView(R.id.post_time_text_view_item_post_detail)
TextView mPostTimeTextView;
@BindView(R.id.title_text_view_item_post_detail)
TextView mTitleTextView;
@BindView(R.id.content_markdown_view_item_post_detail)
TextView mContentMarkdownView;
@BindView(R.id.type_text_view_item_post_detail)
CustomTextView mTypeTextView;
@BindView(R.id.gilded_image_view_item_post_detail)
ImageView mGildedImageView;
@BindView(R.id.gilded_number_text_view_item_post_detail)
TextView mGildedNumberTextView;
@BindView(R.id.crosspost_image_view_item_post_detail)
ImageView mCrosspostImageView;
@BindView(R.id.archived_image_view_item_post_detail)
ImageView mArchivedImageView;
@BindView(R.id.locked_image_view_item_post_detail)
ImageView mLockedImageView;
@BindView(R.id.nsfw_text_view_item_post_detail)
CustomTextView mNSFWTextView;
@BindView(R.id.spoiler_flair_linear_layout_item_post_detail)
LinearLayout spoilerFlairlinearLayout;
@BindView(R.id.spoiler_custom_text_view_item_post_detail)
CustomTextView spoilerTextView;
@BindView(R.id.flair_custom_text_view_item_post_detail)
CustomTextView flairTextView;
@BindView(R.id.link_text_view_item_post_detail)
TextView linkTextView;
@BindView(R.id.image_view_wrapper_item_post_detail)
RelativeLayout mRelativeLayout;
@BindView(R.id.load_wrapper_item_post_detail)
RelativeLayout mLoadWrapper;
@BindView(R.id.progress_bar_item_post_detail)
ProgressBar mLoadImageProgressBar;
@BindView(R.id.load_image_error_text_view_item_post_detail)
TextView mLoadImageErrorTextView;
@BindView(R.id.image_view_item_post_detail)
AspectRatioImageView mImageView;
@BindView(R.id.image_view_no_preview_link_item_post_detail)
ImageView mNoPreviewLinkImageView;
@BindView(R.id.plus_button_item_post_detail)
ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail)
TextView mScoreTextView;
@BindView(R.id.minus_button_item_post_detail)
ImageView mDownvoteButton;
@BindView(R.id.comment_button_item_post_detail)
ImageView commentButton;
@BindView(R.id.comments_count_item_post_detail)
TextView commentsCountTextView;
@BindView(R.id.save_button_item_post_detail)
ImageView saveButton;
@BindView(R.id.share_button_item_post_detail)
ImageView mShareButton;
PostDetailViewHolder(@NonNull View itemView) {
super(itemView);
@ -1461,19 +1495,32 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
class CommentViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.author_text_view_item_post_comment) TextView authorTextView;
@BindView(R.id.author_type_image_view_item_comment) ImageView authorTypeImageView;
@BindView(R.id.comment_time_text_view_item_post_comment) TextView commentTimeTextView;
@BindView(R.id.comment_markdown_view_item_post_comment) TextView commentMarkdownView;
@BindView(R.id.up_vote_button_item_post_comment) ImageView upVoteButton;
@BindView(R.id.score_text_view_item_post_comment) TextView scoreTextView;
@BindView(R.id.down_vote_button_item_post_comment) ImageView downVoteButton;
@BindView(R.id.more_button_item_post_comment) ImageView moreButton;
@BindView(R.id.save_button_item_post_comment) ImageView saveButton;
@BindView(R.id.expand_button_item_post_comment) ImageView expandButton;
@BindView(R.id.share_button_item_post_comment) ImageView shareButton;
@BindView(R.id.reply_button_item_post_comment) ImageView replyButton;
@BindView(R.id.vertical_block_item_post_comment) View verticalBlock;
@BindView(R.id.author_text_view_item_post_comment)
TextView authorTextView;
@BindView(R.id.author_type_image_view_item_comment)
ImageView authorTypeImageView;
@BindView(R.id.comment_time_text_view_item_post_comment)
TextView commentTimeTextView;
@BindView(R.id.comment_markdown_view_item_post_comment)
TextView commentMarkdownView;
@BindView(R.id.up_vote_button_item_post_comment)
ImageView upVoteButton;
@BindView(R.id.score_text_view_item_post_comment)
TextView scoreTextView;
@BindView(R.id.down_vote_button_item_post_comment)
ImageView downVoteButton;
@BindView(R.id.more_button_item_post_comment)
ImageView moreButton;
@BindView(R.id.save_button_item_post_comment)
ImageView saveButton;
@BindView(R.id.expand_button_item_post_comment)
ImageView expandButton;
@BindView(R.id.share_button_item_post_comment)
ImageView shareButton;
@BindView(R.id.reply_button_item_post_comment)
ImageView replyButton;
@BindView(R.id.vertical_block_item_post_comment)
View verticalBlock;
CommentViewHolder(View itemView) {
super(itemView);
@ -1529,8 +1576,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
class LoadMoreChildCommentsViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.vertical_block_item_load_more_comments) View verticalBlock;
@BindView(R.id.placeholder_text_view_item_load_more_comments) TextView placeholderTextView;
@BindView(R.id.vertical_block_item_load_more_comments)
View verticalBlock;
@BindView(R.id.placeholder_text_view_item_load_more_comments)
TextView placeholderTextView;
LoadMoreChildCommentsViewHolder(View itemView) {
super(itemView);
@ -1744,8 +1793,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
class LoadMoreCommentsFailedViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.error_text_view_item_comment_footer_error) TextView errorTextView;
@BindView(R.id.retry_button_item_comment_footer_error) Button retryButton;
@BindView(R.id.error_text_view_item_comment_footer_error)
TextView errorTextView;
@BindView(R.id.retry_button_item_comment_footer_error)
Button retryButton;
LoadMoreCommentsFailedViewHolder(@NonNull View itemView) {
super(itemView);

View File

@ -43,6 +43,20 @@ import ml.docilealligator.infinityforreddit.VoteThing;
import retrofit2.Retrofit;
public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, 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;
private static final DiffUtil.ItemCallback<CommentData> DIFF_CALLBACK = new DiffUtil.ItemCallback<CommentData>() {
@Override
public boolean areItemsTheSame(@NonNull CommentData commentData, @NonNull CommentData t1) {
return commentData.getId().equals(t1.getId());
}
@Override
public boolean areContentsTheSame(@NonNull CommentData commentData, @NonNull CommentData t1) {
return commentData.getCommentContent().equals(t1.getCommentContent());
}
};
private Context mContext;
private Retrofit mOauthRetrofit;
private Markwon mMarkwon;
@ -50,18 +64,9 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
private String mAccountName;
private int mTextColorPrimaryDark;
private int mColorAccent;
private static final int VIEW_TYPE_DATA = 0;
private static final int VIEW_TYPE_ERROR = 1;
private static final int VIEW_TYPE_LOADING = 2;
private NetworkState networkState;
private RetryLoadingMoreCallback mRetryLoadingMoreCallback;
public interface RetryLoadingMoreCallback {
void retryLoadingMore();
}
public CommentsListingRecyclerViewAdapter(Context context, Retrofit oauthRetrofit,
String accessToken, String accountName,
RetryLoadingMoreCallback retryLoadingMoreCallback) {
@ -94,18 +99,6 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
mColorAccent = mContext.getResources().getColor(R.color.colorAccent);
}
private static final DiffUtil.ItemCallback<CommentData> DIFF_CALLBACK = new DiffUtil.ItemCallback<CommentData>() {
@Override
public boolean areItemsTheSame(@NonNull CommentData commentData, @NonNull CommentData t1) {
return commentData.getId().equals(t1.getId());
}
@Override
public boolean areContentsTheSame(@NonNull CommentData commentData, @NonNull CommentData t1) {
return commentData.getCommentContent().equals(t1.getCommentContent());
}
};
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -246,7 +239,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
}
@Override
public void onVoteThingFail(int position) { }
public void onVoteThingFail(int position) {
}
}, comment.getFullName(), newVoteType, holder.getAdapterPosition());
});
@ -295,7 +289,8 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
}
@Override
public void onVoteThingFail(int position1) { }
public void onVoteThingFail(int position1) {
}
}, comment.getFullName(), newVoteType, holder.getAdapterPosition());
});
@ -397,19 +392,35 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
}
}
public interface RetryLoadingMoreCallback {
void retryLoadingMore();
}
class DataViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.linear_layout_item_comment) LinearLayout linearLayout;
@BindView(R.id.vertical_block_item_post_comment) View verticalBlock;
@BindView(R.id.author_text_view_item_post_comment) TextView authorTextView;
@BindView(R.id.comment_time_text_view_item_post_comment) TextView commentTimeTextView;
@BindView(R.id.comment_markdown_view_item_post_comment) TextView commentMarkdownView;
@BindView(R.id.up_vote_button_item_post_comment) ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_comment) TextView scoreTextView;
@BindView(R.id.down_vote_button_item_post_comment) ImageView downvoteButton;
@BindView(R.id.more_button_item_post_comment) ImageView moreButton;
@BindView(R.id.save_button_item_post_comment) ImageView saveButton;
@BindView(R.id.share_button_item_post_comment) ImageView shareButton;
@BindView(R.id.reply_button_item_post_comment) ImageView replyButton;
@BindView(R.id.linear_layout_item_comment)
LinearLayout linearLayout;
@BindView(R.id.vertical_block_item_post_comment)
View verticalBlock;
@BindView(R.id.author_text_view_item_post_comment)
TextView authorTextView;
@BindView(R.id.comment_time_text_view_item_post_comment)
TextView commentTimeTextView;
@BindView(R.id.comment_markdown_view_item_post_comment)
TextView commentMarkdownView;
@BindView(R.id.up_vote_button_item_post_comment)
ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post_comment)
TextView scoreTextView;
@BindView(R.id.down_vote_button_item_post_comment)
ImageView downvoteButton;
@BindView(R.id.more_button_item_post_comment)
ImageView moreButton;
@BindView(R.id.save_button_item_post_comment)
ImageView saveButton;
@BindView(R.id.share_button_item_post_comment)
ImageView shareButton;
@BindView(R.id.reply_button_item_post_comment)
ImageView replyButton;
DataViewHolder(View itemView) {
super(itemView);
@ -418,8 +429,10 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
}
class ErrorViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.error_text_view_item_footer_error) TextView errorTextView;
@BindView(R.id.retry_button_item_footer_error) Button retryButton;
@BindView(R.id.error_text_view_item_footer_error)
TextView errorTextView;
@BindView(R.id.retry_button_item_footer_error)
Button retryButton;
ErrorViewHolder(View itemView) {
super(itemView);

View File

@ -23,14 +23,9 @@ import ml.docilealligator.infinityforreddit.Flair;
import ml.docilealligator.infinityforreddit.R;
public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<FlairBottomSheetRecyclerViewAdapter.FlairViewHolder> {
public interface ItemClickListener {
void onClick(Flair flair);
}
private Context context;
private ArrayList<Flair> flairs;
private ItemClickListener itemClickListener;
public FlairBottomSheetRecyclerViewAdapter(Context context, ItemClickListener itemClickListener) {
this.context = context;
this.itemClickListener = itemClickListener;
@ -93,10 +88,16 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl
notifyDataSetChanged();
}
public interface ItemClickListener {
void onClick(Flair flair);
}
class FlairViewHolder extends RecyclerView.ViewHolder {
View itemView;
@BindView(R.id.flair_text_view_item_flair) TextView flairTextView;
@BindView(R.id.edit_flair_image_view_item_flair) ImageView editFlairImageView;
@BindView(R.id.flair_text_view_item_flair)
TextView flairTextView;
@BindView(R.id.edit_flair_image_view_item_flair)
ImageView editFlairImageView;
FlairViewHolder(@NonNull View itemView) {
super(itemView);

View File

@ -16,10 +16,10 @@ import com.bumptech.glide.request.RequestOptions;
import java.util.List;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
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;
public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

View File

@ -35,20 +35,25 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
private static final int VIEW_TYPE_DATA = 0;
private static final int VIEW_TYPE_ERROR = 1;
private static final int VIEW_TYPE_LOADING = 2;
private static final DiffUtil.ItemCallback<Message> DIFF_CALLBACK = new DiffUtil.ItemCallback<Message>() {
@Override
public boolean areItemsTheSame(@NonNull Message message, @NonNull Message t1) {
return message.getId().equals(t1.getId());
}
@Override
public boolean areContentsTheSame(@NonNull Message message, @NonNull Message t1) {
return message.getBody().equals(t1.getBody());
}
};
private Context mContext;
private Retrofit mOauthRetrofit;
private Markwon mMarkwon;
private String mAccessToken;
private Resources mResources;
private NetworkState networkState;
private RetryLoadingMoreCallback mRetryLoadingMoreCallback;
public interface RetryLoadingMoreCallback {
void retryLoadingMore();
}
public MessageRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, String accessToken,
RetryLoadingMoreCallback retryLoadingMoreCallback) {
super(DIFF_CALLBACK);
@ -78,18 +83,6 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
mResources = context.getResources();
}
private static final DiffUtil.ItemCallback<Message> DIFF_CALLBACK = new DiffUtil.ItemCallback<Message>() {
@Override
public boolean areItemsTheSame(@NonNull Message message, @NonNull Message t1) {
return message.getId().equals(t1.getId());
}
@Override
public boolean areContentsTheSame(@NonNull Message message, @NonNull Message t1) {
return message.getBody().equals(t1.getBody());
}
};
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -139,7 +132,8 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
ReadMessage.readMessage(mOauthRetrofit, mAccessToken, message.getFullname(),
new ReadMessage.ReadMessageListener() {
@Override
public void readSuccess() {}
public void readSuccess() {
}
@Override
public void readFailed() {
@ -215,12 +209,20 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
}
}
public interface RetryLoadingMoreCallback {
void retryLoadingMore();
}
class DataViewHolder extends RecyclerView.ViewHolder {
View itemView;
@BindView(R.id.author_text_view_item_message) TextView authorTextView;
@BindView(R.id.subject_text_view_item_message) TextView subjectTextView;
@BindView(R.id.title_text_view_item_message) TextView titleTextView;
@BindView(R.id.content_custom_markwon_view_item_message) TextView contentCustomMarkwonView;
@BindView(R.id.author_text_view_item_message)
TextView authorTextView;
@BindView(R.id.subject_text_view_item_message)
TextView subjectTextView;
@BindView(R.id.title_text_view_item_message)
TextView titleTextView;
@BindView(R.id.content_custom_markwon_view_item_message)
TextView contentCustomMarkwonView;
DataViewHolder(View itemView) {
super(itemView);
@ -230,8 +232,10 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
}
class ErrorViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.error_text_view_item_footer_error) TextView errorTextView;
@BindView(R.id.retry_button_item_footer_error) Button retryButton;
@BindView(R.id.error_text_view_item_footer_error)
TextView errorTextView;
@BindView(R.id.retry_button_item_footer_error)
Button retryButton;
ErrorViewHolder(View itemView) {
super(itemView);

View File

@ -70,6 +70,22 @@ import retrofit2.Retrofit;
*/
public class PostRecyclerViewAdapter extends PagedListAdapter<Post, 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;
private static final DiffUtil.ItemCallback<Post> DIFF_CALLBACK = new DiffUtil.ItemCallback<Post>() {
@Override
public boolean areItemsTheSame(@NonNull Post post, @NonNull Post t1) {
return post.getId().equals(t1.getId());
}
@Override
public boolean areContentsTheSame(@NonNull Post post, @NonNull Post t1) {
return post.getTitle().equals(t1.getTitle()) && !(post.getSelfText() != null && t1.getSelfText() != null
&& !post.getSelfText().equals(t1.getSelfText()))
&& post.getScore() == t1.getScore() && post.getVoteType() == t1.getVoteType();
}
};
private Context mContext;
private Retrofit mOauthRetrofit;
private Retrofit mRetrofit;
@ -82,19 +98,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private boolean mDisplaySubredditName;
private boolean mNeedBlurNSFW;
private boolean mNeedBlurSpoiler;
private static final int VIEW_TYPE_DATA = 0;
private static final int VIEW_TYPE_ERROR = 1;
private static final int VIEW_TYPE_LOADING = 2;
private NetworkState networkState;
private Callback mCallback;
public interface Callback {
void retryLoadingMore();
void typeChipClicked(int filter);
}
public PostRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, Retrofit retrofit,
RedditDataRoomDatabase redditDataRoomDatabase, String accessToken,
int postType, boolean displaySubredditName, boolean needBlurNSFW,
@ -116,20 +122,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
private static final DiffUtil.ItemCallback<Post> DIFF_CALLBACK = new DiffUtil.ItemCallback<Post>() {
@Override
public boolean areItemsTheSame(@NonNull Post post, @NonNull Post t1) {
return post.getId().equals(t1.getId());
}
@Override
public boolean areContentsTheSame(@NonNull Post post, @NonNull Post t1) {
return post.getTitle().equals(t1.getTitle()) && !(post.getSelfText() != null && t1.getSelfText() != null
&& !post.getSelfText().equals(t1.getSelfText()))
&& post.getScore() == t1.getScore() && post.getVoteType() == t1.getVoteType();
}
};
public void setCanStartActivity(boolean canStartActivity) {
this.canStartActivity = canStartActivity;
}
@ -789,66 +781,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
class DataViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.card_view_item_post) MaterialCardView cardView;
@BindView(R.id.icon_name_linear_layout_view_item_post) LinearLayout iconNameLinearLayout;
@BindView(R.id.icon_gif_image_view_item_post) AspectRatioGifImageView iconGifImageView;
@BindView(R.id.name_text_view_item_post) TextView nameTextView;
@BindView(R.id.stickied_post_image_view_item_post) ImageView stickiedPostImageView;
@BindView(R.id.post_time_text_view_best_item_post) TextView postTimeTextView;
@BindView(R.id.title_text_view_best_item_post) TextView titleTextView;
@BindView(R.id.type_text_view_item_post) CustomTextView typeTextView;
@BindView(R.id.gilded_image_view_item_post) ImageView gildedImageView;
@BindView(R.id.gilded_number_text_view_item_post) TextView gildedNumberTextView;
@BindView(R.id.archived_image_view_item_post) ImageView archivedImageView;
@BindView(R.id.locked_image_view_item_post) ImageView lockedImageView;
@BindView(R.id.crosspost_image_view_item_post) ImageView crosspostImageView;
@BindView(R.id.nsfw_text_view_item_post) CustomTextView nsfwTextView;
@BindView(R.id.spoiler_flair_linear_layout_item_post) LinearLayout spoilerFlairLinearLayout;
@BindView(R.id.spoiler_custom_text_view_item_post) CustomTextView spoilerTextView;
@BindView(R.id.flair_custom_text_view_item_post) CustomTextView flairTextView;
@BindView(R.id.link_text_view_item_post) TextView linkTextView;
@BindView(R.id.image_view_wrapper_item_post) RelativeLayout relativeLayout;
@BindView(R.id.progress_bar_item_post) ProgressBar progressBar;
@BindView(R.id.image_view_best_post_item) AspectRatioGifImageView imageView;
@BindView(R.id.load_image_error_relative_layout_item_post) RelativeLayout errorRelativeLayout;
@BindView(R.id.image_view_no_preview_link_item_post) ImageView noPreviewLinkImageView;
@BindView(R.id.plus_button_item_post) ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post) TextView scoreTextView;
@BindView(R.id.minus_button_item_post) ImageView downvoteButton;
@BindView(R.id.comment_button_item_post) ImageView commentButton;
@BindView(R.id.comments_count_item_post) TextView commentsCountTextView;
@BindView(R.id.save_button_item_post) ImageView saveButton;
@BindView(R.id.share_button_item_post) ImageView shareButton;
DataViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
scoreTextView.setOnClickListener(view -> {
//Do nothing in order to prevent clicking this to start ViewPostDetailActivity
});
}
}
class ErrorViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.error_text_view_item_footer_error) TextView errorTextView;
@BindView(R.id.retry_button_item_footer_error) Button retryButton;
ErrorViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
errorTextView.setText(R.string.load_posts_error);
retryButton.setOnClickListener(view -> mCallback.retryLoadingMore());
}
}
class LoadingViewHolder extends RecyclerView.ViewHolder {
LoadingViewHolder(@NonNull View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
if (holder instanceof DataViewHolder) {
@ -875,4 +807,102 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((DataViewHolder) holder).downvoteButton.clearColorFilter();
}
}
public interface Callback {
void retryLoadingMore();
void typeChipClicked(int filter);
}
class DataViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.card_view_item_post)
MaterialCardView cardView;
@BindView(R.id.icon_name_linear_layout_view_item_post)
LinearLayout iconNameLinearLayout;
@BindView(R.id.icon_gif_image_view_item_post)
AspectRatioGifImageView iconGifImageView;
@BindView(R.id.name_text_view_item_post)
TextView nameTextView;
@BindView(R.id.stickied_post_image_view_item_post)
ImageView stickiedPostImageView;
@BindView(R.id.post_time_text_view_best_item_post)
TextView postTimeTextView;
@BindView(R.id.title_text_view_best_item_post)
TextView titleTextView;
@BindView(R.id.type_text_view_item_post)
CustomTextView typeTextView;
@BindView(R.id.gilded_image_view_item_post)
ImageView gildedImageView;
@BindView(R.id.gilded_number_text_view_item_post)
TextView gildedNumberTextView;
@BindView(R.id.archived_image_view_item_post)
ImageView archivedImageView;
@BindView(R.id.locked_image_view_item_post)
ImageView lockedImageView;
@BindView(R.id.crosspost_image_view_item_post)
ImageView crosspostImageView;
@BindView(R.id.nsfw_text_view_item_post)
CustomTextView nsfwTextView;
@BindView(R.id.spoiler_flair_linear_layout_item_post)
LinearLayout spoilerFlairLinearLayout;
@BindView(R.id.spoiler_custom_text_view_item_post)
CustomTextView spoilerTextView;
@BindView(R.id.flair_custom_text_view_item_post)
CustomTextView flairTextView;
@BindView(R.id.link_text_view_item_post)
TextView linkTextView;
@BindView(R.id.image_view_wrapper_item_post)
RelativeLayout relativeLayout;
@BindView(R.id.progress_bar_item_post)
ProgressBar progressBar;
@BindView(R.id.image_view_best_post_item)
AspectRatioGifImageView imageView;
@BindView(R.id.load_image_error_relative_layout_item_post)
RelativeLayout errorRelativeLayout;
@BindView(R.id.image_view_no_preview_link_item_post)
ImageView noPreviewLinkImageView;
@BindView(R.id.plus_button_item_post)
ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post)
TextView scoreTextView;
@BindView(R.id.minus_button_item_post)
ImageView downvoteButton;
@BindView(R.id.comment_button_item_post)
ImageView commentButton;
@BindView(R.id.comments_count_item_post)
TextView commentsCountTextView;
@BindView(R.id.save_button_item_post)
ImageView saveButton;
@BindView(R.id.share_button_item_post)
ImageView shareButton;
DataViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
scoreTextView.setOnClickListener(view -> {
//Do nothing in order to prevent clicking this to start ViewPostDetailActivity
});
}
}
class ErrorViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.error_text_view_item_footer_error)
TextView errorTextView;
@BindView(R.id.retry_button_item_footer_error)
Button retryButton;
ErrorViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
errorTextView.setText(R.string.load_posts_error);
retryButton.setOnClickListener(view -> mCallback.retryLoadingMore());
}
}
class LoadingViewHolder extends RecyclerView.ViewHolder {
LoadingViewHolder(@NonNull View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}

View File

@ -84,8 +84,10 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler
}
class RuleViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.short_name_text_view_item_rule) TextView shortNameTextView;
@BindView(R.id.description_markwon_view_item_rule) TextView descriptionMarkwonView;
@BindView(R.id.short_name_text_view_item_rule)
TextView shortNameTextView;
@BindView(R.id.description_markwon_view_item_rule)
TextView descriptionMarkwonView;
RuleViewHolder(@NonNull View itemView) {
super(itemView);

View File

@ -33,17 +33,21 @@ import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit;
public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<SubredditData, RecyclerView.ViewHolder> {
public interface Callback {
void retryLoadingMore();
void subredditSelected(String subredditName, String iconUrl);
}
private RequestManager glide;
private static final int VIEW_TYPE_DATA = 0;
private static final int VIEW_TYPE_ERROR = 1;
private static final int VIEW_TYPE_LOADING = 2;
private static final DiffUtil.ItemCallback<SubredditData> DIFF_CALLBACK = new DiffUtil.ItemCallback<SubredditData>() {
@Override
public boolean areItemsTheSame(@NonNull SubredditData oldItem, @NonNull SubredditData newItem) {
return oldItem.getId().equals(newItem.getId());
}
@Override
public boolean areContentsTheSame(@NonNull SubredditData oldItem, @NonNull SubredditData newItem) {
return true;
}
};
private RequestManager glide;
private Context context;
private Retrofit oauthRetrofit;
private Retrofit retrofit;
@ -69,18 +73,6 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
glide = Glide.with(context.getApplicationContext());
}
private static final DiffUtil.ItemCallback<SubredditData> DIFF_CALLBACK = new DiffUtil.ItemCallback<SubredditData>() {
@Override
public boolean areItemsTheSame(@NonNull SubredditData oldItem, @NonNull SubredditData newItem) {
return oldItem.getId().equals(newItem.getId());
}
@Override
public boolean areContentsTheSame(@NonNull SubredditData oldItem, @NonNull SubredditData newItem) {
return true;
}
};
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -190,11 +182,29 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
}
}
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
if (holder instanceof DataViewHolder) {
glide.clear(((DataViewHolder) holder).iconGifImageView);
((DataViewHolder) holder).subscribeButton.setVisibility(View.GONE);
}
}
public interface Callback {
void retryLoadingMore();
void subredditSelected(String subredditName, String iconUrl);
}
class DataViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.constraint_layout_item_subreddit_listing) ConstraintLayout constraintLayout;
@BindView(R.id.subreddit_icon_gif_image_view_item_subreddit_listing) GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_item_subreddit_listing) TextView subredditNameTextView;
@BindView(R.id.subscribe_image_view_item_subreddit_listing) ImageView subscribeButton;
@BindView(R.id.constraint_layout_item_subreddit_listing)
ConstraintLayout constraintLayout;
@BindView(R.id.subreddit_icon_gif_image_view_item_subreddit_listing)
GifImageView iconGifImageView;
@BindView(R.id.subreddit_name_text_view_item_subreddit_listing)
TextView subredditNameTextView;
@BindView(R.id.subscribe_image_view_item_subreddit_listing)
ImageView subscribeButton;
DataViewHolder(View itemView) {
super(itemView);
@ -203,8 +213,10 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
}
class ErrorViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.error_text_view_item_footer_error) TextView errorTextView;
@BindView(R.id.retry_button_item_footer_error) Button retryButton;
@BindView(R.id.error_text_view_item_footer_error)
TextView errorTextView;
@BindView(R.id.retry_button_item_footer_error)
Button retryButton;
ErrorViewHolder(View itemView) {
super(itemView);
@ -220,12 +232,4 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
ButterKnife.bind(this, itemView);
}
}
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
if(holder instanceof DataViewHolder) {
glide.clear(((DataViewHolder) holder).iconGifImageView);
((DataViewHolder) holder).subscribeButton.setVisibility(View.GONE);
}
}
}

View File

@ -16,10 +16,10 @@ import com.bumptech.glide.request.RequestOptions;
import java.util.List;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
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;
public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
@ -32,10 +32,6 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
private String userIconUrl;
private boolean hasClearSelectionRow;
public interface ItemClickListener {
void onClick(String name, String iconUrl, boolean subredditIsUser);
}
public SubscribedSubredditsRecyclerViewAdapter(Context context) {
mContext = context;
glide = Glide.with(context.getApplicationContext());
@ -141,6 +137,10 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
this.userIconUrl = userIconUrl;
}
public interface ItemClickListener {
void onClick(String name, String iconUrl, boolean subredditIsUser);
}
private class SubredditViewHolder extends RecyclerView.ViewHolder {
private final GifImageView iconGifImageView;
private final TextView subredditNameTextView;

View File

@ -21,30 +21,35 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.request.RequestOptions;
import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
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> {
public interface RetryLoadingMoreCallback {
void retryLoadingMore();
}
private RequestManager glide;
private static final int VIEW_TYPE_DATA = 0;
private static final int VIEW_TYPE_ERROR = 1;
private static final int VIEW_TYPE_LOADING = 2;
private static final DiffUtil.ItemCallback<UserData> DIFF_CALLBACK = new DiffUtil.ItemCallback<UserData>() {
@Override
public boolean areItemsTheSame(@NonNull UserData oldItem, @NonNull UserData newItem) {
return oldItem.getName().equals(newItem.getName());
}
@Override
public boolean areContentsTheSame(@NonNull UserData oldItem, @NonNull UserData newItem) {
return true;
}
};
private RequestManager glide;
private Context context;
private Retrofit oauthRetrofit;
private Retrofit retrofit;
@ -69,18 +74,6 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R
glide = Glide.with(context.getApplicationContext());
}
private static final DiffUtil.ItemCallback<UserData> DIFF_CALLBACK = new DiffUtil.ItemCallback<UserData>() {
@Override
public boolean areItemsTheSame(@NonNull UserData oldItem, @NonNull UserData newItem) {
return oldItem.getName().equals(newItem.getName());
}
@Override
public boolean areContentsTheSame(@NonNull UserData oldItem, @NonNull UserData newItem) {
return true;
}
};
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
@ -193,11 +186,27 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R
}
}
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
if (holder instanceof UserListingRecyclerViewAdapter.DataViewHolder) {
glide.clear(((UserListingRecyclerViewAdapter.DataViewHolder) holder).iconGifImageView);
((UserListingRecyclerViewAdapter.DataViewHolder) holder).subscribeButton.setVisibility(View.GONE);
}
}
public interface RetryLoadingMoreCallback {
void retryLoadingMore();
}
class DataViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.constraint_layout_item_user_listing) ConstraintLayout constraintLayout;
@BindView(R.id.user_icon_gif_image_view_item_user_listing) GifImageView iconGifImageView;
@BindView(R.id.user_name_text_view_item_user_listing) TextView UserNameTextView;
@BindView(R.id.subscribe_image_view_item_user_listing) ImageView subscribeButton;
@BindView(R.id.constraint_layout_item_user_listing)
ConstraintLayout constraintLayout;
@BindView(R.id.user_icon_gif_image_view_item_user_listing)
GifImageView iconGifImageView;
@BindView(R.id.user_name_text_view_item_user_listing)
TextView UserNameTextView;
@BindView(R.id.subscribe_image_view_item_user_listing)
ImageView subscribeButton;
DataViewHolder(View itemView) {
super(itemView);
@ -206,8 +215,10 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R
}
class ErrorViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.error_text_view_item_footer_error) TextView errorTextView;
@BindView(R.id.retry_button_item_footer_error) Button retryButton;
@BindView(R.id.error_text_view_item_footer_error)
TextView errorTextView;
@BindView(R.id.retry_button_item_footer_error)
Button retryButton;
ErrorViewHolder(View itemView) {
super(itemView);
@ -223,12 +234,4 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R
ButterKnife.bind(this, itemView);
}
}
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
if(holder instanceof UserListingRecyclerViewAdapter.DataViewHolder) {
glide.clear(((UserListingRecyclerViewAdapter.DataViewHolder) holder).iconGifImageView);
((UserListingRecyclerViewAdapter.DataViewHolder) holder).subscribeButton.setVisibility(View.GONE);
}
}
}

View File

@ -3,13 +3,6 @@ package ml.docilealligator.infinityforreddit;
import com.google.android.material.appbar.AppBarLayout;
public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener {
// State
public enum State {
EXPANDED,
COLLAPSED,
IDLE
}
private AppBarStateChangeListener.State mCurrentState = AppBarStateChangeListener.State.IDLE;
@Override
@ -34,8 +27,16 @@ public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffset
/**
* Notifies on state change
*
* @param appBarLayout Layout
* @param state Collapse state
*/
public abstract void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state);
// State
public enum State {
EXPANDED,
COLLAPSED,
IDLE
}
}

View File

@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit;
import javax.inject.Singleton;
import dagger.Component;
import ml.docilealligator.infinityforreddit.Activity.AccountPostsActivity;
import ml.docilealligator.infinityforreddit.Activity.AccountSavedThingActivity;
import ml.docilealligator.infinityforreddit.Activity.CommentActivity;
@ -36,45 +37,79 @@ import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListing
import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment;
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment;
import dagger.Component;
@Singleton
@Component(modules = AppModule.class)
public interface AppComponent {
void inject(MainActivity mainActivity);
void inject(LoginActivity loginActivity);
void inject(PostFragment postFragment);
void inject(SubredditListingFragment subredditListingFragment);
void inject(UserListingFragment userListingFragment);
void inject(ViewPostDetailActivity viewPostDetailActivity);
void inject(ViewSubredditDetailActivity viewSubredditDetailActivity);
void inject(ViewUserDetailActivity viewUserDetailActivity);
void inject(CommentActivity commentActivity);
void inject(SubscribedThingListingActivity subscribedThingListingActivity);
void inject(PostTextActivity postTextActivity);
void inject(SubscribedSubredditsListingFragment subscribedSubredditsListingFragment);
void inject(PostLinkActivity postLinkActivity);
void inject(PostImageActivity postImageActivity);
void inject(PostVideoActivity postVideoActivity);
void inject(FlairBottomSheetFragment flairBottomSheetFragment);
void inject(RulesActivity rulesActivity);
void inject(CommentsListingFragment commentsListingFragment);
void inject(SubmitPostService submitPostService);
void inject(FilteredThingActivity filteredPostsActivity);
void inject(SearchResultActivity searchResultActivity);
void inject(SearchSubredditsResultActivity searchSubredditsResultActivity);
void inject(FollowedUsersListingFragment followedUsersListingFragment);
void inject(SubredditSelectionActivity subredditSelectionActivity);
void inject(EditPostActivity editPostActivity);
void inject(EditCommentActivity editCommentActivity);
void inject(AccountPostsActivity accountPostsActivity);
void inject(PullNotificationWorker pullNotificationWorker);
void inject(ViewMessageActivity viewMessageActivity);
void inject(NotificationPreferenceFragment notificationPreferenceFragment);
void inject(LinkResolverActivity linkResolverActivity);
void inject(SearchActivity searchActivity);
void inject(SettingsActivity settingsActivity);
void inject(MainPreferenceFragment mainPreferenceFragment);
void inject(AccountSavedThingActivity accountSavedThingActivity);
void inject(ViewImageActivity viewImageActivity);
}

View File

@ -22,7 +22,8 @@ class AppModule {
mApplication = application;
}
@Provides @Named("oauth")
@Provides
@Named("oauth")
@Singleton
Retrofit provideOauthRetrofit(OkHttpClient okHttpClient) {
return new Retrofit.Builder()
@ -32,7 +33,8 @@ class AppModule {
.build();
}
@Provides @Named("oauth_without_authenticator")
@Provides
@Named("oauth_without_authenticator")
@Singleton
Retrofit provideOauthWithoutAuthenticatorRetrofit() {
return new Retrofit.Builder()
@ -41,7 +43,8 @@ class AppModule {
.build();
}
@Provides @Named("no_oauth")
@Provides
@Named("no_oauth")
@Singleton
Retrofit provideRetrofit() {
return new Retrofit.Builder()
@ -50,7 +53,8 @@ class AppModule {
.build();
}
@Provides @Named("upload_media")
@Provides
@Named("upload_media")
@Singleton
Retrofit provideUploadMediaRetrofit() {
return new Retrofit.Builder()
@ -59,7 +63,8 @@ class AppModule {
.build();
}
@Provides @Named("upload_video")
@Provides
@Named("upload_video")
@Singleton
Retrofit provideUploadVideoRetrofit() {
return new Retrofit.Builder()

View File

@ -12,11 +12,6 @@ public class CheckIsFollowingUserAsyncTask extends AsyncTask<Void, Void, Void> {
private SubscribedUserData subscribedUserData;
private CheckIsFollowingUserListener checkIsFollowingUserListener;
public interface CheckIsFollowingUserListener {
void isSubscribed();
void isNotSubscribed();
}
public CheckIsFollowingUserAsyncTask(SubscribedUserDao subscribedUserDao, String username, String accountName,
CheckIsFollowingUserListener checkIsFollowingUserListener) {
this.subscribedUserDao = subscribedUserDao;
@ -40,4 +35,10 @@ public class CheckIsFollowingUserAsyncTask extends AsyncTask<Void, Void, Void> {
checkIsFollowingUserListener.isNotSubscribed();
}
}
public interface CheckIsFollowingUserListener {
void isSubscribed();
void isNotSubscribed();
}
}

View File

@ -13,11 +13,6 @@ public class CheckIsSubscribedToSubredditAsyncTask extends AsyncTask<Void, Void,
private SubscribedSubredditData subscribedSubredditData;
private CheckIsSubscribedToSubredditListener checkIsSubscribedToSubredditListener;
public interface CheckIsSubscribedToSubredditListener {
void isSubscribed();
void isNotSubscribed();
}
public CheckIsSubscribedToSubredditAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase,
String subredditName, String accountName,
CheckIsSubscribedToSubredditListener checkIsSubscribedToSubredditListener) {
@ -42,4 +37,10 @@ public class CheckIsSubscribedToSubredditAsyncTask extends AsyncTask<Void, Void,
checkIsSubscribedToSubredditListener.isNotSubscribed();
}
}
public interface CheckIsSubscribedToSubredditListener {
void isSubscribed();
void isNotSubscribed();
}
}

View File

@ -7,14 +7,9 @@ import ml.docilealligator.infinityforreddit.Account.AccountDao;
public class GetCurrentAccountAsyncTask extends AsyncTask<Void, Void, Void> {
public interface GetCurrentAccountAsyncTaskListener {
void success(Account account);
}
Account account;
AccountDao accountDao;
GetCurrentAccountAsyncTaskListener getCurrentAccountAsyncTaskListener;
public GetCurrentAccountAsyncTask(AccountDao accountDao, GetCurrentAccountAsyncTaskListener getCurrentAccountAsyncTaskListener) {
this.accountDao = accountDao;
this.getCurrentAccountAsyncTaskListener = getCurrentAccountAsyncTaskListener;
@ -30,4 +25,8 @@ public class GetCurrentAccountAsyncTask extends AsyncTask<Void, Void, Void> {
protected void onPostExecute(Void aVoid) {
getCurrentAccountAsyncTaskListener.success(account);
}
public interface GetCurrentAccountAsyncTaskListener {
void success(Account account);
}
}

View File

@ -16,10 +16,6 @@ import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUse
public class InsertSubscribedThingsAsyncTask extends AsyncTask<Void, Void, Void> {
public interface InsertSubscribedThingListener {
void insertSuccess();
}
private RedditDataRoomDatabase mRedditDataRoomDatabase;
private String mAccountName;
private SubscribedSubredditDao mSubscribedSubredditDao;
@ -29,7 +25,6 @@ public class InsertSubscribedThingsAsyncTask extends AsyncTask<Void, Void, Void>
private List<SubscribedUserData> subscribedUserData;
private List<SubredditData> subredditData;
private InsertSubscribedThingListener insertSubscribedThingListener;
public InsertSubscribedThingsAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, @Nullable String accountName,
List<SubscribedSubredditData> subscribedSubredditData,
List<SubscribedUserData> subscribedUserData,
@ -77,4 +72,8 @@ public class InsertSubscribedThingsAsyncTask extends AsyncTask<Void, Void, Void>
protected void onPostExecute(Void aVoid) {
insertSubscribedThingListener.insertSuccess();
}
public interface InsertSubscribedThingListener {
void insertSuccess();
}
}

View File

@ -2,18 +2,14 @@ package ml.docilealligator.infinityforreddit.AsyncTask;
import android.os.AsyncTask;
import ml.docilealligator.infinityforreddit.User.UserData;
import ml.docilealligator.infinityforreddit.User.UserDao;
import ml.docilealligator.infinityforreddit.User.UserData;
public class InsertUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
private UserDao userDao;
private UserData userData;
private InsertUserDataCallback insertUserDataCallback;
public interface InsertUserDataCallback {
void insertSuccess();
}
public InsertUserDataAsyncTask(UserDao userDao, UserData userData, InsertUserDataCallback insertUserDataCallback) {
this.userDao = userDao;
this.userData = userData;
@ -33,4 +29,8 @@ public class InsertUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
insertUserDataCallback.insertSuccess();
}
}
public interface InsertUserDataCallback {
void insertSuccess();
}
}

View File

@ -11,10 +11,6 @@ import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
import retrofit2.Retrofit;
public class LoadSubredditIconAsyncTask extends AsyncTask<Void, Void, Void> {
public interface LoadSubredditIconAsyncTaskListener {
void loadIconSuccess(String iconImageUrl);
}
private RedditDataRoomDatabase redditDataRoomDatabase;
private SubredditDao subredditDao;
private String subredditName;
@ -22,7 +18,6 @@ public class LoadSubredditIconAsyncTask extends AsyncTask<Void, Void, Void> {
private String iconImageUrl;
private boolean hasSubredditInDb;
private LoadSubredditIconAsyncTaskListener loadSubredditIconAsyncTaskListener;
public LoadSubredditIconAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, String subredditName, Retrofit retrofit,
LoadSubredditIconAsyncTaskListener loadSubredditIconAsyncTaskListener) {
this.redditDataRoomDatabase = redditDataRoomDatabase;
@ -69,4 +64,8 @@ public class LoadSubredditIconAsyncTask extends AsyncTask<Void, Void, Void> {
}
}
}
public interface LoadSubredditIconAsyncTaskListener {
void loadIconSuccess(String iconImageUrl);
}
}

View File

@ -3,22 +3,17 @@ 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 ml.docilealligator.infinityforreddit.User.UserData;
import retrofit2.Retrofit;
public class LoadUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
public interface LoadUserDataAsyncTaskListener {
void loadUserDataSuccess(String iconImageUrl);
}
private UserDao userDao;
private String userName;
private String iconImageUrl;
private boolean hasUserInDb;
private Retrofit retrofit;
private LoadUserDataAsyncTaskListener loadUserDataAsyncTaskListener;
public LoadUserDataAsyncTask(UserDao userDao, String userName, Retrofit retrofit, LoadUserDataAsyncTaskListener loadUserDataAsyncTaskListener) {
this.userDao = userDao;
this.userName = userName;
@ -56,4 +51,8 @@ public class LoadUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
});
}
}
public interface LoadUserDataAsyncTaskListener {
void loadUserDataSuccess(String iconImageUrl);
}
}

View File

@ -7,10 +7,6 @@ import ml.docilealligator.infinityforreddit.Account.AccountDao;
public class ParseAndInsertNewAccountAsyncTask extends AsyncTask<Void, Void, Void> {
public interface ParseAndInsertAccountListener {
void success();
}
private String username;
private String accessToken;
private String refreshToken;
@ -20,7 +16,6 @@ public class ParseAndInsertNewAccountAsyncTask extends AsyncTask<Void, Void, Voi
private String code;
private AccountDao accountDao;
private ParseAndInsertAccountListener parseAndInsertAccountListener;
public ParseAndInsertNewAccountAsyncTask(String username, String accessToken, String refreshToken, String profileImageUrl, String bannerImageUrl,
int karma, String code, AccountDao accountDao,
ParseAndInsertAccountListener parseAndInsertAccountListener) {
@ -48,4 +43,8 @@ public class ParseAndInsertNewAccountAsyncTask extends AsyncTask<Void, Void, Voi
protected void onPostExecute(Void aVoid) {
parseAndInsertAccountListener.success();
}
public interface ParseAndInsertAccountListener {
void success();
}
}

View File

@ -6,15 +6,10 @@ import ml.docilealligator.infinityforreddit.Account.Account;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
public class SwitchAccountAsyncTask extends AsyncTask<Void, Void, Void> {
public interface SwitchAccountAsyncTaskListener {
void switched(Account account);
}
private RedditDataRoomDatabase redditDataRoomDatabase;
private String newAccountName;
private Account account;
private SwitchAccountAsyncTaskListener switchAccountAsyncTaskListener;
public SwitchAccountAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, String newAccountName,
SwitchAccountAsyncTaskListener switchAccountAsyncTaskListener) {
this.redditDataRoomDatabase = redditDataRoomDatabase;
@ -34,4 +29,8 @@ public class SwitchAccountAsyncTask extends AsyncTask<Void, Void, Void> {
protected void onPostExecute(Void aVoid) {
switchAccountAsyncTaskListener.switched(account);
}
public interface SwitchAccountAsyncTaskListener {
void switched(Account account);
}
}

View File

@ -6,14 +6,9 @@ import ml.docilealligator.infinityforreddit.Account.AccountDao;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
public class SwitchToAnonymousAccountAsyncTask extends AsyncTask<Void, Void, Void> {
public interface SwitchToAnonymousAccountAsyncTaskListener {
void logoutSuccess();
}
private RedditDataRoomDatabase redditDataRoomDatabase;
private boolean removeCurrentAccount;
private SwitchToAnonymousAccountAsyncTaskListener switchToAnonymousAccountAsyncTaskListener;
public SwitchToAnonymousAccountAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, boolean removeCurrentAccount,
SwitchToAnonymousAccountAsyncTaskListener switchToAnonymousAccountAsyncTaskListener) {
this.redditDataRoomDatabase = redditDataRoomDatabase;
@ -35,4 +30,8 @@ public class SwitchToAnonymousAccountAsyncTask extends AsyncTask<Void, Void, Voi
protected void onPostExecute(Void aVoid) {
switchToAnonymousAccountAsyncTaskListener.logoutSuccess();
}
public interface SwitchToAnonymousAccountAsyncTaskListener {
void logoutSuccess();
}
}

View File

@ -9,7 +9,17 @@ 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;
public static final Creator<CommentData> CREATOR = new Creator<CommentData>() {
@Override
public CommentData createFromParcel(Parcel in) {
return new CommentData(in);
}
@Override
public CommentData[] newArray(int size) {
return new CommentData[size];
}
};
private String id;
private String fullName;
private String author;
@ -33,7 +43,6 @@ public class CommentData implements Parcelable {
private ArrayList<CommentData> children;
private ArrayList<String> moreChildrenFullnames;
private int moreChildrenStartingIndex;
private boolean isPlaceHolder;
private boolean isLoadingMoreChildren;
private boolean loadMoreChildrenFailed;
@ -102,18 +111,6 @@ public class CommentData implements Parcelable {
loadMoreChildrenFailed = in.readByte() != 0;
}
public static final Creator<CommentData> CREATOR = new Creator<CommentData>() {
@Override
public CommentData createFromParcel(Parcel in) {
return new CommentData(in);
}
@Override
public CommentData[] newArray(int size) {
return new CommentData[size];
}
};
public String getId() {
return id;
}

View File

@ -184,11 +184,6 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
private boolean parseFailed;
private ParseCommentAsyncTaskListener parseCommentAsyncTaskListener;
interface ParseCommentAsyncTaskListener {
void parseSuccessful(ArrayList<CommentData> comments, String after);
void parseFailed();
}
ParseCommentAsyncTask(String response, Locale locale, ParseCommentAsyncTaskListener parseCommentAsyncTaskListener) {
this.locale = locale;
this.parseCommentAsyncTaskListener = parseCommentAsyncTaskListener;
@ -214,7 +209,8 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
try {
JSONObject commentJSON = commentsJSONArray.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
comments.add(ParseComment.parseSingleComment(commentJSON, 0, locale));
} catch (JSONException ignored) {}
} catch (JSONException ignored) {
}
}
return comments;
}
@ -228,5 +224,11 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
parseCommentAsyncTaskListener.parseFailed();
}
}
interface ParseCommentAsyncTaskListener {
void parseSuccessful(ArrayList<CommentData> comments, String after);
void parseFailed();
}
}
}

View File

@ -10,6 +10,11 @@ public enum ContentFontStyle {
private int resId;
private String title;
ContentFontStyle(int resId, String title) {
this.resId = resId;
this.title = title;
}
public int getResId() {
return resId;
}
@ -17,9 +22,4 @@ public enum ContentFontStyle {
public String getTitle() {
return title;
}
ContentFontStyle(int resId, String title) {
this.resId = resId;
this.title = title;
}
}

View File

@ -9,6 +9,17 @@ import pl.droidsonroids.gif.GifImageView;
public class AspectRatioGifImageView extends GifImageView {
private float ratio;
public AspectRatioGifImageView(Context context) {
super(context);
this.ratio = 1.0F;
}
public AspectRatioGifImageView(Context context, AttributeSet attrs) {
super(context, attrs);
this.ratio = 1.0F;
this.init(context, attrs);
}
public final float getRatio() {
return this.ratio;
}
@ -40,15 +51,4 @@ public class AspectRatioGifImageView extends GifImageView {
this.setMeasuredDimension(width, height);
}
}
public AspectRatioGifImageView(Context context) {
super(context);
this.ratio = 1.0F;
}
public AspectRatioGifImageView(Context context, AttributeSet attrs) {
super(context, attrs);
this.ratio = 1.0F;
this.init(context, attrs);
}
}

View File

@ -11,11 +11,6 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class DeleteThing {
public interface DeleteThingListener {
void deleteSuccess();
void deleteFailed();
}
public static void delete(Retrofit oauthRetrofit, String fullname, String accessToken, DeleteThingListener deleteThingListener) {
Map<String, String> params = new HashMap<>();
params.put(RedditUtils.ID_KEY, fullname);
@ -35,4 +30,10 @@ public class DeleteThing {
}
});
}
public interface DeleteThingListener {
void deleteSuccess();
void deleteFailed();
}
}

View File

@ -1,3 +1,4 @@
package ml.docilealligator.infinityforreddit.Event;
public class ChangeFontSizeEvent { }
public class ChangeFontSizeEvent {
}

View File

@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.Event;
public class ChangeNSFWBlurEvent {
public boolean needBlurNSFW;
public ChangeNSFWBlurEvent(boolean needBlurNSFW) {
this.needBlurNSFW = needBlurNSFW;
}

View File

@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.Event;
public class ChangeNSFWEvent {
public boolean nsfw;
public ChangeNSFWEvent(boolean nsfw) {
this.nsfw = nsfw;
}

View File

@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.Event;
public class ChangeSpoilerBlurEvent {
public boolean needBlurSpoiler;
public ChangeSpoilerBlurEvent(boolean needBlurSpoiler) {
this.needBlurSpoiler = needBlurSpoiler;
}

View File

@ -2,7 +2,10 @@ package ml.docilealligator.infinityforreddit.Event;
public class SwitchAccountEvent {
public String excludeActivityClassName;
public SwitchAccountEvent() {}
public SwitchAccountEvent() {
}
public SwitchAccountEvent(String excludeActivityClassName) {
this.excludeActivityClassName = excludeActivityClassName;
}

View File

@ -12,16 +12,6 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class FetchComment {
public interface FetchCommentListener {
void onFetchCommentSuccess(ArrayList<CommentData> expandedComments, String parentId, ArrayList<String> children);
void onFetchCommentFailed();
}
public interface FetchMoreCommentListener {
void onFetchMoreCommentSuccess(ArrayList<CommentData> expandedComments, int childrenStartingIndex);
void onFetchMoreCommentFailed();
}
public static void fetchComments(Retrofit retrofit, @Nullable String accessToken, String article, String commentId,
Locale locale, FetchCommentListener fetchCommentListener) {
RedditAPI api = retrofit.create(RedditAPI.class);
@ -124,4 +114,16 @@ public class FetchComment {
}
});
}
public interface FetchCommentListener {
void onFetchCommentSuccess(ArrayList<CommentData> expandedComments, String parentId, ArrayList<String> children);
void onFetchCommentFailed();
}
public interface FetchMoreCommentListener {
void onFetchMoreCommentSuccess(ArrayList<CommentData> expandedComments, int childrenStartingIndex);
void onFetchMoreCommentFailed();
}
}

View File

@ -15,11 +15,6 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class FetchFlairs {
public interface FetchFlairsInSubredditListener {
void fetchSuccessful(ArrayList<Flair> flairs);
void fetchFailed();
}
public static void fetchFlairsInSubreddit(Retrofit oauthRetrofit, String accessToken, String subredditName, FetchFlairsInSubredditListener fetchFlairsInSubredditListener) {
RedditAPI api = oauthRetrofit.create(RedditAPI.class);
@ -54,15 +49,15 @@ public class FetchFlairs {
});
}
private static class ParseFlairsAsyncTask extends AsyncTask<Void, ArrayList<Flair>, ArrayList<Flair>> {
interface ParseFlairsAsyncTaskListener {
void parseSuccessful(ArrayList<Flair> flairs);
void parseFailed();
public interface FetchFlairsInSubredditListener {
void fetchSuccessful(ArrayList<Flair> flairs);
void fetchFailed();
}
private static class ParseFlairsAsyncTask extends AsyncTask<Void, ArrayList<Flair>, ArrayList<Flair>> {
private String response;
private ParseFlairsAsyncTaskListener parseFlairsAsyncTaskListener;
ParseFlairsAsyncTask(String response, ParseFlairsAsyncTaskListener parseFlairsAsyncTaskListener) {
this.response = response;
this.parseFlairsAsyncTaskListener = parseFlairsAsyncTaskListener;
@ -95,5 +90,11 @@ public class FetchFlairs {
parseFlairsAsyncTaskListener.parseFailed();
}
}
interface ParseFlairsAsyncTaskListener {
void parseSuccessful(ArrayList<Flair> flairs);
void parseFailed();
}
}
}

View File

@ -21,11 +21,6 @@ import retrofit2.Retrofit;
public class FetchMessages {
interface FetchMessagesListener {
void fetchSuccess(ArrayList<Message> messages, @Nullable String after);
void fetchFailed();
}
public static final String WHERE_INBOX = "inbox";
public static final String WHERE_UNREAD = "unread";
public static final String WHERE_SENT = "sent";
@ -100,18 +95,19 @@ public class FetchMessages {
return messages;
}
private static class ParseMessageAsnycTask extends AsyncTask<Void, Void, Void> {
interface FetchMessagesListener {
void fetchSuccess(ArrayList<Message> messages, @Nullable String after);
interface ParseMessageAsyncTaskListener {
void parseSuccess(ArrayList<Message> messages, @Nullable String after);
void fetchFailed();
}
private static class ParseMessageAsnycTask extends AsyncTask<Void, Void, Void> {
private String response;
private Locale locale;
private ArrayList<Message> messages;
private String after;
private ParseMessageAsyncTaskListener parseMessageAsyncTaskListener;
ParseMessageAsnycTask(String response, Locale locale, ParseMessageAsyncTaskListener parseMessageAsnycTaskListener) {
this.response = response;
this.locale = locale;
@ -135,5 +131,9 @@ public class FetchMessages {
super.onPostExecute(aVoid);
parseMessageAsyncTaskListener.parseSuccess(messages, after);
}
interface ParseMessageAsyncTaskListener {
void parseSuccess(ArrayList<Message> messages, @Nullable String after);
}
}
}

View File

@ -1,7 +1,5 @@
package ml.docilealligator.infinityforreddit;
import android.util.Log;
import androidx.annotation.NonNull;
import retrofit2.Call;
@ -10,11 +8,6 @@ import retrofit2.Retrofit;
public class FetchMyInfo {
public interface FetchUserMyListener {
void onFetchMyInfoSuccess(String response);
void onFetchMyInfoFail();
}
public static void fetchAccountInfo(final Retrofit retrofit, String accessToken,
final FetchUserMyListener fetchUserMyListener) {
RedditAPI api = retrofit.create(RedditAPI.class);
@ -36,4 +29,10 @@ public class FetchMyInfo {
}
});
}
public interface FetchUserMyListener {
void onFetchMyInfoSuccess(String response);
void onFetchMyInfoFail();
}
}

View File

@ -10,11 +10,6 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class FetchPost {
public interface FetchPostListener {
void fetchPostSuccess(Post post);
void fetchPostFailed();
}
public static void fetchPost(Retrofit retrofit, String id, String accessToken, Locale locale, FetchPostListener fetchPostListener) {
Call<String> postCall;
if (accessToken == null) {
@ -48,4 +43,10 @@ public class FetchPost {
}
});
}
public interface FetchPostListener {
void fetchPostSuccess(Post post);
void fetchPostFailed();
}
}

View File

@ -11,16 +11,6 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class FetchSubredditData {
public interface FetchSubredditDataListener {
void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers);
void onFetchSubredditDataFail();
}
interface FetchSubredditListingDataListener {
void onFetchSubredditListingDataSuccess(ArrayList<SubredditData> subredditData, String after);
void onFetchSubredditListingDataFail();
}
public static void fetchSubredditData(Retrofit retrofit, String subredditName, final FetchSubredditDataListener fetchSubredditDataListener) {
RedditAPI api = retrofit.create(RedditAPI.class);
@ -83,4 +73,16 @@ public class FetchSubredditData {
}
});
}
public interface FetchSubredditDataListener {
void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers);
void onFetchSubredditDataFail();
}
interface FetchSubredditListingDataListener {
void onFetchSubredditListingDataSuccess(ArrayList<SubredditData> subredditData, String after);
void onFetchSubredditListingDataFail();
}
}

View File

@ -13,13 +13,6 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class FetchSubscribedThing {
public interface FetchSubscribedThingListener {
void onFetchSubscribedThingSuccess(ArrayList<SubscribedSubredditData> subscribedSubredditData,
ArrayList<SubscribedUserData> subscribedUserData,
ArrayList<SubredditData> subredditData);
void onFetchSubscribedThingFail();
}
public static void fetchSubscribedThing(final Retrofit retrofit, String accessToken, String accountName,
final String lastItem, final ArrayList<SubscribedSubredditData> subscribedSubredditData,
final ArrayList<SubscribedUserData> subscribedUserData,
@ -67,4 +60,12 @@ public class FetchSubscribedThing {
}
});
}
public interface FetchSubscribedThingListener {
void onFetchSubscribedThingSuccess(ArrayList<SubscribedSubredditData> subscribedSubredditData,
ArrayList<SubscribedUserData> subscribedUserData,
ArrayList<SubredditData> subredditData);
void onFetchSubscribedThingFail();
}
}

View File

@ -10,16 +10,6 @@ import retrofit2.Callback;
import retrofit2.Retrofit;
public class FetchUserData {
public interface FetchUserDataListener {
void onFetchUserDataSuccess(UserData userData);
void onFetchUserDataFailed();
}
public interface FetchUserListingDataListener {
void onFetchUserListingDataSuccess(ArrayList<UserData> userData, String after);
void onFetchUserListingDataFailed();
}
public static void fetchUserData(Retrofit retrofit, String userName, FetchUserDataListener fetchUserDataListener) {
RedditAPI api = retrofit.create(RedditAPI.class);
@ -82,4 +72,16 @@ public class FetchUserData {
}
});
}
public interface FetchUserDataListener {
void onFetchUserDataSuccess(UserData userData);
void onFetchUserDataFailed();
}
public interface FetchUserListingDataListener {
void onFetchUserListingDataSuccess(ArrayList<UserData> userData, String after);
void onFetchUserListingDataFailed();
}
}

View File

@ -4,6 +4,17 @@ import android.os.Parcel;
import android.os.Parcelable;
public class Flair implements Parcelable {
public static final Creator<Flair> CREATOR = new Creator<Flair>() {
@Override
public Flair createFromParcel(Parcel in) {
return new Flair(in);
}
@Override
public Flair[] newArray(int size) {
return new Flair[size];
}
};
private String id;
private String text;
private boolean editable;
@ -20,18 +31,6 @@ public class Flair implements Parcelable {
editable = in.readByte() != 0;
}
public static final Creator<Flair> CREATOR = new Creator<Flair>() {
@Override
public Flair createFromParcel(Parcel in) {
return new Flair(in);
}
@Override
public Flair[] newArray(int size) {
return new Flair[size];
}
};
public String getId() {
return id;
}

View File

@ -9,6 +9,11 @@ public enum FontStyle {
private int resId;
private String title;
FontStyle(int resId, String title) {
this.resId = resId;
this.title = title;
}
public int getResId() {
return resId;
}
@ -16,9 +21,4 @@ public enum FontStyle {
public String getTitle() {
return title;
}
FontStyle(int resId, String title) {
this.resId = resId;
this.title = title;
}
}

View File

@ -55,33 +55,32 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
private static final String ACCESS_TOKEN_STATE = "ATS";
@BindView(R.id.coordinator_layout_comments_listing_fragment) CoordinatorLayout mCoordinatorLayout;
@BindView(R.id.recycler_view_comments_listing_fragment) RecyclerView mCommentRecyclerView;
@BindView(R.id.progress_bar_comments_listing_fragment) CircleProgressBar mProgressBar;
@BindView(R.id.fetch_comments_info_linear_layout_comments_listing_fragment) LinearLayout mFetchCommentInfoLinearLayout;
@BindView(R.id.fetch_comments_info_image_view_comments_listing_fragment) ImageView mFetchCommentInfoImageView;
@BindView(R.id.fetch_comments_info_text_view_comments_listing_fragment) TextView mFetchCommentInfoTextView;
private boolean mNullAccessToken = false;
private String mAccessToken;
private RequestManager mGlide;
private Activity activity;
private CommentsListingRecyclerViewAdapter mAdapter;
@BindView(R.id.coordinator_layout_comments_listing_fragment)
CoordinatorLayout mCoordinatorLayout;
@BindView(R.id.recycler_view_comments_listing_fragment)
RecyclerView mCommentRecyclerView;
@BindView(R.id.progress_bar_comments_listing_fragment)
CircleProgressBar mProgressBar;
@BindView(R.id.fetch_comments_info_linear_layout_comments_listing_fragment)
LinearLayout mFetchCommentInfoLinearLayout;
@BindView(R.id.fetch_comments_info_image_view_comments_listing_fragment)
ImageView mFetchCommentInfoImageView;
@BindView(R.id.fetch_comments_info_text_view_comments_listing_fragment)
TextView mFetchCommentInfoTextView;
CommentViewModel mCommentViewModel;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject @Named("oauth")
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
private boolean mNullAccessToken = false;
private String mAccessToken;
private RequestManager mGlide;
private Activity activity;
private CommentsListingRecyclerViewAdapter mAdapter;
public CommentsListingFragment() {
// Required empty public constructor

View File

@ -36,36 +36,29 @@ import retrofit2.Retrofit;
*/
public class FlairBottomSheetFragment extends BottomSheetDialogFragment {
public interface FlairSelectionCallback {
void flairSelected(Flair flair);
}
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;
@BindView(R.id.recycler_view_bottom_sheet_fragment) RecyclerView recyclerView;
private String mAccessToken;
private String mSubredditName;
private Activity mActivity;
private FlairBottomSheetRecyclerViewAdapter mAdapter;
@BindView(R.id.progress_bar_flair_bottom_sheet_fragment)
ProgressBar progressBar;
@BindView(R.id.error_text_view_flair_bottom_sheet_fragment)
TextView errorTextView;
@BindView(R.id.recycler_view_bottom_sheet_fragment)
RecyclerView recyclerView;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
private String mAccessToken;
private String mSubredditName;
private Activity mActivity;
private FlairBottomSheetRecyclerViewAdapter mAdapter;
public FlairBottomSheetFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@ -122,4 +115,8 @@ public class FlairBottomSheetFragment extends BottomSheetDialogFragment {
}
});
}
public interface FlairSelectionCallback {
void flairSelected(Flair flair);
}
}

View File

@ -22,13 +22,13 @@ import com.bumptech.glide.RequestManager;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
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;
/**
@ -38,23 +38,22 @@ public class FollowedUsersListingFragment extends Fragment {
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;
@BindView(R.id.no_subscriptions_image_view_followed_users_listing_fragment) ImageView mImageView;
@BindView(R.id.recycler_view_followed_users_listing_fragment)
RecyclerView mRecyclerView;
@BindView(R.id.no_subscriptions_linear_layout_followed_users_listing_fragment)
LinearLayout mLinearLayout;
@BindView(R.id.no_subscriptions_image_view_followed_users_listing_fragment)
ImageView mImageView;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
private Activity mActivity;
private RequestManager mGlide;
private SubscribedUserViewModel mSubscribedUserViewModel;
public FollowedUsersListingFragment() {
// Required empty public constructor
}
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View File

@ -32,14 +32,14 @@ public class ModifyCommentBottomSheetFragment extends RoundedBottomSheetDialogFr
public static final String EXTRA_COMMENT_CONTENT = "ECC";
public static final String EXTRA_ACCESS_TOKEN = "EAT";
public static final String EXTRA_POSITION = "EP";
@BindView(R.id.edit_text_view_modify_comment_bottom_sheet_fragment)
TextView editTextView;
@BindView(R.id.delete_text_view_modify_comment_bottom_sheet_fragment)
TextView deleteTextView;
public ModifyCommentBottomSheetFragment() {
// Required empty public constructor
}
@BindView(R.id.edit_text_view_modify_comment_bottom_sheet_fragment) TextView editTextView;
@BindView(R.id.delete_text_view_modify_comment_bottom_sheet_fragment) TextView deleteTextView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View File

@ -82,46 +82,42 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
private static final String IS_IN_LAZY_MODE_STATE = "IILMS";
private static final String RECYCLER_VIEW_POSITION_STATE = "RVPS";
@BindView(R.id.recycler_view_post_fragment) RecyclerView mPostRecyclerView;
@BindView(R.id.progress_bar_post_fragment) CircleProgressBar mProgressBar;
@BindView(R.id.fetch_post_info_linear_layout_post_fragment) LinearLayout mFetchPostInfoLinearLayout;
@BindView(R.id.fetch_post_info_image_view_post_fragment) ImageView mFetchPostInfoImageView;
@BindView(R.id.fetch_post_info_text_view_post_fragment) TextView mFetchPostInfoTextView;
@BindView(R.id.recycler_view_post_fragment)
RecyclerView mPostRecyclerView;
@BindView(R.id.progress_bar_post_fragment)
CircleProgressBar mProgressBar;
@BindView(R.id.fetch_post_info_linear_layout_post_fragment)
LinearLayout mFetchPostInfoLinearLayout;
@BindView(R.id.fetch_post_info_image_view_post_fragment)
ImageView mFetchPostInfoImageView;
@BindView(R.id.fetch_post_info_text_view_post_fragment)
TextView mFetchPostInfoTextView;
PostViewModel mPostViewModel;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private RequestManager mGlide;
private Activity activity;
private LinearLayoutManager mLinearLayoutManager;
private StaggeredGridLayoutManager mStaggeredGridLayoutManager;
private boolean isInLazyMode = false;
private boolean isLazyModePaused = false;
private boolean hasPost = false;
private PostRecyclerViewAdapter mAdapter;
private RecyclerView.SmoothScroller smoothScroller;
PostViewModel mPostViewModel;
private Window window;
private Handler lazyModeHandler;
private LazyModeRunnable lazyModeRunnable;
private CountDownTimer resumeLazyModeCountDownTimer;
private float lazyModeInterval;
@Inject @Named("no_oauth")
Retrofit mRetrofit;
@Inject @Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
public PostFragment() {
// Required empty public constructor
}
@ -422,7 +418,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
stopLazyMode();
}
mFetchPostInfoLinearLayout.setOnClickListener(view -> {});
mFetchPostInfoLinearLayout.setOnClickListener(view -> {
});
showErrorView(R.string.no_posts);
}
});

View File

@ -24,25 +24,22 @@ import ml.docilealligator.infinityforreddit.R;
*/
public class PostTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment {
public interface PostTypeSelectionCallback {
void postTypeSelected(int postType);
}
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;
@BindView(R.id.image_type_linear_layout_post_type_bottom_sheet_fragment) LinearLayout imageTypeLinearLayout;
@BindView(R.id.video_type_linear_layout_post_type_bottom_sheet_fragment) LinearLayout videoTypeLinearLayout;
@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;
@BindView(R.id.image_type_linear_layout_post_type_bottom_sheet_fragment)
LinearLayout imageTypeLinearLayout;
@BindView(R.id.video_type_linear_layout_post_type_bottom_sheet_fragment)
LinearLayout videoTypeLinearLayout;
public PostTypeBottomSheetFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@ -79,4 +76,9 @@ public class PostTypeBottomSheetFragment extends RoundedBottomSheetDialogFragmen
return rootView;
}
public interface PostTypeSelectionCallback {
void postTypeSelected(int postType);
}
}

View File

@ -25,21 +25,20 @@ import ml.docilealligator.infinityforreddit.R;
*/
public class SearchPostSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment {
public interface SearchSortTypeSelectionCallback {
void searchSortTypeSelected(String sortType);
}
@BindView(R.id.relevance_type_text_view_search_sort_type_bottom_sheet_fragment) TextView relevanceTypeTextView;
@BindView(R.id.hot_type_text_view_search_sort_type_bottom_sheet_fragment) TextView hotTypeTextView;
@BindView(R.id.top_type_text_view_search_sort_type_bottom_sheet_fragment) TextView topTypeTextView;
@BindView(R.id.new_type_text_view_search_sort_type_bottom_sheet_fragment) TextView newTypeTextView;
@BindView(R.id.comments_type_text_view_search_sort_type_bottom_sheet_fragment) TextView commentsTypeTextView;
@BindView(R.id.relevance_type_text_view_search_sort_type_bottom_sheet_fragment)
TextView relevanceTypeTextView;
@BindView(R.id.hot_type_text_view_search_sort_type_bottom_sheet_fragment)
TextView hotTypeTextView;
@BindView(R.id.top_type_text_view_search_sort_type_bottom_sheet_fragment)
TextView topTypeTextView;
@BindView(R.id.new_type_text_view_search_sort_type_bottom_sheet_fragment)
TextView newTypeTextView;
@BindView(R.id.comments_type_text_view_search_sort_type_bottom_sheet_fragment)
TextView commentsTypeTextView;
public SearchPostSortTypeBottomSheetFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@ -81,4 +80,9 @@ public class SearchPostSortTypeBottomSheetFragment extends RoundedBottomSheetDia
return rootView;
}
public interface SearchSortTypeSelectionCallback {
void searchSortTypeSelected(String sortType);
}
}

View File

@ -25,20 +25,15 @@ import ml.docilealligator.infinityforreddit.R;
*/
public class SearchUserAndSubredditSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment {
public interface SearchUserAndSubredditSortTypeSelectionCallback {
void searchUserAndSubredditSortTypeSelected(String sortType, int fragmentPosition);
}
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;
@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;
public SearchUserAndSubredditSortTypeBottomSheetFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@ -67,4 +62,9 @@ public class SearchUserAndSubredditSortTypeBottomSheetFragment extends RoundedBo
return rootView;
}
public interface SearchUserAndSubredditSortTypeSelectionCallback {
void searchUserAndSubredditSortTypeSelected(String sortType, int fragmentPosition);
}
}

View File

@ -26,25 +26,25 @@ import ml.docilealligator.infinityforreddit.R;
*/
public class SortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment {
public interface SortTypeSelectionCallback {
void sortTypeSelected(String sortType);
}
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;
@BindView(R.id.new_type_text_view_sort_type_bottom_sheet_fragment) TextView newTypeTextView;
@BindView(R.id.random_type_text_view_sort_type_bottom_sheet_fragment) TextView randomTypeTextView;
@BindView(R.id.rising_type_text_view_sort_type_bottom_sheet_fragment) TextView risingTypeTextView;
@BindView(R.id.top_type_text_view_sort_type_bottom_sheet_fragment) TextView topTypeTextView;
@BindView(R.id.controversial_type_text_view_sort_type_bottom_sheet_fragment) TextView controversialTypeTextView;
@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;
@BindView(R.id.new_type_text_view_sort_type_bottom_sheet_fragment)
TextView newTypeTextView;
@BindView(R.id.random_type_text_view_sort_type_bottom_sheet_fragment)
TextView randomTypeTextView;
@BindView(R.id.rising_type_text_view_sort_type_bottom_sheet_fragment)
TextView risingTypeTextView;
@BindView(R.id.top_type_text_view_sort_type_bottom_sheet_fragment)
TextView topTypeTextView;
@BindView(R.id.controversial_type_text_view_sort_type_bottom_sheet_fragment)
TextView controversialTypeTextView;
public SortTypeBottomSheetFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@ -100,4 +100,9 @@ public class SortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragmen
return rootView;
}
public interface SortTypeSelectionCallback {
void sortTypeSelected(String sortType);
}
}

View File

@ -31,13 +31,13 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Activity.SearchSubredditsResultActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity;
import ml.docilealligator.infinityforreddit.Adapter.SubredditListingRecyclerViewAdapter;
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;
@ -52,27 +52,29 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
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;
@BindView(R.id.progress_bar_subreddit_listing_fragment) CircleProgressBar mProgressBar;
@BindView(R.id.fetch_subreddit_listing_info_linear_layout_subreddit_listing_fragment) LinearLayout mFetchSubredditListingInfoLinearLayout;
@BindView(R.id.fetch_subreddit_listing_info_image_view_subreddit_listing_fragment) ImageView mFetchSubredditListingInfoImageView;
@BindView(R.id.fetch_subreddit_listing_info_text_view_subreddit_listing_fragment) TextView mFetchSubredditListingInfoTextView;
private LinearLayoutManager mLinearLayoutManager;
private SubredditListingRecyclerViewAdapter mAdapter;
@BindView(R.id.coordinator_layout_subreddit_listing_fragment)
CoordinatorLayout mCoordinatorLayout;
@BindView(R.id.recycler_view_subreddit_listing_fragment)
RecyclerView mSubredditListingRecyclerView;
@BindView(R.id.progress_bar_subreddit_listing_fragment)
CircleProgressBar mProgressBar;
@BindView(R.id.fetch_subreddit_listing_info_linear_layout_subreddit_listing_fragment)
LinearLayout mFetchSubredditListingInfoLinearLayout;
@BindView(R.id.fetch_subreddit_listing_info_image_view_subreddit_listing_fragment)
ImageView mFetchSubredditListingInfoImageView;
@BindView(R.id.fetch_subreddit_listing_info_text_view_subreddit_listing_fragment)
TextView mFetchSubredditListingInfoTextView;
SubredditListingViewModel mSubredditListingViewModel;
@Inject @Named("no_oauth")
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject @Named("oauth")
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase redditDataRoomDatabase;
private LinearLayoutManager mLinearLayoutManager;
private SubredditListingRecyclerViewAdapter mAdapter;
public SubredditListingFragment() {
// Required empty public constructor

View File

@ -43,18 +43,17 @@ public class SubscribedSubredditsListingFragment extends Fragment {
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;
@BindView(R.id.no_subscriptions_image_view_subreddits_listing_fragment) ImageView mImageView;
private Activity mActivity;
private RequestManager mGlide;
private SubscribedSubredditViewModel mSubscribedSubredditViewModel;
@BindView(R.id.recycler_view_subscribed_subreddits_listing_fragment)
RecyclerView mRecyclerView;
@BindView(R.id.no_subscriptions_linear_layout_subreddits_listing_fragment)
LinearLayout mLinearLayout;
@BindView(R.id.no_subscriptions_image_view_subreddits_listing_fragment)
ImageView mImageView;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
private Activity mActivity;
private RequestManager mGlide;
private SubscribedSubredditViewModel mSubscribedSubredditViewModel;
public SubscribedSubredditsListingFragment() {
// Required empty public constructor

View File

@ -26,13 +26,13 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Adapter.UserListingRecyclerViewAdapter;
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;
@ -46,29 +46,30 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato
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;
@BindView(R.id.progress_bar_user_listing_fragment) CircleProgressBar mProgressBar;
@BindView(R.id.fetch_user_listing_info_linear_layout_user_listing_fragment) LinearLayout mFetchUserListingInfoLinearLayout;
@BindView(R.id.fetch_user_listing_info_image_view_user_listing_fragment) ImageView mFetchUserListingInfoImageView;
@BindView(R.id.fetch_user_listing_info_text_view_user_listing_fragment) TextView mFetchUserListingInfoTextView;
private LinearLayoutManager mLinearLayoutManager;
private String mQuery;
private UserListingRecyclerViewAdapter mAdapter;
@BindView(R.id.coordinator_layout_user_listing_fragment)
CoordinatorLayout mCoordinatorLayout;
@BindView(R.id.recycler_view_user_listing_fragment)
RecyclerView mUserListingRecyclerView;
@BindView(R.id.progress_bar_user_listing_fragment)
CircleProgressBar mProgressBar;
@BindView(R.id.fetch_user_listing_info_linear_layout_user_listing_fragment)
LinearLayout mFetchUserListingInfoLinearLayout;
@BindView(R.id.fetch_user_listing_info_image_view_user_listing_fragment)
ImageView mFetchUserListingInfoImageView;
@BindView(R.id.fetch_user_listing_info_text_view_user_listing_fragment)
TextView mFetchUserListingInfoTextView;
UserListingViewModel mUserListingViewModel;
@Inject @Named("no_oauth")
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject @Named("oauth")
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase redditDataRoomDatabase;
private LinearLayoutManager mLinearLayoutManager;
private String mQuery;
private UserListingRecyclerViewAdapter mAdapter;
public UserListingFragment() {
// Required empty public constructor

View File

@ -26,22 +26,19 @@ import ml.docilealligator.infinityforreddit.R;
*/
public class UserThingSortTypeBottomSheetFragment extends RoundedBottomSheetDialogFragment {
public interface UserThingSortTypeSelectionCallback {
void userThingSortTypeSelected(String sortType);
}
static final String EXTRA_NO_BEST_TYPE = "ENBT";
@BindView(R.id.new_type_text_view_user_thing_sort_type_bottom_sheet_fragment) TextView newTypeTextView;
@BindView(R.id.hot_type_text_view_user_thing_sort_type_bottom_sheet_fragment) TextView hotTypeTextView;
@BindView(R.id.top_type_text_view_user_thing_sort_type_bottom_sheet_fragment) TextView topTypeTextView;
@BindView(R.id.controversial_type_text_view_user_thing_sort_type_bottom_sheet_fragment) TextView controversialTypeTextView;
@BindView(R.id.new_type_text_view_user_thing_sort_type_bottom_sheet_fragment)
TextView newTypeTextView;
@BindView(R.id.hot_type_text_view_user_thing_sort_type_bottom_sheet_fragment)
TextView hotTypeTextView;
@BindView(R.id.top_type_text_view_user_thing_sort_type_bottom_sheet_fragment)
TextView topTypeTextView;
@BindView(R.id.controversial_type_text_view_user_thing_sort_type_bottom_sheet_fragment)
TextView controversialTypeTextView;
public UserThingSortTypeBottomSheetFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@ -87,4 +84,9 @@ public class UserThingSortTypeBottomSheetFragment extends RoundedBottomSheetDial
return rootView;
}
public interface UserThingSortTypeSelectionCallback {
void userThingSortTypeSelected(String sortType);
}
}

View File

@ -2,13 +2,23 @@ package ml.docilealligator.infinityforreddit;
public interface FragmentCommunicator {
void refresh();
default void changeNSFW(boolean nsfw) {};
default void changeNSFW(boolean nsfw) {
}
default boolean startLazyMode() {
return false;
}
default void stopLazyMode() {}
default void resumeLazyMode(boolean resumeNow) {}
default void pauseLazyMode(boolean startTimer) {}
default void stopLazyMode() {
}
default void resumeLazyMode(boolean resumeNow) {
}
default void pauseLazyMode(boolean startTimer) {
}
default boolean isInLazyMode() {
return false;
}

View File

@ -11,11 +11,6 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class HidePost {
public interface HidePostListener {
void success();
void failed();
}
public static void hidePost(Retrofit oauthRetrofit, String accessToken, String fullname,
HidePostListener hidePostListener) {
Map<String, String> params = new HashMap<>();
@ -57,4 +52,10 @@ public class HidePost {
}
});
}
public interface HidePostListener {
void success();
void failed();
}
}

View File

@ -1,7 +1,5 @@
package ml.docilealligator.infinityforreddit;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.MutableLiveData;

View File

@ -1,29 +1,22 @@
package ml.docilealligator.infinityforreddit;
public class NetworkState {
public enum Status{
LOADING,
SUCCESS,
FAILED
}
private final Status status;
private final String msg;
static final NetworkState LOADED;
static final NetworkState LOADING;
NetworkState(Status status, String msg) {
this.status = status;
this.msg = msg;
}
static {
LOADED = new NetworkState(Status.SUCCESS, "Success");
LOADING = new NetworkState(Status.LOADING, "Loading");
}
private final Status status;
private final String msg;
NetworkState(Status status, String msg) {
this.status = status;
this.msg = msg;
}
public Status getStatus() {
return status;
}
@ -31,4 +24,10 @@ public class NetworkState {
public String getMsg() {
return msg;
}
public enum Status {
LOADING,
SUCCESS,
FAILED
}
}

View File

@ -7,16 +7,17 @@ import org.json.JSONException;
import org.json.JSONObject;
public class ParseAndSaveAccountInfo {
public interface ParseAndSaveAccountInfoListener {
void onParseMyInfoSuccess(String name, String profileImageUrl, String bannerImageUrl, int karma);
void onParseMyInfoFail();
}
public static void parseAndSaveAccountInfo(String response, RedditDataRoomDatabase redditDataRoomDatabase,
ParseAndSaveAccountInfoListener parseAndSaveAccountInfoListener) {
new ParseAndSaveAccountInfoAsyncTask(response, redditDataRoomDatabase, parseAndSaveAccountInfoListener).execute();
}
public interface ParseAndSaveAccountInfoListener {
void onParseMyInfoSuccess(String name, String profileImageUrl, String bannerImageUrl, int karma);
void onParseMyInfoFail();
}
private static class ParseAndSaveAccountInfoAsyncTask extends AsyncTask<Void, Void, Void> {
private JSONObject jsonResponse;
private RedditDataRoomDatabase redditDataRoomDatabase;

View File

@ -19,17 +19,6 @@ import static ml.docilealligator.infinityforreddit.CommentData.VOTE_TYPE_NO_VOTE
import static ml.docilealligator.infinityforreddit.CommentData.VOTE_TYPE_UPVOTE;
public class ParseComment {
public interface ParseCommentListener {
void onParseCommentSuccess(ArrayList<CommentData> expandedComments, String parentId,
ArrayList<String> moreChildrenFullnames);
void onParseCommentFailed();
}
interface ParseSentCommentListener {
void onParseSentCommentSuccess(CommentData commentData);
void onParseSentCommentFailed(@Nullable String errorMessage);
}
public static void parseComment(String response, ArrayList<CommentData> commentData, Locale locale,
ParseCommentListener parseCommentListener) {
try {
@ -61,54 +50,6 @@ public class ParseComment {
new ParseSentCommentAsyncTask(response, depth, locale, parseSentCommentListener).execute();
}
private static class ParseCommentAsyncTask extends AsyncTask<Void, Void, Void> {
private JSONArray commentsJSONArray;
private ArrayList<CommentData> comments;
private ArrayList<CommentData> newComments;
private ArrayList<CommentData> expandedNewComments;
private ArrayList<String> moreChildrenFullnames;
private Locale locale;
private String parentId;
private int depth;
private ParseCommentListener parseCommentListener;
private boolean parseFailed;
ParseCommentAsyncTask(JSONArray commentsJSONArray, ArrayList<CommentData> comments, Locale locale,
@Nullable String parentId, int depth, ParseCommentListener parseCommentListener){
this.commentsJSONArray = commentsJSONArray;
this.comments = comments;
newComments = new ArrayList<>();
expandedNewComments = new ArrayList<>();
moreChildrenFullnames = new ArrayList<>();
this.locale = locale;
this.parentId = parentId;
this.depth = depth;
parseFailed = false;
this.parseCommentListener = parseCommentListener;
}
@Override
protected Void doInBackground(Void... voids) {
try {
parseCommentRecursion(commentsJSONArray, newComments, moreChildrenFullnames, depth, locale);
expandChildren(newComments, expandedNewComments);
} catch (JSONException e) {
parseFailed = true;
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
if(!parseFailed) {
comments.addAll(expandedNewComments);
parseCommentListener.onParseCommentSuccess(comments, parentId, moreChildrenFullnames);
} else {
parseCommentListener.onParseCommentFailed();
}
}
}
private static void parseCommentRecursion(JSONArray comments, ArrayList<CommentData> newCommentData,
ArrayList<String> moreChildrenFullnames, int depth, Locale locale) throws JSONException {
int actualCommentLength;
@ -167,47 +108,6 @@ public class ParseComment {
}
}
private static class ParseSentCommentAsyncTask extends AsyncTask<Void, Void, Void> {
private String response;
private int depth;
private Locale locale;
private ParseSentCommentListener parseSentCommentListener;
private boolean parseFailed;
private String errorMessage;
private CommentData commentData;
ParseSentCommentAsyncTask(String response, int depth, Locale locale, ParseSentCommentListener parseSentCommentListener) {
this.response = response;
this.depth = depth;
this.locale = locale;
this.parseSentCommentListener = parseSentCommentListener;
parseFailed = false;
}
@Override
protected Void doInBackground(Void... voids) {
try {
JSONObject sentCommentData = new JSONObject(response);
commentData = parseSingleComment(sentCommentData, depth, locale);
} catch (JSONException e) {
e.printStackTrace();
errorMessage = parseSentCommentErrorMessage(response);
parseFailed = true;
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
if(parseFailed) {
parseSentCommentListener.onParseSentCommentFailed(errorMessage);
} else {
parseSentCommentListener.onParseSentCommentSuccess(commentData);
}
}
}
static CommentData parseSingleComment(JSONObject singleCommentData, int depth, Locale locale) throws JSONException {
String id = singleCommentData.getString(JSONUtils.ID_KEY);
String fullName = singleCommentData.getString(JSONUtils.NAME_KEY);
@ -280,4 +180,106 @@ public class ParseComment {
return null;
}
public interface ParseCommentListener {
void onParseCommentSuccess(ArrayList<CommentData> expandedComments, String parentId,
ArrayList<String> moreChildrenFullnames);
void onParseCommentFailed();
}
interface ParseSentCommentListener {
void onParseSentCommentSuccess(CommentData commentData);
void onParseSentCommentFailed(@Nullable String errorMessage);
}
private static class ParseCommentAsyncTask extends AsyncTask<Void, Void, Void> {
private JSONArray commentsJSONArray;
private ArrayList<CommentData> comments;
private ArrayList<CommentData> newComments;
private ArrayList<CommentData> expandedNewComments;
private ArrayList<String> moreChildrenFullnames;
private Locale locale;
private String parentId;
private int depth;
private ParseCommentListener parseCommentListener;
private boolean parseFailed;
ParseCommentAsyncTask(JSONArray commentsJSONArray, ArrayList<CommentData> comments, Locale locale,
@Nullable String parentId, int depth, ParseCommentListener parseCommentListener) {
this.commentsJSONArray = commentsJSONArray;
this.comments = comments;
newComments = new ArrayList<>();
expandedNewComments = new ArrayList<>();
moreChildrenFullnames = new ArrayList<>();
this.locale = locale;
this.parentId = parentId;
this.depth = depth;
parseFailed = false;
this.parseCommentListener = parseCommentListener;
}
@Override
protected Void doInBackground(Void... voids) {
try {
parseCommentRecursion(commentsJSONArray, newComments, moreChildrenFullnames, depth, locale);
expandChildren(newComments, expandedNewComments);
} catch (JSONException e) {
parseFailed = true;
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
if (!parseFailed) {
comments.addAll(expandedNewComments);
parseCommentListener.onParseCommentSuccess(comments, parentId, moreChildrenFullnames);
} else {
parseCommentListener.onParseCommentFailed();
}
}
}
private static class ParseSentCommentAsyncTask extends AsyncTask<Void, Void, Void> {
private String response;
private int depth;
private Locale locale;
private ParseSentCommentListener parseSentCommentListener;
private boolean parseFailed;
private String errorMessage;
private CommentData commentData;
ParseSentCommentAsyncTask(String response, int depth, Locale locale, ParseSentCommentListener parseSentCommentListener) {
this.response = response;
this.depth = depth;
this.locale = locale;
this.parseSentCommentListener = parseSentCommentListener;
parseFailed = false;
}
@Override
protected Void doInBackground(Void... voids) {
try {
JSONObject sentCommentData = new JSONObject(response);
commentData = parseSingleComment(sentCommentData, depth, locale);
} catch (JSONException e) {
e.printStackTrace();
errorMessage = parseSentCommentErrorMessage(response);
parseFailed = true;
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
if (parseFailed) {
parseSentCommentListener.onParseSentCommentFailed(errorMessage);
} else {
parseSentCommentListener.onParseSentCommentSuccess(commentData);
}
}
}
}

View File

@ -19,16 +19,6 @@ import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
*/
public class ParsePost {
interface ParsePostsListingListener {
void onParsePostsListingSuccess(ArrayList<Post> newPostData, String lastItem);
void onParsePostsListingFail();
}
public interface ParsePostListener {
void onParsePostSuccess(Post post);
void onParsePostFail();
}
static void parsePosts(String response, Locale locale, int nPosts, int filter, boolean nsfw,
ParsePostsListingListener parsePostsListingListener) {
new ParsePostDataAsyncTask(response, locale, nPosts, filter, nsfw, parsePostsListingListener).execute();
@ -38,124 +28,6 @@ public class ParsePost {
new ParsePostDataAsyncTask(response, locale, true, parsePostListener).execute();
}
private static class ParsePostDataAsyncTask extends AsyncTask<Void, Void, Void> {
private JSONArray allData;
private Locale locale;
private int nPosts;
private int filter;
private boolean nsfw;
private ParsePostsListingListener parsePostsListingListener;
private ParsePostListener parsePostListener;
private ArrayList<Post> newPosts;
private Post post;
private String lastItem;
private boolean parseFailed;
ParsePostDataAsyncTask(String response, Locale locale, int nPosts, int filter, boolean nsfw,
ParsePostsListingListener parsePostsListingListener) {
this.parsePostsListingListener = parsePostsListingListener;
try {
JSONObject jsonResponse = new JSONObject(response);
allData = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY);
lastItem = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY);
this.locale = locale;
this.nPosts = nPosts;
this.filter = filter;
this.nsfw = nsfw;
newPosts = new ArrayList<>();
parseFailed = false;
} catch (JSONException e) {
e.printStackTrace();
parseFailed = true;
}
}
ParsePostDataAsyncTask(String response, Locale locale, boolean nsfw,
ParsePostListener parsePostListener) {
this.parsePostListener = parsePostListener;
try {
allData = new JSONArray(response).getJSONObject(0).getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY);
this.locale = locale;
this.nsfw = nsfw;
parseFailed = false;
} catch (JSONException e) {
e.printStackTrace();
parseFailed = true;
}
}
@Override
protected Void doInBackground(Void... voids) {
if(parseFailed) {
return null;
}
if (newPosts == null) {
//Only one post
if (allData.length() == 0) {
parseFailed = true;
return null;
}
try {
JSONObject data = allData.getJSONObject(0).getJSONObject(JSONUtils.DATA_KEY);
post = parseBasicData(data, locale);
} catch (JSONException e) {
e.printStackTrace();
parseFailed = true;
}
} else {
//Posts listing
int size;
if (nPosts < 0 || nPosts > allData.length()) {
size = allData.length();
} else {
size = nPosts;
}
for (int i = 0; i < size; i++) {
try {
if(allData.getJSONObject(i).getString(JSONUtils.KIND_KEY).equals("t3")) {
JSONObject data = allData.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
Post post = parseBasicData(data, locale);
if(post != null && !(!nsfw && post.isNSFW())) {
if (filter == PostFragment.EXTRA_NO_FILTER) {
newPosts.add(post);
} else if (filter == post.getPostType()) {
newPosts.add(post);
} else if (filter == Post.LINK_TYPE && post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
newPosts.add(post);
} else if(filter == Post.NSFW_TYPE && post.isNSFW()) {
newPosts.add(post);
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
if(!parseFailed) {
if(newPosts != null) {
parsePostsListingListener.onParsePostsListingSuccess(newPosts, lastItem);
} else {
parsePostListener.onParsePostSuccess(post);
}
} else {
if(parsePostsListingListener != null) {
parsePostsListingListener.onParsePostsListingFail();
} else {
parsePostListener.onParsePostFail();
}
}
}
}
private static Post parseBasicData(JSONObject data, Locale locale) throws JSONException {
String id = data.getString(JSONUtils.ID_KEY);
String fullName = data.getString(JSONUtils.NAME_KEY);
@ -364,4 +236,134 @@ public class ParsePost {
return post;
}
interface ParsePostsListingListener {
void onParsePostsListingSuccess(ArrayList<Post> newPostData, String lastItem);
void onParsePostsListingFail();
}
public interface ParsePostListener {
void onParsePostSuccess(Post post);
void onParsePostFail();
}
private static class ParsePostDataAsyncTask extends AsyncTask<Void, Void, Void> {
private JSONArray allData;
private Locale locale;
private int nPosts;
private int filter;
private boolean nsfw;
private ParsePostsListingListener parsePostsListingListener;
private ParsePostListener parsePostListener;
private ArrayList<Post> newPosts;
private Post post;
private String lastItem;
private boolean parseFailed;
ParsePostDataAsyncTask(String response, Locale locale, int nPosts, int filter, boolean nsfw,
ParsePostsListingListener parsePostsListingListener) {
this.parsePostsListingListener = parsePostsListingListener;
try {
JSONObject jsonResponse = new JSONObject(response);
allData = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY);
lastItem = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY);
this.locale = locale;
this.nPosts = nPosts;
this.filter = filter;
this.nsfw = nsfw;
newPosts = new ArrayList<>();
parseFailed = false;
} catch (JSONException e) {
e.printStackTrace();
parseFailed = true;
}
}
ParsePostDataAsyncTask(String response, Locale locale, boolean nsfw,
ParsePostListener parsePostListener) {
this.parsePostListener = parsePostListener;
try {
allData = new JSONArray(response).getJSONObject(0).getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY);
this.locale = locale;
this.nsfw = nsfw;
parseFailed = false;
} catch (JSONException e) {
e.printStackTrace();
parseFailed = true;
}
}
@Override
protected Void doInBackground(Void... voids) {
if (parseFailed) {
return null;
}
if (newPosts == null) {
//Only one post
if (allData.length() == 0) {
parseFailed = true;
return null;
}
try {
JSONObject data = allData.getJSONObject(0).getJSONObject(JSONUtils.DATA_KEY);
post = parseBasicData(data, locale);
} catch (JSONException e) {
e.printStackTrace();
parseFailed = true;
}
} else {
//Posts listing
int size;
if (nPosts < 0 || nPosts > allData.length()) {
size = allData.length();
} else {
size = nPosts;
}
for (int i = 0; i < size; i++) {
try {
if (allData.getJSONObject(i).getString(JSONUtils.KIND_KEY).equals("t3")) {
JSONObject data = allData.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
Post post = parseBasicData(data, locale);
if (post != null && !(!nsfw && post.isNSFW())) {
if (filter == PostFragment.EXTRA_NO_FILTER) {
newPosts.add(post);
} else if (filter == post.getPostType()) {
newPosts.add(post);
} else if (filter == Post.LINK_TYPE && post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
newPosts.add(post);
} else if (filter == Post.NSFW_TYPE && post.isNSFW()) {
newPosts.add(post);
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
if (!parseFailed) {
if (newPosts != null) {
parsePostsListingListener.onParsePostsListingSuccess(newPosts, lastItem);
} else {
parsePostListener.onParsePostSuccess(post);
}
} else {
if (parsePostsListingListener != null) {
parsePostsListingListener.onParsePostsListingFail();
} else {
parsePostListener.onParsePostFail();
}
}
}
}
}

View File

@ -11,16 +11,6 @@ import java.util.ArrayList;
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
class ParseSubredditData {
interface ParseSubredditDataListener {
void onParseSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers);
void onParseSubredditDataFail();
}
interface ParseSubredditListingDataListener {
void onParseSubredditListingDataSuccess(ArrayList<SubredditData> subredditData, String after);
void onParseSubredditListingDataFail();
}
static void parseSubredditData(String response, ParseSubredditDataListener parseSubredditDataListener) {
new ParseSubredditDataAsyncTask(response, parseSubredditDataListener).execute();
}
@ -29,6 +19,51 @@ class ParseSubredditData {
new ParseSubredditListingDataAsyncTask(response, parseSubredditListingDataListener).execute();
}
private static SubredditData parseSubredditData(JSONObject subredditDataJsonObject) throws JSONException {
String id = subredditDataJsonObject.getString(JSONUtils.NAME_KEY);
String subredditFullName = subredditDataJsonObject.getString(JSONUtils.DISPLAY_NAME);
String description = subredditDataJsonObject.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim();
String bannerImageUrl;
if (subredditDataJsonObject.isNull(JSONUtils.BANNER_BACKGROUND_IMAGE_KEY)) {
bannerImageUrl = "";
} else {
bannerImageUrl = subredditDataJsonObject.getString(JSONUtils.BANNER_BACKGROUND_IMAGE_KEY);
}
if (bannerImageUrl.equals("") && !subredditDataJsonObject.isNull(JSONUtils.BANNER_IMG_KEY)) {
bannerImageUrl = subredditDataJsonObject.getString(JSONUtils.BANNER_IMG_KEY);
}
String iconUrl;
if (subredditDataJsonObject.isNull(JSONUtils.COMMUNITY_ICON_KEY)) {
iconUrl = "";
} else {
iconUrl = subredditDataJsonObject.getString(JSONUtils.COMMUNITY_ICON_KEY);
}
if (iconUrl.equals("") && !subredditDataJsonObject.isNull(JSONUtils.ICON_IMG_KEY)) {
iconUrl = subredditDataJsonObject.getString(JSONUtils.ICON_IMG_KEY);
}
int nSubscribers = 0;
if (!subredditDataJsonObject.isNull(JSONUtils.SUBSCRIBERS_KEY)) {
nSubscribers = subredditDataJsonObject.getInt(JSONUtils.SUBSCRIBERS_KEY);
}
return new SubredditData(id, subredditFullName, iconUrl, bannerImageUrl, description, nSubscribers);
}
interface ParseSubredditDataListener {
void onParseSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers);
void onParseSubredditDataFail();
}
interface ParseSubredditListingDataListener {
void onParseSubredditListingDataSuccess(ArrayList<SubredditData> subredditData, String after);
void onParseSubredditListingDataFail();
}
private static class ParseSubredditDataAsyncTask extends AsyncTask<Void, Void, Void> {
private JSONObject jsonResponse;
private boolean parseFailed;
@ -119,37 +154,4 @@ class ParseSubredditData {
}
}
}
private static SubredditData parseSubredditData(JSONObject subredditDataJsonObject) throws JSONException {
String id = subredditDataJsonObject.getString(JSONUtils.NAME_KEY);
String subredditFullName = subredditDataJsonObject.getString(JSONUtils.DISPLAY_NAME);
String description = subredditDataJsonObject.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim();
String bannerImageUrl;
if(subredditDataJsonObject.isNull(JSONUtils.BANNER_BACKGROUND_IMAGE_KEY)) {
bannerImageUrl = "";
} else {
bannerImageUrl = subredditDataJsonObject.getString(JSONUtils.BANNER_BACKGROUND_IMAGE_KEY);
}
if(bannerImageUrl.equals("") && !subredditDataJsonObject.isNull(JSONUtils.BANNER_IMG_KEY)) {
bannerImageUrl= subredditDataJsonObject.getString(JSONUtils.BANNER_IMG_KEY);
}
String iconUrl;
if(subredditDataJsonObject.isNull(JSONUtils.COMMUNITY_ICON_KEY)) {
iconUrl = "";
} else {
iconUrl = subredditDataJsonObject.getString(JSONUtils.COMMUNITY_ICON_KEY);
}
if(iconUrl.equals("") && !subredditDataJsonObject.isNull(JSONUtils.ICON_IMG_KEY)) {
iconUrl = subredditDataJsonObject.getString(JSONUtils.ICON_IMG_KEY);
}
int nSubscribers = 0;
if(!subredditDataJsonObject.isNull(JSONUtils.SUBSCRIBERS_KEY)) {
nSubscribers = subredditDataJsonObject.getInt(JSONUtils.SUBSCRIBERS_KEY);
}
return new SubredditData(id, subredditFullName, iconUrl, bannerImageUrl, description, nSubscribers);
}
}

View File

@ -13,14 +13,6 @@ import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.Subscrib
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData;
class ParseSubscribedThing {
interface ParseSubscribedSubredditsListener {
void onParseSubscribedSubredditsSuccess(ArrayList<SubscribedSubredditData> subscribedSubredditData,
ArrayList<SubscribedUserData> subscribedUserData,
ArrayList<SubredditData> subredditData,
String lastItem);
void onParseSubscribedSubredditsFail();
}
static void parseSubscribedSubreddits(String response, String accountName,
ArrayList<SubscribedSubredditData> subscribedSubredditData,
ArrayList<SubscribedUserData> subscribedUserData,
@ -30,6 +22,15 @@ class ParseSubscribedThing {
parseSubscribedSubredditsListener).execute();
}
interface ParseSubscribedSubredditsListener {
void onParseSubscribedSubredditsSuccess(ArrayList<SubscribedSubredditData> subscribedSubredditData,
ArrayList<SubscribedUserData> subscribedUserData,
ArrayList<SubredditData> subredditData,
String lastItem);
void onParseSubscribedSubredditsFail();
}
private static class ParseSubscribedSubredditsAsyncTask extends AsyncTask<Void, Void, Void> {
private JSONObject jsonResponse;
private String accountName;

View File

@ -11,16 +11,6 @@ import java.util.ArrayList;
import ml.docilealligator.infinityforreddit.User.UserData;
public class ParseUserData {
interface ParseUserDataListener {
void onParseUserDataSuccess(UserData userData);
void onParseUserDataFailed();
}
interface ParseUserListingDataListener {
void onParseUserListingDataSuccess(ArrayList<UserData> userData, String after);
void onParseUserListingDataFailed();
}
static void parseUserData(String response, ParseUserDataListener parseUserDataListener) {
new ParseUserDataAsyncTask(response, parseUserDataListener).execute();
}
@ -29,6 +19,39 @@ public class ParseUserData {
new ParseUserListingDataAsyncTask(response, parseUserListingDataListener).execute();
}
private static UserData parseUserDataBase(JSONObject userDataJson) throws JSONException {
userDataJson = userDataJson.getJSONObject(JSONUtils.DATA_KEY);
String userName = userDataJson.getString(JSONUtils.NAME_KEY);
String iconImageUrl = userDataJson.getString(JSONUtils.ICON_IMG_KEY);
String bannerImageUrl = "";
boolean canBeFollowed;
if (userDataJson.has(JSONUtils.SUBREDDIT_KEY) && !userDataJson.isNull(JSONUtils.SUBREDDIT_KEY)) {
bannerImageUrl = userDataJson.getJSONObject(JSONUtils.SUBREDDIT_KEY).getString(JSONUtils.BANNER_IMG_KEY);
canBeFollowed = true;
} else {
canBeFollowed = false;
}
int linkKarma = userDataJson.getInt(JSONUtils.LINK_KARMA_KEY);
int commentKarma = userDataJson.getInt(JSONUtils.COMMENT_KARMA_KEY);
int karma = linkKarma + commentKarma;
boolean isGold = userDataJson.getBoolean(JSONUtils.IS_GOLD_KEY);
boolean isFriend = userDataJson.getBoolean(JSONUtils.IS_FRIEND_KEY);
return new UserData(userName, iconImageUrl, bannerImageUrl, karma, isGold, isFriend, canBeFollowed);
}
interface ParseUserDataListener {
void onParseUserDataSuccess(UserData userData);
void onParseUserDataFailed();
}
interface ParseUserListingDataListener {
void onParseUserListingDataSuccess(ArrayList<UserData> userData, String after);
void onParseUserListingDataFailed();
}
private static class ParseUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
private JSONObject jsonResponse;
private ParseUserDataListener parseUserDataListener;
@ -120,25 +143,4 @@ public class ParseUserData {
}
}
}
private static UserData parseUserDataBase(JSONObject userDataJson) throws JSONException {
userDataJson = userDataJson.getJSONObject(JSONUtils.DATA_KEY);
String userName = userDataJson.getString(JSONUtils.NAME_KEY);
String iconImageUrl = userDataJson.getString(JSONUtils.ICON_IMG_KEY);
String bannerImageUrl = "";
boolean canBeFollowed;
if(userDataJson.has(JSONUtils.SUBREDDIT_KEY) && !userDataJson.isNull(JSONUtils.SUBREDDIT_KEY)) {
bannerImageUrl = userDataJson.getJSONObject(JSONUtils.SUBREDDIT_KEY).getString(JSONUtils.BANNER_IMG_KEY);
canBeFollowed = true;
} else {
canBeFollowed = false;
}
int linkKarma = userDataJson.getInt(JSONUtils.LINK_KARMA_KEY);
int commentKarma = userDataJson.getInt(JSONUtils.COMMENT_KARMA_KEY);
int karma = linkKarma + commentKarma;
boolean isGold = userDataJson.getBoolean(JSONUtils.IS_GOLD_KEY);
boolean isFriend = userDataJson.getBoolean(JSONUtils.IS_FRIEND_KEY);
return new UserData(userName, iconImageUrl, bannerImageUrl, karma, isGold, isFriend, canBeFollowed);
}
}

View File

@ -15,7 +15,17 @@ public class Post implements Parcelable {
public static final int VIDEO_TYPE = 3;
public static final int GIF_VIDEO_TYPE = 4;
public static final int NO_PREVIEW_LINK_TYPE = 5;
public static final Creator<Post> CREATOR = new Creator<Post>() {
@Override
public Post createFromParcel(Parcel in) {
return new Post(in);
}
@Override
public Post[] newArray(int size) {
return new Post[size];
}
};
private String id;
private String fullName;
private String subredditName;
@ -175,18 +185,6 @@ public class Post implements Parcelable {
crosspostParentId = in.readString();
}
public static final Creator<Post> CREATOR = new Creator<Post>() {
@Override
public Post createFromParcel(Parcel in) {
return new Post(in);
}
@Override
public Post[] newArray(int size) {
return new Post[size];
}
};
public String getId() {
return id;
}
@ -231,22 +229,22 @@ public class Post implements Parcelable {
return postTime;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setSelfText(String selfText) {
this.selfText = selfText;
public void setTitle(String title) {
this.title = title;
}
public String getSelfText() {
return selfText;
}
public void setSelfText(String selfText) {
this.selfText = selfText;
}
public String getPreviewUrl() {
return previewUrl;
}
@ -255,14 +253,14 @@ public class Post implements Parcelable {
return url;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
public String getVideoUrl() {
return videoUrl;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
public String getPermalink() {
return permalink;
}
@ -275,46 +273,46 @@ public class Post implements Parcelable {
this.flair = flair;
}
public void setScore(int score) {
this.score = score;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public int getPostType() {
return postType;
}
public void setVoteType(int voteType) {
this.voteType = voteType;
}
public int getVoteType() {
return voteType;
}
public void setVoteType(int voteType) {
this.voteType = voteType;
}
public int getGilded() {
return gilded;
}
public void setPreviewWidth(int previewWidth) {
this.previewWidth = previewWidth;
}
public int getPreviewWidth() {
return previewWidth;
}
public void setPreviewHeight(int previewHeight) {
this.previewHeight = previewHeight;
public void setPreviewWidth(int previewWidth) {
this.previewWidth = previewWidth;
}
public int getPreviewHeight() {
return previewHeight;
}
public void setPreviewHeight(int previewHeight) {
this.previewHeight = previewHeight;
}
public int getnComments() {
return nComments;
}

View File

@ -34,22 +34,17 @@ import retrofit2.Retrofit;
public class PullNotificationWorker extends Worker {
public static final String WORKER_TAG = "PNWT";
private Context context;
@Inject
@Named("oauth_without_authenticator")
Retrofit mOauthWithoutAuthenticatorRetrofit;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
SharedPreferences mSharedPreferences;
private Context context;
public PullNotificationWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
super(context, workerParams);

View File

@ -11,11 +11,6 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class ReadMessage {
public interface ReadMessageListener {
void readSuccess();
void readFailed();
}
public static void readMessage(Retrofit oauthRetrofit, String accessToken, String commaSeparatedFullnames,
ReadMessageListener readMessageListener) {
Map<String, String> params = new HashMap<>();
@ -37,4 +32,10 @@ public class ReadMessage {
}
});
}
public interface ReadMessageListener {
void readSuccess();
void readFailed();
}
}

View File

@ -21,12 +21,6 @@ import ml.docilealligator.infinityforreddit.User.UserData;
public abstract class RedditDataRoomDatabase extends RoomDatabase {
private static RedditDataRoomDatabase INSTANCE;
public abstract AccountDao accountDao();
public abstract SubredditDao subredditDao();
public abstract SubscribedSubredditDao subscribedSubredditDao();
public abstract UserDao userDao();
public abstract SubscribedUserDao subscribedUserDao();
public static RedditDataRoomDatabase getDatabase(final Context context) {
if (INSTANCE == null) {
synchronized (RedditDataRoomDatabase.class) {
@ -39,4 +33,14 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
}
return INSTANCE;
}
public abstract AccountDao accountDao();
public abstract SubredditDao subredditDao();
public abstract SubscribedSubredditDao subscribedSubredditDao();
public abstract UserDao userDao();
public abstract SubscribedUserDao subscribedUserDao();
}

View File

@ -11,11 +11,6 @@ import retrofit2.Response;
import retrofit2.Retrofit;
public class SaveThing {
public interface SaveThingListener {
void success();
void failed();
}
public static void saveThing(Retrofit oauthRetrofit, String accessToken, String fullname,
SaveThingListener saveThingListener) {
Map<String, String> params = new HashMap<>();
@ -57,4 +52,10 @@ public class SaveThing {
}
});
}
public interface SaveThingListener {
void success();
void failed();
}
}

View File

@ -14,11 +14,6 @@ import retrofit2.Retrofit;
public class SendComment {
public interface SendCommentListener {
void sendCommentSuccess(CommentData commentData);
void sendCommentFailed(String errorMessage);
}
public static void sendComment(String commentMarkdown, String thingFullname, int parentDepth,
Locale locale, Retrofit oauthRetrofit, String accessToken,
SendCommentListener sendCommentListener) {
@ -58,4 +53,10 @@ public class SendComment {
}
});
}
public interface SendCommentListener {
void sendCommentSuccess(CommentData commentData);
void sendCommentFailed(String errorMessage);
}
}

Some files were not shown because too many files have changed in this diff Show More