Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ class CheckerTaskFilterDialogFragment : DialogFragment(), MFDatePicker.OnDatePic
selectedAction, selectedEntity, resourceId)
dialog.dismiss()
}

btn_clear_filter.setOnClickListener {
mOnInputSelected.sendInput(null, null,
selectedAction, selectedEntity, "")
dialog.dismiss()
}
}


Expand Down Expand Up @@ -163,7 +169,7 @@ class CheckerTaskFilterDialogFragment : DialogFragment(), MFDatePicker.OnDatePic
}

interface OnInputSelected {
fun sendInput(fromDate: Timestamp?, toDate: Timestamp, action: String = "",
fun sendInput(fromDate: Timestamp?, toDate: Timestamp?, action: String = "",
entity: String = "", resourceId: String = "")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ class CheckerInboxFragment : MifosBaseFragment(), TextWatcher,
* @param resourceId String
* @return MutableList<CheckerTask>
*/
private fun getFilteredList(fromDate: Timestamp?, toDate: Timestamp,
private fun getFilteredList(fromDate: Timestamp?, toDate: Timestamp?,
action: String, entity: String,
resourceId: String)
: MutableList<CheckerTask> {
Expand All @@ -487,7 +487,11 @@ class CheckerInboxFragment : MifosBaseFragment(), TextWatcher,
return filteredList
} else {
// Resource Id is not available.
if (fromDate == null) {

// If Clear Filter clicked
if (fromDate == null && toDate == null) {
return fetchedCheckerTaskList
} else if (fromDate == null) {
// From Date is not available
if (action == ALL && entity == ALL) {
// No need to check for Action and Entity
Expand Down Expand Up @@ -590,8 +594,8 @@ class CheckerInboxFragment : MifosBaseFragment(), TextWatcher,
* @param entity String
* @param resourceId String
*/
override fun sendInput(fromDate: Timestamp?, toDate: Timestamp,
action: String, entity: String, resourceId: String) {
override fun sendInput(fromDate: Timestamp?, toDate: Timestamp?, action: String, entity: String,
resourceId: String) {
val filteredList = getFilteredList(fromDate, toDate, action, entity, resourceId)
updateRecyclerViewWithNewList(filteredList)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,28 @@
android:maxLines="1"/>
</com.google.android.material.textfield.TextInputLayout>

<Button
android:id="@+id/btn_apply_filter"
style="@style/Button.Base"
android:layout_marginTop="10dp"
android:text="Apply Filters" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="15dp">

<Button
android:id="@+id/btn_clear_filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Clear Filter"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<Button
android:id="@+id/btn_apply_filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Apply Filters"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />

</RelativeLayout>

</LinearLayout>