diff options
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
2 files changed, 21 insertions, 43 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java index f6f60af0..0e75c367 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java @@ -11,12 +11,8 @@ import android.view.Window; import android.view.WindowManager; 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 org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -25,14 +21,12 @@ import java.util.ArrayList; import javax.inject.Inject; import javax.inject.Named; -import butterknife.BindView; -import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; +import ml.docilealligator.infinityforreddit.databinding.ActivitySearchSubredditsResultBinding; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.fragments.SubredditListingFragment; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; @@ -47,12 +41,6 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti private static final String FRAGMENT_OUT_STATE = "FOS"; - @BindView(R.id.coordinator_layout_search_subreddits_result_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.appbar_layout_search_subreddits_result_activity) - AppBarLayout appBarLayout; - @BindView(R.id.toolbar_search_subreddits_result_activity) - Toolbar toolbar; Fragment mFragment; @Inject @Named("default") @@ -62,6 +50,7 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti SharedPreferences mCurrentAccountSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; + private ActivitySearchSubredditsResultBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { @@ -69,9 +58,8 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti super.onCreate(savedInstanceState); - setContentView(R.layout.activity_search_subreddits_result); - - ButterKnife.bind(this); + binding = ActivitySearchSubredditsResultBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); EventBus.getDefault().register(this); @@ -85,7 +73,7 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti Window window = getWindow(); if (isChangeStatusBarIconColor()) { - addOnOffsetChangedListener(appBarLayout); + addOnOffsetChangedListener(binding.appbarLayoutSearchSubredditsResultActivity); } if (isImmersiveInterface()) { @@ -94,13 +82,13 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } - adjustToolbar(toolbar); + adjustToolbar(binding.toolbarSearchSubredditsResultActivity); } } - setSupportActionBar(toolbar); + setSupportActionBar(binding.toolbarSearchSubredditsResultActivity); getSupportActionBar().setDisplayHomeAsUpEnabled(true); - setToolbarGoToTop(toolbar); + setToolbarGoToTop(binding.toolbarSearchSubredditsResultActivity); String query = getIntent().getExtras().getString(EXTRA_QUERY); @@ -136,8 +124,8 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti @Override protected void applyCustomTheme() { - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar); + binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutSearchSubredditsResultActivity, null, binding.toolbarSearchSubredditsResultActivity); } public void getSelectedSubreddit(String name, String iconUrl) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java index 684e676c..78c9b003 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java @@ -11,12 +11,8 @@ import android.view.Window; import android.view.WindowManager; 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 org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -25,14 +21,12 @@ import java.util.ArrayList; import javax.inject.Inject; import javax.inject.Named; -import butterknife.BindView; -import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; +import ml.docilealligator.infinityforreddit.databinding.ActivitySearchUsersResultBinding; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.fragments.UserListingFragment; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; @@ -47,12 +41,6 @@ public class SearchUsersResultActivity extends BaseActivity implements ActivityT private static final String FRAGMENT_OUT_STATE = "FOS"; - @BindView(R.id.coordinator_layout_search_users_result_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.appbar_layout_search_users_result_activity) - AppBarLayout appBarLayout; - @BindView(R.id.toolbar_search_users_result_activity) - Toolbar toolbar; Fragment mFragment; @Inject @Named("default") @@ -62,15 +50,16 @@ public class SearchUsersResultActivity extends BaseActivity implements ActivityT SharedPreferences mCurrentAccountSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; + private ActivitySearchUsersResultBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { ((Infinity) getApplication()).getAppComponent().inject(this); super.onCreate(savedInstanceState); - setContentView(R.layout.activity_search_users_result); - ButterKnife.bind(this); + binding = ActivitySearchUsersResultBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); EventBus.getDefault().register(this); @@ -84,7 +73,7 @@ public class SearchUsersResultActivity extends BaseActivity implements ActivityT Window window = getWindow(); if (isChangeStatusBarIconColor()) { - addOnOffsetChangedListener(appBarLayout); + addOnOffsetChangedListener(binding.appbarLayoutSearchUsersResultActivity); } if (isImmersiveInterface()) { @@ -93,13 +82,13 @@ public class SearchUsersResultActivity extends BaseActivity implements ActivityT } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } - adjustToolbar(toolbar); + adjustToolbar(binding.toolbarSearchUsersResultActivity); } } - setSupportActionBar(toolbar); + setSupportActionBar(binding.toolbarSearchUsersResultActivity); getSupportActionBar().setDisplayHomeAsUpEnabled(true); - setToolbarGoToTop(toolbar); + setToolbarGoToTop(binding.toolbarSearchUsersResultActivity); String query = getIntent().getExtras().getString(EXTRA_QUERY); @@ -135,8 +124,9 @@ public class SearchUsersResultActivity extends BaseActivity implements ActivityT @Override protected void applyCustomTheme() { - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar); + binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutSearchUsersResultActivity, + null, binding.toolbarSearchUsersResultActivity); } public void getSelectedUser(String name, String iconUrl) { |