Merge "Extend settings panel under navigation bar" into tm-qpr-dev am: 17701cd976
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/20929206 Change-Id: I60aab9b333efc5d38f0cbc6f3635948bf734091f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
afb4dd1ece
@@ -29,12 +29,15 @@ import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsControllerCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
|
||||
|
||||
/**
|
||||
@@ -144,9 +147,33 @@ public class SettingsPanelActivity extends FragmentActivity {
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT,
|
||||
WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
setupNavigationBar();
|
||||
mPanelFragment = new PanelFragment();
|
||||
mPanelFragment.setArguments(new Bundle(mBundle));
|
||||
fragmentManager.beginTransaction().add(R.id.main_content, mPanelFragment).commit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust bottom edge and color.
|
||||
*/
|
||||
private void setupNavigationBar() {
|
||||
// Extend the panel all the way to the bottom of the screen, as opposed to sitting on top of
|
||||
// the navigation bar.
|
||||
ViewCompat.setOnApplyWindowInsetsListener(getWindow().getDecorView(),
|
||||
(v, windowInsets) -> {
|
||||
v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), 0);
|
||||
return windowInsets; // propagate down to panel layout root element
|
||||
});
|
||||
|
||||
// When using 3-button navigation in light mode, the system picks white navigation buttons
|
||||
// which are not sufficiently contrasted from the panel background.
|
||||
WindowInsetsControllerCompat windowInsetsController =
|
||||
ViewCompat.getWindowInsetsController(getWindow().getDecorView());
|
||||
|
||||
if (windowInsetsController != null) {
|
||||
boolean forceNavigationButtonsDark = !Utils.isNightMode(this);
|
||||
windowInsetsController.setAppearanceLightNavigationBars(forceNavigationButtonsDark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user