Skip to content

Commit

Permalink
v1.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
YangDai2003 committed May 12, 2024
1 parent ee521ad commit 47f9d97
Show file tree
Hide file tree
Showing 40 changed files with 1,192 additions and 419 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 54 additions & 28 deletions Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,68 @@

# What is Markdown?

Markdown is a plain text format for writing structured documents, based on conventions for indicating formatting in email and usenet posts.
It was developed by John Gruber (with help from Aaron Swartz) and released in 2004 in the form of a syntax description and a Perl script (Markdown.pl) for converting Markdown to HTML.
Markdown is a plain text format for writing structured documents, based on conventions for
indicating formatting in email and usenet posts.
It was developed by John Gruber (with help from Aaron Swartz) and released in 2004 in the form of a
syntax description and a Perl script (Markdown.pl) for converting Markdown to HTML.

In the next decade, dozens of implementations were developed in many languages.
Some extended the original Markdown syntax with conventions for footnotes, tables, and other document elements.
Some allowed Markdown documents to be rendered in formats other than HTML.
Some extended the original Markdown syntax with conventions for footnotes, tables, and other
document elements.
Some allowed Markdown documents to be rendered in formats other than HTML.

Websites like Reddit, StackOverflow, and GitHub had millions of people using Markdown.
And Markdown started to be used beyond the web, to author books, articles, slide shows, letters, and lecture notes.
Websites like Reddit, StackOverflow, and GitHub had millions of people using Markdown.
And Markdown started to be used beyond the web, to author books, articles, slide shows, letters, and
lecture notes.

# What is CommonMark?

CommonMark was developed to address inconsistencies and ambiguities in Markdown.
CommonMark was developed to address inconsistencies and ambiguities in Markdown.

The CommonMark specification defines rules for elements such as headings, lists, links, emphasis, and code blocks, among others.
The CommonMark specification defines rules for elements such as headings, lists, links, emphasis,
and code blocks, among others.

By adhering to the CommonMark standard, developers can ensure consistent rendering of Markdown content across different applications and platforms.
By adhering to the CommonMark standard, developers can ensure consistent rendering of Markdown
content across different applications and platforms.

# What is GitHub Flavored Markdown?

GitHub Flavored Markdown, often shortened as GFM, is the dialect of Markdown that is currently supported for user content on GitHub.com and GitHub Enterprise.
GitHub Flavored Markdown, often shortened as GFM, is the dialect of Markdown that is currently
supported for user content on GitHub.com and GitHub Enterprise.

This formal specification, based on the CommonMark Spec, defines the syntax and semantics of this dialect.
This formal specification, based on the CommonMark Spec, defines the syntax and semantics of this
dialect.

GFM is a strict superset of CommonMark. All the features which are supported in GitHub user content and that are not specified on the original CommonMark Spec are hence known as extensions, and highlighted as such.
GFM is a strict superset of CommonMark. All the features which are supported in GitHub user content
and that are not specified on the original CommonMark Spec are hence known as extensions, and
highlighted as such.

While GFM supports a wide range of inputs, it’s worth noting that GitHub.com and GitHub Enterprise perform additional post-processing and sanitization after GFM is converted to HTML to ensure security and consistency of the website.
While GFM supports a wide range of inputs, it’s worth noting that GitHub.com and GitHub Enterprise
perform additional post-processing and sanitization after GFM is converted to HTML to ensure
security and consistency of the website.

# What is LaTeX?

LaTeX is a typesetting system commonly used for producing scientific and mathematical documents.

LaTeX provides a powerful way to represent mathematical notation in documents, allowing users to create complex equations and formulas with ease.
LaTeX provides a powerful way to represent mathematical notation in documents, allowing users to
create complex equations and formulas with ease.

# How to use LaTeX in Markdown?

Mathematical expressions are key to information sharing amongst engineers, scientists, data scientists, and mathematicians.
Mathematical expressions are key to information sharing amongst engineers, scientists, data
scientists, and mathematicians.

You can use the $ and $$ delimiters in GFM to insert math expressions in TeX and LaTeX style syntax.

# What has OpenNote offered?

OpenNote supports CommonMark and GitHub Flavored Markdown (GFM) syntax, as well as LaTeX math syntax.
OpenNote supports CommonMark and GitHub Flavored Markdown (GFM) syntax, as well as LaTeX math
syntax.

This allows users to create richly formatted notes with support for headings, lists, links, emphasis, code blocks, tables, and mathematical expressions, and allows notes to be exported in various formats including TXT, MD (Markdown), and HTML.
This allows users to create richly formatted notes with support for headings, lists, links,
emphasis, code blocks, tables, and mathematical expressions, and allows notes to be exported in
various formats including TXT, MD (Markdown), and HTML.

# Some Basic Markdown Syntax

Expand Down Expand Up @@ -160,20 +177,29 @@ This allows users to create richly formatted notes with support for headings, li

# Keyboard Shortcuts

| Element | Shortcut |
|:-------------:|:--------------:|
| Bold | `Ctrl+B` |
| Italic | `Ctrl+I` |
| Underline | `Ctrl+U` |
| Strikethrough | `Ctrl+D` |
| Mark | `Ctrl+M` |
| Code | `Ctrl+Shift+K` |
| Quote | `Ctrl+Shift+Q` |
| Math | `Ctrl+Shift+M` |
| Element | Shortcut |
|:---------------:|:--------------:|
| Bold | `Ctrl+B` |
| Italic | `Ctrl+I` |
| Underline | `Ctrl+U` |
| Strikethrough | `Ctrl+D` |
| Mark | `Ctrl+M` |
| Table | `Ctrl+T` |
| Link | `Ctrl+K` |
| Scan | `Ctrl+S` |
| Preview | `Ctrl+P` |
| Heading | `Ctrl+1~6` |
| Code | `Ctrl+Shift+K` |
| Quote | `Ctrl+Shift+Q` |
| Math | `Ctrl+Shift+M` |
| Horizontal Rule | `Ctrl+Shift+R` |
| Task | `Ctrl+Shift+T` |
| Mermaid Diagram | `Ctrl+Shift+D` |

# References

You can find more information about Markdown, CommonMark, GitHub Flavored Markdown, LaTeX Math, and Mermaid at the following links:
You can find more information about Markdown, CommonMark, GitHub Flavored Markdown, LaTeX Math, and
Mermaid at the following links:

