|
|
@ -32,6 +32,15 @@ import net.micode.notes.tool.ResourceParser;
|
|
|
|
import net.micode.notes.ui.NoteEditActivity;
|
|
|
|
import net.micode.notes.ui.NoteEditActivity;
|
|
|
|
import net.micode.notes.ui.NotesListActivity;
|
|
|
|
import net.micode.notes.ui.NotesListActivity;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @ProjectName: minode
|
|
|
|
|
|
|
|
* @Package: net.micode.notes.widget
|
|
|
|
|
|
|
|
* @ClassName: NoteWidgetProvider
|
|
|
|
|
|
|
|
* @Description: 该类继承了AppWidgetProvider,实现挂件添加、删除、更新、启用等功能
|
|
|
|
|
|
|
|
* @Author: 郑鲲鹏
|
|
|
|
|
|
|
|
* @Date: 2023-12-18 21:13
|
|
|
|
|
|
|
|
*/
|
|
|
|
public abstract class NoteWidgetProvider extends AppWidgetProvider {
|
|
|
|
public abstract class NoteWidgetProvider extends AppWidgetProvider {
|
|
|
|
public static final String [] PROJECTION = new String [] {
|
|
|
|
public static final String [] PROJECTION = new String [] {
|
|
|
|
NoteColumns.ID,
|
|
|
|
NoteColumns.ID,
|
|
|
@ -45,6 +54,13 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
|
|
|
|
|
|
|
|
|
|
|
|
private static final String TAG = "NoteWidgetProvider";
|
|
|
|
private static final String TAG = "NoteWidgetProvider";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method onDeleted
|
|
|
|
|
|
|
|
* @description 该方法用于删除Widget
|
|
|
|
|
|
|
|
* @date: 2023-12-18 21:18
|
|
|
|
|
|
|
|
* @author: 郑鲲鹏
|
|
|
|
|
|
|
|
* @return void
|
|
|
|
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onDeleted(Context context, int[] appWidgetIds) {
|
|
|
|
public void onDeleted(Context context, int[] appWidgetIds) {
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
@ -65,6 +81,13 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method update
|
|
|
|
|
|
|
|
* @description 该方法用于添加或更新Widget
|
|
|
|
|
|
|
|
* @date: 2023-12-18 21:11
|
|
|
|
|
|
|
|
* @author: 郑鲲鹏
|
|
|
|
|
|
|
|
* @return void
|
|
|
|
|
|
|
|
*/
|
|
|
|
protected void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
|
|
|
protected void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
|
|
|
update(context, appWidgetManager, appWidgetIds, false);
|
|
|
|
update(context, appWidgetManager, appWidgetIds, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|