Start utilizing view binding (#1013)

This commit is contained in:
Taco 2022-09-21 00:46:13 -04:00 committed by GitHub
parent 8a2932122c
commit 55d6078ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 120 additions and 171 deletions

View File

@ -44,6 +44,10 @@ android {
enableSplit = false enableSplit = false
} }
} }
buildFeatures {
viewBinding true
}
} }
dependencies { dependencies {

View File

@ -6,17 +6,12 @@ import android.os.Bundle;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.r0adkll.slidr.Slidr; import com.r0adkll.slidr.Slidr;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -25,8 +20,6 @@ import org.greenrobot.eventbus.Subscribe;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.Infinity;
@ -35,6 +28,7 @@ import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.databinding.ActivityAccountPostsBinding;
import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent;
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.fragments.PostFragment; import ml.docilealligator.infinityforreddit.fragments.PostFragment;
@ -48,14 +42,6 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
private static final String FRAGMENT_OUT_STATE = "FOS"; private static final String FRAGMENT_OUT_STATE = "FOS";
@BindView(R.id.coordinator_layout_account_posts_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.appbar_layout_account_posts_activity)
AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar_layout_account_posts_activity)
CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.toolbar_account_posts_activity)
Toolbar toolbar;
@Inject @Inject
@Named("default") @Named("default")
SharedPreferences mSharedPreferences; SharedPreferences mSharedPreferences;
@ -72,6 +58,7 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
private String mUserWhere; private String mUserWhere;
private Fragment mFragment; private Fragment mFragment;
private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment; private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment;
private ActivityAccountPostsBinding binding;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -79,9 +66,8 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account_posts); binding = ActivityAccountPostsBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
ButterKnife.bind(this);
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
@ -95,7 +81,7 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
Window window = getWindow(); Window window = getWindow();
if (isChangeStatusBarIconColor()) { if (isChangeStatusBarIconColor()) {
addOnOffsetChangedListener(appBarLayout); addOnOffsetChangedListener(binding.accountPostsAppbarLayout);
} }
if (isImmersiveInterface()) { if (isImmersiveInterface()) {
@ -104,24 +90,24 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
} else { } else {
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
} }
adjustToolbar(toolbar); adjustToolbar(binding.accountPostsToolbar);
} }
} }
mUserWhere = getIntent().getExtras().getString(EXTRA_USER_WHERE); mUserWhere = getIntent().getExtras().getString(EXTRA_USER_WHERE);
if (mUserWhere.equals(PostPagingSource.USER_WHERE_UPVOTED)) { if (mUserWhere.equals(PostPagingSource.USER_WHERE_UPVOTED)) {
toolbar.setTitle(R.string.upvoted); binding.accountPostsToolbar.setTitle(R.string.upvoted);
} else if (mUserWhere.equals(PostPagingSource.USER_WHERE_DOWNVOTED)) { } else if (mUserWhere.equals(PostPagingSource.USER_WHERE_DOWNVOTED)) {
toolbar.setTitle(R.string.downvoted); binding.accountPostsToolbar.setTitle(R.string.downvoted);
} else if (mUserWhere.equals(PostPagingSource.USER_WHERE_HIDDEN)) { } else if (mUserWhere.equals(PostPagingSource.USER_WHERE_HIDDEN)) {
toolbar.setTitle(R.string.hidden); binding.accountPostsToolbar.setTitle(R.string.hidden);
} else if (mUserWhere.equals(PostPagingSource.USER_WHERE_GILDED)) { } else if (mUserWhere.equals(PostPagingSource.USER_WHERE_GILDED)) {
toolbar.setTitle(R.string.gilded); binding.accountPostsToolbar.setTitle(R.string.gilded);
} }
setSupportActionBar(toolbar); setSupportActionBar(binding.accountPostsToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setToolbarGoToTop(toolbar); setToolbarGoToTop(binding.accountPostsToolbar);
postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
@ -130,7 +116,9 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
if (savedInstanceState != null) { if (savedInstanceState != null) {
mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_account_posts_activity, mFragment).commit(); getSupportFragmentManager().beginTransaction()
.replace(binding.accountPostsFrameLayout.getId(), mFragment)
.commit();
} else { } else {
initializeFragment(); initializeFragment();
} }
@ -157,8 +145,10 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); binding.accountPostsCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar); applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(
binding.accountPostsAppbarLayout, binding.accountPostsCollapsingToolbarLayout,
binding.accountPostsToolbar);
} }
private void initializeFragment() { private void initializeFragment() {
@ -171,7 +161,9 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName);
bundle.putBoolean(PostFragment.EXTRA_DISABLE_READ_POSTS, true); bundle.putBoolean(PostFragment.EXTRA_DISABLE_READ_POSTS, true);
mFragment.setArguments(bundle); mFragment.setArguments(bundle);
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_account_posts_activity, mFragment).commit(); getSupportFragmentManager().beginTransaction()
.replace(binding.accountPostsFrameLayout.getId(), mFragment)
.commit();
} }
@Override @Override