- [CommonMark](https://commonmark.org/)
- [GitHub Flavored Markdown](https://github.github.com/gfm/)
Expand Down
28 changes: 18 additions & 10 deletions Guide.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,24 @@ TXT、MD (Markdown) 和 HTML。

# 键盘快捷键

| 元素 | 键位 |
|:---:|:--------------:|
| 粗体 | `Ctrl+B` |
| 斜体 | `Ctrl+I` |
| 下划线 | `Ctrl+U` |
| 删除线 | `Ctrl+D` |
| 标记 | `Ctrl+M` |
| 代码 | `Ctrl+Shift+K` |
| 引用 | `Ctrl+Shift+Q` |
| 数学 | `Ctrl+Shift+M` |
| 元素 | 快捷键 |
|:----------:|:--------------:|
| 粗体 | `Ctrl+B` |
| 斜体 | `Ctrl+I` |
| 下划线 | `Ctrl+U` |
| 删除线 | `Ctrl+D` |
| 标记 | `Ctrl+M` |
| 表格 | `Ctrl+T` |
| 链接 | `Ctrl+K` |
| 扫描 | `Ctrl+S` |
| 预览 | `Ctrl+P` |
| 标题 | `Ctrl+1~6` |
| 代码 | `Ctrl+Shift+K` |
| 引用 | `Ctrl+Shift+Q` |
| 数学 | `Ctrl+Shift+M` |
| 分隔线 | `Ctrl+Shift+R` |
| 任务列表 | `Ctrl+Shift+T` |
| Mermaid 图表 | `Ctrl+Shift+D` |

# 参考

Expand Down
11 changes: 8 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
applicationId = "com.yangdai.opennote"
minSdk = 29
targetSdk = 34
versionCode = 124
versionName = "1.2.4"
versionCode = 126
versionName = "1.2.6"
resourceConfigurations += listOf("en", "zh")

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -62,7 +62,7 @@ android {
}

dependencies {

// Kotlin
implementation(libs.kotlinx.serialization)
implementation(libs.kotlinx.collections.immutable)

Expand Down Expand Up @@ -120,6 +120,11 @@ dependencies {
implementation(libs.androidx.datastore.preferences)
implementation(libs.androidx.appcompat)

// For Glance support
implementation(libs.androidx.glance)
// For AppWidgets support
implementation(libs.androidx.glance.appwidget)

// Test
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
31 changes: 31 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-feature
android:name="android.hardware.camera"
android:required="false" />
Expand All @@ -31,7 +32,9 @@
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:appCategory="productivity"
android:localeConfig="@xml/locales_config"
android:manageSpaceActivity=".ManageSpaceActivity"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
Expand All @@ -53,8 +56,36 @@
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="file" />
<data android:scheme="content" />
<data android:mimeType="text/*" />
</intent-filter>

</activity>

<activity
android:name=".ManageSpaceActivity"
android:exported="true" />

<receiver
android:name="com.yangdai.opennote.presentation.glance.NoteListWidgetReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/note_list_widget_info" />
</receiver>

</application>

</manifest>
22 changes: 22 additions & 0 deletions app/src/main/java/com/yangdai/opennote/ManageSpaceActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.yangdai.opennote

import android.app.Activity
import android.app.PendingIntent
import android.content.Intent
import android.os.Bundle
import androidx.core.app.TaskStackBuilder
import androidx.core.net.toUri
import com.yangdai.opennote.presentation.util.Constants.LINK

class ManageSpaceActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val intent = Intent(this, MainActivity::class.java).setData("$LINK/settings".toUri())
val pendingIntent = TaskStackBuilder.create(this).run {
addNextIntentWithParentStack(intent)
getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
}
pendingIntent?.send()
finish()
}
}
2 changes: 2 additions & 0 deletions app/src/main/java/com/yangdai/opennote/data/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.yangdai.opennote.domain.usecase.UpdateFolder
import com.yangdai.opennote.domain.usecase.UpdateNote
import com.yangdai.opennote.domain.repository.DataStoreRepository
import com.yangdai.opennote.domain.repository.FolderRepository
import com.yangdai.opennote.domain.usecase.GetNoteById
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand Down Expand Up @@ -64,6 +65,7 @@ object AppModule {
): Operations {
return Operations(
getNotes = GetNotes(noteRepository),
getNoteById = GetNoteById(noteRepository),
deleteNote = DeleteNote(noteRepository),
addNote = AddNote(noteRepository),
searchNotes = SearchNotes(noteRepository),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.datastore.preferences.core.stringSetPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import com.yangdai.opennote.domain.repository.DataStoreRepository
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
import javax.inject.Inject

Expand Down Expand Up @@ -53,68 +52,13 @@ class DataStoreRepositoryImpl @Inject constructor(
}
}

override suspend fun getString(key: String): String? {
return try {
val preferencesKey = stringPreferencesKey(key)
val preferences = context.dataStore.data.first()
preferences[preferencesKey]
} catch (e: Exception) {
e.printStackTrace()
null
}
}

override suspend fun getInt(key: String): Int? {
return try {
val preferencesKey = intPreferencesKey(key)
val preferences = context.dataStore.data.first()
preferences[preferencesKey]
} catch (e: Exception) {
e.printStackTrace()
null
}
}

override suspend fun getFloat(key: String): Float? {
return try {
val preferencesKey = floatPreferencesKey(key)
val preferences = context.dataStore.data.first()
preferences[preferencesKey]
} catch (e: Exception) {
e.printStackTrace()
null
}
}

override suspend fun getBoolean(key: String): Boolean? {
return try {
val preferencesKey = booleanPreferencesKey(key)
val preferences = context.dataStore.data.first()
preferences[preferencesKey]
} catch (e: Exception) {
e.printStackTrace()
null
}
}

override suspend fun putStringSet(key: String, value: Set<String>) {
val preferencesKey = stringSetPreferencesKey(key)
context.dataStore.edit { preferences ->
preferences[preferencesKey] = value
}
}

override suspend fun getStringSet(key: String): Set<String>? {
return try {
val preferencesKey = stringSetPreferencesKey(key)
val preferences = context.dataStore.data.first()
preferences[preferencesKey]
} catch (e: Exception) {
e.printStackTrace()
null
}
}

override fun intFlow(key: String): Flow<Int> {
val preferencesKey = intPreferencesKey(key)
return context.dataStore.data.map { preferences ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ interface DataStoreRepository {
suspend fun putBoolean(key: String, value: Boolean)
suspend fun putStringSet(key: String, value: Set<String>)

suspend fun getString(key: String): String?
suspend fun getInt(key: String): Int?
suspend fun getFloat(key: String): Float?
suspend fun getBoolean(key: String): Boolean?
suspend fun getStringSet(key: String): Set<String>?

fun intFlow(key: String): Flow<Int>
fun floatFlow(key: String): Flow<Float>
fun stringFlow(key: String): Flow<String>
Expand Down
Loading

0 comments on commit 47f9d97

Please sign in to comment.