Skip to content

Commit

Permalink
[1.0.2] fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
maksmakuta committed Jan 29, 2024
1 parent 91247b4 commit 383c564
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 30 deletions.
7 changes: 5 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".NotesApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:enableOnBackInvokedCallback="true"
android:supportsRtl="true"
android:theme="@style/NotesTheme">
android:theme="@style/NotesTheme"
tools:targetApi="tiramisu">
<activity
android:name=".MainActivity"
android:exported="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ class NotesAdapter(
}
}

fun clear() {
val c = data.size
data.clear()
notifyItemRangeRemoved(0, c)
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NotesHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val binding = INoteBinding.inflate(layoutInflater, parent, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,4 @@ class EditorVM : ViewModel() {
}
}

fun delete(note: Note) {
viewModelScope.launch(Dispatchers.IO) {
db.notes().del(note)
operation.postValue(true)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class FEditor : Fragment(), MenuProvider {
menuInflater.inflate(R.menu.menu_edit, menu)
if (noteTitle.isEmpty()) {
menu.findItem(R.id.menu_share).isVisible = false
menu.findItem(R.id.menu_del).isVisible = false
}
}

Expand All @@ -78,13 +77,6 @@ class FEditor : Fragment(), MenuProvider {
return true
}

R.id.menu_del -> {
if (vm.note.value != null) {
vm.delete(vm.note.value!!)
}
return true
}

R.id.menu_save -> {
if (vm.note.value != null) {
val f = File(requireContext().filesDir, vm.note.value!!.filename)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.makuta.simplenotes.databinding.DRenameBinding
import com.makuta.simplenotes.databinding.FMainBinding
import java.io.File


class FMain : Fragment(), NotesAdapter.OnNoteActionListener, PopupMenu.OnMenuItemClickListener {

private val vm: MainVM by viewModels()
Expand Down Expand Up @@ -60,11 +59,6 @@ class FMain : Fragment(), NotesAdapter.OnNoteActionListener, PopupMenu.OnMenuIte
)
)
}

binding.fabNew.setOnLongClickListener {
vm.load()
true
}
}

override fun onStart() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/sticky_notes_rename.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<vector android:height="48dp"
android:tint="#000000"
android:tint="?colorOnBackground"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="48dp"
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/res/menu/menu_edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
android:icon="@drawable/sticky_notes_share"
android:title="@string/menu_share" />

<item
android:id="@+id/menu_del"
app:showAsAction="ifRoom"
android:icon="@drawable/sticky_notes_del"
android:title="@string/menu_del" />

<item
android:id="@+id/menu_save"
app:showAsAction="ifRoom"
Expand Down

0 comments on commit 383c564

Please sign in to comment.