mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 11:17:25 +01:00
Locking fab in ViewPostDetailActivity, Swiping up to hide fab in ViewPostDetailActivity are available. Minor bugs fixed.
This commit is contained in:
parent
02db44e532
commit
1f1d6a97fa
@ -41,17 +41,6 @@ public class SettingsActivity extends BaseActivity implements
|
|||||||
|
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
/*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
Window window = getWindow();
|
|
||||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
|
||||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
|
||||||
}
|
|
||||||
TypedValue typedValue = new TypedValue();
|
|
||||||
getTheme().resolveAttribute(R.attr.navBarColor, typedValue, true);
|
|
||||||
int navBarColor = typedValue.data;
|
|
||||||
window.setNavigationBarColor(navBarColor);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
|
@ -173,6 +173,8 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
|||||||
private boolean isSortingComments = false;
|
private boolean isSortingComments = false;
|
||||||
private boolean mVolumeKeysNavigateComments;
|
private boolean mVolumeKeysNavigateComments;
|
||||||
private boolean mIsSmoothScrolling = false;
|
private boolean mIsSmoothScrolling = false;
|
||||||
|
private boolean mLockFab;
|
||||||
|
private boolean mSwipeUpToHideFab;
|
||||||
private LinearLayoutManager mLinearLayoutManager;
|
private LinearLayoutManager mLinearLayoutManager;
|
||||||
private CommentAndPostRecyclerViewAdapter mAdapter;
|
private CommentAndPostRecyclerViewAdapter mAdapter;
|
||||||
private RecyclerView.SmoothScroller mSmoothScroller;
|
private RecyclerView.SmoothScroller mSmoothScroller;
|
||||||
@ -253,6 +255,8 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
|||||||
mVoteButtonsOnTheRight = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY, false);
|
mVoteButtonsOnTheRight = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY, false);
|
||||||
mShowElapsedTime = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY, false);
|
mShowElapsedTime = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY, false);
|
||||||
mVolumeKeysNavigateComments = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOLUME_KEYS_NAVIGATE_COMMENTS, false);
|
mVolumeKeysNavigateComments = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOLUME_KEYS_NAVIGATE_COMMENTS, false);
|
||||||
|
mLockFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false);
|
||||||
|
mSwipeUpToHideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false);
|
||||||
|
|
||||||
mGlide = Glide.with(this);
|
mGlide = Glide.with(this);
|
||||||
mLocale = getResources().getConfiguration().locale;
|
mLocale = getResources().getConfiguration().locale;
|
||||||
@ -265,13 +269,21 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
|||||||
@Override
|
@Override
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
super.onScrolled(recyclerView, dx, dy);
|
super.onScrolled(recyclerView, dx, dy);
|
||||||
if (!mIsSmoothScrolling) {
|
if (!mIsSmoothScrolling && !mLockFab) {
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
|
if (mSwipeUpToHideFab) {
|
||||||
|
fab.show();
|
||||||
|
} else {
|
||||||
|
fab.hide();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mSwipeUpToHideFab) {
|
||||||
fab.hide();
|
fab.hide();
|
||||||
} else {
|
} else {
|
||||||
fab.show();
|
fab.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!isLoadingMoreChildren && loadMoreChildrenSuccess) {
|
if (!isLoadingMoreChildren && loadMoreChildrenSuccess) {
|
||||||
int visibleItemCount = mLinearLayoutManager.getChildCount();
|
int visibleItemCount = mLinearLayoutManager.getChildCount();
|
||||||
@ -296,14 +308,22 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
|||||||
@Override
|
@Override
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
super.onScrolled(recyclerView, dx, dy);
|
super.onScrolled(recyclerView, dx, dy);
|
||||||
if (!mIsSmoothScrolling) {
|
if (!mIsSmoothScrolling && !mLockFab) {
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
|
if (mSwipeUpToHideFab) {
|
||||||
|
fab.show();
|
||||||
|
} else {
|
||||||
|
fab.hide();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mSwipeUpToHideFab) {
|
||||||
fab.hide();
|
fab.hide();
|
||||||
} else {
|
} else {
|
||||||
fab.show();
|
fab.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||||
@ -634,13 +654,21 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
|||||||
@Override
|
@Override
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
super.onScrolled(recyclerView, dx, dy);
|
super.onScrolled(recyclerView, dx, dy);
|
||||||
if (!mIsSmoothScrolling) {
|
if (!mIsSmoothScrolling && !mLockFab) {
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
|
if (mSwipeUpToHideFab) {
|
||||||
|
fab.show();
|
||||||
|
} else {
|
||||||
|
fab.hide();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mSwipeUpToHideFab) {
|
||||||
fab.hide();
|
fab.hide();
|
||||||
} else {
|
} else {
|
||||||
fab.show();
|
fab.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!isLoadingMoreChildren && loadMoreChildrenSuccess) {
|
if (!isLoadingMoreChildren && loadMoreChildrenSuccess) {
|
||||||
int visibleItemCount = mLinearLayoutManager.getChildCount();
|
int visibleItemCount = mLinearLayoutManager.getChildCount();
|
||||||
@ -722,13 +750,21 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
|||||||
@Override
|
@Override
|
||||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
super.onScrolled(recyclerView, dx, dy);
|
super.onScrolled(recyclerView, dx, dy);
|
||||||
if (!mIsSmoothScrolling) {
|
if (!mIsSmoothScrolling && !mLockFab) {
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
|
if (mSwipeUpToHideFab) {
|
||||||
|
fab.show();
|
||||||
|
} else {
|
||||||
|
fab.hide();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mSwipeUpToHideFab) {
|
||||||
fab.hide();
|
fab.hide();
|
||||||
} else {
|
} else {
|
||||||
fab.show();
|
fab.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!isLoadingMoreChildren && loadMoreChildrenSuccess) {
|
if (!isLoadingMoreChildren && loadMoreChildrenSuccess) {
|
||||||
int visibleItemCount = mLinearLayoutManager.getChildCount();
|
int visibleItemCount = mLinearLayoutManager.getChildCount();
|
||||||
|
@ -41,6 +41,7 @@ import ml.docilealligator.infinityforreddit.Fragment.SubredditListingFragment;
|
|||||||
import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment;
|
import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment;
|
||||||
import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment;
|
import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment;
|
||||||
import ml.docilealligator.infinityforreddit.Service.SubmitPostService;
|
import ml.docilealligator.infinityforreddit.Service.SubmitPostService;
|
||||||
|
import ml.docilealligator.infinityforreddit.Settings.GesturesAndButtonsPreferenceFragment;
|
||||||
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
|
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
|
||||||
import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment;
|
import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment;
|
||||||
|
|
||||||
@ -128,4 +129,6 @@ public interface AppComponent {
|
|||||||
void inject(ViewSidebarActivity viewSidebarActivity);
|
void inject(ViewSidebarActivity viewSidebarActivity);
|
||||||
|
|
||||||
void inject(ViewVideoActivity viewVideoActivity);
|
void inject(ViewVideoActivity viewVideoActivity);
|
||||||
|
|
||||||
|
void inject(GesturesAndButtonsPreferenceFragment gesturesAndButtonsPreferenceFragment);
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,60 @@
|
|||||||
package ml.docilealligator.infinityforreddit.Settings;
|
package ml.docilealligator.infinityforreddit.Settings;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import ml.docilealligator.infinityforreddit.Infinity;
|
||||||
import ml.docilealligator.infinityforreddit.R;
|
import ml.docilealligator.infinityforreddit.R;
|
||||||
|
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
*/
|
*/
|
||||||
public class GesturesAndButtonsPreferenceFragment extends PreferenceFragmentCompat {
|
public class GesturesAndButtonsPreferenceFragment extends PreferenceFragmentCompat {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SharedPreferences sharedPreferences;
|
||||||
|
private Activity activity;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
setPreferencesFromResource(R.xml.gestures_and_buttons_preference, rootKey);
|
setPreferencesFromResource(R.xml.gestures_and_buttons_preference, rootKey);
|
||||||
|
((Infinity) activity.getApplication()).getAppComponent().inject(this);
|
||||||
|
|
||||||
|
SwitchPreference lockJumpToNextTopLevelCommentButtonSwitch =
|
||||||
|
findPreference(SharedPreferencesUtils.LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON);
|
||||||
|
SwitchPreference swipeUpToHideJumpToNextTopLevelCommentButtonSwitch =
|
||||||
|
findPreference(SharedPreferencesUtils.SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON);
|
||||||
|
|
||||||
|
if (lockJumpToNextTopLevelCommentButtonSwitch != null && swipeUpToHideJumpToNextTopLevelCommentButtonSwitch != null) {
|
||||||
|
lockJumpToNextTopLevelCommentButtonSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
if ((Boolean) newValue) {
|
||||||
|
swipeUpToHideJumpToNextTopLevelCommentButtonSwitch.setVisible(false);
|
||||||
|
} else {
|
||||||
|
swipeUpToHideJumpToNextTopLevelCommentButtonSwitch.setVisible(true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!sharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false)) {
|
||||||
|
swipeUpToHideJumpToNextTopLevelCommentButtonSwitch.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
activity = (Activity) context;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package ml.docilealligator.infinityforreddit.Settings;
|
package ml.docilealligator.infinityforreddit.Settings;
|
||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.preference.ListPreference;
|
import androidx.preference.ListPreference;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
@ -26,7 +23,6 @@ import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
|||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
*/
|
*/
|
||||||
public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
|
public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
|
||||||
private Activity activity;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
@ -86,10 +82,4 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttach(@NonNull Context context) {
|
|
||||||
super.onAttach(context);
|
|
||||||
activity = (Activity) context;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -69,4 +69,6 @@ public class SharedPreferencesUtils {
|
|||||||
public static final String VOLUME_KEYS_NAVIGATE_POSTS = "volume_keys_navigate_posts";
|
public static final String VOLUME_KEYS_NAVIGATE_POSTS = "volume_keys_navigate_posts";
|
||||||
public static final String MUTE_VIDEO = "mute_video";
|
public static final String MUTE_VIDEO = "mute_video";
|
||||||
public static final String OPEN_LINK_IN_APP = "open_link_in_app";
|
public static final String OPEN_LINK_IN_APP = "open_link_in_app";
|
||||||
|
public static final String LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON = "lock_jump_to_next_top_level_comment_button";
|
||||||
|
public static final String SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON = "swipe_up_to_hide_jump_to_next_top_level_comments_button";
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
android:paddingBottom="16dp"
|
android:paddingBottom="16dp"
|
||||||
android:paddingStart="32dp"
|
android:paddingStart="32dp"
|
||||||
android:paddingEnd="32dp"
|
android:paddingEnd="32dp"
|
||||||
android:text="@string/bottom_sheet_post_link"
|
android:text="@string/bottom_sheet_post_video"
|
||||||
android:textColor="@color/primaryTextColor"
|
android:textColor="@color/primaryTextColor"
|
||||||
android:textSize="?attr/font_default"
|
android:textSize="?attr/font_default"
|
||||||
android:drawableStart="@drawable/ic_outline_video_24dp"
|
android:drawableStart="@drawable/ic_outline_video_24dp"
|
||||||
@ -73,7 +73,7 @@
|
|||||||
android:paddingBottom="16dp"
|
android:paddingBottom="16dp"
|
||||||
android:paddingStart="32dp"
|
android:paddingStart="32dp"
|
||||||
android:paddingEnd="32dp"
|
android:paddingEnd="32dp"
|
||||||
android:text="@string/bottom_sheet_post_video"
|
android:text="@string/bottom_sheet_post_image"
|
||||||
android:textColor="@color/primaryTextColor"
|
android:textColor="@color/primaryTextColor"
|
||||||
android:textSize="?attr/font_default"
|
android:textSize="?attr/font_default"
|
||||||
android:drawableStart="@drawable/ic_image_24dp"
|
android:drawableStart="@drawable/ic_image_24dp"
|
||||||
|
@ -306,6 +306,8 @@
|
|||||||
<string name="settings_default_post_layout">Default Post Layout</string>
|
<string name="settings_default_post_layout">Default Post Layout</string>
|
||||||
<string name="settings_show_divider_in_compact_layout">Show Divider in Compact Layout</string>
|
<string name="settings_show_divider_in_compact_layout">Show Divider in Compact Layout</string>
|
||||||
<string name="settings_swipe_to_go_back_from_post_detail_title">Swipe Right to Go Back From Comments</string>
|
<string name="settings_swipe_to_go_back_from_post_detail_title">Swipe Right to Go Back From Comments</string>
|
||||||
|
<string name="settings_lock_jump_to_next_top_level_comment_button_title">Lock Jump to Next Top-level Comment Button</string>
|
||||||
|
<string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">Swipe Up to Hide Jump to Next Top Level Comment Button</string>
|
||||||
<string name="settings_lazy_mode_interval_title">Lazy Mode Interval</string>
|
<string name="settings_lazy_mode_interval_title">Lazy Mode Interval</string>
|
||||||
<string name="settings_font_size_title">Font Size</string>
|
<string name="settings_font_size_title">Font Size</string>
|
||||||
<string name="settings_title_font_size_title">Title Font Size</string>
|
<string name="settings_title_font_size_title">Title Font Size</string>
|
||||||
|
@ -6,6 +6,17 @@
|
|||||||
app:key="swipe_to_go_back_from_post_detail"
|
app:key="swipe_to_go_back_from_post_detail"
|
||||||
app:title="@string/settings_swipe_to_go_back_from_post_detail_title" />
|
app:title="@string/settings_swipe_to_go_back_from_post_detail_title" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="lock_jump_to_next_top_level_comment_button"
|
||||||
|
app:title="@string/settings_lock_jump_to_next_top_level_comment_button_title" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:key="swipe_up_to_hide_jump_to_next_top_level_comments_button"
|
||||||
|
app:title="@string/settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title"
|
||||||
|
app:isPreferenceVisible="false" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
app:key="volume_keys_navigate_comments"
|
app:key="volume_keys_navigate_comments"
|
||||||
|
Loading…
Reference in New Issue
Block a user