Merge pull request #197 from brarcher/layout-changes

Layout changes for new card view layout
This commit is contained in:
Branden Archer
2018-02-10 13:49:22 -05:00
committed by GitHub
11 changed files with 86 additions and 17 deletions

View File

@@ -27,6 +27,7 @@ android {
disable "ButtonStyle"
disable "AlwaysShowAction"
disable "MissingTranslation"
disable "MissingPrefix"
}
// Starting with Android Studio 3 Robolectric is unable to find resources.
@@ -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'

View File

@@ -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;
@@ -67,8 +69,10 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
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);
}
@@ -112,10 +116,21 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
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)

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -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"
@@ -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"/>

View File

@@ -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>

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 62 KiB