From 8f4fa666232244f890c57bbf0e7bcaed0501b91d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E6=B6=A6=E6=B3=BD?= <3254719436@qq.com>
Date: Sun, 7 Jan 2024 23:35:19 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B3=A8=E9=87=8A=20Signed-o?=
=?UTF-8?q?ff-by:=20=E7=8E=8B=E6=B6=A6=E6=B3=BD=20<3254719436@qq.com>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Notes-master/.idea/misc.xml | 3 -
.../notes/gtask/remote/GTaskClient.java | 172 +++++++-
.../notes/gtask/remote/GTaskManager.java | 149 ++++++-
.../notes/gtask/remote/GTaskSyncService.java | 73 +++-
.../micode/notes/ui/AlarmAlertActivity.java | 393 +++++++++---------
.../micode/notes/ui/AlarmInitReceiver.java | 20 +-
.../net/micode/notes/ui/AlarmReceiver.java | 15 +
.../net/micode/notes/ui/DateTimePicker.java | 217 +++++++++-
.../micode/notes/ui/DateTimePickerDialog.java | 53 ++-
.../net/micode/notes/ui/DropdownMenu.java | 45 +-
.../micode/notes/ui/FoldersListAdapter.java | 76 +++-
.../notes/widget/NoteWidgetProvider.java | 49 ++-
.../notes/widget/NoteWidgetProvider_2x.java | 39 +-
.../notes/widget/NoteWidgetProvider_4x.java | 40 +-
14 files changed, 1062 insertions(+), 282 deletions(-)
delete mode 100644 Notes-master/.idea/misc.xml
diff --git a/Notes-master/.idea/misc.xml b/Notes-master/.idea/misc.xml
deleted file mode 100644
index c39d778..0000000
--- a/Notes-master/.idea/misc.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java b/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java
index c67dfdf..c78f981 100644
--- a/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java
+++ b/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java
@@ -59,7 +59,12 @@ import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
-
+ /**
+ * @classname: GTaskClient
+ * @description:实现GTASK的登录操作,进行GTASK任务的创建,创建任务列表
+ * @date: 2024/1/4 11:21
+ * @author: wangrunze
+ */
public class GTaskClient {
private static final String TAG = GTaskClient.class.getSimpleName();
@@ -101,17 +106,32 @@ public class GTaskClient {
mAccount = null;
mUpdateArray = null;
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: getInstance
+ * @description:获取的实例化对象
+ * @date: 2024/1/4 11:22
+ * @author: wangrunze
+ */
public static synchronized GTaskClient getInstance() {
if (mInstance == null) {
mInstance = new GTaskClient();
}
return mInstance;
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: login
+ * @description:用来实现登录操作的函数
+ * @date: 2024/1/4 11:22
+ * @author: wangrunze
+ * @param:Activity activity
+ * @return:true/false
+ */
public boolean login(Activity activity) {
// we suppose that the cookie would expire after 5 minutes
// then we need to re-login
+ //判断距离最后一次登录操作是否超过5分钟
final long interval = 1000 * 60 * 5;
if (mLastLoginTime + interval < System.currentTimeMillis()) {
mLoggedin = false;
@@ -126,6 +146,7 @@ public class GTaskClient {
if (mLoggedin) {
Log.d(TAG, "already logged in");
+ //如果没超过时间,则不需要重新登录
return true;
}
@@ -135,7 +156,7 @@ public class GTaskClient {
Log.e(TAG, "login google account failed");
return false;
}
-
+ //使用用户自己的域名登录
// login with custom domain if necessary
if (!(mAccount.name.toLowerCase().endsWith("gmail.com") || mAccount.name.toLowerCase()
.endsWith("googlemail.com"))) {
@@ -151,6 +172,7 @@ public class GTaskClient {
}
}
+ //如果用户账户无法登录,则使用谷歌官方的URI进行登录
// try to login with google official url
if (!mLoggedin) {
mGetUrl = GTASK_GET_URL;
@@ -163,7 +185,16 @@ public class GTaskClient {
mLoggedin = true;
return true;
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: loginGoogleAccount
+ * @description:使用令牌机制登录谷歌账户
+ * @date: 2024/1/4 11:24
+ * @author: wangrunze
+ * @param:Activity activity
+ * @param:boolean invalidateToken
+ * @return:账号的令牌
+ */
private String loginGoogleAccount(Activity activity, boolean invalidateToken) {
String authToken;
AccountManager accountManager = AccountManager.get(activity);
@@ -188,7 +219,7 @@ public class GTaskClient {
Log.e(TAG, "unable to get an account with the same name in the settings");
return null;
}
-
+ //获取选中账号的令牌
// get the token now
AccountManagerFuture accountManagerFuture = accountManager.getAuthToken(account,
"goanna_mobile", null, activity, null, null);
@@ -206,7 +237,16 @@ public class GTaskClient {
return authToken;
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: tryToLoginGtask
+ * @description:预先判断令牌是否是有效以及是否能登上GTask
+ * @date: 2024/1/4 11:25
+ * @author: wangrunze
+ * @param:Activity activity
+ * @param:String authToken
+ * @return:true/false
+ */
private boolean tryToLoginGtask(Activity activity, String authToken) {
if (!loginGtask(authToken)) {
// maybe the auth token is out of date, now let's invalidate the
@@ -224,7 +264,14 @@ public class GTaskClient {
}
return true;
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: loginGtask
+ * @description:登录GTask
+ * @date: 2024/1/4 11:26
+ * @author: wangrunze
+ * @param:String authToken
+ */
private boolean loginGtask(String authToken) {
int timeoutConnection = 10000;
int timeoutSocket = 15000;
@@ -238,11 +285,11 @@ public class GTaskClient {
// login gtask
try {
- String loginUrl = mGetUrl + "?auth=" + authToken;
- HttpGet httpGet = new HttpGet(loginUrl);
+ String loginUrl = mGetUrl + "?auth=" + authToken;//设置登录的url
+ HttpGet httpGet = new HttpGet(loginUrl);//通过登录的uri实例化网页上资源的查找
HttpResponse response = null;
response = mHttpClient.execute(httpGet);
-
+ //获取CookieStore里存放的cookie
// get the cookie now
List cookies = mHttpClient.getCookieStore().getCookies();
boolean hasAuthCookie = false;
@@ -254,7 +301,7 @@ public class GTaskClient {
if (!hasAuthCookie) {
Log.w(TAG, "it seems that there is no auth cookie");
}
-
+ //获取client的内容
// get the client version
String resString = getResponseContent(response.getEntity());
String jsBegin = "_setup(";
@@ -283,14 +330,29 @@ public class GTaskClient {
private int getActionId() {
return mActionId++;
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: createHttpPost
+ * @description:创建一个用于向网络传输数据的对象
+ * @date: 2024/1/4 11:28
+ * @author: wangrunze
+ * @return:httpPost实例化对象
+ */
private HttpPost createHttpPost() {
HttpPost httpPost = new HttpPost(mPostUrl);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setHeader("AT", "1");
return httpPost;
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: getResponseContent
+ * @description:获取响应后返回的数据
+ * @date: 2024/1/4 11:29
+ * @author: wangrunze
+ * @param:HttpEntity entity
+ * @return:获取到的资源
+ */
private String getResponseContent(HttpEntity entity) throws IOException {
String contentEncoding = null;
if (entity.getContentEncoding() != null) {
@@ -322,7 +384,15 @@ public class GTaskClient {
input.close();
}
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: postRequest
+ * @description: 通过JSON发送请求
+ * @date: 2024/1/4 11:30
+ * @author: wangrunze
+ * @param:JSONObject js
+ * @return:JSONObject
+ */
private JSONObject postRequest(JSONObject js) throws NetworkFailureException {
if (!mLoggedin) {
Log.e(TAG, "please login first");
@@ -359,7 +429,14 @@ public class GTaskClient {
throw new ActionFailureException("error occurs when posting request");
}
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: createTask
+ * @description:创建单个任务
+ * @date: 2024/1/4 11:31
+ * @author: wangrunze
+ * @param:Task task
+ */
public void createTask(Task task) throws NetworkFailureException {
commitUpdate();
try {
@@ -385,7 +462,14 @@ public class GTaskClient {
throw new ActionFailureException("create task: handing jsonobject failed");
}
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: createTaskList
+ * @description:创建一个任务列表
+ * @date: 2024/1/4 11:31
+ * @author: wangrunze
+ * @param:TaskList tasklist
+ */
public void createTaskList(TaskList tasklist) throws NetworkFailureException {
commitUpdate();
try {
@@ -411,7 +495,13 @@ public class GTaskClient {
throw new ActionFailureException("create tasklist: handing jsonobject failed");
}
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: commitUpdate
+ * @description:同步更新
+ * @date: 2024/1/4 11:32
+ * @author: wangrunze
+ */
public void commitUpdate() throws NetworkFailureException {
if (mUpdateArray != null) {
try {
@@ -432,7 +522,14 @@ public class GTaskClient {
}
}
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: addUpdateNode
+ * @description:添加更新的事项
+ * @date: 2024/1/4 11:32
+ * @author: wangrunze
+ * @param:Node node
+ */
public void addUpdateNode(Node node) throws NetworkFailureException {
if (node != null) {
// too many update items may result in an error
@@ -446,7 +543,16 @@ public class GTaskClient {
mUpdateArray.put(node.getUpdateAction(getActionId()));
}
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: moveTask
+ * @description:移动task
+ * @date: 2024/1/4 11:32
+ * @author: wangrunze
+ * @param:Task task
+ * @param:TaskList preParent
+ * @param:TaskList curParent
+ */
public void moveTask(Task task, TaskList preParent, TaskList curParent)
throws NetworkFailureException {
commitUpdate();
@@ -485,7 +591,14 @@ public class GTaskClient {
throw new ActionFailureException("move task: handing jsonobject failed");
}
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: deleteNode
+ * @description:删除操作节点
+ * @date: 2024/1/4 11:33
+ * @author: wangrunze
+ * @param:Node node
+ */
public void deleteNode(Node node) throws NetworkFailureException {
commitUpdate();
try {
@@ -508,7 +621,13 @@ public class GTaskClient {
throw new ActionFailureException("delete node: handing jsonobject failed");
}
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: getTaskLists
+ * @description:获取任务列表
+ * @date: 2024/1/4 11:34
+ * @author: wangrunze
+ */
public JSONArray getTaskLists() throws NetworkFailureException {
if (!mLoggedin) {
Log.e(TAG, "please login first");
@@ -546,7 +665,14 @@ public class GTaskClient {
throw new ActionFailureException("get task lists: handing jasonobject failed");
}
}
-
+ /**
+ * @classname: GTaskClient
+ * @methodname: getTaskList
+ * @description:从网络上获取相应数据
+ * @date: 2024/1/4 11:34
+ * @author: wangrunze
+ * @param:String listGid
+ */
public JSONArray getTaskList(String listGid) throws NetworkFailureException {
commitUpdate();
try {
diff --git a/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java b/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java
index d2b4082..96e3202 100644
--- a/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java
+++ b/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java
@@ -47,7 +47,12 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
-
+/**
+ * @classname: GTaskManager
+ * @description:gtask管理
+ * @date: 2024/1/4 11:36
+ * @author: wangrunze
+*/
public class GTaskManager {
private static final String TAG = GTaskManager.class.getSimpleName();
@@ -87,7 +92,7 @@ public class GTaskManager {
private HashMap mNidToGid;
- private GTaskManager() {
+ private GTaskManager() {//对象初始化函数
mSyncing = false;
mCancelled = false;
mGTaskListHashMap = new HashMap();
@@ -98,19 +103,41 @@ public class GTaskManager {
mGidToNid = new HashMap();
mNidToGid = new HashMap();
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: getInstance
+ * @description:初始化
+ * @date: 2024/1/4 11:37
+ * @author: wangrunze
+ */
public static synchronized GTaskManager getInstance() {
if (mInstance == null) {
mInstance = new GTaskManager();
}
return mInstance;
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: setActivityContext
+ * @description:运行在多线程的环境下
+ * @date: 2024/1/4 11:38
+ * @author: wangrunze
+ * @param:Activity activity
+
+ */
public synchronized void setActivityContext(Activity activity) {
// used for getting authtoken
mActivity = activity;
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: sync
+ * @description:实现本地同步操作和远端同步操作
+ * @date: 2024/1/4 11:38
+ * @author: wangrunze
+ * @param:Context context
+ * @param:GTaskASyncTask asyncTask
+ */
public int sync(Context context, GTaskASyncTask asyncTask) {
if (mSyncing) {
Log.d(TAG, "Sync is in progress");
@@ -128,14 +155,14 @@ public class GTaskManager {
mNidToGid.clear();
try {
- GTaskClient client = GTaskClient.getInstance();
+ GTaskClient client = GTaskClient.getInstance();//getInstance即为创建一个实例
client.resetUpdateArray();
// login google task
if (!mCancelled) {
if (!client.login(mActivity)) {
throw new NetworkFailureException("login google task failed");
- }
+ }//获取Google上的JSONtasklist转为本地TaskList
}
// get the task list from google
@@ -167,7 +194,13 @@ public class GTaskManager {
return mCancelled ? STATE_SYNC_CANCELLED : STATE_SUCCESS;
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: initGTaskList
+ * @description:初始化GtaskList
+ * @date: 2024/1/4 11:41
+ * @author: wangrunze
+ */
private void initGTaskList() throws NetworkFailureException {
if (mCancelled)
return;
@@ -246,7 +279,13 @@ public class GTaskManager {
throw new ActionFailureException("initGTaskList: handing JSONObject failed");
}
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: syncContent
+ * @description:本地内容同步操作
+ * @date: 2024/1/4 11:41
+ * @author: wangrunze
+ */
private void syncContent() throws NetworkFailureException {
int syncType;
Cursor c = null;
@@ -350,7 +389,13 @@ public class GTaskManager {
}
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: syncFolder
+ * @description:设置文件夹
+ * @date: 2024/1/4 11:42
+ * @author: wangrunze
+ */
private void syncFolder() throws NetworkFailureException {
Cursor c = null;
String gid;
@@ -475,7 +520,16 @@ public class GTaskManager {
if (!mCancelled)
GTaskClient.getInstance().commitUpdate();
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: doContentSync
+ * @description:syncType分类
+ * @date: 2024/1/4 11:43
+ * @author: wangrunze
+ * @param:int syncType
+ * @param:Node node
+ * @param: Cursor c
+ */
private void doContentSync(int syncType, Node node, Cursor c) throws NetworkFailureException {
if (mCancelled) {
return;
@@ -521,7 +575,14 @@ public class GTaskManager {
throw new ActionFailureException("unkown sync action type");
}
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: addLocalNode
+ * @description:本地增加Node
+ * @date: 2024/1/4 11:43
+ * @author: wangrunze
+ * @param:Node node
+ */
private void addLocalNode(Node node) throws NetworkFailureException {
if (mCancelled) {
return;
@@ -595,7 +656,15 @@ public class GTaskManager {
// update meta
updateRemoteMeta(node.getGid(), sqlNote);
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: updateLocalNode
+ * @description:更新本地node
+ * @date: 2024/1/4 11:44
+ * @author: wangrunze
+ * @param:Node node
+ * @param:Cursor cCursor c
+ */
private void updateLocalNode(Node node, Cursor c) throws NetworkFailureException {
if (mCancelled) {
return;
@@ -618,7 +687,15 @@ public class GTaskManager {
// update meta info
updateRemoteMeta(node.getGid(), sqlNote);
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: addRemoteNode
+ * @description:远程增加Node
+ * @date: 2024/1/4 11:44
+ * @author: wangrunze
+ * @param:Node node
+ * @param:Cursor c
+ */
private void addRemoteNode(Node node, Cursor c) throws NetworkFailureException {
if (mCancelled) {
return;
@@ -691,7 +768,15 @@ public class GTaskManager {
mGidToNid.put(n.getGid(), sqlNote.getId());
mNidToGid.put(sqlNote.getId(), n.getGid());
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: updateRemoteNode
+ * @description:更新远端的Node
+ * @date: 2024/1/4 11:45
+ * @author: wangrunze
+ * @param:Node node
+ * @param:Cursor c
+ */
private void updateRemoteNode(Node node, Cursor c) throws NetworkFailureException {
if (mCancelled) {
return;
@@ -729,7 +814,15 @@ public class GTaskManager {
sqlNote.resetLocalModified();
sqlNote.commit(true);
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: updateRemoteMeta
+ * @description:更新远程meta
+ * @date: 2024/1/4 11:45
+ * @author: wangrunze
+ * @param:String gid
+ * @param:SqlNote sqlNote
+ */
private void updateRemoteMeta(String gid, SqlNote sqlNote) throws NetworkFailureException {
if (sqlNote != null && sqlNote.isNoteType()) {
MetaData metaData = mMetaHashMap.get(gid);
@@ -745,7 +838,13 @@ public class GTaskManager {
}
}
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: refreshLocalSyncId
+ * @description:刷新本地
+ * @date: 2024/1/4 11:46
+ * @author: wangrunze
+ */
private void refreshLocalSyncId() throws NetworkFailureException {
if (mCancelled) {
return;
@@ -789,11 +888,23 @@ public class GTaskManager {
}
}
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: getSyncAccount
+ * @description:获取同步账号
+ * @date: 2024/1/4 11:47
+ * @author: wangrunze
+ */
public String getSyncAccount() {
return GTaskClient.getInstance().getSyncAccount().name;
}
-
+ /**
+ * @classname: GTaskManager
+ * @methodname: cancelSync
+ * @description:取消同步
+ * @date: 2024/1/4 11:48
+ * @author: wangrunze
+ */
public void cancelSync() {
mCancelled = true;
}
diff --git a/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java b/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java
index cca36f7..11e143a 100644
--- a/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java
+++ b/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java
@@ -22,7 +22,12 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
-
+/**
+ * @classname: GTaskSyncService
+ * @description:运行后台
+ * @date: 2024/1/4 11:50
+ * @author: wangrunze
+*/
public class GTaskSyncService extends Service {
public final static String ACTION_STRING_NAME = "sync_action_type";
@@ -41,7 +46,13 @@ public class GTaskSyncService extends Service {
private static GTaskASyncTask mSyncTask = null;
private static String mSyncProgress = "";
-
+ /**
+ * @classname: GTaskSyncService
+ * @methodname: startSync
+ * @description:启动一个同步的工作
+ * @date: 2024/1/4 11:52
+ * @author: wangrunze
+ */
private void startSync() {
if (mSyncTask == null) {
mSyncTask = new GTaskASyncTask(this, new GTaskASyncTask.OnCompleteListener() {
@@ -55,18 +66,36 @@ public class GTaskSyncService extends Service {
mSyncTask.execute();
}
}
-
+ /**
+ * @classname: GTaskSyncService
+ * @methodname: cancelSync
+ * @description:取消同步
+ * @date: 2024/1/4 11:53
+ * @author: wangrunze
+ */
private void cancelSync() {
if (mSyncTask != null) {
mSyncTask.cancelSync();
}
}
-
+ /**
+ * @classname: GTaskSyncService
+ * @methodname: onCreate
+ * @description:创建service
+ * @date: 2024/1/4 11:53
+ * @author: wangrunze
+ */
@Override
public void onCreate() {
mSyncTask = null;
}
-
+ /**
+ * @classname: GTaskSyncService
+ * @methodname: onStartCommand
+ * @description:对service进行操作
+ * @date: 2024/1/4 11:54
+ * @author: wangrunze
+ */
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Bundle bundle = intent.getExtras();
@@ -85,7 +114,13 @@ public class GTaskSyncService extends Service {
}
return super.onStartCommand(intent, flags, startId);
}
-
+ /**
+ * @classname: GTaskSyncService
+ * @methodname: onLowMemory
+ * @description:取消同步操作
+ * @date: 2024/1/4 11:54
+ * @author: wangrunze
+ */
@Override
public void onLowMemory() {
if (mSyncTask != null) {
@@ -96,7 +131,14 @@ public class GTaskSyncService extends Service {
public IBinder onBind(Intent intent) {
return null;
}
-
+ /**
+ * @classname: GTaskSyncService
+ * @methodname: sendBroadcast
+ * @description:发送广播
+ * @date: 2024/1/4 11:55
+ * @author: wangrunze
+ * @param:String msg
+ */
public void sendBroadcast(String msg) {
mSyncProgress = msg;
Intent intent = new Intent(GTASK_SERVICE_BROADCAST_NAME);
@@ -105,13 +147,28 @@ public class GTaskSyncService extends Service {
sendBroadcast(intent);
}
+ /**
+ * @classname: GTaskSyncService
+ * @methodname: startSync
+ * @description:开始执行一个service
+ * @date: 2024/1/4 11:56
+ * @author: wangrunze
+ * @param:Activity activity
+ */
public static void startSync(Activity activity) {
GTaskManager.getInstance().setActivityContext(activity);
Intent intent = new Intent(activity, GTaskSyncService.class);
intent.putExtra(GTaskSyncService.ACTION_STRING_NAME, GTaskSyncService.ACTION_START_SYNC);
activity.startService(intent);
}
-
+ /**
+ * @classname: GTaskSyncService
+ * @methodname: cancelSync
+ * @description:取消执行一个service
+ * @date: 2024/1/4 11:56
+ * @author: wangrunze
+ * @param:Context context
+ */
public static void cancelSync(Context context) {
Intent intent = new Intent(context, GTaskSyncService.class);
intent.putExtra(GTaskSyncService.ACTION_STRING_NAME, GTaskSyncService.ACTION_CANCEL_SYNC);
diff --git a/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java b/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java
index 7370d57..1587955 100644
--- a/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java
+++ b/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java
@@ -14,200 +14,199 @@
* limitations under the License.
*/
- package net.micode.notes.ui;
-
- import android.app.Activity;
- import android.app.AlertDialog;
- import android.content.Context;
- import android.content.DialogInterface;
- import android.content.DialogInterface.OnClickListener;
- import android.content.DialogInterface.OnDismissListener;
- import android.content.Intent;
- import android.media.AudioManager;
- import android.media.MediaPlayer;
- import android.media.RingtoneManager;
- import android.net.Uri;
- import android.os.Bundle;
- import android.os.PowerManager;
- import android.provider.Settings;
- import android.view.Window;
- import android.view.WindowManager;
-
- import net.micode.notes.R;
- import net.micode.notes.data.Notes;
- import net.micode.notes.tool.DataUtils;
-
- import java.io.IOException;
-
- /**
- * @classname: AlarmAlertActivity
- * @description:设置闹钟提示
- * @date: 2023/12/28 11:18
- * @author: wangrunze
- */
- public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener {
- private long mNoteId;//文本在数据库存储中的ID号
- private String mSnippet;//闹钟提示时出现的文本片段
- private static final int SNIPPET_PREW_MAX_LEN = 60;
- MediaPlayer mPlayer;
- //Bundle类型的数据与Map类型的数据相似,都是以key-value的形式存储数据的
- //onsaveInstanceState方法是用来保存Activity的状态的,能从onCreate的参数savedInsanceState中获得状态数据
-
- /**
- * @classname: AlarmAlertActivity
- * @methodname onCreate
- * @description:创建界面并进行初始化操作
- * @date: 2023/12/28 11:27
- * @author: wangrunze
- * @param: Bundle savedInstanceState
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- requestWindowFeature(Window.FEATURE_NO_TITLE);//界面显示——无标题
-
- final Window win = getWindow();
- win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
-
- if (!isScreenOn()) {
- win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON//保持窗体点亮
- | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON//将窗体点亮
- | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON//允许窗体点亮时锁屏
- | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);//在手机锁屏后如果到了闹钟提示时间,点亮屏幕
- }
-
- Intent intent = getIntent();
-
- try {
- mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1));
- mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId);//根据ID从数据库中获取标签的内容
- mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0,
- SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info)//判断标签片段是否达到符合长度
- : mSnippet;
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- return;
- }
-
- mPlayer = new MediaPlayer();
- if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
- showActionDialog();//弹出对话框
- playAlarmSound();//闹钟提示音激发
- } else {
- finish();
- }
- }
-
- /**
- * @classname: AlarmAlertActivity
- * @methodname isScreenOn
- * @description:判断屏幕是否锁屏,调用系统函数判断,最后返回值是布尔类型
- * @date: 2023/12/28 11:28
- * @author: wangrunze
- * @return: pm.isScreenOn()
- */
- private boolean isScreenOn() {
- PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- return pm.isScreenOn();
- }
-
- /**
- * @classname: AlarmAlertActivity
- * @methodname playAlarmSound
- * @description:闹钟提示音启动激发
- * @date: 2023/12/28 11:29
- * @author: wangrunze
- */
-
- private void playAlarmSound() {
- Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM);
-
- int silentModeStreams = Settings.System.getInt(getContentResolver(),
- Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); //调用系统的铃声管理URI,得到闹钟提示音
-
- if ((silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0) {
- mPlayer.setAudioStreamType(silentModeStreams);
- } else {
- mPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
- }
- try {
- mPlayer.setDataSource(this, url);//无返回值,设置多媒体数据来源
- mPlayer.prepare();//准备同步
- mPlayer.setLooping(true);//设置是否循环播放
- mPlayer.start();//开始播放
- } catch (IllegalArgumentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();//抛出异常, 还将显示出更深的调用信息
- } catch (SecurityException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalStateException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- /**
- * @classname: AlarmAlertActivity
- * @methodname showActionDialog
- * @description:新建对话框
- * @date: 2023/12/28 11:30
- * @author: wangrunze
- */
-
- private void showActionDialog() {
- AlertDialog.Builder dialog = new AlertDialog.Builder(this);//用到AlertDialog.Builder中的create()新建了一个AlertDialog
- dialog.setTitle(R.string.app_name);//为对话框设置标题
- dialog.setMessage(mSnippet);//为对话框设置内容
- dialog.setPositiveButton(R.string.notealert_ok, this);//给对话框添加"Yes"按钮
- if (isScreenOn()) {
- dialog.setNegativeButton(R.string.notealert_enter, this);//给对话框添加"no"按钮
- }
- dialog.show().setOnDismissListener(this);
- }
-
- //DialogInterface dialog为对话框,which为选择按钮,功能为选择各种操作
- public void onClick(DialogInterface dialog, int which) {
- switch (which) {
- case DialogInterface.BUTTON_NEGATIVE://这是取消操作
- Intent intent = new Intent(this, NoteEditActivity.class);//实现两个类间的数据传输
- intent.setAction(Intent.ACTION_VIEW);//设置动作属性
- intent.putExtra(Intent.EXTRA_UID, mNoteId);
- startActivity(intent);
- break;
- default:
- break;
- }
- }
-
- /**
- * @classname: AlarmAlertActivity
- * @methodname onDismiss
- * @description:停止闹钟声音
- * @date: 2023/12/28 11:30
- * @author: wangrunze
- * @param:DialogInterface dialog
- */
- public void onDismiss(DialogInterface dialog) {
- stopAlarmSound();
- finish();
- }
- /**
- * @classname: AlarmAlertActivity
- * @methodname: stopAlarmSound
- * @description:
- * @date: 2023/12/28 11:31
- * @author: wangrunze
- */
- private void stopAlarmSound() {
- if (mPlayer != null) {
- mPlayer.stop();
- mPlayer.release();
- mPlayer = null;
- }
- }
- }
-
\ No newline at end of file
+package net.micode.notes.ui;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
+import android.content.DialogInterface.OnDismissListener;
+import android.content.Intent;
+import android.media.AudioManager;
+import android.media.MediaPlayer;
+import android.media.RingtoneManager;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.PowerManager;
+import android.provider.Settings;
+import android.view.Window;
+import android.view.WindowManager;
+
+import net.micode.notes.R;
+import net.micode.notes.data.Notes;
+import net.micode.notes.tool.DataUtils;
+
+import java.io.IOException;
+
+/**
+ * @classname: AlarmAlertActivity
+ * @description:设置闹钟提示
+ * @date: 2023/12/28 11:18
+ * @author: wangrunze
+*/
+public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener {
+ private long mNoteId;//文本在数据库存储中的ID号
+ private String mSnippet;//闹钟提示时出现的文本片段
+ private static final int SNIPPET_PREW_MAX_LEN = 60;
+ MediaPlayer mPlayer;
+ //Bundle类型的数据与Map类型的数据相似,都是以key-value的形式存储数据的
+ //onsaveInstanceState方法是用来保存Activity的状态的,能从onCreate的参数savedInsanceState中获得状态数据
+
+ /**
+ * @classname: AlarmAlertActivity
+ * @methodname onCreate
+ * @description:创建界面并进行初始化操作
+ * @date: 2023/12/28 11:27
+ * @author: wangrunze
+ * @param: Bundle savedInstanceState
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requestWindowFeature(Window.FEATURE_NO_TITLE);//界面显示——无标题
+
+ final Window win = getWindow();
+ win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
+
+ if (!isScreenOn()) {
+ win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON//保持窗体点亮
+ | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON//将窗体点亮
+ | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON//允许窗体点亮时锁屏
+ | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);//在手机锁屏后如果到了闹钟提示时间,点亮屏幕
+ }
+
+ Intent intent = getIntent();
+
+ try {
+ mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1));
+ mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId);//根据ID从数据库中获取标签的内容
+ mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0,
+ SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info)//判断标签片段是否达到符合长度
+ : mSnippet;
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ return;
+ }
+
+ mPlayer = new MediaPlayer();
+ if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
+ showActionDialog();//弹出对话框
+ playAlarmSound();//闹钟提示音激发
+ } else {
+ finish();
+ }
+ }
+
+ /**
+ * @classname: AlarmAlertActivity
+ * @methodname isScreenOn
+ * @description:判断屏幕是否锁屏,调用系统函数判断,最后返回值是布尔类型
+ * @date: 2023/12/28 11:28
+ * @author: wangrunze
+ * @return: pm.isScreenOn()
+ */
+ private boolean isScreenOn() {
+ PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
+ return pm.isScreenOn();
+ }
+
+ /**
+ * @classname: AlarmAlertActivity
+ * @methodname playAlarmSound
+ * @description:闹钟提示音启动激发
+ * @date: 2023/12/28 11:29
+ * @author: wangrunze
+ */
+
+ private void playAlarmSound() {
+ Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM);
+
+ int silentModeStreams = Settings.System.getInt(getContentResolver(),
+ Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); //调用系统的铃声管理URI,得到闹钟提示音
+
+ if ((silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0) {
+ mPlayer.setAudioStreamType(silentModeStreams);
+ } else {
+ mPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
+ }
+ try {
+ mPlayer.setDataSource(this, url);//无返回值,设置多媒体数据来源
+ mPlayer.prepare();//准备同步
+ mPlayer.setLooping(true);//设置是否循环播放
+ mPlayer.start();//开始播放
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();//抛出异常, 还将显示出更深的调用信息
+ } catch (SecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalStateException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @classname: AlarmAlertActivity
+ * @methodname showActionDialog
+ * @description:新建对话框
+ * @date: 2023/12/28 11:30
+ * @author: wangrunze
+ */
+
+ private void showActionDialog() {
+ AlertDialog.Builder dialog = new AlertDialog.Builder(this);//用到AlertDialog.Builder中的create()新建了一个AlertDialog
+ dialog.setTitle(R.string.app_name);//为对话框设置标题
+ dialog.setMessage(mSnippet);//为对话框设置内容
+ dialog.setPositiveButton(R.string.notealert_ok, this);//给对话框添加"Yes"按钮
+ if (isScreenOn()) {
+ dialog.setNegativeButton(R.string.notealert_enter, this);//给对话框添加"no"按钮
+ }
+ dialog.show().setOnDismissListener(this);
+ }
+
+ //DialogInterface dialog为对话框,which为选择按钮,功能为选择各种操作
+ public void onClick(DialogInterface dialog, int which) {
+ switch (which) {
+ case DialogInterface.BUTTON_NEGATIVE://这是取消操作
+ Intent intent = new Intent(this, NoteEditActivity.class);//实现两个类间的数据传输
+ intent.setAction(Intent.ACTION_VIEW);//设置动作属性
+ intent.putExtra(Intent.EXTRA_UID, mNoteId);
+ startActivity(intent);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @classname: AlarmAlertActivity
+ * @methodname onDismiss
+ * @description:启动停止闹钟声音
+ * @date: 2023/12/28 11:30
+ * @author: wangrunze
+ * @param:DialogInterface dialog
+ */
+ public void onDismiss(DialogInterface dialog) {
+ stopAlarmSound();
+ finish();
+ }
+ /**
+ * @classname: AlarmAlertActivity
+ * @methodname: stopAlarmSound
+ * @description:停止闹钟声音
+ * @date: 2023/12/28 11:31
+ * @author: wangrunze
+ */
+ private void stopAlarmSound() {
+ if (mPlayer != null) {
+ mPlayer.stop();
+ mPlayer.release();
+ mPlayer = null;
+ }
+ }
+}
diff --git a/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java b/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java
index f221202..0b59510 100644
--- a/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java
+++ b/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java
@@ -27,20 +27,34 @@ import android.database.Cursor;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
-
+/**
+ * @classname: AlarmInitReceiver
+ * @description:根据数据库里的闹钟时间创建一个闹钟机制
+ * @date: 2023/12/29 11:17
+ * @author: wangrunze
+*/
public class AlarmInitReceiver extends BroadcastReceiver {
private static final String [] PROJECTION = new String [] {
NoteColumns.ID,
NoteColumns.ALERTED_DATE
};
-
+ //对数据库的操作,调用标签ID和闹钟时间
private static final int COLUMN_ID = 0;
private static final int COLUMN_ALERTED_DATE = 1;
+ /**
+ * @classname: AlarmInitReceiver
+ * @methodname: onReceive
+ * @description:通过查找数据库中的标签内容,找到和当前系统时间相等的标签
+ * @date: 2023/12/29 11:23
+ * @author: wangrunze
+ * @param:Context context
+ * @param:Intent intent
+ */
@Override
public void onReceive(Context context, Intent intent) {
- long currentDate = System.currentTimeMillis();
+ long currentDate = System.currentTimeMillis();//System.currentTimeMillis()产生一个当前的毫秒,这个毫秒其实就是自1970年1月1日0时起的毫秒数
Cursor c = context.getContentResolver().query(Notes.CONTENT_NOTE_URI,
PROJECTION,
NoteColumns.ALERTED_DATE + ">? AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE,
diff --git a/src/main/java/net/micode/notes/ui/AlarmReceiver.java b/src/main/java/net/micode/notes/ui/AlarmReceiver.java
index 54e503b..a2a56bc 100644
--- a/src/main/java/net/micode/notes/ui/AlarmReceiver.java
+++ b/src/main/java/net/micode/notes/ui/AlarmReceiver.java
@@ -19,8 +19,23 @@ package net.micode.notes.ui;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+/**
+ * @classname: AlarmReceiver
+ * @description:实现alarm闹钟功能
+ * @date: 2023/12/29 11:28
+ * @author: wangrunze
+*/
public class AlarmReceiver extends BroadcastReceiver {
+ /**
+ * @classname: AlarmReceiver
+ * @methodname: onReceive
+ * @description:启动AlarmAlertActivity
+ * @date: 2023/12/29 11:29
+ * @author: wangrunze
+ * @param:Context context
+ * @param:Intent intent
+ */
@Override
public void onReceive(Context context, Intent intent) {
intent.setClass(context, AlarmAlertActivity.class);
diff --git a/src/main/java/net/micode/notes/ui/DateTimePicker.java b/src/main/java/net/micode/notes/ui/DateTimePicker.java
index 496b0cd..e2421a9 100644
--- a/src/main/java/net/micode/notes/ui/DateTimePicker.java
+++ b/src/main/java/net/micode/notes/ui/DateTimePicker.java
@@ -28,6 +28,12 @@ import android.view.View;
import android.widget.FrameLayout;
import android.widget.NumberPicker;
+/**
+ * @classname: DateTimePicker
+ * @description:时间同步
+ * @date: 2023/12/29 11:40
+ * @author: wangrunze
+*/
public class DateTimePicker extends FrameLayout {
private static final boolean DEFAULT_ENABLE_STATE = true;
@@ -65,6 +71,16 @@ public class DateTimePicker extends FrameLayout {
private OnDateTimeChangedListener mOnDateTimeChangedListener;
private NumberPicker.OnValueChangeListener mOnDateChangedListener = new NumberPicker.OnValueChangeListener() {
+ /**
+ * @classname: DateTimePicker
+ * @methodname: onValueChange
+ * @description:对日期的监听
+ * @date: 2023/12/29 11:41
+ * @author: wangrunze
+ * @param:NumberPicker picker
+ * @param:int oldVal
+ * @param: int newVal
+ */
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
mDate.add(Calendar.DAY_OF_YEAR, newVal - oldVal);
@@ -74,6 +90,16 @@ public class DateTimePicker extends FrameLayout {
};
private NumberPicker.OnValueChangeListener mOnHourChangedListener = new NumberPicker.OnValueChangeListener() {
+ /**
+ * @classname: DateTimePicker
+ * @methodname: onValueChange
+ * @description:对小时(Hour)的监听
+ * @date: 2023/12/29 11:42
+ * @author: wangrunze
+ * @param:NumberPicker picker
+ * @param:int oldVal
+ * @param:int newVal
+ */
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
boolean isDateChanged = false;
@@ -116,6 +142,16 @@ public class DateTimePicker extends FrameLayout {
};
private NumberPicker.OnValueChangeListener mOnMinuteChangedListener = new NumberPicker.OnValueChangeListener() {
+ /**
+ * @classname: DateTimePicker
+ * @methodname: onValueChange
+ * @description:对分钟的监听
+ * @date: 2023/12/29 11:43
+ * @author: wangrunze
+ * @param:NumberPicker picker
+ * @param:int oldVal
+ * @param:int newVal
+ */
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
int minValue = mMinuteSpinner.getMinValue();
@@ -146,6 +182,16 @@ public class DateTimePicker extends FrameLayout {
private NumberPicker.OnValueChangeListener mOnAmPmChangedListener = new NumberPicker.OnValueChangeListener() {
@Override
+ /**
+ * @classname: DateTimePicker
+ * @methodname: onValueChange
+ * @description: 对AM和PM的监听
+ * @date: 2023/12/29 11:43
+ * @author: wangrunze
+ * @param:NumberPicker picker
+ * @param:int oldVal
+ * @param: int newVal
+ */
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
mIsAm = !mIsAm;
if (mIsAm) {
@@ -157,12 +203,20 @@ public class DateTimePicker extends FrameLayout {
onDateTimeChanged();
}
};
-
+
public interface OnDateTimeChangedListener {
void onDateTimeChanged(DateTimePicker view, int year, int month,
int dayOfMonth, int hourOfDay, int minute);
}
+ /**
+ * @classname: DateTimePicker
+ * @methodname: DateTimePicker
+ * @description:获取当前的系统时间
+ * @date: 2023/12/29 11:45
+ * @author: wangrunze
+ * @param:Context context
+ */
public DateTimePicker(Context context) {
this(context, System.currentTimeMillis());
}
@@ -171,6 +225,16 @@ public class DateTimePicker extends FrameLayout {
this(context, date, DateFormat.is24HourFormat(context));
}
+ /**
+ * @classname: DateTimePicker
+ * @methodname: DateTimePicker
+ * @description:获取系统时间
+ * @date: 2023/12/29 11:47
+ * @author: wangrunze
+ * @param:Context context
+ * @param:long date
+ * @param:boolean is24HourView
+ */
public DateTimePicker(Context context, long date, boolean is24HourView) {
super(context);
mDate = Calendar.getInstance();
@@ -214,6 +278,14 @@ public class DateTimePicker extends FrameLayout {
mInitialising = false;
}
+ /**
+ * @classname: DateTimePicker
+ * @methodname: setEnabled
+ * @description:对时间的启动
+ * @date: 2023/12/29 11:49
+ * @author: wangrunze
+ * @param:boolean enabled
+ */
@Override
public void setEnabled(boolean enabled) {
if (mIsEnabled == enabled) {
@@ -246,6 +318,14 @@ public class DateTimePicker extends FrameLayout {
*
* @param date The current date in millis
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: setCurrentDate
+ * @description:获取当前时间
+ * @date: 2023/12/29 11:51
+ * @author: wangrunze
+ * @param:long date
+ */
public void setCurrentDate(long date) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(date);
@@ -262,6 +342,14 @@ public class DateTimePicker extends FrameLayout {
* @param hourOfDay The current hourOfDay
* @param minute The current minute
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: setCurrentDate
+ * @description:获取当前时间
+ * @date: 2023/12/29 11:51
+ * @author: wangrunze
+ * @param:long date
+ */
public void setCurrentDate(int year, int month,
int dayOfMonth, int hourOfDay, int minute) {
setCurrentYear(year);
@@ -285,6 +373,14 @@ public class DateTimePicker extends FrameLayout {
*
* @param year The current year
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: setCurrentYear
+ * @description:Set current year
+ * @date: 2024/1/7 9:53
+ * @author: wangrunze
+ * @param:year
+ */
public void setCurrentYear(int year) {
if (!mInitialising && year == getCurrentYear()) {
return;
@@ -293,12 +389,19 @@ public class DateTimePicker extends FrameLayout {
updateDateControl();
onDateTimeChanged();
}
-
/**
* Get current month in the year
*
* @return The current month in the year
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: getCurrentMonth
+ * @description:Get current month in the year
+ * @date: 2024/1/7 9:54
+ * @author: wangrunze
+ * @return:current month
+ */
public int getCurrentMonth() {
return mDate.get(Calendar.MONTH);
}
@@ -308,6 +411,14 @@ public class DateTimePicker extends FrameLayout {
*
* @param month The month in the year
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: setCurrentMonth
+ * @description:Set current month in the year
+ * @date: 2024/1/7 9:56
+ * @author: wangrunze
+ * @param:current month
+ */
public void setCurrentMonth(int month) {
if (!mInitialising && month == getCurrentMonth()) {
return;
@@ -322,6 +433,14 @@ public class DateTimePicker extends FrameLayout {
*
* @return The day of the month
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: getCurrentDay
+ * @description:Get current day of the month
+ * @date: 2024/1/7 9:57
+ * @author: wangrunze
+ * @return:current day
+ */
public int getCurrentDay() {
return mDate.get(Calendar.DAY_OF_MONTH);
}
@@ -331,6 +450,14 @@ public class DateTimePicker extends FrameLayout {
*
* @param dayOfMonth The day of the month
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: setCurrentDay
+ * @description:Set current day of the month
+ * @date: 2024/1/7 9:57
+ * @author: wangrunze
+ * @param:The day of the month
+ */
public void setCurrentDay(int dayOfMonth) {
if (!mInitialising && dayOfMonth == getCurrentDay()) {
return;
@@ -344,10 +471,26 @@ public class DateTimePicker extends FrameLayout {
* Get current hour in 24 hour mode, in the range (0~23)
* @return The current hour in 24 hour mode
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: getCurrentHourOfDay
+ * @description:Get current hour in 24 hour mode
+ * @date: 2024/1/7 9:58
+ * @author: wangrunze
+ * @return:The current hour in 24 hour mode
+ */
+
public int getCurrentHourOfDay() {
return mDate.get(Calendar.HOUR_OF_DAY);
}
-
+ /**
+ * @classname: DateTimePicker
+ * @methodname: getCurrentHour
+ * @description:Get current hour
+ * @date: 2024/1/7 9:58
+ * @author: wangrunze
+ * @return:The current hour
+ */
private int getCurrentHour() {
if (mIs24HourView){
return getCurrentHourOfDay();
@@ -366,6 +509,14 @@ public class DateTimePicker extends FrameLayout {
*
* @param hourOfDay
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: setCurrentHour
+ * @description:Set current hour in 24 hour mode
+ * @date: 2024/1/7 9:59
+ * @author: wangrunze
+ * @param:hourOfDay
+ */
public void setCurrentHour(int hourOfDay) {
if (!mInitialising && hourOfDay == getCurrentHourOfDay()) {
return;
@@ -394,6 +545,14 @@ public class DateTimePicker extends FrameLayout {
*
* @return The Current Minute
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: getCurrentMinute
+ * @description: Get currentMinute
+ * @date: 2024/1/7 9:59
+ * @author: wangrunze
+ * @return:The Current Minute
+ */
public int getCurrentMinute() {
return mDate.get(Calendar.MINUTE);
}
@@ -401,6 +560,14 @@ public class DateTimePicker extends FrameLayout {
/**
* Set current minute
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: setCurrentMinute
+ * @description:Set current minute
+ * @date: 2024/1/7 9:59
+ * @author: wangrunze
+ * @param:int minute
+ */
public void setCurrentMinute(int minute) {
if (!mInitialising && minute == getCurrentMinute()) {
return;
@@ -413,6 +580,14 @@ public class DateTimePicker extends FrameLayout {
/**
* @return true if this is in 24 hour view else false.
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: is24HourView
+ * @description:判断是否是24Hour视图
+ * @date: 2024/1/7 10:00
+ * @author: wangrunze
+ * @return:true if this is in 24 hour view else false.
+ */
public boolean is24HourView () {
return mIs24HourView;
}
@@ -422,6 +597,14 @@ public class DateTimePicker extends FrameLayout {
*
* @param is24HourView True for 24 hour mode. False for AM/PM mode.
*/
+ /**
+ * @classname: DateTimePicker
+ * @methodname: set24HourView
+ * @description:Set whether in 24 hour or AM/PM mode
+ * @date: 2024/1/7 10:01
+ * @author: wangrunze
+ * @param:is24HourView True for 24 hour mode
+ */
public void set24HourView(boolean is24HourView) {
if (mIs24HourView == is24HourView) {
return;
@@ -434,6 +617,13 @@ public class DateTimePicker extends FrameLayout {
updateAmPmControl();
}
+ /**
+ * @classname: DateTimePicker
+ * @methodname: updateDateControl
+ * @description:更新时间管理
+ * @date: 2023/12/29 11:53
+ * @author: wangrunze
+ */
private void updateDateControl() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(mDate.getTimeInMillis());
@@ -448,6 +638,13 @@ public class DateTimePicker extends FrameLayout {
mDateSpinner.invalidate();
}
+ /**
+ * @classname: DateTimePicker
+ * @methodname: updateDateControl
+ * @description:更新ampm管理
+ * @date: 2023/12/29 11:53
+ * @author: wangrunze
+ */
private void updateAmPmControl() {
if (mIs24HourView) {
mAmPmSpinner.setVisibility(View.GONE);
@@ -458,6 +655,13 @@ public class DateTimePicker extends FrameLayout {
}
}
+ /**
+ * @classname: DateTimePicker
+ * @methodname: updateDateControl
+ * @description:更新小时管理
+ * @date: 2023/12/29 11:53
+ * @author: wangrunze
+ */
private void updateHourControl() {
if (mIs24HourView) {
mHourSpinner.setMinValue(HOUR_SPINNER_MIN_VAL_24_HOUR_VIEW);
@@ -476,6 +680,13 @@ public class DateTimePicker extends FrameLayout {
mOnDateTimeChangedListener = callback;
}
+ /**
+ * @classname: DateTimePicker
+ * @methodname: onDateTimeChanged
+ * @description:获取当前时间
+ * @date: 2023/12/29 11:54
+ * @author: wangrunze
+ */
private void onDateTimeChanged() {
if (mOnDateTimeChangedListener != null) {
mOnDateTimeChangedListener.onDateTimeChanged(this, getCurrentYear(),
diff --git a/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java b/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java
index 2c47ba4..295baac 100644
--- a/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java
+++ b/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java
@@ -29,17 +29,31 @@ import android.content.DialogInterface.OnClickListener;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
+/**
+ * @classname: DateTimePickerDialog
+ * @description:时间设置
+ * @date: 2024/1/4 10:19
+ * @author: wangrunze
+*/
public class DateTimePickerDialog extends AlertDialog implements OnClickListener {
private Calendar mDate = Calendar.getInstance();
private boolean mIs24HourView;
private OnDateTimeSetListener mOnDateTimeSetListener;
- private DateTimePicker mDateTimePicker;
+ private DateTimePicker mDateTimePicker;//DateTimePicker控件,控件一般用于让用户可以从日期列表中选择单个值。
public interface OnDateTimeSetListener {
void OnDateTimeSet(AlertDialog dialog, long date);
}
-
+ /**
+ * @classname: DateTimePickerDialog
+ * @methodname: DateTimePickerDialog
+ * @description:实现界面对话框
+ * @date: 2024/1/4 10:26
+ * @author: wangrunze
+ * @param:Context context
+ * @param:long date
+ */
public DateTimePickerDialog(Context context, long date) {
super(context);
mDateTimePicker = new DateTimePicker(context);
@@ -64,14 +78,35 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
updateTitle(mDate.getTimeInMillis());
}
+ /**
+ * @classname: DateTimePickerDialog
+ * @methodname: set24HourView
+ * @description:设置24小时
+ * @date: 2024/1/4 10:34
+ * @author: wangrunze
+ */
public void set24HourView(boolean is24HourView) {
mIs24HourView = is24HourView;
}
-
+ /**
+ * @classname: DateTimePickerDialog
+ * @methodname: setOnDateTimeSetListener
+ * @description:实现时间日期滚动选择按钮监听
+ * @date: 2024/1/4 10:43
+ * @author: wangrunze
+ * @param:OnDateTimeSetListener callBack
+ */
public void setOnDateTimeSetListener(OnDateTimeSetListener callBack) {
mOnDateTimeSetListener = callBack;
}
-
+ /**
+ * @classname: DateTimePickerDialog
+ * @methodname: updateTitle
+ * @description:更新标题
+ * @date: 2024/1/4 10:55
+ * @author: wangrunze
+ * @param:long date
+ */
private void updateTitle(long date) {
int flag =
DateUtils.FORMAT_SHOW_YEAR |
@@ -80,7 +115,15 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR;
setTitle(DateUtils.formatDateTime(this.getContext(), date, flag));
}
-
+ /**
+ * @classname: DateTimePickerDialog
+ * @methodname: onClick
+ * @description:设置按钮
+ * @date: 2024/1/4 10:58
+ * @author: wangrunze
+ * @param:DialogInterface arg0
+ * @param:int arg1
+ */
public void onClick(DialogInterface arg0, int arg1) {
if (mOnDateTimeSetListener != null) {
mOnDateTimeSetListener.OnDateTimeSet(this, mDate.getTimeInMillis());
diff --git a/src/main/java/net/micode/notes/ui/DropdownMenu.java b/src/main/java/net/micode/notes/ui/DropdownMenu.java
index 613dc74..15ba7bb 100644
--- a/src/main/java/net/micode/notes/ui/DropdownMenu.java
+++ b/src/main/java/net/micode/notes/ui/DropdownMenu.java
@@ -26,12 +26,26 @@ import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
import net.micode.notes.R;
-
+/**
+ * @classname: DropdownMenu
+ * @description:下拉菜单
+ * @date: 2024/1/4 11:00
+ * @author: wangrunze
+*/
public class DropdownMenu {
private Button mButton;
private PopupMenu mPopupMenu;
private Menu mMenu;
-
+ /**
+ * @classname: DropdownMenu
+ * @methodname: DropdownMenu
+ * @description:创建下拉菜单
+ * @date: 2024/1/4 11:02
+ * @author: wangrunze
+ * @param:Context context
+ * @param:Button button
+ * @param:int menuId
+ */
public DropdownMenu(Context context, Button button, int menuId) {
mButton = button;
mButton.setBackgroundResource(R.drawable.dropdown_icon);
@@ -44,17 +58,38 @@ public class DropdownMenu {
}
});
}
-
+ /**
+ * @classname: DropdownMenu
+ * @methodname: setOnDropdownMenuItemClickListener
+ * @description:实现下拉菜单按钮监听
+ * @date: 2024/1/4 11:03
+ * @author: wangrunze
+ * @param:OnMenuItemClickListener listener
+ */
public void setOnDropdownMenuItemClickListener(OnMenuItemClickListener listener) {
if (mPopupMenu != null) {
mPopupMenu.setOnMenuItemClickListener(listener);
}
}
-
+ /**
+ * @classname: DropdownMenu
+ * @methodname: findItem
+ * @description:菜单初始化,显示菜单的选项
+ * @date: 2024/1/4 11:04
+ * @author: wangrunze
+ * @param:int id
+ */
public MenuItem findItem(int id) {
return mMenu.findItem(id);
}
-
+ /**
+ * @classname: DropdownMenu
+ * @methodname: setTitle
+ * @description:设置标题
+ * @date: 2024/1/4 11:05
+ * @author: wangrunze
+ * @param:CharSequence title
+ */
public void setTitle(CharSequence title) {
mButton.setText(title);
}
diff --git a/src/main/java/net/micode/notes/ui/FoldersListAdapter.java b/src/main/java/net/micode/notes/ui/FoldersListAdapter.java
index 96b77da..2debb05 100644
--- a/src/main/java/net/micode/notes/ui/FoldersListAdapter.java
+++ b/src/main/java/net/micode/notes/ui/FoldersListAdapter.java
@@ -28,26 +28,57 @@ import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
-
+/**
+ * @classname: FoldersListAdapter
+ * @description:便签数据库和用户的交互
+ * @date: 2024/1/4 11:07
+ * @author: wangrunze
+*/
public class FoldersListAdapter extends CursorAdapter {
public static final String [] PROJECTION = {
NoteColumns.ID,
NoteColumns.SNIPPET
- };
+ };//调用数据库中便签的ID和片段
public static final int ID_COLUMN = 0;
public static final int NAME_COLUMN = 1;
-
+ /**
+ * @classname: FoldersListAdapter
+ * @methodname: FoldersListAdapter
+ * @description:数据库操作
+ * @date: 2024/1/4 11:08
+ * @author: wangrunze
+ * @param:Context context
+ * @param: Cursor c
+ */
public FoldersListAdapter(Context context, Cursor c) {
super(context, c);
// TODO Auto-generated constructor stub
}
-
+ /**
+ * @classname: FoldersListAdapter
+ * @methodname: newView
+ * @description:创建一个文件夹,对于各文件夹中子标签的初始化
+ * @date: 2024/1/4 11:09
+ * @author: wangrunze
+ * @param:Context context
+ * @param:Cursor cursor
+ * @param:ViewGroup parent
+ */
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
return new FolderListItem(context);
}
-
+ /**
+ * @classname: FoldersListAdapter
+ * @methodname: bindView
+ * @description:将各个布局文件绑定起来
+ * @date: 2024/1/4 11:10
+ * @author: wangrunze
+ * @param:View view
+ * @param:Context context
+ * @param:Cursor cursor
+ */
@Override
public void bindView(View view, Context context, Cursor cursor) {
if (view instanceof FolderListItem) {
@@ -56,22 +87,49 @@ public class FoldersListAdapter extends CursorAdapter {
((FolderListItem) view).bind(folderName);
}
}
-
+ /**
+ * @classname: FoldersListAdapter
+ * @methodname: getFolderName
+ * @description:获取文件夹名称
+ * @date: 2024/1/4 11:10
+ * @author: wangrunze
+ * @param:Context context
+ * @param:int position
+ */
public String getFolderName(Context context, int position) {
Cursor cursor = (Cursor) getItem(position);
return (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context
.getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN);
}
-
+ /**
+ * @classname: FoldersListAdapter
+ * @description:关于文件夹操作
+ * @date: 2024/1/4 11:11
+ * @author: wangrunze
+ */
private class FolderListItem extends LinearLayout {
private TextView mName;
-
+ /**
+ * @classname: FolderListItem
+ * @methodname: FolderListItem
+ * @description:初始化文件夹
+ * @date: 2024/1/4 11:12
+ * @author: wangrunze
+ * @param:Context context
+ */
public FolderListItem(Context context) {
super(context);
inflate(context, R.layout.folder_list_item, this);
mName = (TextView) findViewById(R.id.tv_folder_name);
}
-
+ /**
+ * @classname: FolderListItem
+ * @methodname: bind
+ * @description:设置文件夹名称
+ * @date: 2024/1/4 11:13
+ * @author: wangrunze
+ * @param:String name
+ */
public void bind(String name) {
mName.setText(name);
}
diff --git a/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java b/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java
index ec6f819..cc0cc85 100644
--- a/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java
+++ b/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java
@@ -31,7 +31,12 @@ import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.tool.ResourceParser;
import net.micode.notes.ui.NoteEditActivity;
import net.micode.notes.ui.NotesListActivity;
-
+/**
+ * @classname: NoteWidgetProvider
+ * @description:桌面插件操作
+ * @date: 2024/1/7 10:22
+ * @author: wangrunze
+*/
public abstract class NoteWidgetProvider extends AppWidgetProvider {
public static final String [] PROJECTION = new String [] {
NoteColumns.ID,
@@ -45,6 +50,15 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
private static final String TAG = "NoteWidgetProvider";
+ /**
+ * @classname: NoteWidgetProvider
+ * @methodname: onDeleted
+ * @description:删除插件
+ * @date: 2024/1/7 10:23
+ * @author: wangrunze
+ * @param:Context context
+ * @param:int[] appWidgetIds
+ */
@Override
public void onDeleted(Context context, int[] appWidgetIds) {
ContentValues values = new ContentValues();
@@ -56,7 +70,15 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
new String[] { String.valueOf(appWidgetIds[i])});
}
}
-
+ /**
+ * @classname: NoteWidgetProvider
+ * @methodname: getNoteWidgetInfo
+ * @description:设置插件
+ * @date: 2024/1/7 10:23
+ * @author: wangrunze
+ * @param:Context context
+ * @param:int widgetId
+ */
private Cursor getNoteWidgetInfo(Context context, int widgetId) {
return context.getContentResolver().query(Notes.CONTENT_NOTE_URI,
PROJECTION,
@@ -64,11 +86,30 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
new String[] { String.valueOf(widgetId), String.valueOf(Notes.ID_TRASH_FOLER) },
null);
}
-
+ /**
+ * @classname: NoteWidgetProvider
+ * @methodname: update
+ * @description:更新插件
+ * @date: 2024/1/7 10:24
+ * @author: wangrunze
+ * @param:Context context
+ * @param:AppWidgetManager appWidgetManager
+ * @param:int[] appWidgetIds
+ */
protected void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
update(context, appWidgetManager, appWidgetIds, false);
}
-
+ /**
+ * @classname: NoteWidgetProvider
+ * @methodname: update
+ * @description:更新插件
+ * @date: 2024/1/7 10:24
+ * @author: wangrunze
+ * @param:Context context
+ * @param:AppWidgetManager appWidgetManager
+ * @param:int[] appWidgetIds
+ * @param:boolean privacyMode
+ */
private void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds,
boolean privacyMode) {
for (int i = 0; i < appWidgetIds.length; i++) {
diff --git a/src/main/java/net/micode/notes/widget/NoteWidgetProvider_2x.java b/src/main/java/net/micode/notes/widget/NoteWidgetProvider_2x.java
index adcb2f7..1fff72e 100644
--- a/src/main/java/net/micode/notes/widget/NoteWidgetProvider_2x.java
+++ b/src/main/java/net/micode/notes/widget/NoteWidgetProvider_2x.java
@@ -23,24 +23,61 @@ import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.tool.ResourceParser;
-
+/**
+ * @classname: NoteWidgetProvider_2x
+ * @description:设置2*2大小插件
+ * @date: 2024/1/7 10:27
+ * @author: wangrunze
+*/
public class NoteWidgetProvider_2x extends NoteWidgetProvider {
@Override
+ /**
+ * @classname: NoteWidgetProvider_2x
+ * @methodname: onUpdate
+ * @description:更新插件
+ * @date: 2024/1/7 10:29
+ * @author: wangrunze
+ * @param:Context context
+ * @param:AppWidgetManager appWidgetManager
+ * @param:int[] appWidgetIds
+ */
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
super.update(context, appWidgetManager, appWidgetIds);
}
@Override
+ /**
+ * @classname: NoteWidgetProvider_2x
+ * @methodname: getLayoutId
+ * @description:布局文件的资源ID
+ * @date: 2024/1/7 10:30
+ * @author: wangrunze
+ */
protected int getLayoutId() {
return R.layout.widget_2x;
}
@Override
+ /**
+ * @classname: NoteWidgetProvider_2x
+ * @methodname: getBgResourceId
+ * @description:获取其2倍大小的背景资源ID
+ * @date: 2024/1/7 10:31
+ * @author: wangrunze
+ * @param:int bgId
+ */
protected int getBgResourceId(int bgId) {
return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);
}
@Override
+ /**
+ * @classname: NoteWidgetProvider_2x
+ * @methodname: getWidgetType
+ * @description:获取背景类型
+ * @date: 2024/1/7 10:31
+ * @author: wangrunze
+ */
protected int getWidgetType() {
return Notes.TYPE_WIDGET_2X;
}
diff --git a/src/main/java/net/micode/notes/widget/NoteWidgetProvider_4x.java b/src/main/java/net/micode/notes/widget/NoteWidgetProvider_4x.java
index c12a02e..33c820d 100644
--- a/src/main/java/net/micode/notes/widget/NoteWidgetProvider_4x.java
+++ b/src/main/java/net/micode/notes/widget/NoteWidgetProvider_4x.java
@@ -23,23 +23,59 @@ import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.tool.ResourceParser;
-
+/**
+ * @classname: NoteWidgetProvider_4x
+ * @description:设置大小为4*1的插件
+ * @date: 2024/1/7 10:32
+ * @author: wangrunze
+*/
public class NoteWidgetProvider_4x extends NoteWidgetProvider {
@Override
+ /**
+ * @classname: NoteWidgetProvider_4x
+ * @methodname: onUpdate
+ * @description:更新插件
+ * @date: 2024/1/7 10:32
+ * @author: wangrunze
+ * @param:Context context
+ * @param:AppWidgetManager appWidgetManager
+ * @param: int[] appWidgetIds
+ */
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
super.update(context, appWidgetManager, appWidgetIds);
}
-
+ /**
+ * @classname: NoteWidgetProvider_4x
+ * @methodname: getLayoutId
+ * @description:布局文件的资源ID
+ * @date: 2024/1/7 10:33
+ * @author: wangrunze
+ */
protected int getLayoutId() {
return R.layout.widget_4x;
}
@Override
+ /**
+ * @classname: NoteWidgetProvider_4x
+ * @methodname: getBgResourceId
+ * @description:获取其4倍大小的背景资源ID
+ * @date: 2024/1/7 10:33
+ * @author: wangrunze
+ * @param:int bgId
+ */
protected int getBgResourceId(int bgId) {
return ResourceParser.WidgetBgResources.getWidget4xBgResource(bgId);
}
@Override
+ /**
+ * @classname: NoteWidgetProvider_4x
+ * @methodname: getWidgetType
+ * @description:获取背景类型
+ * @date: 2024/1/7 10:34
+ * @author: wangrunze
+ */
protected int getWidgetType() {
return Notes.TYPE_WIDGET_4X;
}