Methods Summary |
---|
public android.widget.Button | getBackButton()
return mBackButton;
|
private int | getNavbarTheme()
// Normally we can automatically guess the theme by comparing the foreground color against
// the background color. But we also allow specifying explicitly using
// setup_wizard_navbar_theme.
TypedArray attributes = getActivity().obtainStyledAttributes(
new int[] {
R.attr.setup_wizard_navbar_theme,
android.R.attr.colorForeground,
android.R.attr.colorBackground });
int theme = attributes.getResourceId(0, 0);
if (theme == 0) {
// Compare the value of the foreground against the background color to see if current
// theme is light-on-dark or dark-on-light.
float[] foregroundHsv = new float[3];
float[] backgroundHsv = new float[3];
Color.colorToHSV(attributes.getColor(1, 0), foregroundHsv);
Color.colorToHSV(attributes.getColor(2, 0), backgroundHsv);
boolean isDarkBg = foregroundHsv[2] > backgroundHsv[2];
theme = isDarkBg ? R.style.setup_wizard_navbar_theme_dark :
R.style.setup_wizard_navbar_theme_light;
}
attributes.recycle();
return theme;
|
public android.widget.Button | getNextButton()
return mNextButton;
|
public void | onAttach(android.app.Activity activity)
super.onAttach(activity);
mCallback = (NavigationBarListener) activity;
|
public void | onClick(android.view.View v)
if (v == mBackButton) {
mCallback.onNavigateBack();
} else if (v == mNextButton) {
mCallback.onNavigateNext();
}
|
public android.view.View | onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
Context context = new ContextThemeWrapper(getActivity(), getNavbarTheme());
inflater = LayoutInflater.from(context);
mNavigationBarView = (ViewGroup) inflater.inflate(R.layout.setup_wizard_navbar_layout,
container, false);
mNextButton = (Button) mNavigationBarView.findViewById(R.id.setup_wizard_navbar_next);
mBackButton = (Button) mNavigationBarView.findViewById(R.id.setup_wizard_navbar_back);
mNextButton.setOnClickListener(this);
mBackButton.setOnClickListener(this);
return mNavigationBarView;
|
public boolean | onPreDraw()
// View.setSystemUiVisibility checks if the visibility changes before applying them
// so the performance impact is contained
mNavigationBarView.setSystemUiVisibility(mSystemUiFlags);
return true;
|
public void | onViewCreated(android.view.View view, android.os.Bundle savedInstanceState)
super.onViewCreated(view, savedInstanceState);
mCallback.onNavigationBarCreated(this);
mNavigationBarView.setSystemUiVisibility(mSystemUiFlags);
// Set the UI flags before draw because the visibility might change in unexpected /
// undetectable times, like transitioning from a finishing activity that had a keyboard
ViewTreeObserver viewTreeObserver = mNavigationBarView.getViewTreeObserver();
viewTreeObserver.addOnPreDrawListener(this);
|
public void | setUseImmersiveMode(boolean useImmersiveMode)Sets whether system navigation bar should be hidden.
// By default, enable layoutHideNavigation if immersive mode is used
setUseImmersiveMode(useImmersiveMode, useImmersiveMode);
|
public void | setUseImmersiveMode(boolean useImmersiveMode, boolean layoutHideNavigation)
if (useImmersiveMode) {
mSystemUiFlags |= IMMERSIVE_FLAGS;
if (layoutHideNavigation) {
mSystemUiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
}
} else {
mSystemUiFlags &= ~(IMMERSIVE_FLAGS | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
}
mNavigationBarView.setSystemUiVisibility(mSystemUiFlags);
|