View File

@ -11,17 +11,12 @@ import android.view.WindowManager;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.adapter.FragmentStateAdapter;
import androidx.viewpager2.widget.ViewPager2; import androidx.viewpager2.widget.ViewPager2;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator; import com.google.android.material.tabs.TabLayoutMediator;
import com.r0adkll.slidr.Slidr; import com.r0adkll.slidr.Slidr;
import com.r0adkll.slidr.model.SlidrInterface; import com.r0adkll.slidr.model.SlidrInterface;
@ -34,8 +29,6 @@ import java.util.concurrent.Executor;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface; import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface;
@ -43,6 +36,7 @@ import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.databinding.ActivityAccountSavedThingBinding;
import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent;
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.fragments.CommentsListingFragment; import ml.docilealligator.infinityforreddit.fragments.CommentsListingFragment;
@ -57,18 +51,6 @@ import retrofit2.Retrofit;
public class AccountSavedThingActivity extends BaseActivity implements ActivityToolbarInterface, public class AccountSavedThingActivity extends BaseActivity implements ActivityToolbarInterface,
PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, MarkPostAsReadInterface { PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, MarkPostAsReadInterface {
@BindView(R.id.coordinator_layout_account_saved_thing_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.appbar_layout_account_saved_thing_activity)
AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar_layout_account_saved_thing_activity)
CollapsingToolbarLayout collapsingToolbarLayout;
@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)
ViewPager2 viewPager2;
@Inject @Inject
@Named("oauth") @Named("oauth")
Retrofit mOauthRetrofit; Retrofit mOauthRetrofit;
@ -93,16 +75,15 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
private String mAccessToken; private String mAccessToken;
private String mAccountName; private String mAccountName;
private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment; private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment;
private ActivityAccountSavedThingBinding binding;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this); ((Infinity) getApplication()).getAppComponent().inject(this);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityAccountSavedThingBinding.inflate(getLayoutInflater());
setContentView(R.layout.activity_account_saved_thing); setContentView(binding.getRoot());
ButterKnife.bind(this);
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
@ -116,7 +97,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
Window window = getWindow(); Window window = getWindow();
if (isChangeStatusBarIconColor()) { if (isChangeStatusBarIconColor()) {
addOnOffsetChangedListener(appBarLayout); addOnOffsetChangedListener(binding.accountSavedThingAppbarLayout);
} }
if (isImmersiveInterface()) { if (isImmersiveInterface()) {
@ -125,13 +106,13 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
} else { } else {
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
} }
adjustToolbar(toolbar); adjustToolbar(binding.accountSavedThingToolbar);
} }
} }
setSupportActionBar(toolbar); setSupportActionBar(binding.accountSavedThingToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setToolbarGoToTop(toolbar); setToolbarGoToTop(binding.accountSavedThingToolbar);
postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
@ -164,17 +145,20 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); binding.accountSavedThingCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar); applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(
applyTabLayoutTheme(tabLayout); binding.accountSavedThingAppbarLayout,
binding.accountSavedThingCollapsingToolbarLayout,
binding.accountSavedThingToolbar);
applyTabLayoutTheme(binding.accountSavedThingTabLayout);
} }
private void initializeViewPager() { private void initializeViewPager() {
sectionsPagerAdapter = new SectionsPagerAdapter(this); sectionsPagerAdapter = new SectionsPagerAdapter(this);
viewPager2.setAdapter(sectionsPagerAdapter); binding.accountSavedThingViewPager2.setAdapter(sectionsPagerAdapter);
viewPager2.setOffscreenPageLimit(2); binding.accountSavedThingViewPager2.setOffscreenPageLimit(2);
viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); binding.accountSavedThingViewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false));
new TabLayoutMediator(tabLayout, viewPager2, (tab, position) -> { new TabLayoutMediator(binding.accountSavedThingTabLayout, binding.accountSavedThingViewPager2, (tab, position) -> {
switch (position) { switch (position) {
case 0: case 0:
Utils.setTitleWithCustomFontToTab(typeface, tab, getString(R.string.posts)); Utils.setTitleWithCustomFontToTab(typeface, tab, getString(R.string.posts));
@ -185,7 +169,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
} }
}).attach(); }).attach();
viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { binding.accountSavedThingViewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override @Override
public void onPageSelected(int position) { public void onPageSelected(int position) {
if (position == 0) { if (position == 0) {
@ -196,7 +180,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
} }
}); });
fixViewPager2Sensitivity(viewPager2); fixViewPager2Sensitivity(binding.accountSavedThingViewPager2);
} }
@Override @Override
@ -303,14 +287,14 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT
@Nullable @Nullable
private Fragment getCurrentFragment() { private Fragment getCurrentFragment() {
if (viewPager2 == null || fragmentManager == null) { if (fragmentManager == null) {
return null; return null;
} }
return fragmentManager.findFragmentByTag("f" + viewPager2.getCurrentItem()); return fragmentManager.findFragmentByTag("f" + binding.accountSavedThingViewPager2.getCurrentItem());
} }
public boolean handleKeyDown(int keyCode) { public boolean handleKeyDown(int keyCode) {
if (viewPager2.getCurrentItem() == 0) { if (binding.accountSavedThingViewPager2.getCurrentItem() == 0) {
Fragment fragment = getCurrentFragment(); Fragment fragment = getCurrentFragment();
if (fragment instanceof PostFragment) { if (fragment instanceof PostFragment) {
return ((PostFragment) fragment).handleKeyDown(keyCode); return ((PostFragment) fragment).handleKeyDown(keyCode);

View File

@ -16,22 +16,16 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager; import com.bumptech.glide.RequestManager;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
@ -48,8 +42,6 @@ import java.util.concurrent.TimeUnit;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import io.noties.markwon.AbstractMarkwonPlugin; import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon; import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration; import io.noties.markwon.MarkwonConfiguration;
@ -81,6 +73,7 @@ import ml.docilealligator.infinityforreddit.comment.Comment;
import ml.docilealligator.infinityforreddit.comment.SendComment; import ml.docilealligator.infinityforreddit.comment.SendComment;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed; import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed;
import ml.docilealligator.infinityforreddit.databinding.ActivityCommentBinding;
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.markdown.RedditHeadingPlugin; import ml.docilealligator.infinityforreddit.markdown.RedditHeadingPlugin;
import ml.docilealligator.infinityforreddit.markdown.SpoilerParserPlugin; import ml.docilealligator.infinityforreddit.markdown.SpoilerParserPlugin;
@ -89,7 +82,6 @@ import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.utils.Utils; import ml.docilealligator.infinityforreddit.utils.Utils;
import okhttp3.ConnectionPool; import okhttp3.ConnectionPool;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import pl.droidsonroids.gif.GifImageView;
import retrofit2.Retrofit; import retrofit2.Retrofit;
public class CommentActivity extends BaseActivity implements UploadImageEnabledActivity, AccountChooserBottomSheetFragment.AccountChooserListener { public class CommentActivity extends BaseActivity implements UploadImageEnabledActivity, AccountChooserBottomSheetFragment.AccountChooserListener {
@ -111,28 +103,6 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
private static final String SELECTED_ACCOUNT_STATE = "SAS"; private static final String SELECTED_ACCOUNT_STATE = "SAS";
private static final String UPLOADED_IMAGES_STATE = "UIS"; private static final String UPLOADED_IMAGES_STATE = "UIS";
@BindView(R.id.coordinator_layout_comment_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.appbar_layout_comment_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_comment_activity)
Toolbar toolbar;
@BindView(R.id.comment_parent_markwon_view_comment_activity)
TextView commentParentMarkwonView;
@BindView(R.id.divider_comment_activity)
View divider;
@BindView(R.id.content_markdown_view_comment_activity)
RecyclerView contentMarkdownRecyclerView;
@BindView(R.id.account_linear_layout_comment_activity)
LinearLayout accountLinearLayout;
@BindView(R.id.account_icon_gif_image_view_comment_activity)
GifImageView accountIconImageView;
@BindView(R.id.account_name_text_view_comment_activity)
TextView accountNameTextView;
@BindView(R.id.comment_edit_text_comment_activity)
EditText commentEditText;
@BindView(R.id.markdown_bottom_bar_recycler_view_comment_activity)
RecyclerView markdownBottomBarRecyclerView;
@Inject @Inject
@Named("no_oauth") @Named("no_oauth")
Retrofit mRetrofit; Retrofit mRetrofit;
@ -169,6 +139,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
private Menu mMenu; private Menu mMenu;
private int commentColor; private int commentColor;
private int commentSpoilerBackgroundColor; private int commentSpoilerBackgroundColor;
private ActivityCommentBinding binding;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -177,17 +148,15 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
setImmersiveModeNotApplicable(); setImmersiveModeNotApplicable();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityCommentBinding.inflate(getLayoutInflater());
setContentView(R.layout.activity_comment); setContentView(binding.getRoot());
ButterKnife.bind(this);
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
applyCustomTheme(); applyCustomTheme();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
addOnOffsetChangedListener(appBarLayout); addOnOffsetChangedListener(binding.commentAppbarLayout);
} }
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
@ -239,7 +208,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS)) .usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
.build(); .build();
if (parentTextMarkdown != null) { if (parentTextMarkdown != null) {
commentParentMarkwonView.setOnLongClickListener(view -> { binding.commentCommentParentMarkwonView.setOnLongClickListener(view -> {
Utils.hideKeyboard(CommentActivity.this); Utils.hideKeyboard(CommentActivity.this);
if (parentText == null) { if (parentText == null) {
CopyTextBottomSheetFragment.show(getSupportFragmentManager(), CopyTextBottomSheetFragment.show(getSupportFragmentManager(),
@ -250,13 +219,13 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
} }
return true; return true;
}); });
markwon.setMarkdown(commentParentMarkwonView, parentTextMarkdown); markwon.setMarkdown(binding.commentCommentParentMarkwonView, parentTextMarkdown);
} }
String parentBodyMarkdown = intent.getStringExtra(EXTRA_COMMENT_PARENT_BODY_MARKDOWN_KEY); String parentBodyMarkdown = intent.getStringExtra(EXTRA_COMMENT_PARENT_BODY_MARKDOWN_KEY);
String parentBody = intent.getStringExtra(EXTRA_COMMENT_PARENT_BODY_KEY); String parentBody = intent.getStringExtra(EXTRA_COMMENT_PARENT_BODY_KEY);
if (parentBodyMarkdown != null && !parentBodyMarkdown.equals("")) { if (parentBodyMarkdown != null && !parentBodyMarkdown.equals("")) {
contentMarkdownRecyclerView.setVisibility(View.VISIBLE); binding.commentContentMarkdownView.setVisibility(View.VISIBLE);
contentMarkdownRecyclerView.setNestedScrollingEnabled(false); binding.commentContentMarkdownView.setNestedScrollingEnabled(false);
Markwon postBodyMarkwon = Markwon.builder(this) Markwon postBodyMarkwon = Markwon.builder(this)
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> { .usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
plugin.excludeInlineProcessor(AutolinkInlineProcessor.class); plugin.excludeInlineProcessor(AutolinkInlineProcessor.class);
@ -314,8 +283,8 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
.tableLayout(R.layout.adapter_table_block, R.id.table_layout) .tableLayout(R.layout.adapter_table_block, R.id.table_layout)
.textLayoutIsRoot(R.layout.view_table_entry_cell))) .textLayoutIsRoot(R.layout.view_table_entry_cell)))
.build(); .build();
contentMarkdownRecyclerView.setLayoutManager(new LinearLayoutManagerBugFixed(this)); binding.commentContentMarkdownView.setLayoutManager(new LinearLayoutManagerBugFixed(this));
contentMarkdownRecyclerView.setAdapter(markwonAdapter); binding.commentContentMarkdownView.setAdapter(markwonAdapter);
markwonAdapter.setMarkdown(postBodyMarkwon, parentBodyMarkdown); markwonAdapter.setMarkdown(postBodyMarkwon, parentBodyMarkdown);
markwonAdapter.notifyDataSetChanged(); markwonAdapter.notifyDataSetChanged();
} }
@ -324,10 +293,10 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
parentPosition = intent.getExtras().getInt(EXTRA_PARENT_POSITION_KEY); parentPosition = intent.getExtras().getInt(EXTRA_PARENT_POSITION_KEY);
isReplying = intent.getExtras().getBoolean(EXTRA_IS_REPLYING_KEY); isReplying = intent.getExtras().getBoolean(EXTRA_IS_REPLYING_KEY);
if (isReplying) { if (isReplying) {
toolbar.setTitle(getString(R.string.comment_activity_label_is_replying)); binding.commentToolbar.setTitle(getString(R.string.comment_activity_label_is_replying));
} }
setSupportActionBar(toolbar); setSupportActionBar(binding.commentToolbar);
mGlide = Glide.with(this); mGlide = Glide.with(this);
@ -340,9 +309,9 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon) .error(mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(accountIconImageView); .into(binding.commentAccountIconGifImageView);
accountNameTextView.setText(selectedAccount.getAccountName()); binding.commentAccountNameTextView.setText(selectedAccount.getAccountName());
} else { } else {
loadCurrentAccount(); loadCurrentAccount();
} }
@ -355,7 +324,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
@Override @Override
public void onClick(int item) { public void onClick(int item) {
MarkdownBottomBarRecyclerViewAdapter.bindEditTextWithItemClickListener( MarkdownBottomBarRecyclerViewAdapter.bindEditTextWithItemClickListener(
CommentActivity.this, commentEditText, item); CommentActivity.this, binding.commentCommentEditText, item);
} }
@Override @Override
@ -370,16 +339,16 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
} }
}); });
markdownBottomBarRecyclerView.setLayoutManager(new LinearLayoutManagerBugFixed(this, binding.commentMarkdownBottomBarRecyclerView.setLayoutManager(new LinearLayoutManagerBugFixed(this,
LinearLayoutManagerBugFixed.HORIZONTAL, false)); LinearLayoutManagerBugFixed.HORIZONTAL, false));
markdownBottomBarRecyclerView.setAdapter(adapter); binding.commentMarkdownBottomBarRecyclerView.setAdapter(adapter);
accountLinearLayout.setOnClickListener(view -> { binding.commentAccountLinearLayout.setOnClickListener(view -> {
AccountChooserBottomSheetFragment fragment = new AccountChooserBottomSheetFragment(); AccountChooserBottomSheetFragment fragment = new AccountChooserBottomSheetFragment();
fragment.show(getSupportFragmentManager(), fragment.getTag()); fragment.show(getSupportFragmentManager(), fragment.getTag());
}); });
commentEditText.requestFocus(); binding.commentCommentEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) { if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
@ -397,9 +366,9 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon) .error(mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(accountIconImageView); .into(binding.commentAccountIconGifImageView);
accountNameTextView.setText(account.getAccountName()); binding.commentAccountNameTextView.setText(account.getAccountName());
} }
}); });
}); });
@ -424,22 +393,22 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); binding.commentCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar); applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.commentAppbarLayout, null, binding.commentToolbar);
commentColor = mCustomThemeWrapper.getCommentColor(); commentColor = mCustomThemeWrapper.getCommentColor();
commentSpoilerBackgroundColor = commentColor | 0xFF000000; commentSpoilerBackgroundColor = commentColor | 0xFF000000;
commentParentMarkwonView.setTextColor(commentColor); binding.commentCommentParentMarkwonView.setTextColor(commentColor);
divider.setBackgroundColor(mCustomThemeWrapper.getDividerColor()); binding.commentDivider.setBackgroundColor(mCustomThemeWrapper.getDividerColor());
commentEditText.setTextColor(mCustomThemeWrapper.getCommentColor()); binding.commentCommentEditText.setTextColor(mCustomThemeWrapper.getCommentColor());
int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor(); int secondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor();
commentEditText.setHintTextColor(secondaryTextColor); binding.commentCommentEditText.setHintTextColor(secondaryTextColor);
markdownColor = secondaryTextColor; markdownColor = secondaryTextColor;
spoilerBackgroundColor = markdownColor | 0xFF000000; spoilerBackgroundColor = markdownColor | 0xFF000000;
accountNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); binding.commentAccountNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
if (typeface != null) { if (typeface != null) {
commentParentMarkwonView.setTypeface(typeface); binding.commentCommentParentMarkwonView.setTypeface(typeface);
commentEditText.setTypeface(typeface); binding.commentCommentEditText.setTypeface(typeface);
} }
} }
@ -448,7 +417,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
super.onPause(); super.onPause();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) { if (imm != null) {
imm.hideSoftInputFromWindow(commentEditText.getWindowToken(), 0); imm.hideSoftInputFromWindow(binding.commentCommentEditText.getWindowToken(), 0);
} }
} }
@ -468,7 +437,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
return true; return true;
} else if (itemId == R.id.action_preview_comment_activity) { } else if (itemId == R.id.action_preview_comment_activity) {
Intent intent = new Intent(this, FullMarkdownActivity.class); Intent intent = new Intent(this, FullMarkdownActivity.class);
intent.putExtra(FullMarkdownActivity.EXTRA_COMMENT_MARKDOWN, commentEditText.getText().toString()); intent.putExtra(FullMarkdownActivity.EXTRA_COMMENT_MARKDOWN, binding.commentCommentEditText.getText().toString());
intent.putExtra(FullMarkdownActivity.EXTRA_SUBMIT_POST, true); intent.putExtra(FullMarkdownActivity.EXTRA_SUBMIT_POST, true);
startActivityForResult(intent, MARKDOWN_PREVIEW_REQUEST_CODE); startActivityForResult(intent, MARKDOWN_PREVIEW_REQUEST_CODE);
} else if (itemId == R.id.action_send_comment_activity) { } else if (itemId == R.id.action_send_comment_activity) {
@ -482,9 +451,9 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
public void sendComment(@Nullable MenuItem item) { public void sendComment(@Nullable MenuItem item) {
if (!isSubmitting) { if (!isSubmitting) {
isSubmitting = true; isSubmitting = true;
if (commentEditText.getText() == null || commentEditText.getText().toString().equals("")) { if (binding.commentCommentEditText.getText() == null || binding.commentCommentEditText.getText().toString().equals("")) {
isSubmitting = false; isSubmitting = false;
Snackbar.make(coordinatorLayout, R.string.comment_content_required, Snackbar.LENGTH_SHORT).show(); Snackbar.make(binding.commentCoordinatorLayout, R.string.comment_content_required, Snackbar.LENGTH_SHORT).show();
return; return;
} }
@ -492,7 +461,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
item.setEnabled(false); item.setEnabled(false);
item.getIcon().setAlpha(130); item.getIcon().setAlpha(130);
} }
Snackbar sendingSnackbar = Snackbar.make(coordinatorLayout, R.string.sending_comment, Snackbar.LENGTH_INDEFINITE); Snackbar sendingSnackbar = Snackbar.make(binding.commentCoordinatorLayout, R.string.sending_comment, Snackbar.LENGTH_INDEFINITE);
sendingSnackbar.show(); sendingSnackbar.show();
Retrofit newAuthenticatorOauthRetrofit = mOauthRetrofit.newBuilder().client(new OkHttpClient.Builder().authenticator(new AnyAccountAccessTokenAuthenticator(mRetrofit, mRedditDataRoomDatabase, selectedAccount, mCurrentAccountSharedPreferences)) Retrofit newAuthenticatorOauthRetrofit = mOauthRetrofit.newBuilder().client(new OkHttpClient.Builder().authenticator(new AnyAccountAccessTokenAuthenticator(mRetrofit, mRedditDataRoomDatabase, selectedAccount, mCurrentAccountSharedPreferences))
@ -502,7 +471,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS)) .connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
.build()) .build())
.build(); .build();
SendComment.sendComment(mExecutor, new Handler(), commentEditText.getText().toString(), SendComment.sendComment(mExecutor, new Handler(), binding.commentCommentEditText.getText().toString(),
parentFullname, parentDepth, newAuthenticatorOauthRetrofit, selectedAccount, parentFullname, parentDepth, newAuthenticatorOauthRetrofit, selectedAccount,
new SendComment.SendCommentListener() { new SendComment.SendCommentListener() {
@Override @Override
@ -533,9 +502,9 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
} }
if (errorMessage == null || !errorMessage.equals("")) { if (errorMessage == null || !errorMessage.equals("")) {
Snackbar.make(coordinatorLayout, R.string.send_comment_failed, Snackbar.LENGTH_SHORT).show(); Snackbar.make(binding.commentCoordinatorLayout, R.string.send_comment_failed, Snackbar.LENGTH_SHORT).show();
} else { } else {
Snackbar.make(coordinatorLayout, errorMessage, Snackbar.LENGTH_SHORT).show(); Snackbar.make(binding.commentCoordinatorLayout, errorMessage, Snackbar.LENGTH_SHORT).show();
} }
} }
}); });
@ -562,10 +531,10 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
return; return;
} }
Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit, Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit,
mAccessToken, commentEditText, coordinatorLayout, data.getData(), uploadedImages); mAccessToken, binding.commentCommentEditText, binding.commentCoordinatorLayout, data.getData(), uploadedImages);
} else if (requestCode == CAPTURE_IMAGE_REQUEST_CODE) { } else if (requestCode == CAPTURE_IMAGE_REQUEST_CODE) {
Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit, Utils.uploadImageToReddit(this, mExecutor, mOauthRetrofit, mUploadMediaRetrofit,
mAccessToken, commentEditText, coordinatorLayout, capturedImageUri, uploadedImages); mAccessToken, binding.commentCommentEditText, binding.commentCoordinatorLayout, capturedImageUri, uploadedImages);
} else if (requestCode == MARKDOWN_PREVIEW_REQUEST_CODE) { } else if (requestCode == MARKDOWN_PREVIEW_REQUEST_CODE) {
sendComment(mMenu == null ? null : mMenu.findItem(R.id.action_send_comment_activity)); sendComment(mMenu == null ? null : mMenu.findItem(R.id.action_send_comment_activity));
} }
@ -577,7 +546,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
if (isSubmitting) { if (isSubmitting) {
promptAlertDialog(R.string.exit_when_submit, R.string.exit_when_edit_comment_detail); promptAlertDialog(R.string.exit_when_submit, R.string.exit_when_edit_comment_detail);
} else { } else {
if (commentEditText.getText().toString().equals("")) { if (binding.commentCommentEditText.getText().toString().equals("")) {
finish(); finish();
} else { } else {
promptAlertDialog(R.string.discard, R.string.discard_detail); promptAlertDialog(R.string.discard, R.string.discard_detail);
@ -622,9 +591,9 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
@Override @Override
public void insertImageUrl(UploadedImage uploadedImage) { public void insertImageUrl(UploadedImage uploadedImage) {
int start = Math.max(commentEditText.getSelectionStart(), 0); int start = Math.max(binding.commentCommentEditText.getSelectionStart(), 0);
int end = Math.max(commentEditText.getSelectionEnd(), 0); int end = Math.max(binding.commentCommentEditText.getSelectionEnd(), 0);
commentEditText.getText().replace(Math.min(start, end), Math.max(start, end), binding.commentCommentEditText.getText().replace(Math.min(start, end), Math.max(start, end),
"[" + uploadedImage.imageName + "](" + uploadedImage.imageUrl + ")", "[" + uploadedImage.imageName + "](" + uploadedImage.imageUrl + ")",
0, "[]()".length() + uploadedImage.imageName.length() + uploadedImage.imageUrl.length()); 0, "[]()".length() + uploadedImage.imageName.length() + uploadedImage.imageUrl.length());
} }
@ -638,9 +607,9 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(mGlide.load(R.drawable.subreddit_default_icon) .error(mGlide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
.into(accountIconImageView); .into(binding.commentAccountIconGifImageView);
accountNameTextView.setText(selectedAccount.getAccountName()); binding.commentAccountNameTextView.setText(selectedAccount.getAccountName());
} }
} }
} }

