Search in sources :

Example 1 with SubSettings

use of com.android.settings.SubSettings in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SettingsBaseActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isLockTaskModePinned() && !isSettingsRunOnTop() && !isLaunchableInTaskModePinned()) {
        Log.w(TAG, "Devices lock task mode pinned.");
        finish();
    }
    final long startTime = System.currentTimeMillis();
    getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
    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.
    if (WizardManagerHelper.isAnySetupWizard(getIntent()) && this instanceof SubSettings) {
        setTheme(R.style.LightTheme_SubSettings_SetupWizard);
    }
    super.setContentView(R.layout.settings_base_layout);
    final Toolbar toolbar = findViewById(R.id.action_bar);
    if (theme.getBoolean(android.R.styleable.Theme_windowNoTitle, false)) {
        toolbar.setVisibility(View.GONE);
        return;
    }
    setActionBar(toolbar);
    if (DEBUG_TIMING) {
        Log.d(TAG, "onCreate took " + (System.currentTimeMillis() - startTime) + " ms");
    }
}
Also used : SubSettings(com.android.settings.SubSettings) TypedArray(android.content.res.TypedArray) Toolbar(android.widget.Toolbar)

Example 2 with SubSettings

use of com.android.settings.SubSettings 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)

Aggregations

TypedArray (android.content.res.TypedArray)2 Toolbar (android.widget.Toolbar)2 SubSettings (com.android.settings.SubSettings)2 HideNonSystemOverlayMixin (com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin)1