mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-27 03:18:24 +01:00
Add option to have circular FAB icon
This commit is contained in:
parent
fd14753a1d
commit
d4b107bc79
@ -39,6 +39,9 @@ import androidx.viewpager2.widget.ViewPager2;
|
|||||||
import com.google.android.material.appbar.AppBarLayout;
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
import com.google.android.material.shape.CornerFamily;
|
||||||
|
import com.google.android.material.shape.MaterialShapeDrawable;
|
||||||
|
import com.google.android.material.shape.ShapeAppearanceModel;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@ -377,9 +380,18 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomFo
|
|||||||
button.setTextColor(customThemeWrapper.getFABIconColor());
|
button.setTextColor(customThemeWrapper.getFABIconColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void applyFABTheme(FloatingActionButton fab) {
|
protected void applyFABTheme(FloatingActionButton fab, boolean isCircular) {
|
||||||
fab.setBackgroundTintList(ColorStateList.valueOf(customThemeWrapper.getColorAccent()));
|
fab.setBackgroundTintList(ColorStateList.valueOf(customThemeWrapper.getColorAccent()));
|
||||||
fab.setImageTintList(ColorStateList.valueOf(customThemeWrapper.getFABIconColor()));
|
fab.setImageTintList(ColorStateList.valueOf(customThemeWrapper.getFABIconColor()));
|
||||||
|
if (isCircular) {
|
||||||
|
ShapeAppearanceModel shapeAppearanceModel = ShapeAppearanceModel.builder()
|
||||||
|
.setAllCorners(CornerFamily.ROUNDED, 100) // Adjust the radius value to control the roundness
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Apply the circular shape to the FAB
|
||||||
|
MaterialShapeDrawable shapeDrawable = new MaterialShapeDrawable(shapeAppearanceModel);
|
||||||
|
fab.setShapeAppearanceModel(shapeAppearanceModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fixViewPager2Sensitivity(ViewPager2 viewPager2) {
|
protected void fixViewPager2Sensitivity(ViewPager2 viewPager2) {
|
||||||
|
@ -51,6 +51,7 @@ import eu.toldi.infinityforlemmy.customtheme.CustomThemeViewModel;
|
|||||||
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
|
||||||
import eu.toldi.infinityforlemmy.events.RecreateActivityEvent;
|
import eu.toldi.infinityforlemmy.events.RecreateActivityEvent;
|
||||||
import eu.toldi.infinityforlemmy.utils.CustomThemeSharedPreferencesUtils;
|
import eu.toldi.infinityforlemmy.utils.CustomThemeSharedPreferencesUtils;
|
||||||
|
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||||
import eu.toldi.infinityforlemmy.utils.Utils;
|
import eu.toldi.infinityforlemmy.utils.Utils;
|
||||||
|
|
||||||
public class CustomThemeListingActivity extends BaseActivity implements
|
public class CustomThemeListingActivity extends BaseActivity implements
|
||||||
@ -154,7 +155,7 @@ public class CustomThemeListingActivity extends BaseActivity implements
|
|||||||
@Override
|
@Override
|
||||||
protected void applyCustomTheme() {
|
protected void applyCustomTheme() {
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
||||||
applyFABTheme(fab);
|
applyFABTheme(fab, sharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -265,7 +265,7 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
|
|||||||
protected void applyCustomTheme() {
|
protected void applyCustomTheme() {
|
||||||
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
||||||
applyFABTheme(fab);
|
applyFABTheme(fab, mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindView(PostFilter postFilter, boolean initializeFragment) {
|
private void bindView(PostFilter postFilter, boolean initializeFragment) {
|
||||||
|
@ -229,7 +229,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
|
|||||||
mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(mAppBarLayout, mCollapsingToolbarLayout, mToolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(mAppBarLayout, mCollapsingToolbarLayout, mToolbar);
|
||||||
applyTabLayoutTheme(tabLayout);
|
applyTabLayoutTheme(tabLayout);
|
||||||
applyFABTheme(fab);
|
applyFABTheme(fab, mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getCurrentAccountAndFetchMessage(Bundle savedInstanceState) {
|
private void getCurrentAccountAndFetchMessage(Bundle savedInstanceState) {
|
||||||
|
@ -107,6 +107,7 @@ import eu.toldi.infinityforlemmy.events.ChangeLockBottomAppBarEvent;
|
|||||||
import eu.toldi.infinityforlemmy.events.ChangeNSFWEvent;
|
import eu.toldi.infinityforlemmy.events.ChangeNSFWEvent;
|
||||||
import eu.toldi.infinityforlemmy.events.ChangeRequireAuthToAccountSectionEvent;
|
import eu.toldi.infinityforlemmy.events.ChangeRequireAuthToAccountSectionEvent;
|
||||||
import eu.toldi.infinityforlemmy.events.ChangeShowAvatarOnTheRightInTheNavigationDrawerEvent;
|
import eu.toldi.infinityforlemmy.events.ChangeShowAvatarOnTheRightInTheNavigationDrawerEvent;
|
||||||
|
import eu.toldi.infinityforlemmy.events.ChangeUseCircularFabEvent;
|
||||||
import eu.toldi.infinityforlemmy.events.RecreateActivityEvent;
|
import eu.toldi.infinityforlemmy.events.RecreateActivityEvent;
|
||||||
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
import eu.toldi.infinityforlemmy.events.SwitchAccountEvent;
|
||||||
import eu.toldi.infinityforlemmy.fragments.PostFragment;
|
import eu.toldi.infinityforlemmy.fragments.PostFragment;
|
||||||
@ -233,6 +234,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
private String mMessageFullname;
|
private String mMessageFullname;
|
||||||
private String mNewAccountName;
|
private String mNewAccountName;
|
||||||
private boolean hideFab;
|
private boolean hideFab;
|
||||||
|
|
||||||
|
private boolean useCircularFab;
|
||||||
private boolean showBottomAppBar;
|
private boolean showBottomAppBar;
|
||||||
private int mBackButtonAction;
|
private int mBackButtonAction;
|
||||||
private boolean mLockBottomAppBar;
|
private boolean mLockBottomAppBar;
|
||||||
@ -259,6 +262,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false);
|
hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false);
|
||||||
|
useCircularFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false);
|
||||||
showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false);
|
showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false);
|
||||||
|
|
||||||
navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), findViewById(R.id.linear_layout_bottom_app_bar),
|
navigationWrapper = new NavigationWrapper(findViewById(R.id.bottom_app_bar_bottom_app_bar), findViewById(R.id.linear_layout_bottom_app_bar),
|
||||||
@ -385,7 +389,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
navigationView.setBackgroundColor(backgroundColor);
|
navigationView.setBackgroundColor(backgroundColor);
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
||||||
applyTabLayoutTheme(tabLayout);
|
applyTabLayoutTheme(tabLayout);
|
||||||
applyFABTheme(navigationWrapper.floatingActionButton);
|
applyFABTheme(navigationWrapper.floatingActionButton, useCircularFab);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeNotificationAndBindView() {
|
private void initializeNotificationAndBindView() {
|
||||||
@ -1336,6 +1340,12 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
|||||||
navigationWrapper.floatingActionButton.setVisibility(hideFab ? View.GONE : View.VISIBLE);
|
navigationWrapper.floatingActionButton.setVisibility(hideFab ? View.GONE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onChangeUseCircularFab(ChangeUseCircularFabEvent event) {
|
||||||
|
useCircularFab = event.isUseCircularFab();
|
||||||
|
applyFABTheme(navigationWrapper.floatingActionButton, useCircularFab);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLongPress() {
|
public void onLongPress() {
|
||||||
if (sectionsPagerAdapter != null) {
|
if (sectionsPagerAdapter != null) {
|
||||||
|
@ -33,6 +33,7 @@ import eu.toldi.infinityforlemmy.post.Post;
|
|||||||
import eu.toldi.infinityforlemmy.postfilter.DeletePostFilter;
|
import eu.toldi.infinityforlemmy.postfilter.DeletePostFilter;
|
||||||
import eu.toldi.infinityforlemmy.postfilter.PostFilter;
|
import eu.toldi.infinityforlemmy.postfilter.PostFilter;
|
||||||
import eu.toldi.infinityforlemmy.postfilter.PostFilterViewModel;
|
import eu.toldi.infinityforlemmy.postfilter.PostFilterViewModel;
|
||||||
|
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||||
|
|
||||||
public class PostFilterPreferenceActivity extends BaseActivity {
|
public class PostFilterPreferenceActivity extends BaseActivity {
|
||||||
|
|
||||||
@ -205,7 +206,7 @@ public class PostFilterPreferenceActivity extends BaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void applyCustomTheme() {
|
protected void applyCustomTheme() {
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
||||||
applyFABTheme(fab);
|
applyFABTheme(fab, sharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
coordinatorLayout.setBackgroundColor(customThemeWrapper.getBackgroundColor());
|
coordinatorLayout.setBackgroundColor(customThemeWrapper.getBackgroundColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import eu.toldi.infinityforlemmy.postfilter.PostFilter;
|
|||||||
import eu.toldi.infinityforlemmy.postfilter.PostFilterUsage;
|
import eu.toldi.infinityforlemmy.postfilter.PostFilterUsage;
|
||||||
import eu.toldi.infinityforlemmy.postfilter.PostFilterUsageViewModel;
|
import eu.toldi.infinityforlemmy.postfilter.PostFilterUsageViewModel;
|
||||||
import eu.toldi.infinityforlemmy.postfilter.SavePostFilterUsage;
|
import eu.toldi.infinityforlemmy.postfilter.SavePostFilterUsage;
|
||||||
|
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||||
import eu.toldi.infinityforlemmy.utils.Utils;
|
import eu.toldi.infinityforlemmy.utils.Utils;
|
||||||
|
|
||||||
public class PostFilterUsageListingActivity extends BaseActivity {
|
public class PostFilterUsageListingActivity extends BaseActivity {
|
||||||
@ -206,7 +207,7 @@ public class PostFilterUsageListingActivity extends BaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void applyCustomTheme() {
|
protected void applyCustomTheme() {
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
||||||
applyFABTheme(fab);
|
applyFABTheme(fab, sharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
coordinatorLayout.setBackgroundColor(customThemeWrapper.getBackgroundColor());
|
coordinatorLayout.setBackgroundColor(customThemeWrapper.getBackgroundColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -475,8 +475,9 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
|
|||||||
nsfwTextView.setTextColor(primaryTextColor);
|
nsfwTextView.setTextColor(primaryTextColor);
|
||||||
titleEditText.setTextColor(primaryTextColor);
|
titleEditText.setTextColor(primaryTextColor);
|
||||||
titleEditText.setHintTextColor(secondaryTextColor);
|
titleEditText.setHintTextColor(secondaryTextColor);
|
||||||
applyFABTheme(captureFab);
|
boolean circleFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false);
|
||||||
applyFABTheme(selectFromLibraryFab);
|
applyFABTheme(captureFab, circleFab);
|
||||||
|
applyFABTheme(selectFromLibraryFab, circleFab);
|
||||||
selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent());
|
selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent());
|
||||||
if (typeface != null) {
|
if (typeface != null) {
|
||||||
subredditNameTextView.setTypeface(typeface);
|
subredditNameTextView.setTypeface(typeface);
|
||||||
|
@ -447,8 +447,9 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
|
|||||||
nsfwTextView.setTextColor(primaryTextColor);
|
nsfwTextView.setTextColor(primaryTextColor);
|
||||||
titleEditText.setTextColor(primaryTextColor);
|
titleEditText.setTextColor(primaryTextColor);
|
||||||
titleEditText.setHintTextColor(secondaryTextColor);
|
titleEditText.setHintTextColor(secondaryTextColor);
|
||||||
applyFABTheme(captureFab);
|
boolean circularFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false);
|
||||||
applyFABTheme(selectFromLibraryFab);
|
applyFABTheme(captureFab, circularFab);
|
||||||
|
applyFABTheme(selectFromLibraryFab, circularFab);
|
||||||
selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent());
|
selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent());
|
||||||
if (typeface != null) {
|
if (typeface != null) {
|
||||||
subredditNameTextView.setTypeface(typeface);
|
subredditNameTextView.setTypeface(typeface);
|
||||||
|
@ -238,7 +238,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
|
|||||||
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
||||||
applyTabLayoutTheme(tabLayout);
|
applyTabLayoutTheme(tabLayout);
|
||||||
applyFABTheme(fab);
|
applyFABTheme(fab, mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindView(Bundle savedInstanceState) {
|
private void bindView(Bundle savedInstanceState) {
|
||||||
|
@ -194,7 +194,7 @@ public class SelectedSubredditsAndUsersActivity extends BaseActivity implements
|
|||||||
protected void applyCustomTheme() {
|
protected void applyCustomTheme() {
|
||||||
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
||||||
applyFABTheme(fab);
|
applyFABTheme(fab, mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -221,7 +221,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
|
|||||||
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
||||||
applyTabLayoutTheme(tabLayout);
|
applyTabLayoutTheme(tabLayout);
|
||||||
applyFABTheme(fab);
|
applyFABTheme(fab, mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
searchEditText.setTextColor(mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor());
|
searchEditText.setTextColor(mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor());
|
||||||
searchEditText.setHintTextColor(mCustomThemeWrapper.getToolbarSecondaryTextColor());
|
searchEditText.setHintTextColor(mCustomThemeWrapper.getToolbarSecondaryTextColor());
|
||||||
}
|
}
|
||||||
|
@ -853,7 +853,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
|
|||||||
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
|
||||||
navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor());
|
navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor());
|
||||||
applyFABTheme(navigationWrapper.floatingActionButton);
|
applyFABTheme(navigationWrapper.floatingActionButton, mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -335,7 +335,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
protected void applyCustomTheme() {
|
protected void applyCustomTheme() {
|
||||||
mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
|
||||||
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(mAppBarLayout, mCollapsingToolbarLayout, mToolbar);
|
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(mAppBarLayout, mCollapsingToolbarLayout, mToolbar);
|
||||||
applyFABTheme(fab);
|
applyFABTheme(fab, mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
searchPanelMaterialCardView.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimary()));
|
searchPanelMaterialCardView.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimary()));
|
||||||
int searchPanelTextAndIconColor = mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor();
|
int searchPanelTextAndIconColor = mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor();
|
||||||
searchTextInputLayout.setBoxStrokeColor(searchPanelTextAndIconColor);
|
searchTextInputLayout.setBoxStrokeColor(searchPanelTextAndIconColor);
|
||||||
|
@ -420,7 +420,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
descriptionTextView.setTextColor(primaryTextColor);
|
descriptionTextView.setTextColor(primaryTextColor);
|
||||||
navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor());
|
navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor());
|
||||||
applyTabLayoutTheme(tabLayout);
|
applyTabLayoutTheme(tabLayout);
|
||||||
applyFABTheme(navigationWrapper.floatingActionButton);
|
applyFABTheme(navigationWrapper.floatingActionButton, mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
if (typeface != null) {
|
if (typeface != null) {
|
||||||
subredditNameTextView.setTypeface(typeface);
|
subredditNameTextView.setTypeface(typeface);
|
||||||
subscribeSubredditChip.setTypeface(typeface);
|
subscribeSubredditChip.setTypeface(typeface);
|
||||||
|
@ -631,7 +631,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||||
cakedayTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
cakedayTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||||
navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor());
|
navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor());
|
||||||
applyFABTheme(navigationWrapper.floatingActionButton);
|
applyFABTheme(navigationWrapper.floatingActionButton, mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_CIRCULAR_FAB, false));
|
||||||
descriptionTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
descriptionTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
|
||||||
subscribeUserChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
|
subscribeUserChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
|
||||||
applyTabLayoutTheme(tabLayout);
|
applyTabLayoutTheme(tabLayout);
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package eu.toldi.infinityforlemmy.events;
|
||||||
|
|
||||||
|
public class ChangeUseCircularFabEvent {
|
||||||
|
|
||||||
|
private boolean useCircularFab;
|
||||||
|
|
||||||
|
public ChangeUseCircularFabEvent(boolean useCircularFab) {
|
||||||
|
this.useCircularFab = useCircularFab;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUseCircularFab() {
|
||||||
|
return useCircularFab;
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import eu.toldi.infinityforlemmy.R;
|
import eu.toldi.infinityforlemmy.R;
|
||||||
import eu.toldi.infinityforlemmy.customviews.CustomFontPreferenceFragmentCompat;
|
import eu.toldi.infinityforlemmy.customviews.CustomFontPreferenceFragmentCompat;
|
||||||
import eu.toldi.infinityforlemmy.events.ChangeHideFabInPostFeedEvent;
|
import eu.toldi.infinityforlemmy.events.ChangeHideFabInPostFeedEvent;
|
||||||
|
import eu.toldi.infinityforlemmy.events.ChangeUseCircularFabEvent;
|
||||||
import eu.toldi.infinityforlemmy.events.ChangeVoteButtonsPositionEvent;
|
import eu.toldi.infinityforlemmy.events.ChangeVoteButtonsPositionEvent;
|
||||||
import eu.toldi.infinityforlemmy.events.RecreateActivityEvent;
|
import eu.toldi.infinityforlemmy.events.RecreateActivityEvent;
|
||||||
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
|
||||||
@ -23,6 +24,7 @@ public class InterfacePreferenceFragment extends CustomFontPreferenceFragmentCom
|
|||||||
|
|
||||||
Preference immersiveInterfaceEntryPreference = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_ENTRY_KEY);
|
Preference immersiveInterfaceEntryPreference = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_ENTRY_KEY);
|
||||||
SwitchPreference hideFabInPostFeedSwitchPreference = findPreference(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED);
|
SwitchPreference hideFabInPostFeedSwitchPreference = findPreference(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED);
|
||||||
|
SwitchPreference useCircularFAbSwitchPreference = findPreference(SharedPreferencesUtils.USE_CIRCULAR_FAB);
|
||||||
SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
|
SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
|
||||||
SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
|
SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
|
||||||
|
|
||||||
@ -37,6 +39,13 @@ public class InterfacePreferenceFragment extends CustomFontPreferenceFragmentCom
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useCircularFAbSwitchPreference != null) {
|
||||||
|
useCircularFAbSwitchPreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
EventBus.getDefault().post(new ChangeUseCircularFabEvent((Boolean) newValue));
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (bottomAppBarSwitch != null) {
|
if (bottomAppBarSwitch != null) {
|
||||||
bottomAppBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
bottomAppBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||||
|
@ -46,6 +46,8 @@ public class SharedPreferencesUtils {
|
|||||||
public static final String REDDIT_USER_AGREEMENT_KEY = "reddit_user_agreement";
|
public static final String REDDIT_USER_AGREEMENT_KEY = "reddit_user_agreement";
|
||||||
public static final String HIDE_FAB_IN_POST_FEED = "hide_fab_in_post_feed";
|
public static final String HIDE_FAB_IN_POST_FEED = "hide_fab_in_post_feed";
|
||||||
|
|
||||||
|
public static final String USE_CIRCULAR_FAB = "use_circular_fab";
|
||||||
|
|
||||||
public static final String SORT_TYPE_SHARED_PREFERENCES_FILE = "eu.toldi.infinityforlemmy.sort_type";
|
public static final String SORT_TYPE_SHARED_PREFERENCES_FILE = "eu.toldi.infinityforlemmy.sort_type";
|
||||||
public static final String SORT_TYPE_BEST_POST = "sort_type_best_post";
|
public static final String SORT_TYPE_BEST_POST = "sort_type_best_post";
|
||||||
public static final String SORT_TIME_BEST_POST = "sort_time_best_post";
|
public static final String SORT_TIME_BEST_POST = "sort_time_best_post";
|
||||||
|
@ -1346,4 +1346,5 @@
|
|||||||
<string name="upload_image">Upload an image</string>
|
<string name="upload_image">Upload an image</string>
|
||||||
<string name="mentions">Mentions</string>
|
<string name="mentions">Mentions</string>
|
||||||
<string name="replies">Replies</string>
|
<string name="replies">Replies</string>
|
||||||
|
<string name="use_circular_fab">Use Circular FAB</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -29,6 +29,11 @@
|
|||||||
app:key="hide_fab_in_post_feed"
|
app:key="hide_fab_in_post_feed"
|
||||||
app:title="@string/settings_hide_fab_in_post_feed" />
|
app:title="@string/settings_hide_fab_in_post_feed" />
|
||||||
|
|
||||||
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="use_circular_fab"
|
||||||
|
app:title="@string/use_circular_fab" />
|
||||||
|
|
||||||
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
<eu.toldi.infinityforlemmy.customviews.CustomFontSwitchPreference
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
app:key="bottom_app_bar"
|
app:key="bottom_app_bar"
|
||||||
|
Loading…
Reference in New Issue
Block a user