Fix issue #593
This commit is contained in:
parent
fa1bc9f545
commit
a27ffa3dfa
|
@ -206,6 +206,8 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
private int style;
|
||||
private Activity activity;
|
||||
private HashMap<String, Integer> tabPosition = new HashMap<>();
|
||||
private FloatingActionButton federatedTimelines;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -339,7 +341,7 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
}else {
|
||||
style = R.style.Dialog;
|
||||
}
|
||||
FloatingActionButton federatedTimelines = findViewById(R.id.federated_timeline);
|
||||
federatedTimelines = findViewById(R.id.federated_timeline);
|
||||
|
||||
delete_instance.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -2727,6 +2729,24 @@ public abstract class BaseMainActivity extends BaseActivity
|
|||
|
||||
}
|
||||
|
||||
public void manageFloatingButton(boolean display){
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
boolean displayFollowInstance = sharedpreferences.getBoolean(Helper.SET_DISPLAY_FOLLOW_INSTANCE, true);
|
||||
if(display){
|
||||
toot.show();
|
||||
if( !displayFollowInstance)
|
||||
federatedTimelines.hide();
|
||||
else
|
||||
federatedTimelines.show();
|
||||
}else{
|
||||
toot.hide();
|
||||
federatedTimelines.hide();
|
||||
}
|
||||
}
|
||||
public boolean getFloatingVisibility(){
|
||||
return toot.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
public void refreshButton(){
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
FloatingActionButton federatedTimelines = findViewById(R.id.federated_timeline);
|
||||
|
|
|
@ -178,6 +178,12 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy)
|
||||
{
|
||||
if (context instanceof BaseMainActivity ) {
|
||||
if( dy < 0 && !((BaseMainActivity)context).getFloatingVisibility() )
|
||||
((BaseMainActivity) context).manageFloatingButton(true);
|
||||
if( dy > 0 && ((BaseMainActivity)context).getFloatingVisibility() )
|
||||
((BaseMainActivity) context).manageFloatingButton(false);
|
||||
}
|
||||
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
|
||||
if(dy > 0){
|
||||
int visibleItemCount = mLayoutManager.getChildCount();
|
||||
|
@ -219,6 +225,12 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue