From a38b175c8789e2e302a998ff9bfca07b183c0967 Mon Sep 17 00:00:00 2001 From: LZ <2929718516@qq.com> Date: Wed, 27 Nov 2024 12:07:11 +0800 Subject: [PATCH] =?UTF-8?q?NoteWidgetProvider=5F2x=E7=B1=BB=E6=98=AFNoteWi?= =?UTF-8?q?dgetProvider=E7=9A=84=E5=AD=90=E7=B1=BB=EF=BC=8C=E4=B8=93?= =?UTF-8?q?=E9=97=A8=E7=94=A8=E4=BA=8E=E5=A4=84=E7=90=862x=E5=B0=8F?= =?UTF-8?q?=E9=83=A8=E4=BB=B6=E7=9A=84=E6=9B=B4=E6=96=B0=E5=92=8C=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E3=80=82=E5=AE=83=E9=87=8D=E5=86=99=E4=BA=86=E7=88=B6?= =?UTF-8?q?=E7=B1=BB=E7=9A=84onUpdate=E3=80=81getLayoutId=E3=80=81getBgRes?= =?UTF-8?q?ourceId=E5=92=8CgetWidgetType=E6=96=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E6=8F=90=E4=BE=9B2x=E5=B0=8F=E9=83=A8=E4=BB=B6?= =?UTF-8?q?=E7=89=B9=E6=9C=89=E7=9A=84=E5=B8=83=E5=B1=80=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E3=80=81=E8=83=8C=E6=99=AF=E8=B5=84=E6=BA=90=E5=92=8C=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=82=E8=BF=99=E4=B8=AA=E7=B1=BB=E7=A1=AE=E4=BF=9D?= =?UTF-8?q?=E4=BA=86=E5=BD=93=E7=B3=BB=E7=BB=9F=E9=9C=80=E8=A6=81=E6=9B=B4?= =?UTF-8?q?=E6=96=B02x=E5=B0=8F=E9=83=A8=E4=BB=B6=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=83=BD=E5=A4=9F=E6=AD=A3=E7=A1=AE=E5=9C=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=92=8C=E6=A0=B7=E5=BC=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NoteWidgetProvider_2x.java | 64 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 NoteWidgetProvider_2x.java diff --git a/NoteWidgetProvider_2x.java b/NoteWidgetProvider_2x.java new file mode 100644 index 0000000..a6e3a67 --- /dev/null +++ b/NoteWidgetProvider_2x.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) + * 版权声明,表明该文件由MiCode开源社区拥有版权,时间为2010-2011年。 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 该文件在Apache License 2.0下授权,你只能在遵守该许可证的情况下使用此文件。 + * 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 net.micode.notes.widget; +// 声明该类属于net.micode.notes.widget包。 + +import android.appwidget.AppWidgetManager; +import android.content.Context; +// 导入Android小部件管理器和上下文相关的类。 + +import net.micode.notes.R; +import net.micode.notes.data.Notes; +import net.micode.notes.tool.ResourceParser; +// 导入项目的资源、数据和工具类。 + +public class NoteWidgetProvider_2x extends NoteWidgetProvider { + // 定义NoteWidgetProvider_2x类,继承自NoteWidgetProvider,用于提供2x小部件的具体实现。 + + @Override + public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { + // 当小部件需要更新时,系统会调用此方法。 + super.update(context, appWidgetManager, appWidgetIds); + // 调用父类的update方法,执行更新逻辑。 + } + + @Override + protected int getLayoutId() { + // 获取小部件的布局资源ID。 + return R.layout.widget_2x; + // 返回2x小部件的布局资源ID。 + } + + @Override + protected int getBgResourceId(int bgId) { + // 根据背景ID获取对应的资源ID。 + return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId); + // 使用ResourceParser工具类来获取2x小部件的背景资源ID。 + } + + @Override + protected int getWidgetType() { + // 获取小部件的类型。 + return Notes.TYPE_WIDGET_2X; + // 返回小部件的类型常量,用于区分不同的小部件。 + } +} \ No newline at end of file