From a4d30d56386c322ee797a471c49db9a5dbe182b9 Mon Sep 17 00:00:00 2001 From: PatelVatsalB21 Date: Tue, 13 Apr 2021 13:15:18 +0530 Subject: [PATCH] fix 320: Chip implemented in Group Status --- .../groupdetails/GroupDetailsFragment.kt | 20 ++++++++----- .../res/layout/fragment_groups_details.xml | 30 +++++++------------ app/src/main/res/values/colors.xml | 5 ++++ 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/org/apache/fineract/ui/online/groups/groupdetails/GroupDetailsFragment.kt b/app/src/main/java/org/apache/fineract/ui/online/groups/groupdetails/GroupDetailsFragment.kt index 7095ac0f..54d3e2fe 100644 --- a/app/src/main/java/org/apache/fineract/ui/online/groups/groupdetails/GroupDetailsFragment.kt +++ b/app/src/main/java/org/apache/fineract/ui/online/groups/groupdetails/GroupDetailsFragment.kt @@ -3,6 +3,7 @@ package org.apache.fineract.ui.online.groups.groupdetails import android.content.Intent import android.os.Bundle import android.view.* +import androidx.core.content.ContextCompat import butterknife.ButterKnife import butterknife.OnClick import kotlinx.android.synthetic.main.fragment_groups_details.* @@ -15,7 +16,6 @@ import org.apache.fineract.ui.base.FineractBaseFragment import org.apache.fineract.ui.online.groups.GroupAction import org.apache.fineract.ui.online.groups.creategroup.CreateGroupActivity import org.apache.fineract.ui.online.groups.grouptasks.GroupTasksBottomSheetFragment -import org.apache.fineract.ui.views.CircularImageView import org.apache.fineract.utils.Constants import org.apache.fineract.utils.DateUtils import org.apache.fineract.utils.Utils @@ -93,8 +93,8 @@ class GroupDetailsFragment : FineractBaseFragment() { tvIdentifier.text = group.identifier tvGroupId.text = group.groupDefinitionIdentifier tvName.text = group.name - tvStatus.text = group.status?.name - setGroupStatusCircularIcon(group.status, civStatus) + statusChip.text = group.status?.name + setGroupStatusChipIcon(group.status) group.leaders?.let { leadersNameAdapter.submitList(it as ArrayList) } @@ -117,16 +117,22 @@ class GroupDetailsFragment : FineractBaseFragment() { bottomSheet.show(childFragmentManager, getString(R.string.tasks)) } - private fun setGroupStatusCircularIcon(status: Group.Status?, civStatus: CircularImageView) { + private fun setGroupStatusChipIcon(status: Group.Status?) { when (status) { Group.Status.PENDING -> { - civStatus.setImageDrawable(Utils.setCircularBackground(R.color.blue, context)) + statusChip.chipIcon = ContextCompat.getDrawable(context!!, + R.drawable.ic_hourglass_empty_black_24dp) + statusChip.setChipBackgroundColorResource(R.color.pending_blue) } Group.Status.ACTIVE -> { - civStatus.setImageDrawable(Utils.setCircularBackground(R.color.deposit_green, context)) + statusChip.chipIcon = ContextCompat.getDrawable(context!!, + R.drawable.ms_ic_check) + statusChip.setChipBackgroundColorResource(R.color.activate_green) } Group.Status.CLOSED -> { - civStatus.setImageDrawable(Utils.setCircularBackground(R.color.red_dark, context)) + statusChip.chipIcon = ContextCompat.getDrawable(context!!, + R.drawable.ic_close_black_24dp) + statusChip.setChipBackgroundColorResource(R.color.closed_red) } } } diff --git a/app/src/main/res/layout/fragment_groups_details.xml b/app/src/main/res/layout/fragment_groups_details.xml index b5e91de0..11906d29 100644 --- a/app/src/main/res/layout/fragment_groups_details.xml +++ b/app/src/main/res/layout/fragment_groups_details.xml @@ -4,7 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical"> + android:orientation="vertical" + android:theme="@style/Theme.MaterialComponents.Light.NoActionBar"> - - - - - - - + android:text="@string/status" + app:chipIcon="@drawable/ic_check_circle_black_24dp" + app:checkedIconVisible="false" + app:chipIconTint="@color/black" + /> #eaeaea #c1c1c1 + + + #8CFF91 + #7489FF + #FFA4A4