mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-02 11:37:37 +00:00
Merge branch 'develop' into improve/fixui
# Conflicts: # app/src/main/java/one/nem/lacerta/MainActivity.java # feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java
This commit is contained in:
9 files changed
+177
-34
No files matched your search
@@ -71,8 +71,37 @@ public class MainActivity extends AppCompatActivity {
|
||||
// Set status bar color
|
||||
getWindow().setStatusBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurface));
|
||||
|
||||
// Set app bar color
|
||||
AppBarLayout appBarLayout = 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
|
||||
getWindow().setStatusBarColor(ContextCompat.getColor(getApplicationContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
||||
} else if (verticalOffset == 0) {
|
||||
// Expanded
|
||||
getWindow().setStatusBarColor(ContextCompat.getColor(getApplicationContext(), one.nem.lacerta.shared.ui.R.color.colorSurface));
|
||||
} else {
|
||||
// Somewhere in between
|
||||
// Here you can add a color transition if you want
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
// Public
|
||||
public void setActionBarTitle(String title) {
|
||||
getSupportActionBar().setTitle(title);
|
||||
}
|
||||
|
||||
public void setActionBarBackButton(boolean isEnabled) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(isEnabled);
|
||||
}
|
||||
|
||||
private void initializeApp() {
|
||||
Log.d("Init", "Initializing app");
|
||||
@@ -88,4 +117,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
boolean isEnabled = FeatureSwitch.Meta.canOverrideSwitch ? sharedPrefUtils.getFeatureSwitchOverride(featureSwitchOverride) : defaultValue;
|
||||
if (!isEnabled) bottomNavigationView.getMenu().removeItem(menuId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigateToFragment(Fragment fragment) {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.nav_host_fragment, fragment)
|
||||
.addToBackStack(null)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user