mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 09:43:15 +00:00
UI修正
This commit is contained in:
parent
1ce3af59e6
commit
fda8adae80
|
@ -10,6 +10,8 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import one.nem.lacerta.setting.model.SettingListItem;
|
||||
|
@ -86,6 +88,23 @@ public class SettingTopFragment extends Fragment {
|
|||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
recyclerView.setAdapter(new ListItemAdapter(settingListItems));
|
||||
|
||||
// Set status bar color
|
||||
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
||||
@Override
|
||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
||||
if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) {
|
||||
// Collapsed
|
||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
||||
} else if (verticalOffset == 0) {
|
||||
// Expanded
|
||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface));
|
||||
} else {
|
||||
// Somewhere in between
|
||||
// Here you can add a color transition if you want
|
||||
}
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user