Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Fix-320: Chip implemented in Group Status #183

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
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 @@ -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.*
Expand All @@ -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
Expand Down Expand Up @@ -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<String>)
}
Expand All @@ -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)
}
}
}
Expand Down
30 changes: 10 additions & 20 deletions app/src/main/res/layout/fragment_groups_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
Expand Down Expand Up @@ -48,26 +49,15 @@
android:text="@string/status"
android:textColor="@color/gray_dark" />

<LinearLayout
android:layout_width="match_parent"
<com.google.android.material.chip.Chip
android:id="@+id/statusChip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_padding_8dp"
android:orientation="horizontal">

<org.apache.fineract.ui.views.CircularImageView
android:id="@+id/civStatus"
android:layout_width="25dp"
android:layout_height="match_parent" />

<TextView
android:id="@+id/tvStatus"
style="@style/Base.TextAppearance.AppCompat.Medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
tools:text="@string/medium_text" />

</LinearLayout>
android:text="@string/status"
app:chipIcon="@drawable/ic_check_circle_black_24dp"
app:checkedIconVisible="false"
app:chipIconTint="@color/black"
/>


<TextView
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
<color name="base10">#eaeaea</color>
<color name="base30">#c1c1c1</color>

<!-- Status Chip Colors -->

<color name="activate_green">#8CFF91</color>
<color name="pending_blue">#7489FF</color>
<color name="closed_red">#FFA4A4</color>

<!--Swipe Refresh Colors-->
<array name="swipeRefreshColors">
Expand Down