Skip to content

Commit

Permalink
Changed ImageView of the fitbit icon to checkbox with the logo image.
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasrafael committed Jan 20, 2020
1 parent ba577fb commit f5ac4da
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package br.edu.uepb.nutes.ocariot.view.adapter;

import android.content.Context;
import android.content.res.ColorStateList;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.core.widget.ImageViewCompat;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
Expand Down Expand Up @@ -69,13 +68,8 @@ public void showData(RecyclerView.ViewHolder holder, int position, List<Child> i
}

// Fitbit status
ColorStateList colorFitbitStatus = ColorStateList.valueOf(mContext.getResources()
.getColor(R.color.colorFitbitInactive));
if (child.isFitbitAccessValid()) {
colorFitbitStatus = ColorStateList.valueOf(mContext.getResources()
.getColor(R.color.colorFitbitActive));
}
ImageViewCompat.setImageTintList(h.fitBitStatus, colorFitbitStatus);
h.fitBitStatus.setChecked(false);
if (child.isFitbitAccessValid()) h.fitBitStatus.setChecked(true);

// Gender
if (child.getGender().equalsIgnoreCase("male")) {
Expand Down Expand Up @@ -143,8 +137,8 @@ class ViewHolderChild extends RecyclerView.ViewHolder {
@BindView(R.id.child_last_sync_tv)
TextView lastSync;

@BindView(R.id.fitbit_status_img)
ImageView fitBitStatus;
@BindView(R.id.fitbit_status_cb)
CheckBox fitBitStatus;

@BindView(R.id.gender_img)
ImageView gender;
Expand Down
Binary file removed app/src/main/res/drawable-hdpi/ic_fitbit_logo.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-mdpi/ic_fitbit_logo.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-xhdpi/ic_fitbit_logo.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-xxhdpi/ic_fitbit_logo.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-xxxhdpi/ic_fitbit_logo.png
Binary file not shown.
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/checkbox_fitbit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/ic_fitbit_active" android:state_checked="true" />
<item android:drawable="@drawable/ic_fitbit_inactive" android:state_checked="false" />
</selector>
Binary file added app/src/main/res/drawable/ic_fitbit_active.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_fitbit_inactive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 11 additions & 7 deletions app/src/main/res/layout/child_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/gender_img"
android:layout_marginTop="-2dp"
android:layout_marginStart="40dp"
android:layout_marginTop="-2dp"
android:text="B0001"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@color/colorBlackLight"
Expand All @@ -32,19 +32,23 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/name_child"
android:layout_marginTop="2dp"
android:layout_marginStart="40dp"
android:layout_marginTop="2dp"
android:text="@string/last_sync_date_time"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="@color/colorBlackLight" />

<ImageView
android:id="@+id/fitbit_status_img"
<CheckBox
android:id="@+id/fitbit_status_cb"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
android:contentDescription="@null"
android:layout_marginTop="10dp"
android:tint="@color/colorFitbitActive"
android:src="@drawable/ic_fitbit_logo" />
android:background="@drawable/checkbox_fitbit"
android:button="@null"
android:checked="false"
android:clickable="false"
android:contentDescription="@null"
android:focusable="false"
android:focusableInTouchMode="false" />
</RelativeLayout>
2 changes: 0 additions & 2 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@
<color name="colorLineDivider">#e2e2e2</color>
<color name="colorInputText">#d3d3d3</color>
<color name="colorBackgroundNavigation">#f0f0f0</color>
<color name="colorFitbitActive">#1babb4</color>
<color name="colorFitbitInactive">#d6d6d6</color>

</resources>

0 comments on commit f5ac4da

Please sign in to comment.