View File

@ -4,25 +4,25 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/coordinator_layout_account_posts_activity" android:id="@+id/account_posts_coordinator_layout"
tools:context=".activities.AccountPostsActivity"> tools:context=".activities.AccountPostsActivity">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_layout_account_posts_activity" android:id="@+id/account_posts_appbar_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"> android:theme="@style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout_account_posts_activity" android:id="@+id/account_posts_collapsing_toolbar_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false" app:titleEnabled="false"
app:toolbarId="@+id/toolbar_account_posts_activity"> app:toolbarId="@+id/account_posts_toolbar">
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_account_posts_activity" android:id="@+id/account_posts_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize" android:minHeight="?attr/actionBarSize"
@ -34,7 +34,7 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/frame_layout_account_posts_activity" android:id="@+id/account_posts_frame_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />

View File

@ -4,25 +4,25 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/coordinator_layout_account_saved_thing_activity" android:id="@+id/account_saved_thing_coordinator_layout"
tools:context=".activities.AccountPostsActivity"> tools:context=".activities.AccountPostsActivity">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_layout_account_saved_thing_activity" android:id="@+id/account_saved_thing_appbar_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"> android:theme="@style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout_account_saved_thing_activity" android:id="@+id/account_saved_thing_collapsing_toolbar_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false" app:titleEnabled="false"
app:toolbarId="@+id/toolbar_account_saved_thing_activity"> app:toolbarId="@+id/account_saved_thing_toolbar">
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_account_saved_thing_activity" android:id="@+id/account_saved_thing_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize" android:minHeight="?attr/actionBarSize"
@ -34,7 +34,7 @@
</com.google.android.material.appbar.CollapsingToolbarLayout> </com.google.android.material.appbar.CollapsingToolbarLayout>
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout_tab_layout_account_saved_thing_activity_activity" android:id="@+id/account_saved_thing_tab_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
@ -48,7 +48,7 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager2.widget.ViewPager2 <androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager_account_saved_thing_activity" android:id="@+id/account_saved_thing_view_pager_2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />

