Skip to content
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 @@ -8,6 +8,7 @@ public class LifePlayerUiModel {
private final int rotationDegrees;
private final int backgroundColorRes;
private final int foregroundColorRes;
private final int accentBackgroundColorRes;
private final int recentLifeChange;
private final long recentLifeChangeTimestampMs;
private final boolean commanderDamageVisible;
Expand All @@ -25,6 +26,7 @@ public LifePlayerUiModel(
int rotationDegrees,
int backgroundColorRes,
int foregroundColorRes,
int accentBackgroundColorRes,
int recentLifeChange,
long recentLifeChangeTimestampMs,
boolean commanderDamageVisible,
Expand All @@ -40,6 +42,7 @@ public LifePlayerUiModel(
this.rotationDegrees = rotationDegrees;
this.backgroundColorRes = backgroundColorRes;
this.foregroundColorRes = foregroundColorRes;
this.accentBackgroundColorRes = accentBackgroundColorRes;
this.recentLifeChange = recentLifeChange;
this.recentLifeChangeTimestampMs = recentLifeChangeTimestampMs;
this.commanderDamageVisible = commanderDamageVisible;
Expand Down Expand Up @@ -72,6 +75,10 @@ public int getForegroundColorRes() {
return foregroundColorRes;
}

public int getAccentBackgroundColorRes() {
return accentBackgroundColorRes;
}

public int getRecentLifeChange() {
return recentLifeChange;
}
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/com/nicue/onetwo/ui/life/MtgLifeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,19 @@ private void bindPlayerCell(
player.isTimerExpired()
? ContextCompat.getColor(requireContext(), R.color.mtg_expired_foreground)
: ContextCompat.getColor(requireContext(), player.getForegroundColorRes());
int accentBgColor =
player.isTimerExpired()
? ContextCompat.getColor(requireContext(), R.color.mtg_expired_foreground)
: ContextCompat.getColor(
requireContext(), player.getAccentBackgroundColorRes());
int seatIndex = player.getSeatIndex();

ColorStateList accentTint = ColorStateList.valueOf(accentBgColor);
cellBinding.playerColorIndicatorStart.setImageTintList(accentTint);
cellBinding.playerColorIndicatorEnd.setImageTintList(accentTint);
cellBinding.playerColorIndicatorBottomStart.setImageTintList(accentTint);
cellBinding.playerColorIndicatorBottomEnd.setImageTintList(accentTint);

TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(
cellBinding.tvLifeCount,
20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ private void updateUiState() {
getRotationForSeat(seatIndex, totalPlayers),
getBackgroundColorResForSeat(seatIndex),
getForegroundColorResForSeat(seatIndex),
getAccentBackgroundColorResForSeat(seatIndex),
recentLifeChange,
recentLifeChangeTimestampMs,
commanderDamageEnabled && totalPlayers > 1,
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_corner_bracket.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:strokeColor="#FFFFFF"
android:strokeWidth="4"
android:strokeLineCap="round"
android:strokeLineJoin="round"
android:pathData="M 4,24 L 4,4 L 24,4" />
</vector>
40 changes: 40 additions & 0 deletions app/src/main/res/layout/life_player_cell.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,46 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@+id/player_color_indicator_start"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="0dp"
android:src="@drawable/ic_corner_bracket"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<ImageView
android:id="@+id/player_color_indicator_end"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="0dp"
android:src="@drawable/ic_corner_bracket"
android:scaleX="-1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

<ImageView
android:id="@+id/player_color_indicator_bottom_start"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="0dp"
android:src="@drawable/ic_corner_bracket"
android:scaleY="-1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<ImageView
android:id="@+id/player_color_indicator_bottom_end"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="0dp"
android:src="@drawable/ic_corner_bracket"
android:scaleX="-1"
android:scaleY="-1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/inner_player_layout"
android:layout_width="0dp"
Expand Down
Loading