bugfix, layout improvements

This commit is contained in:
Conny Duck 2017-08-05 11:34:50 +02:00
commit f696b6e8d3
6 changed files with 102 additions and 96 deletions

View file

@ -178,15 +178,16 @@ public class AccountListFragment extends BaseFragment implements AccountActionLi
if (actionButtonPresent()) {
/* Use a modified scroll listener that both loads more statuses as it goes, and hides
* the follow button on down-scroll. */
ActionButtonActivity actionButtonActivity = (ActionButtonActivity) getActivity();
final FloatingActionButton composeButton = actionButtonActivity.getActionButton();
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
hideFab = preferences.getBoolean("fabHide", false);
scrollListener = new EndlessOnScrollListener(layoutManager) {
@Override
public void onScrolled(RecyclerView view, int dx, int dy) {
super.onScrolled(view, dx, dy);
ActionButtonActivity actionButtonActivity = (ActionButtonActivity) getActivity();
FloatingActionButton composeButton = actionButtonActivity.getActionButton();
if (composeButton != null) {
if (hideFab) {
if (dy > 0 && composeButton.isShown()) {

View file

@ -40,6 +40,7 @@ import com.keylesspalace.tusky.adapter.NotificationsAdapter;
import com.keylesspalace.tusky.R;
import com.keylesspalace.tusky.entity.Notification;
import com.keylesspalace.tusky.entity.Status;
import com.keylesspalace.tusky.interfaces.ActionButtonActivity;
import com.keylesspalace.tusky.interfaces.StatusActionListener;
import com.keylesspalace.tusky.receiver.TimelineReceiver;
import com.keylesspalace.tusky.util.HttpHeaderLink;
@ -172,9 +173,7 @@ public class NotificationsFragment extends SFragment implements
* guaranteed to be set until then.
* Use a modified scroll listener that both loads more notifications as it goes, and hides
* the compose button on down-scroll. */
final FloatingActionButton composeButton = activity.getActionButton();
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(
activity);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
preferences.registerOnSharedPreferenceChangeListener(this);
hideFab = preferences.getBoolean("fabHide", false);
scrollListener = new EndlessOnScrollListener(layoutManager) {
@ -182,6 +181,9 @@ public class NotificationsFragment extends SFragment implements
public void onScrolled(RecyclerView view, int dx, int dy) {
super.onScrolled(view, dx, dy);
ActionButtonActivity activity = (ActionButtonActivity) getActivity();
FloatingActionButton composeButton = activity.getActionButton();
if(composeButton != null) {
if (hideFab) {
if (dy > 0 && composeButton.isShown()) {

View file

@ -198,15 +198,16 @@ public class TimelineFragment extends SFragment implements
if (actionButtonPresent()) {
/* Use a modified scroll listener that both loads more statuses as it goes, and hides
* the follow button on down-scroll. */
ActionButtonActivity activity = (ActionButtonActivity) getActivity();
final FloatingActionButton composeButton = activity.getActionButton();
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
hideFab = preferences.getBoolean("fabHide", false);
scrollListener = new EndlessOnScrollListener(layoutManager) {
@Override
public void onScrolled(RecyclerView view, int dx, int dy) {
super.onScrolled(view, dx, dy);
ActionButtonActivity activity = (ActionButtonActivity) getActivity();
FloatingActionButton composeButton = activity.getActionButton();
if (composeButton != null) {
if (hideFab) {
if (dy > 0 && composeButton.isShown()) {