Home | History | Annotate | Download | only in deskclock
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.deskclock.tests;
     18 
     19 import android.app.Activity;
     20 import android.content.Intent;
     21 import android.os.Bundle;
     22 import android.provider.AlarmClock;
     23 
     24 public class TestAddAlarm extends Activity {
     25 
     26     @Override
     27     protected void onCreate(Bundle icicle) {
     28         super.onCreate(icicle);
     29 
     30         Intent i = new Intent(AlarmClock.ACTION_SET_ALARM);
     31         i.putExtra(AlarmClock.EXTRA_MESSAGE, "New Alarm!");
     32         i.putExtra(AlarmClock.EXTRA_HOUR, 12);
     33         i.putExtra(AlarmClock.EXTRA_MINUTES, 27);
     34 
     35         startActivity(i);
     36 
     37         // Should not see a duplicate
     38         startActivity(i);
     39 
     40         i.removeExtra(AlarmClock.EXTRA_MESSAGE);
     41         startActivity(i);
     42         // No dup of null message.
     43         startActivity(i);
     44 
     45         // No extras, launches the alarm list.
     46         startActivity(new Intent(AlarmClock.ACTION_SET_ALARM));
     47 
     48         finish();
     49     }
     50 }
     51