基本信息
源码名称:安卓日历小部件源码(AppWidgetProvider)
源码大小:0.05M
文件格式:.rar
开发语言:Java
更新时间:2019-09-10
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
一款关于日历与行程安排的项目源码,点击日期可以转跳到日程新增界面,事件是提前定好的类型,提醒周期很丰富,可以按照周、年、月、日、小时和分钟为周期进行提醒,日历默认会显示一些节假日和纪念日信息。当日期被标记上事件以后会在日期右上角显示一个小红角作为提醒。
package com.yarin.android.TodayDate; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.text.format.Time; import android.widget.RemoteViews; public class TodayDateSmall extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { RemoteViews updateView = buildUpdate(context); appWidgetManager.updateAppWidget(appWidgetIds, updateView); super.onUpdate(context, appWidgetManager, appWidgetIds); } private String[] months = {"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"}; private RemoteViews buildUpdate(Context context) { RemoteViews updateView = null; Time time = new Time(); time.setToNow(); String month = months[time.month]; updateView = new RemoteViews(context.getPackageName(), R.layout.widget_layout_small); updateView.setTextViewText(R.id.Date, new Integer(time.monthDay).toString()); updateView.setTextViewText(R.id.Month, month); Intent launchIntent = new Intent(); launchIntent.setComponent(new ComponentName("com.android.calendar", "com.android.calendar.LaunchActivity")); launchIntent.setAction(Intent.ACTION_MAIN); launchIntent.addCategory(Intent.CATEGORY_LAUNCHER); launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); PendingIntent intent = PendingIntent.getActivity(context, 0, launchIntent, 0); updateView.setOnClickPendingIntent(R.id.SmallBase, intent); return updateView; } }