diff --git a/app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt b/app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt index 704c1c79..77ad6cd9 100644 --- a/app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt +++ b/app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt @@ -12,6 +12,7 @@ import androidx.lifecycle.repeatOnLifecycle import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import by.kirich1409.viewbindingdelegate.viewBinding +import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton import com.google.android.material.floatingactionbutton.FloatingActionButton import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.launch @@ -38,9 +39,12 @@ class NotesFragment: Fragment(R.layout.fragment_notes) { private lateinit var newTextNoteButton: FloatingActionButton private lateinit var newGraphicNoteButton: FloatingActionButton private lateinit var pasteNoteButton: Button + private lateinit var newNoteButton: ExtendedFloatingActionButton private lateinit var recyclerView: RecyclerView + private var showFabs = false + private val newTextNoteClickListener = View.OnClickListener { activity.fragment = EditTextNotesFragment() activity.replaceFragment(activity.fragment, EditTextNotesFragment.TAG) @@ -70,9 +74,24 @@ class NotesFragment: Fragment(R.layout.fragment_notes) { recyclerView = binding.include.recyclerView activity.title = getString(R.string.app_name) activity.supportActionBar?.setDisplayHomeAsUpEnabled(false) - newTextNoteButton = binding.newNote + newTextNoteButton = binding.newTextNote pasteNoteButton = binding.pasteNote newGraphicNoteButton = binding.newGraphicNote + newNoteButton = binding.newNote + newNoteButton.shrink() + newNoteButton.setOnClickListener { + showFabs = if (!showFabs) { + newNoteButton.extend() + newTextNoteButton.show() + newGraphicNoteButton.show() + true + } else { + newNoteButton.shrink() + newTextNoteButton.hide() + newGraphicNoteButton.hide() + false + } + } newTextNoteButton.setOnClickListener(newTextNoteClickListener) newGraphicNoteButton.setOnClickListener(newGraphicNoteClickListener) pasteNoteButton.setOnClickListener(pasteNoteClickListener) diff --git a/app/src/main/res/layout/fragment_notes.xml b/app/src/main/res/layout/fragment_notes.xml index 6816c88e..5b8b3f71 100644 --- a/app/src/main/res/layout/fragment_notes.xml +++ b/app/src/main/res/layout/fragment_notes.xml @@ -1,7 +1,8 @@ + android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto"> - + + @@ -26,9 +38,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" - android:layout_marginEnd="20dp" - android:layout_marginBottom="20dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="80dp" android:clickable="true" + android:visibility="gone" android:contentDescription="@string/new_note" android:src="@drawable/ic_brush" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5955cf21..440b247f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -31,5 +31,7 @@ Just now Graphic note %1$s Text note %1$s + New note + Close \ No newline at end of file