OSDN Git Service

Moving things around a little in the new DeskClock.
[android-x86/packages-apps-DeskClock.git] / src / com / android / deskclock / AnalogAppWidgetProvider.java
1 /*
2  * Copyright (C) 2009 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;
18
19 import android.app.AlarmManager;
20 import android.app.PendingIntent;
21 import android.appwidget.AppWidgetManager;
22 import android.content.BroadcastReceiver;
23 import android.content.ComponentName;
24 import android.content.ContentResolver;
25 import android.content.Context;
26 import android.content.Intent;
27 import android.content.res.Resources;
28 import android.database.Cursor;
29 import android.graphics.PorterDuff;
30 import android.net.Uri;
31 import android.provider.Calendar;
32 import android.provider.Calendar.Attendees;
33 import android.provider.Calendar.Calendars;
34 import android.provider.Calendar.EventsColumns;
35 import android.provider.Calendar.Instances;
36 import android.provider.Calendar.Reminders;
37 import android.text.format.DateFormat;
38 import android.text.format.DateUtils;
39 import android.util.Config;
40 import android.util.Log;
41 import android.view.View;
42 import android.widget.RemoteViews;
43
44 import java.util.Arrays;
45
46 /**
47  * Simple widget to show analog clock.
48  */
49 public class AnalogAppWidgetProvider extends BroadcastReceiver {
50     static final String TAG = "AnalogAppWidgetProvider";
51
52     public void onReceive(Context context, Intent intent) {
53         String action = intent.getAction();
54         
55         if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)) {
56             RemoteViews views = new RemoteViews(context.getPackageName(),
57                     R.layout.analog_appwidget);
58             
59             int[] appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
60             
61             AppWidgetManager gm = AppWidgetManager.getInstance(context);
62             gm.updateAppWidget(appWidgetIds, views);
63         }
64     }
65 }
66