aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-04-28 02:23:05 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-04-28 02:23:05 +0000
commit797d8d8e6671e2c35ba20a3b1f96d15f4ccbd299 (patch)
tree6f93527b73c270929084c303ee64fe2922561d63
parent254b99eb9c2bbdbcb816e847b175c3fd2eac4150 (diff)
downloadinfinity-for-reddit-797d8d8e6671e2c35ba20a3b1f96d15f4ccbd299.tar
infinity-for-reddit-797d8d8e6671e2c35ba20a3b1f96d15f4ccbd299.tar.gz
infinity-for-reddit-797d8d8e6671e2c35ba20a3b1f96d15f4ccbd299.tar.bz2
infinity-for-reddit-797d8d8e6671e2c35ba20a3b1f96d15f4ccbd299.tar.lz
infinity-for-reddit-797d8d8e6671e2c35ba20a3b1f96d15f4ccbd299.tar.xz
infinity-for-reddit-797d8d8e6671e2c35ba20a3b1f96d15f4ccbd299.tar.zst
infinity-for-reddit-797d8d8e6671e2c35ba20a3b1f96d15f4ccbd299.zip
Migrate to ViewBinding in some activities.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditPostActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/FetchRandomSubredditOrPostActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/LockScreenActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/LoginActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java32
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java31
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java32
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java33
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java82
-rw-r--r--app/src/main/res/layout/activity_multireddit_selection.xml1
-rw-r--r--app/src/main/res/layout/activity_post_filter_application.xml1
-rw-r--r--app/src/main/res/layout/activity_post_filter_preference.xml1
-rw-r--r--app/src/main/res/layout/activity_report.xml1
-rw-r--r--app/src/main/res/layout/activity_rules.xml1
20 files changed, 78 insertions, 161 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditPostActivity.java
index b880f5d9..151a8596 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditPostActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditPostActivity.java
@@ -96,6 +96,7 @@ public class EditPostActivity extends BaseActivity implements UploadImageEnabled
setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState);
+
binding = ActivityEditPostBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java
index 44010326..23624623 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java
@@ -84,6 +84,7 @@ public class EditProfileActivity extends BaseActivity {
setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState);
+
binding = ActivityEditProfileBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FetchRandomSubredditOrPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FetchRandomSubredditOrPostActivity.java
index 93d13128..c262beaa 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FetchRandomSubredditOrPostActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FetchRandomSubredditOrPostActivity.java
@@ -11,7 +11,6 @@ import java.util.concurrent.Executor;
import javax.inject.Inject;
import javax.inject.Named;
-import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.RandomBottomSheetFragment;
@@ -44,11 +43,10 @@ public class FetchRandomSubredditOrPostActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplicationContext()).getAppComponent().inject(this);
super.onCreate(savedInstanceState);
+
binding = ActivityFetchRandomSubredditOrPostBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
- ButterKnife.bind(this);
-
int option = getIntent().getIntExtra(EXTRA_RANDOM_OPTION, RandomBottomSheetFragment.RANDOM_SUBREDDIT);
FetchPost.fetchRandomPost(mExecutor, new Handler(), mRetrofit,
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java
index a2999c75..4c5333ba 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java
@@ -111,8 +111,6 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
binding = ActivityFilteredThingBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
- ButterKnife.bind(this);
-
EventBus.getDefault().register(this);
applyCustomTheme();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java
index 84fed183..5fea5dae 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java
@@ -21,7 +21,6 @@ import org.greenrobot.eventbus.Subscribe;
import javax.inject.Inject;
import javax.inject.Named;
-import butterknife.ButterKnife;
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration;
@@ -64,8 +63,6 @@ public class FullMarkdownActivity extends BaseActivity {
binding = ActivityCommentFullMarkdownBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
- ButterKnife.bind(this);
-
EventBus.getDefault().register(this);
applyCustomTheme();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java
index 55f2eadc..a684bae3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java
@@ -76,7 +76,7 @@ public class HistoryActivity extends BaseActivity implements ActivityToolbarInte
mSliderPanel = Slidr.attach(this);
}
- //mViewPager2 = viewPager2;
+ mViewPager2 = binding.viewPagerHistoryActivity;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Window window = getWindow();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java
index 3904a3f3..b0288907 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java
@@ -34,7 +34,6 @@ import java.util.concurrent.Executor;
import javax.inject.Inject;
import javax.inject.Named;
-import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
@@ -98,8 +97,6 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
binding = ActivityInboxBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
- ButterKnife.bind(this);
-
EventBus.getDefault().register(this);
applyCustomTheme();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LockScreenActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LockScreenActivity.java
index fe4f175d..cae0f334 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LockScreenActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LockScreenActivity.java
@@ -16,7 +16,6 @@ import java.util.concurrent.Executor;
import javax.inject.Inject;
import javax.inject.Named;
-import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
@@ -45,8 +44,6 @@ public class LockScreenActivity extends BaseActivity {
binding = ActivityLockScreenBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
- ButterKnife.bind(this);
-
applyCustomTheme();
binding.unlockButtonLockScreenActivity.setOnClickListener(view -> {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LoginActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LoginActivity.java
index 41f74bbc..c617d811 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LoginActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LoginActivity.java
@@ -35,7 +35,6 @@ import java.util.concurrent.Executor;
import javax.inject.Inject;
import javax.inject.Named;
-import butterknife.ButterKnife;
import me.saket.bettermovementmethod.BetterLinkMovementMethod;
import ml.docilealligator.infinityforreddit.FetchMyInfo;
import ml.docilealligator.infinityforreddit.Infinity;
@@ -100,8 +99,6 @@ public class LoginActivity extends BaseActivity {
return;
}
- ButterKnife.bind(this);
-
applyCustomTheme();
if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
index 4a36cb50..41db3cf0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
@@ -229,8 +229,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
- ButterKnife.bind(this);
-
hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false);
showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java
index ca77561b..d6a398ca 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java
@@ -12,13 +12,8 @@ import android.view.WindowManager;
import android.widget.Toast;
import androidx.annotation.NonNull;
-import androidx.appcompat.widget.Toolbar;
-import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment;
-import com.google.android.material.appbar.AppBarLayout;
-import com.google.android.material.appbar.CollapsingToolbarLayout;
-
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -28,8 +23,6 @@ import java.util.concurrent.Executor;
import javax.inject.Inject;
import javax.inject.Named;
-import butterknife.BindView;
-import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
@@ -38,6 +31,7 @@ import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.asynctasks.InsertMultireddit;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr;
+import ml.docilealligator.infinityforreddit.databinding.ActivityMultiredditSelectionBinding;
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.fragments.MultiRedditListingFragment;
import ml.docilealligator.infinityforreddit.multireddit.FetchMyMultiReddits;
@@ -52,14 +46,6 @@ public class MultiredditSelectionActivity extends BaseActivity implements Activi
private static final String INSERT_SUBSCRIBED_MULTIREDDIT_STATE = "ISSS";
private static final String FRAGMENT_OUT_STATE = "FOS";
- @BindView(R.id.coordinator_layout_multireddit_selection_activity)
- CoordinatorLayout coordinatorLayout;
- @BindView(R.id.appbar_layout_multireddit_selection_activity)
- AppBarLayout appBarLayout;
- @BindView(R.id.collapsing_toolbar_layout_multireddit_selection_activity)
- CollapsingToolbarLayout collapsingToolbarLayout;
- @BindView(R.id.toolbar_multireddit_selection_activity)
- Toolbar toolbar;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@@ -77,15 +63,16 @@ public class MultiredditSelectionActivity extends BaseActivity implements Activi
Executor mExecutor;
private boolean mInsertSuccess = false;
private Fragment mFragment;
+ private ActivityMultiredditSelectionBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this);
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_multireddit_selection);
- ButterKnife.bind(this);
+ binding = ActivityMultiredditSelectionBinding.inflate(getLayoutInflater());
+ setContentView(binding.getRoot());
EventBus.getDefault().register(this);
@@ -99,7 +86,7 @@ public class MultiredditSelectionActivity extends BaseActivity implements Activi
Window window = getWindow();
if (isChangeStatusBarIconColor()) {
- addOnOffsetChangedListener(appBarLayout);
+ addOnOffsetChangedListener(binding.appbarLayoutMultiredditSelectionActivity);
}
if (isImmersiveInterface()) {
@@ -108,11 +95,11 @@ public class MultiredditSelectionActivity extends BaseActivity implements Activi
} else {
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
- adjustToolbar(toolbar);
+ adjustToolbar(binding.toolbarMultiredditSelectionActivity);
}
}
- setSupportActionBar(toolbar);
+ setSupportActionBar(binding.toolbarMultiredditSelectionActivity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (savedInstanceState == null) {
@@ -142,8 +129,9 @@ public class MultiredditSelectionActivity extends BaseActivity implements Activi
@Override
protected void applyCustomTheme() {
- coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
- applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
+ binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
+ applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutMultiredditSelectionActivity,
+ binding.collapsingToolbarLayoutMultiredditSelectionActivity, binding.toolbarMultiredditSelectionActivity);
}
private void bindView(boolean initializeFragment) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java
index d070812a..0aa8f352 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java
@@ -32,6 +32,7 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.adapters.PostFilterWithUsageRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostFilterOptionsBottomSheetFragment;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.databinding.ActivityPostFilterPreferenceBinding;
import ml.docilealligator.infinityforreddit.post.Post;
import ml.docilealligator.infinityforreddit.postfilter.DeletePostFilter;
import ml.docilealligator.infinityforreddit.postfilter.PostFilter;
@@ -44,18 +45,6 @@ public class PostFilterPreferenceActivity extends BaseActivity {
public static final String EXTRA_SUBREDDIT_NAME = "ESN";
public static final String EXTRA_USER_NAME = "EUN";
- @BindView(R.id.coordinator_layout_post_filter_preference_activity)
- CoordinatorLayout coordinatorLayout;
- @BindView(R.id.appbar_layout_post_filter_preference_activity)
- AppBarLayout appBarLayout;
- @BindView(R.id.collapsing_toolbar_layout_post_filter_preference_activity)
- CollapsingToolbarLayout collapsingToolbarLayout;
- @BindView(R.id.toolbar_post_filter_preference_activity)
- Toolbar toolbar;
- @BindView(R.id.recycler_view_post_filter_preference_activity)
- RecyclerView recyclerView;
- @BindView(R.id.fab_post_filter_preference_activity)
- FloatingActionButton fab;
@Inject
@Named("default")
SharedPreferences sharedPreferences;
@@ -70,6 +59,7 @@ public class PostFilterPreferenceActivity extends BaseActivity {
Executor executor;
public PostFilterWithUsageViewModel postFilterWithUsageViewModel;
private PostFilterWithUsageRecyclerViewAdapter adapter;
+ private ActivityPostFilterPreferenceBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -78,20 +68,20 @@ public class PostFilterPreferenceActivity extends BaseActivity {
setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_post_filter_preference);
- ButterKnife.bind(this);
+ binding = ActivityPostFilterPreferenceBinding.inflate(getLayoutInflater());
+ setContentView(binding.getRoot());
applyCustomTheme();
- setSupportActionBar(toolbar);
+ setSupportActionBar(binding.toolbarPostFilterPreferenceActivity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Post post = getIntent().getParcelableExtra(EXTRA_POST);
String subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME);
String username = getIntent().getStringExtra(EXTRA_USER_NAME);
- fab.setOnClickListener(view -> {
+ binding.fabPostFilterPreferenceActivity.setOnClickListener(view -> {
if (post != null) {
showPostFilterOptions(post, null);
} else if (subredditName != null) {
@@ -121,7 +111,7 @@ public class PostFilterPreferenceActivity extends BaseActivity {
}
});
- recyclerView.setAdapter(adapter);
+ binding.recyclerViewPostFilterPreferenceActivity.setAdapter(adapter);
postFilterWithUsageViewModel = new ViewModelProvider(this,
new PostFilterWithUsageViewModel.Factory(redditDataRoomDatabase)).get(PostFilterWithUsageViewModel.class);
@@ -227,9 +217,10 @@ public class PostFilterPreferenceActivity extends BaseActivity {
@Override
protected void applyCustomTheme() {
- applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
- applyFABTheme(fab);
- coordinatorLayout.setBackgroundColor(customThemeWrapper.getBackgroundColor());
+ applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutPostFilterPreferenceActivity,
+ binding.collapsingToolbarLayoutPostFilterPreferenceActivity, binding.toolbarPostFilterPreferenceActivity);
+ applyFABTheme(binding.fabPostFilterPreferenceActivity);
+ binding.getRoot().setBackgroundColor(customThemeWrapper.getBackgroundColor());
}
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java
index c8df22b2..72f3b467 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java
@@ -34,6 +34,7 @@ import ml.docilealligator.infinityforreddit.adapters.PostFilterUsageRecyclerView
import ml.docilealligator.infinityforreddit.bottomsheetfragments.NewPostFilterUsageBottomSheetFragment;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostFilterUsageOptionsBottomSheetFragment;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.databinding.ActivityPostFilterApplicationBinding;
import ml.docilealligator.infinityforreddit.postfilter.DeletePostFilterUsage;
import ml.docilealligator.infinityforreddit.postfilter.PostFilter;
import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage;
@@ -44,18 +45,7 @@ import ml.docilealligator.infinityforreddit.utils.Utils;
public class PostFilterUsageListingActivity extends BaseActivity {
public static final String EXTRA_POST_FILTER = "EPF";
- @BindView(R.id.coordinator_layout_post_filter_application_activity)
- CoordinatorLayout coordinatorLayout;
- @BindView(R.id.appbar_layout_post_filter_application_activity)
- AppBarLayout appBarLayout;
- @BindView(R.id.collapsing_toolbar_layout_post_filter_application_activity)
- CollapsingToolbarLayout collapsingToolbarLayout;
- @BindView(R.id.toolbar_post_filter_application_activity)
- Toolbar toolbar;
- @BindView(R.id.recycler_view_post_filter_application_activity)
- RecyclerView recyclerView;
- @BindView(R.id.fab_post_filter_application_activity)
- FloatingActionButton fab;
+
@Inject
@Named("default")
SharedPreferences sharedPreferences;
@@ -71,6 +61,7 @@ public class PostFilterUsageListingActivity extends BaseActivity {
public PostFilterUsageViewModel postFilterUsageViewModel;
private PostFilterUsageRecyclerViewAdapter adapter;
private PostFilter postFilter;
+ private ActivityPostFilterApplicationBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -79,20 +70,20 @@ public class PostFilterUsageListingActivity extends BaseActivity {
setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_post_filter_application);
- ButterKnife.bind(this);
+ binding = ActivityPostFilterApplicationBinding.inflate(getLayoutInflater());
+ setContentView(binding.getRoot());
applyCustomTheme();
- setSupportActionBar(toolbar);
+ setSupportActionBar(binding.toolbarPostFilterApplicationActivity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
postFilter = getIntent().getParcelableExtra(EXTRA_POST_FILTER);
setTitle(postFilter.name);
- fab.setOnClickListener(view -> {
+ binding.fabPostFilterApplicationActivity.setOnClickListener(view -> {
NewPostFilterUsageBottomSheetFragment newPostFilterUsageBottomSheetFragment = new NewPostFilterUsageBottomSheetFragment();
newPostFilterUsageBottomSheetFragment.show(getSupportFragmentManager(), newPostFilterUsageBottomSheetFragment.getTag());
});
@@ -104,7 +95,7 @@ public class PostFilterUsageListingActivity extends BaseActivity {
postFilterUsageOptionsBottomSheetFragment.setArguments(bundle);
postFilterUsageOptionsBottomSheetFragment.show(getSupportFragmentManager(), postFilterUsageOptionsBottomSheetFragment.getTag());
});
- recyclerView.setAdapter(adapter);
+ binding.recyclerViewPostFilterApplicationActivity.setAdapter(adapter);
postFilterUsageViewModel = new ViewModelProvider(this,
new PostFilterUsageViewModel.Factory(redditDataRoomDatabase, postFilter.name)).get(PostFilterUsageViewModel.class);
@@ -213,8 +204,9 @@ public class PostFilterUsageListingActivity extends BaseActivity {
@Override
protected void applyCustomTheme() {
- applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
- applyFABTheme(fab);
- coordinatorLayout.setBackgroundColor(customThemeWrapper.getBackgroundColor());
+ applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutPostFilterApplicationActivity,
+ binding.collapsingToolbarLayoutPostFilterApplicationActivity, binding.toolbarPostFilterApplicationActivity);
+ applyFABTheme(binding.fabPostFilterApplicationActivity);
+ binding.getRoot().setBackgroundColor(customThemeWrapper.getBackgroundColor());
}
} \ No newline at end of file
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java
index 90265e54..8528a3ce 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java
@@ -9,11 +9,7 @@ import android.view.MenuItem;
import android.widget.Toast;
import androidx.annotation.NonNull;
-import androidx.appcompat.widget.Toolbar;
-import androidx.coordinatorlayout.widget.CoordinatorLayout;
-import androidx.recyclerview.widget.RecyclerView;
-import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
@@ -22,8 +18,6 @@ import java.util.concurrent.Executor;
import javax.inject.Inject;
import javax.inject.Named;
-import butterknife.BindView;
-import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.FetchRules;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
@@ -35,6 +29,7 @@ import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.adapters.ReportReasonRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr;
+import ml.docilealligator.infinityforreddit.databinding.ActivityReportBinding;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
import retrofit2.Retrofit;
@@ -45,14 +40,6 @@ public class ReportActivity extends BaseActivity {
private static final String GENERAL_REASONS_STATE = "GRS";
private static final String RULES_REASON_STATE = "RRS";
- @BindView(R.id.coordinator_layout_report_activity)
- CoordinatorLayout coordinatorLayout;
- @BindView(R.id.appbar_layout_report_activity)
- AppBarLayout appBarLayout;
- @BindView(R.id.toolbar_report_activity)
- Toolbar toolbar;
- @BindView(R.id.recycler_view_report_activity)
- RecyclerView recyclerView;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@@ -76,6 +63,7 @@ public class ReportActivity extends BaseActivity {
private ArrayList<ReportReason> generalReasons;
private ArrayList<ReportReason> rulesReasons;
private ReportReasonRecyclerViewAdapter mAdapter;
+ private ActivityReportBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -84,9 +72,9 @@ public class ReportActivity extends BaseActivity {
setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_report);
- ButterKnife.bind(this);
+ binding = ActivityReportBinding.inflate(getLayoutInflater());
+ setContentView(binding.getRoot());
applyCustomTheme();
@@ -95,10 +83,10 @@ public class ReportActivity extends BaseActivity {
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
- addOnOffsetChangedListener(appBarLayout);
+ addOnOffsetChangedListener(binding.appbarLayoutReportActivity);
}
- setSupportActionBar(toolbar);
+ setSupportActionBar(binding.toolbarReportActivity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mFullname = getIntent().getStringExtra(EXTRA_THING_FULLNAME);
@@ -114,7 +102,7 @@ public class ReportActivity extends BaseActivity {
} else {
mAdapter = new ReportReasonRecyclerViewAdapter(this, mCustomThemeWrapper, ReportReason.getGeneralReasons(this));
}
- recyclerView.setAdapter(mAdapter);
+ binding.recyclerViewReportActivity.setAdapter(mAdapter);
if (rulesReasons == null) {
FetchRules.fetchRules(mExecutor, new Handler(),
@@ -127,7 +115,7 @@ public class ReportActivity extends BaseActivity {
@Override
public void failed() {
- Snackbar.make(coordinatorLayout, R.string.error_loading_rules_without_retry, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(binding.getRoot(), R.string.error_loading_rules_without_retry, Snackbar.LENGTH_SHORT).show();
}
});
} else {
@@ -200,7 +188,8 @@ public class ReportActivity extends BaseActivity {
@Override
protected void applyCustomTheme() {
- coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
- applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar);
+ binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
+ applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutReportActivity,
+ null, binding.toolbarReportActivity);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java
index f57c48c1..0f46e512 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java
@@ -9,16 +9,8 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
-import android.widget.ProgressBar;
-import android.widget.TextView;
import androidx.annotation.NonNull;
-import androidx.appcompat.widget.Toolbar;
-import androidx.coordinatorlayout.widget.CoordinatorLayout;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.google.android.material.appbar.AppBarLayout;
-import com.google.android.material.appbar.CollapsingToolbarLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -29,8 +21,6 @@ import java.util.concurrent.Executor;
import javax.inject.Inject;
import javax.inject.Named;
-import butterknife.BindView;
-import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.FetchRules;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
@@ -40,6 +30,7 @@ import ml.docilealligator.infinityforreddit.adapters.RulesRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr;
import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel;
+import ml.docilealligator.infinityforreddit.databinding.ActivityRulesBinding;
import ml.docilealligator.infinityforreddit.events.ChangeNetworkStatusEvent;
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
@@ -50,20 +41,6 @@ public class RulesActivity extends BaseActivity {
static final String EXTRA_SUBREDDIT_NAME = "ESN";
- @BindView(R.id.coordinator_layout_rules_activity)
- CoordinatorLayout coordinatorLayout;
- @BindView(R.id.appbar_layout_rules_activity)
- AppBarLayout appBarLayout;
- @BindView(R.id.collapsing_toolbar_layout_rules_activity)
- CollapsingToolbarLayout collapsingToolbarLayout;
- @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;
@@ -82,6 +59,7 @@ public class RulesActivity extends BaseActivity {
Executor mExecutor;
private String mSubredditName;
private RulesRecyclerViewAdapter mAdapter;
+ private ActivityRulesBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -89,9 +67,8 @@ public class RulesActivity extends BaseActivity {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_rules);
-
- ButterKnife.bind(this);
+ binding = ActivityRulesBinding.inflate(getLayoutInflater());
+ setContentView(binding.getRoot());
EventBus.getDefault().register(this);
@@ -106,7 +83,7 @@ public class RulesActivity extends BaseActivity {
Window window = getWindow();
if (isChangeStatusBarIconColor()) {
- addOnOffsetChangedListener(appBarLayout);
+ addOnOffsetChangedListener(binding.appbarLayoutRulesActivity);
}
if (isImmersiveInterface()) {
@@ -115,34 +92,34 @@ public class RulesActivity extends BaseActivity {
} else {
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
- adjustToolbar(toolbar);
+ adjustToolbar(binding.toolbarRulesActivity);
int navBarHeight = getNavBarHeight();
if (navBarHeight > 0) {
- recyclerView.setPadding(0, 0, 0, navBarHeight);
+ binding.recyclerViewRulesActivity.setPadding(0, 0, 0, navBarHeight);
}
}
}
- appBarLayout.setBackgroundColor(mCustomThemeWrapper.getColorPrimary());
- setSupportActionBar(toolbar);
+ binding.appbarLayoutRulesActivity.setBackgroundColor(mCustomThemeWrapper.getColorPrimary());
+ setSupportActionBar(binding.toolbarRulesActivity);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mSubredditName = getIntent().getExtras().getString(EXTRA_SUBREDDIT_NAME);
mAdapter = new RulesRecyclerViewAdapter(this, mCustomThemeWrapper, sliderPanel, mSubredditName);
- recyclerView.setAdapter(mAdapter);
+ binding.recyclerViewRulesActivity.setAdapter(mAdapter);
FetchRules.fetchRules(mExecutor, new Handler(),
accountName.equals(Account.ANONYMOUS_ACCOUNT) ? mRetrofit : mOauthRetrofit,
accessToken, accountName, mSubredditName, new FetchRules.FetchRulesListener() {
@Override
public void success(ArrayList<Rule> rules) {
- progressBar.setVisibility(View.GONE);
+ binding.progressBarRulesActivity.setVisibility(View.GONE);
if (rules == null || rules.size() == 0) {
- errorTextView.setVisibility(View.VISIBLE);
- errorTextView.setText(R.string.no_rule);
- errorTextView.setOnClickListener(view -> {
+ binding.errorTextViewRulesActivity.setVisibility(View.VISIBLE);
+ binding.errorTextViewRulesActivity.setText(R.string.no_rule);
+ binding.errorTextViewRulesActivity.setOnClickListener(view -> {
});
}
mAdapter.changeDataset(rules);
@@ -172,32 +149,33 @@ public class RulesActivity extends BaseActivity {
@Override
protected void applyCustomTheme() {
- coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
- applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
- progressBar.setIndeterminateTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorAccent()));
- errorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
+ binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
+ applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutRulesActivity,
+ binding.collapsingToolbarLayoutRulesActivity, binding.toolbarRulesActivity);
+ binding.progressBarRulesActivity.setIndeterminateTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorAccent()));
+ binding.errorTextViewRulesActivity.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
if (typeface != null) {
- errorTextView.setTypeface(typeface);
+ binding.errorTextViewRulesActivity.setTypeface(typeface);
}
}
private void displayError() {
- progressBar.setVisibility(View.GONE);
- errorTextView.setVisibility(View.VISIBLE);
- errorTextView.setText(R.string.error_loading_rules);
- errorTextView.setOnClickListener(view -> {
- progressBar.setVisibility(View.VISIBLE);
- errorTextView.setVisibility(View.GONE);
+ binding.progressBarRulesActivity.setVisibility(View.GONE);
+ binding.errorTextViewRulesActivity.setVisibility(View.VISIBLE);
+ binding.errorTextViewRulesActivity.setText(R.string.error_loading_rules);
+ binding.errorTextViewRulesActivity.setOnClickListener(view -> {
+ binding.progressBarRulesActivity.setVisibility(View.VISIBLE);
+ binding.errorTextViewRulesActivity.setVisibility(View.GONE);
FetchRules.fetchRules(mExecutor, new Handler(),
accountName.equals(Account.ANONYMOUS_ACCOUNT) ? mRetrofit : mOauthRetrofit,
accessToken, accountName, mSubredditName, new FetchRules.FetchRulesListener() {
@Override
public void success(ArrayList<Rule> rules) {
- progressBar.setVisibility(View.GONE);
+ binding.progressBarRulesActivity.setVisibility(View.GONE);
if (rules == null || rules.size() == 0) {
- errorTextView.setVisibility(View.VISIBLE);
- errorTextView.setText(R.string.no_rule);
- errorTextView.setOnClickListener(view -> {
+ binding.errorTextViewRulesActivity.setVisibility(View.VISIBLE);
+ binding.errorTextViewRulesActivity.setText(R.string.no_rule);
+ binding.errorTextViewRulesActivity.setOnClickListener(view -> {
});
}
mAdapter.changeDataset(rules);
diff --git a/app/src/main/res/layout/activity_multireddit_selection.xml b/app/src/main/res/layout/activity_multireddit_selection.xml
index 0cfe6e8d..af97f0c8 100644
--- a/app/src/main/res/layout/activity_multireddit_selection.xml
+++ b/app/src/main/res/layout/activity_multireddit_selection.xml
@@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:id="@+id/coordinator_layout_multireddit_selection_activity"
tools:application=".MultiredditSelectionActivity">
<com.google.android.material.appbar.AppBarLayout
diff --git a/app/src/main/res/layout/activity_post_filter_application.xml b/app/src/main/res/layout/activity_post_filter_application.xml
index 6708bb4e..cac8ca4f 100644
--- a/app/src/main/res/layout/activity_post_filter_application.xml
+++ b/app/src/main/res/layout/activity_post_filter_application.xml
@@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:id="@+id/coordinator_layout_post_filter_application_activity"
tools:context=".activities.PostFilterUsageListingActivity">
<com.google.android.material.appbar.AppBarLayout
diff --git a/app/src/main/res/layout/activity_post_filter_preference.xml b/app/src/main/res/layout/activity_post_filter_preference.xml
index 7db6ad95..613d0e2b 100644
--- a/app/src/main/res/layout/activity_post_filter_preference.xml
+++ b/app/src/main/res/layout/activity_post_filter_preference.xml
@@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:id="@+id/coordinator_layout_post_filter_preference_activity"
tools:context=".activities.PostFilterPreferenceActivity">
<com.google.android.material.appbar.AppBarLayout
diff --git a/app/src/main/res/layout/activity_report.xml b/app/src/main/res/layout/activity_report.xml
index fc0b504d..c27335e9 100644
--- a/app/src/main/res/layout/activity_report.xml
+++ b/app/src/main/res/layout/activity_report.xml
@@ -2,7 +2,6 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/coordinator_layout_report_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:application=".PostImageActivity">
diff --git a/app/src/main/res/layout/activity_rules.xml b/app/src/main/res/layout/activity_rules.xml
index 606546a3..cebe1577 100644
--- a/app/src/main/res/layout/activity_rules.xml
+++ b/app/src/main/res/layout/activity_rules.xml
@@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:id="@+id/coordinator_layout_rules_activity"
tools:application=".RulesActivity">
<com.google.android.material.appbar.AppBarLayout