Skip to content

Commit

Permalink
Merge pull request #197 from brarcher/layout-changes
Browse files Browse the repository at this point in the history
Layout changes for new card view layout
  • Loading branch information
brarcher authored Feb 10, 2018
2 parents 017d97d + abfcf9d commit be0c250
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 17 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ android {
disable "ButtonStyle"
disable "AlwaysShowAction"
disable "MissingTranslation"
disable "MissingPrefix"
}

// Starting with Android Studio 3 Robolectric is unable to find resources.
Expand All @@ -45,9 +46,11 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:design:27.0.2'
compile 'com.android.support:support-v4:27.0.2'
compile 'com.journeyapps:zxing-android-embedded:3.5.0@aar'
compile 'com.google.zxing:core:3.3.0'
compile 'org.apache.commons:commons-csv:1.5'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile group: 'com.google.guava', name: 'guava', version: '20.0'
compile 'com.github.apl-devs:appintro:v4.2.0'
testCompile 'junit:junit:4.12'
Expand Down
21 changes: 18 additions & 3 deletions app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
private static final String TAG = "CardLocker";

TextView cardIdFieldView;
TextView noteView;
View noteViewDivider;
TextView storeName;
ImageView barcodeImage;
ImageView storeLogo;
View collapsingToolbarLayout;
int loyaltyCardId;
boolean rotationEnabled;
Expand Down Expand Up @@ -67,8 +69,10 @@ protected void onCreate(Bundle savedInstanceState)
db = new DBHelper(this);

cardIdFieldView = findViewById(R.id.cardIdView);
noteView = findViewById(R.id.noteView);
noteViewDivider = findViewById(R.id.noteViewDivider);
storeName = findViewById(R.id.storeName);
barcodeImage = findViewById(R.id.barcode);
storeLogo = findViewById(R.id.storeLogo);
collapsingToolbarLayout = findViewById(R.id.collapsingToolbarLayout);
}

Expand Down Expand Up @@ -112,10 +116,21 @@ public void onResume()

cardIdFieldView.setText(loyaltyCard.cardId);

if(loyaltyCard.note.length() > 0)
{
noteView.setText(loyaltyCard.note);
}
else
{
noteView.setVisibility(View.GONE);
noteViewDivider.setVisibility(View.GONE);
}

storeName.setText(loyaltyCard.store);

int cardViewLetterFontSize = getResources().getDimensionPixelSize(R.dimen.cardViewLetterFontSize);
int pixelSize = getResources().getDimensionPixelSize(R.dimen.cardThumbnailSizeLarge);
LetterBitmap letterBitmap = new LetterBitmap(this, loyaltyCard.store, loyaltyCard.store, cardViewLetterFontSize, pixelSize, pixelSize);
storeLogo.setImageBitmap(letterBitmap.getLetterTile());
collapsingToolbarLayout.setBackgroundColor(letterBitmap.getBackgroundColor());

if(barcodeImage.getHeight() == 0)
Expand Down
Binary file modified app/src/main/res/drawable-hdpi/intro4_image.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 modified app/src/main/res/drawable-mdpi/intro4_image.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 modified app/src/main/res/drawable-xhdpi/intro4_image.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 modified app/src/main/res/drawable-xxhdpi/intro4_image.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 modified app/src/main/res/drawable-xxxhdpi/intro4_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 60 additions & 14 deletions app/src/main/res/layout/loyalty_card_view_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,75 @@
android:layout_height="fill_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<LinearLayout
<android.support.constraint.ConstraintLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.constraint.Guideline
android:id="@+id/centerGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5"/>

<ImageView
android:id="@+id/barcode"
android:layout_width="fill_parent"
android:layout_height="0.0px"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="20.0dip"
android:layout_marginBottom="10.0dip"
android:layout_weight="0.1"
android:layout_gravity="center_horizontal"
app:layout_constraintBottom_toTopOf="@+id/centerGuideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:contentDescription="@string/barcodeImageDescription"/>

<TextView
android:id="@+id/cardIdView"
android:textSize="42.0sp"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginLeft="10.0dip"
android:layout_marginRight="10.0dip"
android:maxLines="1"
android:layout_weight="0.1"
app:layout_constraintTop_toBottomOf="@id/centerGuideline"
app:layout_constraintBottom_toTopOf="@+id/noteViewDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:textAlignment="center"
app:autoSizeTextType="uniform"
app:autoSizeMinTextSize="@dimen/singleCardCardIdTextSizeMin"
app:autoSizeMaxTextSize="@dimen/singleCardCardIdTextSizeMax"
android:ellipsize="end"
android:text="1234567890"/>
android:textIsSelectable="true"/>

</LinearLayout>
<View
android:id="@id/noteViewDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/black"
app:layout_constraintTop_toBottomOf="@id/cardIdView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="@id/noteView"
/>

<TextView
android:id="@+id/noteView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10.0dip"
android:ellipsize="end"
android:layout_gravity="bottom"
app:layout_constraintTop_toBottomOf="@id/noteViewDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:autoSizeTextType="uniform"
app:autoSizeMinTextSize="@dimen/singleCardNoteTextSizeMin"
app:autoSizeMaxTextSize="@dimen/singleCardNoteTextSizeMax"
android:textIsSelectable="true"/>

</android.support.constraint.ConstraintLayout>

<View
android:id="@+id/drop_shadow_actionbar"
Expand Down Expand Up @@ -73,10 +113,16 @@
app:expandedTitleMarginEnd="64dp"
app:contentScrim="?colorPrimary"
app:expandedTitleGravity="top">
<ImageView
android:id="@+id/storeLogo"
<TextView
android:id="@+id/storeName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@android:color/white"
android:textSize="40sp"
android:textAlignment="center"
android:layout_gravity="center"
android:layout_marginTop="?actionBarSize"
app:layout_collapseMode="parallax"
android:fitsSystemWindows="true"/>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
<dimen name="storeNameTextSize">28sp</dimen>
<dimen name="noteTextSize">14sp</dimen>

<dimen name="singleCardCardIdTextSizeMin">15sp</dimen>
<dimen name="singleCardCardIdTextSizeMax">50sp</dimen>
<dimen name="singleCardNoteTextSizeMin">25sp</dimen>
<dimen name="singleCardNoteTextSizeMax">50sp</dimen>

<dimen name="inputBorderThickness">2dip</dimen>
<dimen name="inputBorderDividerThickness">4dip</dimen>
<dimen name="inputPadding">20dip</dimen>
Expand Down
Binary file modified metadata/en-US/images/phoneScreenshots/screenshot-03.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 modified metadata/en-US/images/phoneScreenshots/screenshot-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit be0c250

Please sign in to comment.