Skip to content

Commit

Permalink
Merge pull request #123 from CSE-110-Winter-2024/ui-hotfix
Browse files Browse the repository at this point in the history
Fix UI so that it correctly displays letters with list items
  • Loading branch information
JGonzaga7 authored Mar 15, 2024
2 parents a54e193 + 80e1cef commit c1317b2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,42 @@ public View getView(int position, View convertView, ViewGroup parent) {
binding.background.setBackgroundColor(Color.WHITE);
}

/*
Logic for color of the list context icon
*/
// Logic for letter shown inside
if (goal.context() == Context.HOME) {
binding.imageView.setColorFilter(Color.parseColor("#faf04d"));
binding.listItemLetter.setText("H");
}
if (goal.context() == Context.WORK) {
binding.imageView.setColorFilter(Color.parseColor("#31c7f8"));
binding.listItemLetter.setText("W");
}
if (goal.context() == Context.SCHOOL) {
binding.imageView.setColorFilter(Color.parseColor("#c95bf9"));
binding.listItemLetter.setText("S");
}
if (goal.context() == Context.ERRANDS) {
binding.imageView.setColorFilter(Color.parseColor("#a2cb84"));
binding.listItemLetter.setText("E");
}

/*
Logic for color of the list context icon
*/
if (goal.completed()) {
binding.imageView.setColorFilter(Color.parseColor("#aba8a7"));
}
else {
if (goal.context() == Context.HOME) {
binding.imageView.setColorFilter(Color.parseColor("#faf04d"));
}
if (goal.context() == Context.WORK) {
binding.imageView.setColorFilter(Color.parseColor("#31c7f8"));
}
if (goal.context() == Context.SCHOOL) {
binding.imageView.setColorFilter(Color.parseColor("#c95bf9"));
}
if (goal.context() == Context.ERRANDS) {
binding.imageView.setColorFilter(Color.parseColor("#a2cb84"));
}
}



return binding.getRoot();
}
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/layout/list_item_goal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,16 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.523"
app:tint="@color/black" />

<TextView
android:id="@+id/listItemLetter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="H"
android:textAlignment="center"
android:textColor="#000000"
app:layout_constraintBottom_toBottomOf="@+id/imageView"
app:layout_constraintEnd_toEndOf="@+id/imageView"
app:layout_constraintStart_toStartOf="@+id/imageView"
app:layout_constraintTop_toTopOf="@+id/imageView" />
</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit c1317b2

Please sign in to comment.