Search in sources :

Example 6 with HideNonSystemOverlayMixin

use of com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin in project android_packages_apps_Settings by omnirom.

the class SettingsBaseActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isLockTaskModePinned() && !isSettingsRunOnTop()) {
        Log.w(TAG, "Devices lock task mode pinned.");
        finish();
    }
    final long startTime = System.currentTimeMillis();
    getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
    TextAppearanceConfig.setShouldLoadFontSynchronously(true);
    mCategoryMixin = new CategoryMixin(this);
    getLifecycle().addObserver(mCategoryMixin);
    final TypedArray theme = getTheme().obtainStyledAttributes(android.R.styleable.Theme);
    if (!theme.getBoolean(android.R.styleable.Theme_windowNoTitle, false)) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
    }
    // Apply SetupWizard light theme during setup flow. This is for SubSettings pages.
    final boolean isAnySetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
    if (isAnySetupWizard && this instanceof SubSettings) {
        int appliedTheme;
        if (ThemeHelper.trySetDynamicColor(this)) {
            appliedTheme = ThemeHelper.isSetupWizardDayNightEnabled(this) ? R.style.SudDynamicColorThemeSettings_SetupWizard_DayNight : R.style.SudDynamicColorThemeSettings_SetupWizard;
        } else {
            appliedTheme = ThemeHelper.isSetupWizardDayNightEnabled(this) ? R.style.SubSettings_SetupWizard : R.style.SudThemeGlifV3_Light;
        }
        setTheme(appliedTheme);
    }
    if (isToolbarEnabled() && !isAnySetupWizard) {
        super.setContentView(R.layout.collapsing_toolbar_base_layout);
        mCollapsingToolbarLayout = findViewById(R.id.collapsing_toolbar);
        mAppBarLayout = findViewById(R.id.app_bar);
        if (mCollapsingToolbarLayout != null) {
            mCollapsingToolbarLayout.setLineSpacingMultiplier(TOOLBAR_LINE_SPACING_MULTIPLIER);
        }
        disableCollapsingToolbarLayoutScrollingBehavior();
    } else {
        super.setContentView(R.layout.settings_base_layout);
    }
    // This is to hide the toolbar from those pages which don't need a toolbar originally.
    final Toolbar toolbar = findViewById(R.id.action_bar);
    if (!isToolbarEnabled() || isAnySetupWizard) {
        toolbar.setVisibility(View.GONE);
        return;
    }
    setActionBar(toolbar);
    if (DEBUG_TIMING) {
        Log.d(TAG, "onCreate took " + (System.currentTimeMillis() - startTime) + " ms");
    }
}
Also used : HideNonSystemOverlayMixin(com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin) SubSettings(com.android.settings.SubSettings) TypedArray(android.content.res.TypedArray) Toolbar(android.widget.Toolbar)

Example 7 with HideNonSystemOverlayMixin

use of com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin in project android_packages_apps_Settings by omnirom.

the class SettingsHomepageActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.settings_homepage_container);
    final View appBar = findViewById(R.id.app_bar_container);
    appBar.setMinimumHeight(getSearchBoxHeight());
    initHomepageContainer();
    final Toolbar toolbar = findViewById(R.id.search_action_bar);
    FeatureFactory.getFactory(this).getSearchFeatureProvider().initSearchToolbar(this, /* activity */
    toolbar, SettingsEnums.SETTINGS_HOMEPAGE);
    getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
    mCategoryMixin = new CategoryMixin(this);
    getLifecycle().addObserver(mCategoryMixin);
    if (!getSystemService(ActivityManager.class).isLowRamDevice()) {
        // Only allow features on high ram devices.
        final ImageView avatarView = findViewById(R.id.account_avatar);
        if (AvatarViewMixin.isAvatarSupported(this)) {
            avatarView.setVisibility(View.VISIBLE);
            getLifecycle().addObserver(new AvatarViewMixin(this, avatarView));
        }
        showSuggestionFragment();
        if (FeatureFlagUtils.isEnabled(this, FeatureFlags.CONTEXTUAL_HOME)) {
            showFragment(new ContextualCardsFragment(), R.id.contextual_cards_content);
        }
    }
    showFragment(new TopLevelSettings(), R.id.main_content);
    ((FrameLayout) findViewById(R.id.main_content)).getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
}
Also used : HideNonSystemOverlayMixin(com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin) ContextualCardsFragment(com.android.settings.homepage.contextualcards.ContextualCardsFragment) ImageView(android.widget.ImageView) CategoryMixin(com.android.settings.core.CategoryMixin) ImageView(android.widget.ImageView) View(android.view.View) AvatarViewMixin(com.android.settings.accounts.AvatarViewMixin) Toolbar(android.widget.Toolbar)

Example 8 with HideNonSystemOverlayMixin

use of com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin in project android_packages_apps_Settings by omnirom.

the class SettingsPanelActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getApplicationContext().getTheme().rebase();
    createOrUpdatePanel(true);
    getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
}
Also used : HideNonSystemOverlayMixin(com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin)

Example 9 with HideNonSystemOverlayMixin

use of com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin in project android_packages_apps_Settings by omnirom.

the class AddAppNetworksActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.settings_panel);
    showAddNetworksFragment();
    getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
    // Move the window to the bottom of screen, and make it take up the entire screen width.
    final Window window = getWindow();
    window.setGravity(Gravity.BOTTOM);
    window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
}
Also used : Window(android.view.Window) HideNonSystemOverlayMixin(com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin)

Example 10 with HideNonSystemOverlayMixin

use of com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin in project android_packages_apps_Settings by omnirom.

the class CredentialStorage method onCreate.

@Override
protected void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    mUtils = new LockPatternUtils(this);
    getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
}
Also used : HideNonSystemOverlayMixin(com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin) LockPatternUtils(com.android.internal.widget.LockPatternUtils)

Aggregations

HideNonSystemOverlayMixin (com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin)10 Window (android.view.Window)5 Test (org.junit.Test)4 WindowManager (android.view.WindowManager)2 Toolbar (android.widget.Toolbar)2 BatteryFixSliceTest (com.android.settings.homepage.contextualcards.slices.BatteryFixSliceTest)2 Config (org.robolectric.annotation.Config)2 TypedArray (android.content.res.TypedArray)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 LockPatternUtils (com.android.internal.widget.LockPatternUtils)1 SubSettings (com.android.settings.SubSettings)1 AvatarViewMixin (com.android.settings.accounts.AvatarViewMixin)1 CategoryMixin (com.android.settings.core.CategoryMixin)1 ContextualCardsFragment (com.android.settings.homepage.contextualcards.ContextualCardsFragment)1