aboutsummaryrefslogtreecommitdiff
path: root/notification/LNotifications
diff options
context:
space:
mode:
authorJose Alcerreca <jalc@google.com>2016-11-23 19:11:53 +0000
committerJose Alcerreca <jalc@google.com>2016-11-29 10:45:22 +0000
commitca8142263e550a96dda0e738de3540a8fecce701 (patch)
tree4e1572351d664c0cbd1c84fa45e636bd52bd45ed /notification/LNotifications
parenta96e01f2b5ed38d455ccc85a4161d250a314488d (diff)
downloadandroid-ca8142263e550a96dda0e738de3540a8fecce701.tar.gz
Adds modern tabs, removes tests
Change-Id: I713bb8351252a45904a548631de7206f6760b7e9
Diffstat (limited to 'notification/LNotifications')
-rw-r--r--notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/HeadsUpNotificationFragment.java5
-rw-r--r--notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/LNotificationActivity.java81
-rw-r--r--notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/OtherMetadataFragment.java21
-rw-r--r--notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/VisibilityMetadataFragment.java16
-rw-r--r--notification/LNotifications/Application/src/main/res/layout/activity_notification.xml24
-rw-r--r--notification/LNotifications/Application/tests/src/com/example/android/lnotifications/HeadsUpNotificationFragmentTest.java51
-rw-r--r--notification/LNotifications/Application/tests/src/com/example/android/lnotifications/LNotificationActivityTest.java49
-rw-r--r--notification/LNotifications/Application/tests/src/com/example/android/lnotifications/OtherMetadataFragmentTest.java84
-rw-r--r--notification/LNotifications/Application/tests/src/com/example/android/lnotifications/VisibilityMetadataFragmentTest.java66
9 files changed, 79 insertions, 318 deletions
diff --git a/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/HeadsUpNotificationFragment.java b/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/HeadsUpNotificationFragment.java
index d304cf4a..89904031 100644
--- a/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/HeadsUpNotificationFragment.java
+++ b/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/HeadsUpNotificationFragment.java
@@ -16,13 +16,13 @@
package com.example.android.lnotifications;
-import android.app.Fragment;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -110,8 +110,7 @@ public class HeadsUpNotificationFragment extends Fragment {
*
* @return A Notification instance.
*/
- //@VisibleForTesting
- Notification createNotification(boolean makeHeadsUpNotification) {
+ private Notification createNotification(boolean makeHeadsUpNotification) {
Notification.Builder notificationBuilder = new Notification.Builder(getActivity())
.setSmallIcon(R.drawable.ic_launcher_notification)
.setPriority(Notification.PRIORITY_DEFAULT)
diff --git a/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/LNotificationActivity.java b/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/LNotificationActivity.java
index fbc3e623..8b44ed32 100644
--- a/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/LNotificationActivity.java
+++ b/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/LNotificationActivity.java
@@ -16,65 +16,74 @@
package com.example.android.lnotifications;
-import android.app.ActionBar;
-import android.app.Activity;
-import android.app.Fragment;
-import android.app.FragmentTransaction;
import android.os.Bundle;
+import android.support.design.widget.TabLayout;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
+import android.support.v4.view.ViewPager;
+
+import static com.example.android.lnotifications.R.id.pager;
/**
* Launcher Activity for the L Notification samples application.
*/
-public class LNotificationActivity extends Activity {
+public class LNotificationActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notification);
- setTitle(R.string.title_lnotification_activity);
- ActionBar actionBar = getActionBar();
- // Use ViewPager in the support library where possible.
- // At this time, the support library for L is not ready so using the deprecated method
- // to create tabs.
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
- ActionBar.Tab tabHeadsUpNotification = actionBar.newTab().setText("Heads Up");
- ActionBar.Tab tabVisibilityMetadata = actionBar.newTab().setText("Visibility");
- ActionBar.Tab tabOtherMetadata = actionBar.newTab().setText("Others");
- tabHeadsUpNotification.setTabListener(new FragmentTabListener(HeadsUpNotificationFragment
- .newInstance()));
- tabVisibilityMetadata.setTabListener(new FragmentTabListener(VisibilityMetadataFragment
- .newInstance()));
- tabOtherMetadata.setTabListener(new FragmentTabListener(OtherMetadataFragment.newInstance
- ()));
- actionBar.addTab(tabHeadsUpNotification, 0);
- actionBar.addTab(tabVisibilityMetadata, 1);
- actionBar.addTab(tabOtherMetadata, 2);
+ // Show 3 tabs with the different notification options.
+ ViewPager viewPager = (ViewPager) findViewById(pager);
+ TabLayout tabs = (TabLayout) findViewById(R.id.tabs);
+
+ NotificationsPagerAdapter pagerAdapter =
+ new NotificationsPagerAdapter(getSupportFragmentManager());
+ viewPager.setAdapter(pagerAdapter);
+ tabs.setupWithViewPager(viewPager);
}
- /**
- * TabListener that replaces a Fragment when a tab is clicked.
- */
- private static class FragmentTabListener implements ActionBar.TabListener {
- public Fragment fragment;
+ private static class NotificationsPagerAdapter extends FragmentPagerAdapter {
- public FragmentTabListener(Fragment fragment) {
- this.fragment = fragment;
+ NotificationsPagerAdapter(FragmentManager fm) {
+ super(fm);
}
@Override
- public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
- //do nothing.
+ public Fragment getItem(int position) {
+ switch (position) {
+ case 0:
+ return HeadsUpNotificationFragment.newInstance();
+ case 1:
+ return VisibilityMetadataFragment.newInstance();
+ case 2:
+ return OtherMetadataFragment.newInstance();
+ default:
+ break;
+ }
+ return null;
}
@Override
- public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
- ft.replace(R.id.container, fragment);
+ public int getCount() {
+ return 3;
}
@Override
- public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
- ft.remove(fragment);
+ public CharSequence getPageTitle(int position) {
+ switch (position) {
+ case 0:
+ return "Heads Up";
+ case 1:
+ return "Visibility";
+ case 2:
+ return "Others";
+ default:
+ return super.getPageTitle(position);
+ }
}
}
}
diff --git a/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/OtherMetadataFragment.java b/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/OtherMetadataFragment.java
index 51616e70..0da2c2ad 100644
--- a/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/OtherMetadataFragment.java
+++ b/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/OtherMetadataFragment.java
@@ -17,7 +17,6 @@
package com.example.android.lnotifications;
import android.app.Activity;
-import android.app.Fragment;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
@@ -30,6 +29,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.MediaStore;
+import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -42,7 +42,6 @@ import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
-import java.util.Random;
/**
* Fragment that demonstrates how to attach metadata introduced in Android L, such as
@@ -58,10 +57,10 @@ public class OtherMetadataFragment extends Fragment {
public static final int REQUEST_CODE_PICK_CONTACT = 1;
/**
- * Incremental Integer used for ID for notifications so that each notification will be
+ * Incremental int used for ID for notifications so that each notification will be
* treated differently.
*/
- private Integer mIncrementalNotificationId = Integer.valueOf(0);
+ private int mIncrementalNotificationId = 0;
private NotificationManager mNotificationManager;
@@ -85,8 +84,7 @@ public class OtherMetadataFragment extends Fragment {
/**
* Holds a URI for the person to be attached to the notification.
*/
- //@VisibleForTesting
- Uri mContactUri;
+ private Uri mContactUri;
/**
* Use this factory method to create a new instance of
@@ -177,8 +175,7 @@ public class OtherMetadataFragment extends Fragment {
*
* @return A Notification instance.
*/
- //@VisibleForTesting
- Notification createNotification(Priority priority, Category category, Uri contactUri) {
+ private Notification createNotification(Priority priority, Category category, Uri contactUri) {
Notification.Builder notificationBuilder = new Notification.Builder(getActivity())
.setContentTitle("Notification with other metadata")
.setSmallIcon(R.drawable.ic_launcher_notification)
@@ -207,7 +204,7 @@ public class OtherMetadataFragment extends Fragment {
private void showNotificationClicked(Priority priority, Category category, Uri contactUri) {
// Assigns a unique (incremented) notification ID in order to treat each notification as a
// different one. This helps demonstrate how a priority flag affects ordering.
- mIncrementalNotificationId = new Integer(mIncrementalNotificationId + 1);
+ mIncrementalNotificationId++;
mNotificationManager.notify(mIncrementalNotificationId, createNotification(priority,
category, contactUri));
Toast.makeText(getActivity(), "Show Notification clicked", Toast.LENGTH_SHORT).show();
@@ -295,8 +292,7 @@ public class OtherMetadataFragment extends Fragment {
* Enum indicating possible categories in {@link Notification} used from
* {@link #mCategorySpinner}.
*/
- //@VisibleForTesting
- static enum Category {
+ private enum Category {
ALARM("alarm"),
CALL("call"),
EMAIL("email"),
@@ -328,8 +324,7 @@ public class OtherMetadataFragment extends Fragment {
* Enum indicating possible priorities in {@link Notification} used from
* {@link #mPrioritySpinner}.
*/
- //@VisibleForTesting
- static enum Priority {
+ private enum Priority {
DEFAULT(Notification.PRIORITY_DEFAULT),
MAX(Notification.PRIORITY_MAX),
HIGH(Notification.PRIORITY_HIGH),
diff --git a/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/VisibilityMetadataFragment.java b/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/VisibilityMetadataFragment.java
index 616632b3..c12d1082 100644
--- a/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/VisibilityMetadataFragment.java
+++ b/notification/LNotifications/Application/src/main/java/com/example/android/lnotifications/VisibilityMetadataFragment.java
@@ -16,11 +16,11 @@
package com.example.android.lnotifications;
-import android.app.Fragment;
import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Bundle;
+import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -28,8 +28,6 @@ import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.Toast;
-import java.util.Random;
-
/**
* Fragment that demonstrates how notifications with different visibility metadata differ on
@@ -45,10 +43,10 @@ public class VisibilityMetadataFragment extends Fragment {
private RadioGroup mRadioGroup;
/**
- * Incremental Integer used for ID for notifications so that each notification will be
+ * Incremental int used for ID for notifications so that each notification will be
* treated differently.
*/
- private Integer mIncrementalNotificationId = Integer.valueOf(0);
+ private int mIncrementalNotificationId = 0;
/**
* Button to show a notification.
@@ -106,8 +104,7 @@ public class VisibilityMetadataFragment extends Fragment {
*
* @return A Notification instance.
*/
- //@VisibleForTesting
- Notification createNotification(NotificationVisibility visibility) {
+ private Notification createNotification(NotificationVisibility visibility) {
Notification.Builder notificationBuilder = new Notification.Builder(getActivity())
.setContentTitle("Notification for Visibility metadata");
@@ -150,7 +147,7 @@ public class VisibilityMetadataFragment extends Fragment {
// Assigns a unique (incremented) notification ID in order to treat each notification as a
// different one. This helps demonstrate how a notification with a different visibility
// level differs on the lockscreen.
- mIncrementalNotificationId = new Integer(mIncrementalNotificationId + 1);
+ mIncrementalNotificationId++;
mNotificationManager.notify(mIncrementalNotificationId, createNotification(visibility));
Toast.makeText(getActivity(), "Show Notification clicked", Toast.LENGTH_SHORT).show();
}
@@ -160,8 +157,7 @@ public class VisibilityMetadataFragment extends Fragment {
* representation of visibility levels, an icon ID to create a notification) to
* create a notification.
*/
- //@VisibleForTesting
- static enum NotificationVisibility {
+ private enum NotificationVisibility {
PUBLIC(Notification.VISIBILITY_PUBLIC, "Public", R.drawable.ic_public_notification),
PRIVATE(Notification.VISIBILITY_PRIVATE, "Private", R.drawable.ic_private_notification),
SECRET(Notification.VISIBILITY_SECRET, "Secret", R.drawable.ic_secret_notification);
diff --git a/notification/LNotifications/Application/src/main/res/layout/activity_notification.xml b/notification/LNotifications/Application/src/main/res/layout/activity_notification.xml
index cd0cd687..8723923f 100644
--- a/notification/LNotifications/Application/src/main/res/layout/activity_notification.xml
+++ b/notification/LNotifications/Application/src/main/res/layout/activity_notification.xml
@@ -14,14 +14,26 @@
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:orientation="vertical"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.android.lnotifications.LNotificationActivity">
-</FrameLayout>
+
+ <android.support.design.widget.TabLayout
+ android:id="@+id/tabs"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:tabMode="fixed"
+ app:tabGravity="fill" />
+
+ <android.support.v4.view.ViewPager
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/pager"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+ </android.support.v4.view.ViewPager>
+</LinearLayout>
diff --git a/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/HeadsUpNotificationFragmentTest.java b/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/HeadsUpNotificationFragmentTest.java
deleted file mode 100644
index 1264c16e..00000000
--- a/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/HeadsUpNotificationFragmentTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.example.android.lnotifications;
-
-import android.app.Notification;
-import android.test.ActivityInstrumentationTestCase2;
-
-/**
- * Unit tests for {@link HeadsUpNotificationFragment}.
- */
-public class HeadsUpNotificationFragmentTest extends
- ActivityInstrumentationTestCase2<LNotificationActivity> {
-
- private LNotificationActivity mActivity;
- private HeadsUpNotificationFragment mFragment;
-
- public HeadsUpNotificationFragmentTest() {
- super(LNotificationActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mActivity = getActivity();
- // The first tab should be {@link HeadsUpNotificationFragment}, that is tested in the
- // {@link LNotificationActivityTest}.
- mActivity.getActionBar().setSelectedNavigationItem(0);
- getInstrumentation().waitForIdleSync();
- mFragment = (HeadsUpNotificationFragment) mActivity.getFragmentManager()
- .findFragmentById(R.id.container);
- }
-
- public void testPreconditions() {
- assertNotNull(mActivity);
- assertNotNull(mFragment);
- assertNotNull(mActivity.findViewById(R.id.heads_up_notification_description));
- assertNotNull(mActivity.findViewById(R.id.show_notification_button));
- assertNotNull(mActivity.findViewById(R.id.use_heads_up_checkbox));
- }
-
- public void testCreateNotification_verifyFullScreenIntentIsNotNull() {
- Notification notification = mFragment.createNotification(true);
- assertNotNull(notification.fullScreenIntent);
- }
-
- public void testCreateNotification_verifyFullScreenIntentIsNull() {
- Notification notification = mFragment.createNotification(false);
- assertNull(notification.fullScreenIntent);
- }
-
- // If Mockito can be used, mock the NotificationManager and tests Notifications are actually
- // created.
-}
diff --git a/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/LNotificationActivityTest.java b/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/LNotificationActivityTest.java
deleted file mode 100644
index 061f9e8e..00000000
--- a/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/LNotificationActivityTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.example.android.lnotifications;
-
-import android.app.Fragment;
-import android.test.ActivityInstrumentationTestCase2;
-
-/**
- * Unit tests for {@link LNotificationActivity}.
- */
-public class LNotificationActivityTest extends
- ActivityInstrumentationTestCase2<LNotificationActivity> {
-
- private LNotificationActivity mActivity;
-
- public LNotificationActivityTest() {
- super(LNotificationActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mActivity = getActivity();
- }
-
- public void testPreconditions() {
- assertNotNull(String.format("%s is null", LNotificationActivity.class.getSimpleName()),
- mActivity);
- }
-
- public void testFirstTabInActionBarIsHeadsUpNotificationFragment() {
- mActivity.getActionBar().setSelectedNavigationItem(0);
- getInstrumentation().waitForIdleSync();
- Fragment fragment = mActivity.getFragmentManager().findFragmentById(R.id.container);
- assertTrue(fragment instanceof HeadsUpNotificationFragment);
- }
-
- public void testSecondtabInActionBarIsVisibilityMetadataFragment() {
- mActivity.getActionBar().setSelectedNavigationItem(1);
- getInstrumentation().waitForIdleSync();
- Fragment fragment = mActivity.getFragmentManager().findFragmentById(R.id.container);
- assertTrue(fragment instanceof VisibilityMetadataFragment);
- }
-
- public void testThirdtabInActionBarIsOtherMetadataFragment() {
- mActivity.getActionBar().setSelectedNavigationItem(2);
- getInstrumentation().waitForIdleSync();
- Fragment fragment = mActivity.getFragmentManager().findFragmentById(R.id.container);
- assertTrue(fragment instanceof OtherMetadataFragment);
- }
-}
diff --git a/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/OtherMetadataFragmentTest.java b/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/OtherMetadataFragmentTest.java
deleted file mode 100644
index 11a6c81d..00000000
--- a/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/OtherMetadataFragmentTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.example.android.lnotifications;
-
-import android.app.Activity;
-import android.app.Notification;
-import android.content.Intent;
-import android.net.Uri;
-import android.test.ActivityInstrumentationTestCase2;
-import android.util.Log;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-
-/**
- * Unit tests for {@link OtherMetadataFragment}.
- */
-public class OtherMetadataFragmentTest extends
- ActivityInstrumentationTestCase2<LNotificationActivity> {
-
- private LNotificationActivity mActivity;
- private OtherMetadataFragment mFragment;
-
- public OtherMetadataFragmentTest() {
- super(LNotificationActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mActivity = getActivity();
- // The third tab should be {@link OtherMetadataFragment}, that is tested in the
- // {@link LNotificationActivityTest}.
- mActivity.getActionBar().setSelectedNavigationItem(2);
- getInstrumentation().waitForIdleSync();
- mFragment = (OtherMetadataFragment) mActivity.getFragmentManager()
- .findFragmentById(R.id.container);
- }
-
- public void testPreconditions() {
- assertNotNull(mActivity);
- assertNotNull(mFragment);
- assertNull(mFragment.mContactUri);
- assertNotNull(mActivity.findViewById(R.id.attach_person));
- assertNotNull(mActivity.findViewById(R.id.category_spinner));
- assertNotNull(mActivity.findViewById(R.id.priority_spinner));
- assertNotNull(mActivity.findViewById(R.id.show_notification_button));
- }
-
- public void testCreateNotification_verifyPriorityAndCategoryWithoutPerson() {
- Notification notification = mFragment.createNotification(OtherMetadataFragment.Priority
- .HIGH, OtherMetadataFragment.Category.CALL, null);
- assertEquals(Notification.PRIORITY_HIGH, notification.priority);
- assertEquals(Notification.CATEGORY_CALL, notification.category);
- }
-
- public void testCreateNotification_verifyPriorityAndCategoryWithPerson() {
- String tel = "81 (90) 555-1212";
- Uri dummyContactUri = Uri.fromParts("tel", tel, null);
- Notification notification = mFragment.createNotification(OtherMetadataFragment.Priority
- .DEFAULT, OtherMetadataFragment.Category.MESSAGE, dummyContactUri);
- assertEquals(Notification.PRIORITY_DEFAULT, notification.priority);
- assertEquals(Notification.CATEGORY_MESSAGE, notification.category);
-
- String[] peopleArray = notification.extras.getStringArray(Notification.EXTRA_PEOPLE);
- assertNotNull(peopleArray);
- assertEquals(1, peopleArray.length);
- }
-
- public void testActionPickResultUpdatesContactInstanceField() {
- getInstrumentation().runOnMainSync(new Runnable() {
- @Override
- public void run() {
- String tel = "81 (90) 555-1212";
- Uri dummyContactUri = Uri.fromParts("tel", tel, null);
- Intent intent = new Intent(Intent.ACTION_PICK);
- intent.setData(dummyContactUri);
- mFragment.onActivityResult(mFragment.REQUEST_CODE_PICK_CONTACT,
- Activity.RESULT_OK, intent);
- }
- });
- getInstrumentation().waitForIdleSync();
- assertNotNull(mFragment.mContactUri);
- }
-}
diff --git a/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/VisibilityMetadataFragmentTest.java b/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/VisibilityMetadataFragmentTest.java
deleted file mode 100644
index eec62f08..00000000
--- a/notification/LNotifications/Application/tests/src/com/example/android/lnotifications/VisibilityMetadataFragmentTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.example.android.lnotifications;
-
-import android.app.Notification;
-import android.test.ActivityInstrumentationTestCase2;
-
-/**
- * Unit tests for {@link VisibilityMetadataFragment}.
- */
-public class VisibilityMetadataFragmentTest extends
- ActivityInstrumentationTestCase2<LNotificationActivity> {
-
- private LNotificationActivity mActivity;
- private VisibilityMetadataFragment mFragment;
-
- public VisibilityMetadataFragmentTest() {
- super(LNotificationActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mActivity = getActivity();
- // The second tab should be {@link VisibilityMetadataFragment}, that is tested in the
- // {@link LNotificationActivityTest}.
- mActivity.getActionBar().setSelectedNavigationItem(1);
- getInstrumentation().waitForIdleSync();
- mFragment = (VisibilityMetadataFragment) mActivity.getFragmentManager()
- .findFragmentById(R.id.container);
- }
-
- public void testPreconditions() {
- assertNotNull(mActivity);
- assertNotNull(mFragment);
- assertNotNull(mActivity.findViewById(R.id.visibility_metadata_notification_description));
- assertNotNull(mActivity.findViewById(R.id.visibility_radio_group));
- assertNotNull(mActivity.findViewById(R.id.visibility_private_radio_button));
- assertNotNull(mActivity.findViewById(R.id.visibility_secret_radio_button));
- assertNotNull(mActivity.findViewById(R.id.visibility_public_radio_button));
- assertNotNull(mActivity.findViewById(R.id.show_notification_button));
- }
-
- public void testCreateNotification_publicVisibility() {
- Notification notification = mFragment.createNotification(VisibilityMetadataFragment
- .NotificationVisibility.PUBLIC);
-
- assertEquals(Notification.VISIBILITY_PUBLIC, notification.visibility);
- assertEquals(R.drawable.ic_public_notification, notification.icon);
- }
-
- public void testCreateNotification_privateVisibility() {
- Notification notification = mFragment.createNotification(VisibilityMetadataFragment
- .NotificationVisibility.PRIVATE);
-
- assertEquals(Notification.VISIBILITY_PRIVATE, notification.visibility);
- assertEquals(R.drawable.ic_private_notification, notification.icon);
- }
-
- public void testCreateNotification_secretVisibility() {
- Notification notification = mFragment.createNotification(VisibilityMetadataFragment
- .NotificationVisibility.SECRET);
-
- assertEquals(Notification.VISIBILITY_SECRET, notification.visibility);
- assertEquals(R.drawable.ic_secret_notification, notification.icon);
- }
-}
-