-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[enhancement] Dedicated title/description input fields: #22
- Loading branch information
1 parent
c2332f0
commit 7de28e6
Showing
12 changed files
with
154 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/BaseEditNoteFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package dev.arkbuilders.arkmemo.ui.fragments | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.fragment.app.Fragment | ||
import by.kirich1409.viewbindingdelegate.viewBinding | ||
import dev.arkbuilders.arkmemo.R | ||
import dev.arkbuilders.arkmemo.databinding.FragmentEditNotesBinding | ||
|
||
open class BaseEditNoteFragment: Fragment(R.layout.fragment_edit_notes) { | ||
|
||
val binding by viewBinding(FragmentEditNotesBinding::bind) | ||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
binding.tvDescription.setOnClickListener { | ||
if (binding.editTextDescription.visibility == View.GONE) { | ||
binding.tvDescription.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_chevron_down, 0) | ||
binding.editTextDescription.visibility = View.VISIBLE | ||
} else { | ||
binding.tvDescription.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_chevron_right, 0) | ||
binding.editTextDescription.visibility = View.GONE | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/src/main/java/dev/arkbuilders/arkmemo/utils/NoteExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package dev.arkbuilders.arkmemo.utils | ||
|
||
import android.content.Context | ||
import dev.arkbuilders.arkmemo.R | ||
import dev.arkbuilders.arkmemo.models.GraphicNote | ||
import dev.arkbuilders.arkmemo.models.Note | ||
import dev.arkbuilders.arkmemo.models.TextNote | ||
|
||
fun Note.getAutoTitle(context: Context? = null): String { | ||
|
||
return if (this is TextNote) { | ||
this.title.ifEmpty { this.text.take(20) } | ||
} else if (this is GraphicNote && context != null) { | ||
this.title.ifEmpty { | ||
String.format(context.getString(R.string.ark_memo_graphic_note), this.resource?.id) | ||
} | ||
} else { | ||
"" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector android:height="24dp" android:tint="#000000" | ||
android:viewportHeight="24" android:viewportWidth="24" | ||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="@android:color/white" android:pathData="M7.41,8.59L12,13.17l4.59,-4.58L18,10l-6,6 -6,-6 1.41,-1.41z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector android:height="24dp" android:tint="#000000" | ||
android:viewportHeight="24" android:viewportWidth="24" | ||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="@android:color/white" android:pathData="M8.59,16.59L13.17,12 8.59,7.41 10,6l6,6 -6,6 -1.41,-1.41z"/> | ||
</vector> |
Oops, something went wrong.