feat: shows toolbar when scrolled past title
This still needs to be redone with the same style as the profile fragment
This commit is contained in:
@@ -67,6 +67,7 @@ public abstract class SettingsBaseFragment extends MastodonToolbarFragment imple
|
||||
protected boolean needAppRestart;
|
||||
private Instance instance;
|
||||
private String instanceName;
|
||||
protected String title;
|
||||
|
||||
protected NotificationPolicyItem notificationPolicyItem;
|
||||
|
||||
@@ -93,7 +94,7 @@ public abstract class SettingsBaseFragment extends MastodonToolbarFragment imple
|
||||
DomainManager.getInstance().setCurrentDomain(session.domain + "/settings");
|
||||
|
||||
addItems(items);
|
||||
String title = getArguments().getString("title", getTitle().toString());
|
||||
title = getArguments().getString("title", getTitle().toString());
|
||||
items.add(0, new GiantHeaderItem(title));
|
||||
}
|
||||
|
||||
@@ -114,6 +115,26 @@ public abstract class SettingsBaseFragment extends MastodonToolbarFragment imple
|
||||
outRect.top = V.dp(32);
|
||||
}
|
||||
});
|
||||
|
||||
//TODO do this the same way as the profile toolbar
|
||||
list.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) list.getLayoutManager();
|
||||
if (linearLayoutManager != null && linearLayoutManager.findFirstVisibleItemPosition() > 0) {
|
||||
setTitle(title);
|
||||
if(!title.isEmpty()){
|
||||
getToolbar().setBackgroundColor(UiUtils.getThemeColor(getContext(), R.attr.colorBackgroundLight));
|
||||
setStatusBarColor(UiUtils.getThemeColor(getContext(), R.attr.colorBackgroundLight));
|
||||
}
|
||||
} else {
|
||||
setTitle("");
|
||||
getToolbar().setBackgroundColor(UiUtils.getThemeColor(getContext(), R.attr.colorWindowBackground));
|
||||
setStatusBarColor(UiUtils.getThemeColor(getContext(), R.attr.colorWindowBackground));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user