Merge "Use a single layout for CreateShortcut activity."
This commit is contained in:
committed by
Android (Google) Code Review
commit
2a6193df36
36
res/layout/activity_list.xml
Normal file
36
res/layout/activity_list.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/activity_list_empty"
|
||||
android:visibility="gone"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
|
||||
</FrameLayout>
|
@@ -612,6 +612,8 @@
|
||||
<string name="settings_label_launcher">Settings</string>
|
||||
<!-- Label for option to select a settings panel as a shortcut -->
|
||||
<string name="settings_shortcut">Settings shortcut</string>
|
||||
<!-- Shown in create shortcut activity when there is no shortcut that can be created. [CHAR_LIMIT=None] -->
|
||||
<string name="activity_list_empty">No matching activities found.</string>
|
||||
<!-- Wireless controls settings screen, setting check box label -->
|
||||
<string name="airplane_mode">Airplane mode</string>
|
||||
<!-- Main Settings screen settings title for things like airplane mode, tethering, NFC, VPN. This will take you to another screen with those settings. [CHAR LIMIT=30] -->
|
||||
|
@@ -85,6 +85,11 @@ public class CreateShortcut extends LauncherActivity {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSetContentView() {
|
||||
setContentView(R.layout.activity_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform query on package manager for list items. The default
|
||||
* implementation queries for activities.
|
||||
|
44
tests/app/src/com/android/settings/CreateShortcutTest.java
Normal file
44
tests/app/src/com/android/settings/CreateShortcutTest.java
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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.
|
||||
*/
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Instrumentation;
|
||||
import android.content.Intent;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.filters.SmallTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@SmallTest
|
||||
public class CreateShortcutTest {
|
||||
|
||||
@Test
|
||||
public void test_layoutDoesNotHaveCancelButton() {
|
||||
Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
|
||||
instrumentation.startActivitySync(new Intent(Intent.ACTION_CREATE_SHORTCUT)
|
||||
.setClassName(instrumentation.getTargetContext(),
|
||||
CreateShortcut.class.getName()));
|
||||
onView(withText(R.string.cancel)).check(doesNotExist());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user