diff --git a/java/net/micode/notes/MainActivity.java b/java/net/micode/notes/MainActivity.java new file mode 100644 index 0000000..8091753 --- /dev/null +++ b/java/net/micode/notes/MainActivity.java @@ -0,0 +1,24 @@ +package net.micode.notes; + +import android.os.Bundle; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + EdgeToEdge.enable(this); + setContentView(R.layout.activity_main); + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> { + Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); + v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); + return insets; + }); + } +} \ No newline at end of file diff --git a/java/net/micode/notes/data/Contact.java b/java/net/micode/notes/data/Contact.java index d97ac5d..24a4c84 100644 --- a/java/net/micode/notes/data/Contact.java +++ b/java/net/micode/notes/data/Contact.java @@ -26,7 +26,12 @@ import android.util.Log; import java.util.HashMap; public class Contact { + //HashMap 是一个散列表,它存储的内容是键值对(key-value)映射。 + // 根据键的 HashCode 值存储数据,具有很快的访问速度,最多允许一条记录的键为 null,不支持线程同步。 + // HashMap 是无序的,即不会记录插入的顺序。HashMap 继承于AbstractMap, + // 实现了 Map、Cloneable、java.io.Serializable 接口。 private static HashMap sContactCache; + //定义一个私有的常量,TAG为Contact private static final String TAG = "Contact"; private static final String CALLER_ID_SELECTION = "PHONE_NUMBERS_EQUAL(" + Phone.NUMBER diff --git a/java/net/micode/notes/gtask/remote/GTaskASyncTask.java b/java/net/micode/notes/gtask/remote/GTaskASyncTask.java index b3b61e7..43cbee6 100644 --- a/java/net/micode/notes/gtask/remote/GTaskASyncTask.java +++ b/java/net/micode/notes/gtask/remote/GTaskASyncTask.java @@ -64,24 +64,24 @@ public class GTaskASyncTask extends AsyncTask { } private void showNotification(int tickerId, String content) { - Notification notification = new Notification(R.drawable.notification, mContext - .getString(tickerId), System.currentTimeMillis()); - notification.defaults = Notification.DEFAULT_LIGHTS; - notification.flags = Notification.FLAG_AUTO_CANCEL; PendingIntent pendingIntent; if (tickerId != R.string.ticker_success) { pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, - NotesPreferenceActivity.class), 0); - + NotesPreferenceActivity.class), PendingIntent.FLAG_IMMUTABLE); } else { pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, - NotesListActivity.class), 0); + NotesListActivity.class), PendingIntent.FLAG_IMMUTABLE); } - notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, - pendingIntent); + Notification.Builder builder = new Notification.Builder(mContext) + .setAutoCancel(true) + .setContentTitle(mContext.getString(R.string.app_name)) + .setContentText(content) + .setContentIntent(pendingIntent) + .setWhen(System.currentTimeMillis()) + .setOngoing(true); + Notification notification=builder.getNotification(); mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification); } - @Override protected Integer doInBackground(Void... unused) { publishProgess(mContext.getString(R.string.sync_progress_login, NotesPreferenceActivity diff --git a/res/drawable/ic_launcher_background.xml b/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/drawable/ic_launcher_foreground.xml b/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml new file mode 100644 index 0000000..86a5d97 --- /dev/null +++ b/res/layout/activity_main.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/res/mipmap-anydpi-v26/ic_launcher.xml b/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/res/mipmap-anydpi-v26/ic_launcher_round.xml b/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/res/mipmap-hdpi/ic_launcher.webp b/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/res/mipmap-hdpi/ic_launcher_round.webp b/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/res/mipmap-mdpi/ic_launcher.webp b/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/res/mipmap-mdpi/ic_launcher_round.webp b/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/res/mipmap-xhdpi/ic_launcher.webp b/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/res/mipmap-xhdpi/ic_launcher_round.webp b/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/res/mipmap-xxhdpi/ic_launcher.webp b/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/res/mipmap-xxhdpi/ic_launcher_round.webp b/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/res/mipmap-xxxhdpi/ic_launcher.webp b/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/res/mipmap-xxxhdpi/ic_launcher_round.webp b/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/res/values-night/themes.xml b/res/values-night/themes.xml new file mode 100644 index 0000000..d2c68d1 --- /dev/null +++ b/res/values-night/themes.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/res/values/themes.xml b/res/values/themes.xml new file mode 100644 index 0000000..7c616ff --- /dev/null +++ b/res/values/themes.xml @@ -0,0 +1,9 @@ + + + + +