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

Commit 120f9716 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Disable settings nav drawer entirely."

parents 11eb3321 5ba2d3fe
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -465,8 +465,7 @@ public class SettingsDrawerActivity extends Activity {
    }

    boolean isNavDrawerEnabled() {
        return !isDashboardFeatureEnabled()
                || getResources().getBoolean(R.bool.config_enable_nav_drawer);
        return getResources().getBoolean(R.bool.config_enable_nav_drawer);
    }

    private class PackageReceiver extends BroadcastReceiver {
+14 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.settingslib.drawer;

import android.app.Activity;
import android.app.Instrumentation;
import android.content.Intent;
import android.support.test.InstrumentationRegistry;
@@ -25,6 +26,8 @@ import android.support.test.runner.AndroidJUnit4;

import com.android.settingslib.R;

import com.google.common.truth.Truth;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -36,12 +39,12 @@ import static android.support.test.espresso.assertion.ViewAssertions.doesNotExis
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
import static com.google.common.truth.Truth.assertThat;

@RunWith(AndroidJUnit4.class)
@SmallTest
public class SettingsDrawerActivityTest {


    @Rule
    public ActivityTestRule<TestActivity> mActivityRule =
            new ActivityTestRule<>(TestActivity.class, true, true);
@@ -83,6 +86,16 @@ public class SettingsDrawerActivityTest {
                .check(matches(isDisplayed()));
    }

    @Test
    public void startActivity_shouldNotHaveNavDrawer() {
        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
        Activity activity = instrumentation.startActivitySync(
                new Intent(instrumentation.getTargetContext(), TestActivity.class));

        assertThat(((SettingsDrawerActivity) activity).isNavDrawerEnabled())
                .isFalse();
    }

    /**
     * Test Activity in this test.
     *
+2 −2
Original line number Diff line number Diff line
@@ -21,12 +21,12 @@ import android.content.Context;
import android.content.Intent;
import android.util.Pair;

import com.android.settingslib.SettingLibRobolectricTestRunner;
import com.android.settingslib.TestConfig;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowApplication;

@@ -35,7 +35,7 @@ import java.util.Map;

import static com.google.common.truth.Truth.assertThat;

@RunWith(RobolectricTestRunner.class)
@RunWith(SettingLibRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class CategoryManagerTest {