Skip to content

Commit

Permalink
Show capacity and set/rarity crypt card information
Browse files Browse the repository at this point in the history
Initial implementation of #37
  • Loading branch information
franciscojunior committed Mar 3, 2017
1 parent 9f4efc2 commit 87d548b
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/src/main/java/name/vampidroid/CryptCardDetailsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class CryptCardDetailsActivity extends AppCompatActivity {
private CompositeSubscription subscriptions;
private String shareSubject;
private String shareBody;
private String cardSetRarity;
private String cardCapacity;


@Override
Expand Down Expand Up @@ -189,6 +191,8 @@ private void setupDisciplineImagesArray() {
private void setupCardData() {

final TextView txtCardText = (TextView) findViewById(R.id.cardText);
final TextView txtCardCapacity = (TextView) findViewById(R.id.txtCardCapacity);
final TextView txtCardSetRarity = (TextView) findViewById(R.id.txtCardSetRarity);

cardDetailsViewModel = ((VampiDroidApplication)getApplication()).getCardDetailsViewModel(getIntent().getExtras().getLong("cardId"));

Expand All @@ -202,9 +206,9 @@ public Observable<Pair<Pair<BitmapDrawable, Palette>, Drawable[]>> call(Cursor c
String cardClan = c.getString(2);
cardDisciplines = c.getString(3);
cardText = c.getString(4);
String cardCapacity = c.getString(5);
cardCapacity = c.getString(5);
String cardArtist = c.getString(6);
String cardSetRarity = c.getString(7);
cardSetRarity = c.getString(7);
String cardGroup = c.getString(8);
cardAdvanced = c.getString(9);
c.close();
Expand Down Expand Up @@ -239,20 +243,25 @@ public void call(Pair<Pair<BitmapDrawable, Palette>, Drawable[]> data) {

collapsingToolbarLayout.setTitle(cardName);
txtCardText.setText(cardText);
txtCardCapacity.setText(cardCapacity);
txtCardSetRarity.setText(cardSetRarity);


cardImage.setImageDrawable(imageDrawable);

final TextView txtDisciplinesLabel = (TextView) findViewById(R.id.textCardDisciplines);
final TextView txtTextLabel = (TextView) findViewById(R.id.textCardText);
final TextView txtCapacityLabel = (TextView) findViewById(R.id.txtCapacityLabel);
final TextView txtSetRarityLabel = (TextView) findViewById(R.id.txtSetRarityLabel);


final int paletteColor = palette.getVibrantColor(ContextCompat.getColor(CryptCardDetailsActivity.this, R.color.colorAccent));


txtDisciplinesLabel.setTextColor(paletteColor);
txtTextLabel.setTextColor(paletteColor);

txtCapacityLabel.setTextColor(paletteColor);
txtSetRarityLabel.setTextColor(paletteColor);

// Reference: http://stackoverflow.com/questions/30966222/change-color-of-floating-action-button-from-appcompat-22-2-0-programmatically
// fab.setBackgroundTintList(ColorStateList.valueOf(palette.getVibrantColor(defaultColor)));
Expand Down
23 changes: 23 additions & 0 deletions app/src/main/res/layout/card_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,29 @@
</RelativeLayout>
</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:id="@+id/cardViewCardCapacity"
card_view:cardUseCompatPadding="true"
android:layout_below="@id/cardViewDisciplines">

<include layout="@layout/card_details_capacity" />

</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:id="@+id/cardViewCardSetRarity"
card_view:cardUseCompatPadding="true"
android:layout_below="@id/cardViewCardCapacity">

<include layout="@layout/card_details_set_rarity" />

</android.support.v7.widget.CardView>


</RelativeLayout>
Expand Down
35 changes: 35 additions & 0 deletions app/src/main/res/layout/card_details_capacity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp">

<TextView
android:id="@+id/txtCapacityLabel"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Capacity"
android:textColor="@color/colorAccent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/txtCardCapacity"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:fontFamily="sans-serif-condensed"
android:text="4"
app:layout_constraintLeft_toLeftOf="@+id/txtCapacityLabel"
app:layout_constraintTop_toBottomOf="@+id/txtCapacityLabel" />

</android.support.constraint.ConstraintLayout>
35 changes: 35 additions & 0 deletions app/src/main/res/layout/card_details_set_rarity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp">

<TextView
android:id="@+id/txtSetRarityLabel"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Set/Rarity"
android:textColor="@color/colorAccent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/txtCardSetRarity"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="sans-serif-condensed"
android:text="FN:U2"
app:layout_constraintTop_toBottomOf="@+id/txtSetRarityLabel"
android:layout_marginLeft="16dp"
app:layout_constraintLeft_toLeftOf="@+id/txtSetRarityLabel"
android:layout_marginStart="16dp" />

</android.support.constraint.ConstraintLayout>

0 comments on commit 87d548b

Please sign in to comment.