Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e14ca00 authored by Fan Zhang's avatar Fan Zhang
Browse files

Remove obsolete logic in SettingsActivity.

mIsShowingDashboard is always false, it used to be true when we are
displaying homepage, but now homepage is hosted in a entirely different
activity.

so all related logic can now be removed.

Test: robotests

Misc clean up: remove unused colors

Test: rebuild, color-lint
Change-Id: I1e1628c1e9606c2b7dc40ef3c21d4ed1391a8c03
parent 662b209b
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -114,13 +114,6 @@
        <uses-library android:name="org.apache.http.legacy" />
        <!-- Settings -->

        <activity android:name="SettingsActivity"
                android:label="@string/settings_label_launcher"
                android:launchMode="singleTask">
            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                android:value="true" />
        </activity>

        <activity android:name=".homepage.SettingsHomepageActivity"
                  android:label="@string/settings_label_launcher"
                  android:theme="@style/Theme.Settings.Home"
+74 −282

File changed.

Preview size limit exceeded, changes collapsed.

+0 −33
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2014, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <include layout="@layout/search_bar" />

    <FrameLayout
        android:id="@+id/main_content"
        android:layout_height="match_parent"
        android:layout_width="match_parent" />
</LinearLayout>
+0 −20
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@
    <color name="red">#F00</color>
    <color name="blue">#00F</color>

    <color name="material_empty_color_light">#FFCED7DB</color>

    <color name="bluetooth_dialog_text_color">#8a000000</color>

    <color name="crypt_keeper_clock_background">#ff9a9a9a</color>
@@ -30,7 +28,6 @@

    <color name="divider_color">#20ffffff</color>
    <color name="title_color">@android:color/holo_blue_light</color>
    <color name="setup_lock_pattern_view_regular_color_dark">#ffbdbdbd</color>
    <color name="setup_lock_pattern_view_regular_color_light">@color/lock_pattern_view_regular_color</color>
    <color name="setup_lock_pattern_view_success_color_dark">#ff84ffff</color>
    <color name="setup_lock_pattern_view_success_color_light">@color/suw_color_accent_light</color>
@@ -52,25 +49,13 @@
    <color name="running_processes_system_ram">#ff384248</color>
    <color name="running_processes_free_ram">#ffced7db</color>

    <color name="wifi_divider">#ffe0e0e0</color>
    <color name="sim_noitification">@*android:color/accent_device_default_light</color>

    <color name="confirm_device_credential_transparent_black">#60000000</color>
    <color name="voice_interaction_highlight">#33b5e5</color>

    <color name="memory_normal">#ff009587</color>
    <color name="memory_moderate">#ffF3B300</color>
    <color name="memory_low">#ffff9700</color>
    <color name="memory_critical">#ffff5621</color>

    <color name="memory_avg_use">#ff384248</color>

    <!-- Accent color that matches the settings launcher icon -->
    <color name="icon_accent">#ffabffec</color>

    <color name="importance_icon_tint">#8a000000</color>
    <color name="importance_disabled_tint">#4d000000</color>

    <!-- Accessibility SUW colors -->
    <color name="material_blue_500">#4285F4</color>
    <color name="material_blue_700">#3367D6</color>
@@ -78,7 +63,6 @@
    <color name="material_grey_200">#ffffff</color>
    <color name="switch_bar_background">#ff80868B</color>


    <color name="message_text_incoming">#ffffffff</color>
    <color name="message_text_outgoing">#ff323232</color>
    <color name="timestamp_text_outgoing">#99323232</color>
@@ -102,10 +86,6 @@
    <!-- Color for preference icons on the Wifi Network Details page -->
    <color name="wifi_details_icon_color">#8A000000</color>

    <!-- Suggestion/condition colors -->
    <color name="suggestion_condition_background">#f2f2f2</color>
    <color name="condition_card_background">#f8f8f8</color>

    <!-- Dashboard/homepage icon background colors -->
    <color name="homepage_network_background">#2196F3</color>
    <color name="homepage_connected_device_background">#72B70F</color>
+5 −21
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toolbar;

import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
@@ -169,8 +168,6 @@ public class SettingsActivity extends SettingsBaseActivity

    private Button mNextButton;

    private boolean mIsShowingDashboard;

    private ViewGroup mContent;

    // Categories
@@ -241,9 +238,6 @@ public class SettingsActivity extends SettingsBaseActivity
        // Getting Intent properties can only be done after the super.onCreate(...)
        final String initialFragmentName = intent.getStringExtra(EXTRA_SHOW_FRAGMENT);

        mIsShowingDashboard = TextUtils.equals(
                SettingsActivity.class.getName(), intent.getComponent().getClassName());

        // This is a "Sub Settings" when:
        // - this is a real SubSettings
        // - or :settings:show_fragment_as_subsetting is passed to the Intent
@@ -256,8 +250,7 @@ public class SettingsActivity extends SettingsBaseActivity
            setTheme(R.style.Theme_SubSettings);
        }

        setContentView(mIsShowingDashboard ?
                R.layout.settings_main_dashboard : R.layout.settings_main_prefs);
        setContentView(R.layout.settings_main_prefs);

        mContent = findViewById(R.id.main_content);

@@ -276,25 +269,16 @@ public class SettingsActivity extends SettingsBaseActivity
                setTitleFromBackStack();
            }
        } else {
            launchSettingFragment(initialFragmentName, isSubSettings, intent);
            launchSettingFragment(initialFragmentName, intent);
        }

        final boolean deviceProvisioned = Utils.isDeviceProvisioned(this);
        if (mIsShowingDashboard) {
            findViewById(R.id.search_bar).setVisibility(
                    deviceProvisioned ? View.VISIBLE : View.INVISIBLE);
            findViewById(R.id.action_bar).setVisibility(View.GONE);
            final Toolbar toolbar = findViewById(R.id.search_action_bar);
            setActionBar(toolbar);
            FeatureFactory.getFactory(this).getSearchFeatureProvider()
                    .initSearchToolbar(this, toolbar);
        }

        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(deviceProvisioned);
            actionBar.setHomeButtonEnabled(deviceProvisioned);
            actionBar.setDisplayShowTitleEnabled(!mIsShowingDashboard);
            actionBar.setDisplayShowTitleEnabled(true);
        }
        mSwitchBar = findViewById(R.id.switch_bar);
        if (mSwitchBar != null) {
@@ -372,8 +356,8 @@ public class SettingsActivity extends SettingsBaseActivity
    }

    @VisibleForTesting
    void launchSettingFragment(String initialFragmentName, boolean isSubSettings, Intent intent) {
        if (!mIsShowingDashboard && initialFragmentName != null) {
    void launchSettingFragment(String initialFragmentName, Intent intent) {
        if (initialFragmentName != null) {
            setTitleFromIntent(intent);

            Bundle initialArguments = intent.getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
Loading