mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-02-10 08:20:49 +01:00
adding a FAB at the checklist fragment
This commit is contained in:
parent
22be4e4ac4
commit
c0acb525ad
@ -1,13 +1,19 @@
|
|||||||
package com.simplemobiletools.notes.pro.fragments
|
package com.simplemobiletools.notes.pro.fragments
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||||
|
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
|
||||||
|
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
|
||||||
|
import com.simplemobiletools.commons.extensions.isBlackAndWhiteTheme
|
||||||
import com.simplemobiletools.notes.pro.R
|
import com.simplemobiletools.notes.pro.R
|
||||||
import com.simplemobiletools.notes.pro.helpers.NOTE_ID
|
import com.simplemobiletools.notes.pro.helpers.NOTE_ID
|
||||||
import com.simplemobiletools.notes.pro.helpers.NotesHelper
|
import com.simplemobiletools.notes.pro.helpers.NotesHelper
|
||||||
import com.simplemobiletools.notes.pro.models.Note
|
import com.simplemobiletools.notes.pro.models.Note
|
||||||
|
import kotlinx.android.synthetic.main.fragment_checklist.view.*
|
||||||
|
|
||||||
class ChecklistFragment : NoteFragment() {
|
class ChecklistFragment : NoteFragment() {
|
||||||
private var noteId = 0L
|
private var noteId = 0L
|
||||||
@ -25,7 +31,7 @@ class ChecklistFragment : NoteFragment() {
|
|||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
NotesHelper(activity!!).getNoteWithId(noteId) {
|
NotesHelper(activity!!).getNoteWithId(noteId) {
|
||||||
if (it != null) {
|
if (it != null && activity?.isDestroyed == false) {
|
||||||
note = it
|
note = it
|
||||||
setupFragment()
|
setupFragment()
|
||||||
}
|
}
|
||||||
@ -33,6 +39,13 @@ class ChecklistFragment : NoteFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupFragment() {
|
private fun setupFragment() {
|
||||||
|
val plusIcon = resources.getColoredDrawableWithColor(R.drawable.ic_plus, if (context!!.isBlackAndWhiteTheme()) Color.BLACK else Color.WHITE)
|
||||||
|
view.checklist_fab.apply {
|
||||||
|
setImageDrawable(plusIcon)
|
||||||
|
background.applyColorFilter(context!!.getAdjustedPrimaryColor())
|
||||||
|
setOnClickListener {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,10 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/checklist"
|
android:id="@+id/checklist_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
|
android:id="@+id/checklist_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:overScrollMode="never"
|
android:overScrollMode="never"
|
||||||
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/>
|
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/>
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyFloatingActionButton
|
||||||
|
android:id="@+id/checklist_fab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_margin="@dimen/activity_margin"
|
||||||
|
android:src="@drawable/ic_plus"/>
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user