View File

@ -2,19 +2,19 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinator_layout_comment_activity" android:id="@+id/comment_coordinator_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:application=".CommentActivity"> tools:application=".CommentActivity">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_layout_comment_activity" android:id="@+id/comment_appbar_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"> android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_comment_activity" android:id="@+id/comment_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize" android:minHeight="?attr/actionBarSize"
@ -40,7 +40,7 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/comment_parent_markwon_view_comment_activity" android:id="@+id/comment_comment_parent_markwon_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="16dp" android:layout_margin="16dp"
@ -48,7 +48,7 @@
android:fontFamily="?attr/content_font_family" /> android:fontFamily="?attr/content_font_family" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/content_markdown_view_comment_activity" android:id="@+id/comment_content_markdown_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
@ -57,12 +57,12 @@
android:visibility="gone" /> android:visibility="gone" />
<View <View
android:id="@+id/divider_comment_activity" android:id="@+id/comment_divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" /> android:layout_height="1dp" />
<LinearLayout <LinearLayout
android:id="@+id/account_linear_layout_comment_activity" android:id="@+id/comment_account_linear_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="16dp" android:paddingTop="16dp"
@ -72,13 +72,13 @@
android:background="?attr/selectableItemBackground"> android:background="?attr/selectableItemBackground">
<pl.droidsonroids.gif.GifImageView <pl.droidsonroids.gif.GifImageView
android:id="@+id/account_icon_gif_image_view_comment_activity" android:id="@+id/comment_account_icon_gif_image_view"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginStart="16dp" /> android:layout_marginStart="16dp" />
<TextView <TextView
android:id="@+id/account_name_text_view_comment_activity" android:id="@+id/comment_account_name_text_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
@ -89,7 +89,7 @@
</LinearLayout> </LinearLayout>
<EditText <EditText
android:id="@+id/comment_edit_text_comment_activity" android:id="@+id/comment_comment_edit_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#00000000" android:background="#00000000"
@ -106,7 +106,7 @@
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/markdown_bottom_bar_recycler_view_comment_activity" android:id="@+id/comment_markdown_bottom_bar_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:scrollbars="horizontal" android:scrollbars="horizontal"