mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 11:17:25 +01:00
Add a SidebarFragment in ViewSubredditDetailActivity. Fix some UI issues.
This commit is contained in:
parent
7e222091c8
commit
daa6b06617
@ -85,12 +85,12 @@ public class SubredditMultiselectionActivity extends BaseActivity {
|
||||
SharedPreferences mSharedPreferences;
|
||||
@Inject
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
public SubscribedSubredditViewModel mSubscribedSubredditViewModel;
|
||||
private boolean mNullAccessToken = false;
|
||||
private String mAccessToken;
|
||||
private String mAccountName;
|
||||
private SubredditMultiselectionRecyclerViewAdapter mAdapter;
|
||||
private RequestManager mGlide;
|
||||
private SubscribedSubredditViewModel mSubscribedSubredditViewModel;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
@ -188,12 +188,11 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
|
||||
MenuItem lazyModeItem = mMenu.findItem(R.id.action_lazy_mode_view_multi_reddit_detail_activity);
|
||||
if (isInLazyMode) {
|
||||
lazyModeItem.setTitle(R.string.action_stop_lazy_mode);
|
||||
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED);
|
||||
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL);
|
||||
collapsingToolbarLayout.setLayoutParams(params);
|
||||
} else {
|
||||
lazyModeItem.setTitle(R.string.action_start_lazy_mode);
|
||||
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS |
|
||||
AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED);
|
||||
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS);
|
||||
collapsingToolbarLayout.setLayoutParams(params);
|
||||
}
|
||||
return true;
|
||||
@ -227,15 +226,14 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
|
||||
isInLazyMode = false;
|
||||
((FragmentCommunicator) mFragment).stopLazyMode();
|
||||
lazyModeItem.setTitle(R.string.action_start_lazy_mode);
|
||||
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS |
|
||||
AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED);
|
||||
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS);
|
||||
collapsingToolbarLayout.setLayoutParams(params);
|
||||
} else {
|
||||
isInLazyMode = true;
|
||||
if (((FragmentCommunicator) mFragment).startLazyMode()) {
|
||||
lazyModeItem.setTitle(R.string.action_stop_lazy_mode);
|
||||
appBarLayout.setExpanded(false);
|
||||
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED);
|
||||
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL);
|
||||
collapsingToolbarLayout.setLayoutParams(params);
|
||||
} else {
|
||||
isInLazyMode = false;
|
||||
|
@ -76,8 +76,8 @@ public class ViewSidebarActivity extends BaseActivity {
|
||||
SharedPreferences mSharedPreferences;
|
||||
@Inject
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
public SubredditViewModel mSubredditViewModel;
|
||||
private String subredditName;
|
||||
private SubredditViewModel mSubredditViewModel;
|
||||
private int markdownColor;
|
||||
|
||||
@Override
|
||||
|
@ -10,6 +10,7 @@ import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
@ -21,7 +22,10 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
@ -32,6 +36,7 @@ import com.google.android.material.bottomappbar.BottomAppBar;
|
||||
import com.google.android.material.chip.Chip;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -42,6 +47,7 @@ import javax.inject.Named;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsSubscribedToSubredditAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubredditDataAsyncTask;
|
||||
@ -53,6 +59,7 @@ import ml.docilealligator.infinityforreddit.FetchSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostLayoutBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostTypeBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SidebarFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SortTimeBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SortTypeBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
||||
@ -79,7 +86,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
|
||||
private static final String FETCH_SUBREDDIT_INFO_STATE = "FSIS";
|
||||
private static final String CURRENT_ONLINE_SUBSCRIBERS_STATE = "COSS";
|
||||
private static final String FRAGMENT_OUT_STATE_KEY = "FOSK";
|
||||
private static final String IS_IN_LAZY_MODE_STATE = "IILMS";
|
||||
private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
|
||||
private static final String ACCESS_TOKEN_STATE = "ATS";
|
||||
@ -89,6 +95,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
|
||||
@BindView(R.id.coordinator_layout_view_subreddit_detail_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.view_pager_view_subreddit_detail_activity)
|
||||
ViewPager viewPager;
|
||||
@BindView(R.id.appbar_layout_view_subreddit_detail)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.collapsing_toolbar_layout_view_subreddit_detail_activity)
|
||||
@ -97,6 +105,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
LinearLayout linearLayout;
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.tab_layout_view_subreddit_detail_activity)
|
||||
TabLayout tabLayout;
|
||||
@BindView(R.id.banner_image_view_view_subreddit_detail_activity)
|
||||
GifImageView bannerImageView;
|
||||
@BindView(R.id.icon_gif_image_view_view_subreddit_detail_activity)
|
||||
@ -138,6 +148,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
SharedPreferences mSharedPreferences;
|
||||
@Inject
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
public SubredditViewModel mSubredditViewModel;
|
||||
private SectionsPagerAdapter sectionsPagerAdapter;
|
||||
private boolean mNullAccessToken = false;
|
||||
private String mAccessToken;
|
||||
private String mAccountName;
|
||||
@ -152,14 +164,18 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
private String mMessageFullname;
|
||||
private String mNewAccountName;
|
||||
private RequestManager glide;
|
||||
private Fragment mFragment;
|
||||
private Menu mMenu;
|
||||
private AppBarLayout.LayoutParams params;
|
||||
private PostTypeBottomSheetFragment postTypeBottomSheetFragment;
|
||||
private SortTypeBottomSheetFragment sortTypeBottomSheetFragment;
|
||||
private SortTimeBottomSheetFragment sortTimeBottomSheetFragment;
|
||||
private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment;
|
||||
private SubredditViewModel mSubredditViewModel;
|
||||
private int expandedTabTextColor;
|
||||
private int expandedTabBackgroundColor;
|
||||
private int expandedTabIndicatorColor;
|
||||
private int collapsedTabTextColor;
|
||||
private int collapsedTabBackgroundColor;
|
||||
private int collapsedTabIndicatorColor;
|
||||
private int unsubscribedColor;
|
||||
private int subscribedColor;
|
||||
|
||||
@ -180,14 +196,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
Window window = getWindow();
|
||||
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
addOnOffsetChangedListener(appBarLayout);
|
||||
}
|
||||
|
||||
if (isImmersiveInterface()) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
adjustToolbar(toolbar);
|
||||
showToast = true;
|
||||
|
||||
int navBarHeight = getNavBarHeight();
|
||||
if (navBarHeight > 0) {
|
||||
@ -200,6 +211,56 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
showToast = true;
|
||||
}
|
||||
}
|
||||
|
||||
View decorView = window.getDecorView();
|
||||
if (isChangeStatusBarIconColor()) {
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state) {
|
||||
if (state == State.COLLAPSED) {
|
||||
decorView.setSystemUiVisibility(getSystemVisibilityToolbarCollapsed());
|
||||
tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor);
|
||||
tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor);
|
||||
tabLayout.setBackgroundColor(collapsedTabBackgroundColor);
|
||||
} else if (state == State.EXPANDED) {
|
||||
decorView.setSystemUiVisibility(getSystemVisibilityToolbarExpanded());
|
||||
tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor);
|
||||
tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor);
|
||||
tabLayout.setBackgroundColor(expandedTabBackgroundColor);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||
if (state == State.COLLAPSED) {
|
||||
tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor);
|
||||
tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor);
|
||||
tabLayout.setBackgroundColor(collapsedTabBackgroundColor);
|
||||
} else if (state == State.EXPANDED) {
|
||||
tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor);
|
||||
tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor);
|
||||
tabLayout.setBackgroundColor(expandedTabBackgroundColor);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
|
||||
@Override
|
||||
public void onStateChanged(AppBarLayout appBarLayout, State state) {
|
||||
if (state == State.EXPANDED) {
|
||||
tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor);
|
||||
tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor);
|
||||
tabLayout.setBackgroundColor(expandedTabBackgroundColor);
|
||||
} else if (state == State.COLLAPSED) {
|
||||
tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor);
|
||||
tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor);
|
||||
tabLayout.setBackgroundColor(collapsedTabBackgroundColor);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false);
|
||||
@ -221,13 +282,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
mMessageFullname = savedInstanceState.getString(MESSAGE_FULLNAME_STATE);
|
||||
mNewAccountName = savedInstanceState.getString(NEW_ACCOUNT_NAME_STATE);
|
||||
|
||||
mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE_KEY);
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_view_subreddit_detail_activity, mFragment).commit();
|
||||
|
||||
if (!mNullAccessToken && mAccessToken == null) {
|
||||
getCurrentAccountAndBindView();
|
||||
} else {
|
||||
bindView(false);
|
||||
bindView();
|
||||
}
|
||||
|
||||
if (mFetchSubredditInfoSuccess) {
|
||||
@ -318,8 +376,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (mFragment != null) {
|
||||
return ((FragmentCommunicator)(mFragment)).handleKeyDown(keyCode) || super.onKeyDown(keyCode, event);
|
||||
if (sectionsPagerAdapter != null) {
|
||||
return sectionsPagerAdapter.handleKeyDown(keyCode) || super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
return super.onKeyDown(keyCode, event);
|
||||
@ -341,6 +399,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
coordinatorLayout.setBackgroundColor(backgroundColor);
|
||||
collapsingToolbarLayout.setContentScrimColor(mCustomThemeWrapper.getColorPrimary());
|
||||
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
|
||||
expandedTabTextColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTextColor();
|
||||
expandedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabIndicator();
|
||||
expandedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabBackground();
|
||||
collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor();
|
||||
collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator();
|
||||
collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground();
|
||||
linearLayout.setBackgroundColor(backgroundColor);
|
||||
subredditNameTextView.setTextColor(mCustomThemeWrapper.getSubreddit());
|
||||
subscribeSubredditChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
|
||||
@ -354,6 +418,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
multiRedditBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
messageBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
profileBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
applyTabLayoutTheme(tabLayout);
|
||||
applyFABTheme(fab, R.drawable.ic_add_day_night_24dp);
|
||||
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
|
||||
subscribedColor = mCustomThemeWrapper.getSubscribed();
|
||||
@ -375,12 +440,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
mAccountName = newAccount.getUsername();
|
||||
}
|
||||
|
||||
bindView(true);
|
||||
bindView();
|
||||
}).execute();
|
||||
} else {
|
||||
mAccessToken = account.getAccessToken();
|
||||
mAccountName = account.getUsername();
|
||||
bindView(true);
|
||||
bindView();
|
||||
}
|
||||
} else {
|
||||
if (account == null) {
|
||||
@ -390,7 +455,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
mAccountName = account.getUsername();
|
||||
}
|
||||
|
||||
bindView(true);
|
||||
bindView();
|
||||
}
|
||||
}).execute();
|
||||
}
|
||||
@ -414,7 +479,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
}
|
||||
}
|
||||
|
||||
private void bindView(boolean initializeFragment) {
|
||||
private void bindView() {
|
||||
if (mAccessToken != null) {
|
||||
if (mMessageFullname != null) {
|
||||
ReadMessage.readMessage(mOauthRetrofit, mAccessToken, mMessageFullname, new ReadMessage.ReadMessageListener() {
|
||||
@ -531,16 +596,33 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
}
|
||||
}).execute();
|
||||
|
||||
if (initializeFragment) {
|
||||
mFragment = new PostFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(PostFragment.EXTRA_NAME, subredditName);
|
||||
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
|
||||
bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER);
|
||||
bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
mFragment.setArguments(bundle);
|
||||
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_view_subreddit_detail_activity, mFragment).commit();
|
||||
}
|
||||
sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||
viewPager.setAdapter(sectionsPagerAdapter);
|
||||
viewPager.setOffscreenPageLimit(2);
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
|
||||
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
if (isInLazyMode) {
|
||||
if (viewPager.getCurrentItem() == 0) {
|
||||
sectionsPagerAdapter.resumeLazyMode();
|
||||
} else {
|
||||
sectionsPagerAdapter.pauseLazyMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -582,24 +664,22 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
if (mMenu != null) {
|
||||
mMenu.findItem(R.id.action_lazy_mode_view_subreddit_detail_activity).setTitle(R.string.action_start_lazy_mode);
|
||||
}
|
||||
if (mFragment instanceof FragmentCommunicator) {
|
||||
((FragmentCommunicator) mFragment).refresh();
|
||||
mFetchSubredditInfoSuccess = false;
|
||||
fetchSubredditData();
|
||||
}
|
||||
sectionsPagerAdapter.refresh();
|
||||
mFetchSubredditInfoSuccess = false;
|
||||
fetchSubredditData();
|
||||
return true;
|
||||
case R.id.action_lazy_mode_view_subreddit_detail_activity:
|
||||
MenuItem lazyModeItem = mMenu.findItem(R.id.action_lazy_mode_view_subreddit_detail_activity);
|
||||
if (isInLazyMode) {
|
||||
isInLazyMode = false;
|
||||
((FragmentCommunicator) mFragment).stopLazyMode();
|
||||
sectionsPagerAdapter.stopLazyMode();
|
||||
lazyModeItem.setTitle(R.string.action_start_lazy_mode);
|
||||
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS |
|
||||
AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED);
|
||||
collapsingToolbarLayout.setLayoutParams(params);
|
||||
} else {
|
||||
isInLazyMode = true;
|
||||
if (((FragmentCommunicator) mFragment).startLazyMode()) {
|
||||
if (sectionsPagerAdapter.startLazyMode()) {
|
||||
lazyModeItem.setTitle(R.string.action_stop_lazy_mode);
|
||||
appBarLayout.setExpanded(false);
|
||||
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED);
|
||||
@ -632,7 +712,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
outState.putString(ACCOUNT_NAME_STATE, mAccountName);
|
||||
outState.putString(MESSAGE_FULLNAME_STATE, mMessageFullname);
|
||||
outState.putString(NEW_ACCOUNT_NAME_STATE, mNewAccountName);
|
||||
getSupportFragmentManager().putFragment(outState, FRAGMENT_OUT_STATE_KEY, mFragment);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -660,10 +739,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
if(sortType.getTime() != null) {
|
||||
mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST, sortType.getTime().name()).apply();
|
||||
}
|
||||
|
||||
if (mFragment != null) {
|
||||
((PostFragment) mFragment).changeSortType(sortType);
|
||||
}
|
||||
sectionsPagerAdapter.changeSortType(sortType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -702,10 +778,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
|
||||
@Override
|
||||
public void postLayoutSelected(int postLayout) {
|
||||
if (mFragment != null) {
|
||||
mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + subredditName, postLayout).apply();
|
||||
((FragmentCommunicator) mFragment).changePostLayout(postLayout);
|
||||
}
|
||||
mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + subredditName, postLayout).apply();
|
||||
sectionsPagerAdapter.changePostLayout(postLayout);
|
||||
}
|
||||
|
||||
public void postScrollUp() {
|
||||
@ -739,6 +813,131 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
||||
|
||||
@Subscribe
|
||||
public void onChangeNSFWEvent(ChangeNSFWEvent changeNSFWEvent) {
|
||||
((FragmentCommunicator) mFragment).changeNSFW(changeNSFWEvent.nsfw);
|
||||
sectionsPagerAdapter.changeNSFW(changeNSFWEvent.nsfw);
|
||||
}
|
||||
|
||||
private class SectionsPagerAdapter extends FragmentPagerAdapter {
|
||||
private PostFragment postFragment;
|
||||
private SidebarFragment sidebarFragment;
|
||||
|
||||
SectionsPagerAdapter(FragmentManager fm) {
|
||||
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
if (position == 0) {
|
||||
PostFragment fragment = new PostFragment();
|
||||
fragment = new PostFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(PostFragment.EXTRA_NAME, subredditName);
|
||||
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
|
||||
bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER);
|
||||
bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
SidebarFragment fragment = new SidebarFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(SidebarFragment.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
return "Posts";
|
||||
case 1:
|
||||
return "Sidebar";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Object instantiateItem(@NonNull ViewGroup container, int position) {
|
||||
Fragment fragment = (Fragment) super.instantiateItem(container, position);
|
||||
switch (position) {
|
||||
case 0:
|
||||
postFragment = (PostFragment) fragment;
|
||||
break;
|
||||
case 1:
|
||||
sidebarFragment = (SidebarFragment) fragment;
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public boolean handleKeyDown(int keyCode) {
|
||||
return viewPager.getCurrentItem() == 0 && postFragment.handleKeyDown(keyCode);
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
if (viewPager.getCurrentItem() == 0) {
|
||||
if (postFragment != null) {
|
||||
postFragment.refresh();
|
||||
}
|
||||
} else {
|
||||
if (sidebarFragment != null) {
|
||||
sidebarFragment.fetchSubredditData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean startLazyMode() {
|
||||
if (postFragment != null) {
|
||||
return ((FragmentCommunicator) postFragment).startLazyMode();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void stopLazyMode() {
|
||||
if (postFragment != null) {
|
||||
((FragmentCommunicator) postFragment).stopLazyMode();
|
||||
}
|
||||
}
|
||||
|
||||
void resumeLazyMode() {
|
||||
if (postFragment != null) {
|
||||
((FragmentCommunicator) postFragment).resumeLazyMode(false);
|
||||
}
|
||||
}
|
||||
|
||||
void pauseLazyMode() {
|
||||
if (postFragment != null) {
|
||||
((FragmentCommunicator) postFragment).pauseLazyMode(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeSortType(SortType sortType) {
|
||||
if (postFragment != null) {
|
||||
mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_USER_POST, sortType.getType().name()).apply();
|
||||
if(sortType.getTime() != null) {
|
||||
mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_USER_POST, sortType.getTime().name()).apply();
|
||||
}
|
||||
|
||||
postFragment.changeSortType(sortType);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeNSFW(boolean nsfw) {
|
||||
if (postFragment != null) {
|
||||
postFragment.changeNSFW(nsfw);
|
||||
}
|
||||
}
|
||||
|
||||
void changePostLayout(int postLayout) {
|
||||
if (postFragment != null) {
|
||||
mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + subredditName, postLayout).apply();
|
||||
((FragmentCommunicator) postFragment).changePostLayout(postLayout);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,10 +126,10 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
||||
SharedPreferences mSharedPreferences;
|
||||
@Inject
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
public UserViewModel userViewModel;
|
||||
private SectionsPagerAdapter sectionsPagerAdapter;
|
||||
private SubscribedUserDao subscribedUserDao;
|
||||
private RequestManager glide;
|
||||
private UserViewModel userViewModel;
|
||||
private Menu mMenu;
|
||||
private AppBarLayout.LayoutParams params;
|
||||
private UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment;
|
||||
|
@ -78,6 +78,7 @@ public class CustomThemeListingRecyclerViewAdapter extends RecyclerView.Adapter<
|
||||
Intent intent = new Intent(activity, CustomizeThemeActivity.class);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_NAME, customTheme.name);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_IS_PREDEFIINED_THEME, true);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_CREATE_THEME, true);
|
||||
activity.startActivity(intent);
|
||||
});
|
||||
} else if (holder instanceof UserCustomThemeViewHolder) {
|
||||
|
@ -43,7 +43,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
|
||||
private RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||
private String mAccessToken;
|
||||
private RequestManager glide;
|
||||
private int mUsernameColor;
|
||||
private int mPrimaryTextColor;
|
||||
private int mSecondaryTextColor;
|
||||
|
||||
public FollowedUsersRecyclerViewAdapter(Context context, Retrofit oauthRetrofit,
|
||||
@ -55,7 +55,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
|
||||
mRedditDataRoomDatabase = redditDataRoomDatabase;
|
||||
mAccessToken = accessToken;
|
||||
glide = Glide.with(context.getApplicationContext());
|
||||
mUsernameColor = customThemeWrapper.getUsername();
|
||||
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
|
||||
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
|
||||
FavoriteUserViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
userNameTextView.setTextColor(mUsernameColor);
|
||||
userNameTextView.setTextColor(mPrimaryTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
|
||||
UserViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
userNameTextView.setTextColor(mUsernameColor);
|
||||
userNameTextView.setTextColor(mPrimaryTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.FollowedUsersListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SidebarFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SubredditListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment;
|
||||
@ -146,4 +147,6 @@ public interface AppComponent {
|
||||
void inject(CustomizeThemeActivity customizeThemeActivity);
|
||||
|
||||
void inject(CustomThemeListingActivity customThemeListingActivity);
|
||||
|
||||
void inject(SidebarFragment sidebarFragment);
|
||||
}
|
||||
|
@ -0,0 +1,177 @@
|
||||
package ml.docilealligator.infinityforreddit.Fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.SuperscriptSpan;
|
||||
import android.text.util.Linkify;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import org.commonmark.ext.gfm.tables.TableBlock;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
import io.noties.markwon.MarkwonConfiguration;
|
||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
import io.noties.markwon.recycler.MarkwonAdapter;
|
||||
import io.noties.markwon.recycler.table.TableEntry;
|
||||
import io.noties.markwon.recycler.table.TableEntryPlugin;
|
||||
import io.noties.markwon.simple.ext.SimpleExtPlugin;
|
||||
import io.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute;
|
||||
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubredditDataAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.FetchSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditViewModel;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
*/
|
||||
public class SidebarFragment extends Fragment {
|
||||
|
||||
public static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
@BindView(R.id.swipe_refresh_layout_sidebar_fragment)
|
||||
SwipeRefreshLayout swipeRefreshLayout;
|
||||
@BindView(R.id.markdown_recycler_view_sidebar_fragment)
|
||||
RecyclerView recyclerView;
|
||||
private Activity activity;
|
||||
private String subredditName;
|
||||
public SubredditViewModel mSubredditViewModel;
|
||||
private int markdownColor;
|
||||
@Inject
|
||||
@Named("no_oauth")
|
||||
Retrofit mRetrofit;
|
||||
@Inject
|
||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||
@Inject
|
||||
CustomThemeWrapper mCustomThemeWrapper;
|
||||
|
||||
public SidebarFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_sidebar, container, false);
|
||||
|
||||
((Infinity) activity.getApplication()).getAppComponent().inject(this);
|
||||
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
subredditName = getArguments().getString(EXTRA_SUBREDDIT_NAME);
|
||||
if (subredditName == null) {
|
||||
Toast.makeText(activity, R.string.error_getting_subreddit_name, Toast.LENGTH_SHORT).show();
|
||||
return rootView;
|
||||
}
|
||||
|
||||
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground());
|
||||
swipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent());
|
||||
markdownColor = mCustomThemeWrapper.getSecondaryTextColor();
|
||||
|
||||
Markwon markwon = Markwon.builder(activity)
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) {
|
||||
textView.setTextColor(markdownColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
|
||||
builder.linkResolver((view, link) -> {
|
||||
Intent intent = new Intent(activity, LinkResolverActivity.class);
|
||||
Uri uri = Uri.parse(link);
|
||||
if (uri.getScheme() == null && uri.getHost() == null) {
|
||||
intent.setData(LinkResolverActivity.getRedditUriByPath(link));
|
||||
} else {
|
||||
intent.setData(uri);
|
||||
}
|
||||
startActivity(intent);
|
||||
}).urlProcessor(new UrlProcessorRelativeToAbsolute("https://www.reddit.com"));
|
||||
}
|
||||
})
|
||||
.usePlugin(StrikethroughPlugin.create())
|
||||
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
||||
.usePlugin(SimpleExtPlugin.create(plugin ->
|
||||
plugin.addExtension(1, '^', (configuration, props) -> {
|
||||
return new SuperscriptSpan();
|
||||
})
|
||||
)
|
||||
)
|
||||
.usePlugin(TableEntryPlugin.create(activity))
|
||||
.build();
|
||||
MarkwonAdapter markwonAdapter = MarkwonAdapter.builder(R.layout.adapter_default_entry, R.id.text)
|
||||
.include(TableBlock.class, TableEntry.create(builder -> builder
|
||||
.tableLayout(R.layout.adapter_table_block, R.id.table_layout)
|
||||
.textLayoutIsRoot(R.layout.view_table_entry_cell)))
|
||||
.build();
|
||||
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(activity));
|
||||
recyclerView.setAdapter(markwonAdapter);
|
||||
|
||||
mSubredditViewModel = new ViewModelProvider(this,
|
||||
new SubredditViewModel.Factory(activity.getApplication(), mRedditDataRoomDatabase, subredditName))
|
||||
.get(SubredditViewModel.class);
|
||||
mSubredditViewModel.getSubredditLiveData().observe(this, subredditData -> {
|
||||
if (subredditData != null) {
|
||||
markwonAdapter.setMarkdown(markwon, subredditData.getSidebarDescription());
|
||||
markwonAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
fetchSubredditData();
|
||||
}
|
||||
});
|
||||
|
||||
swipeRefreshLayout.setOnRefreshListener(this::fetchSubredditData);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
activity = (Activity) context;
|
||||
}
|
||||
|
||||
public void fetchSubredditData() {
|
||||
swipeRefreshLayout.setRefreshing(true);
|
||||
FetchSubredditData.fetchSubredditData(mRetrofit, subredditName, new FetchSubredditData.FetchSubredditDataListener() {
|
||||
@Override
|
||||
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
new InsertSubredditDataAsyncTask(mRedditDataRoomDatabase, subredditData, () -> swipeRefreshLayout.setRefreshing(false)).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFetchSubredditDataFail() {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
Toast.makeText(activity, R.string.cannot_fetch_sidebar, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -74,9 +74,9 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra
|
||||
RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||
@Inject
|
||||
CustomThemeWrapper customThemeWrapper;
|
||||
public SubscribedSubredditViewModel mSubscribedSubredditViewModel;
|
||||
private Activity mActivity;
|
||||
private RequestManager mGlide;
|
||||
private SubscribedSubredditViewModel mSubscribedSubredditViewModel;
|
||||
|
||||
public SubscribedSubredditsListingFragment() {
|
||||
// Required empty public constructor
|
||||
|
@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="?attr/toolbarPrimaryTextAndIconColor"
|
||||
android:pathData="M18,13h-5v5c0,0.55 -0.45,1 -1,1s-1,-0.45 -1,-1v-5H6c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h5V6c0,-0.55 0.45,-1 1,-1s1,0.45 1,1v5h5c0.55,0 1,0.45 1,1s-0.45,1 -1,1z"/>
|
||||
</vector>
|
@ -8,6 +8,12 @@
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".Activity.ViewSubredditDetailActivity">
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager_view_subreddit_detail_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_view_subreddit_detail"
|
||||
android:layout_width="match_parent"
|
||||
@ -121,9 +127,22 @@
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tab_layout_view_subreddit_detail_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed"
|
||||
app:tabIndicatorHeight="3dp"
|
||||
app:tabRippleColor="?attr/colorControlHighlight"
|
||||
app:tabUnboundedRipple="false" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<include layout="@layout/content_view_subreddit_detail" />
|
||||
<!--<include layout="@layout/content_view_subreddit_detail" />-->
|
||||
|
||||
<com.google.android.material.bottomappbar.BottomAppBar
|
||||
android:id="@+id/bottom_navigation_view_subreddit_detail_activity"
|
||||
|
24
app/src/main/res/layout/fragment_sidebar.xml
Normal file
24
app/src/main/res/layout/fragment_sidebar.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:application="ml.docilealligator.infinityforreddit.Fragment.SidebarFragment">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh_layout_sidebar_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/markdown_recycler_view_sidebar_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
android:clipToPadding="false" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -5,6 +5,6 @@
|
||||
android:id="@+id/action_create_create_multi_reddit_activity"
|
||||
android:orderInCategory="1"
|
||||
android:title="@string/action_send"
|
||||
android:icon="@drawable/ic_add_toolbar_24dp"
|
||||
android:icon="@drawable/ic_add_24dp"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user