Skip to content

Commit 009095d

Browse files
committed
#29 Fix
#29 Fix
1 parent 30d555a commit 009095d

File tree

3 files changed

+99
-84
lines changed

3 files changed

+99
-84
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.cooltechworks.creditcarddesign.views;
2+
3+
import android.content.Context;
4+
import android.support.v4.view.ViewPager;
5+
import android.util.AttributeSet;
6+
import android.view.View;
7+
8+
public class HeightWrappingViewPager extends ViewPager {
9+
10+
public HeightWrappingViewPager(Context context) {
11+
super(context);
12+
}
13+
14+
public HeightWrappingViewPager(Context context, AttributeSet attrs) {
15+
super(context, attrs);
16+
}
17+
18+
@Override
19+
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
20+
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
21+
View firstChild = getChildAt(0);
22+
firstChild.measure(widthMeasureSpec, heightMeasureSpec);
23+
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(firstChild.getMeasuredHeight(), MeasureSpec.EXACTLY));
24+
}
25+
}
Lines changed: 59 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,72 @@
1-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools"
3-
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:orientation="vertical"
6-
tools:context=".CardEditActivity">
7-
8-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
9-
xmlns:tools="http://schemas.android.com/tools"
10-
android:id="@+id/parent"
11-
android:layout_width="match_parent"
12-
android:layout_height="wrap_content"
13-
android:orientation="vertical"
14-
tools:context=".CardEditActivity">
15-
16-
<LinearLayout
17-
android:layout_width="match_parent"
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:id="@+id/parent"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content"
6+
android:orientation="vertical"
7+
tools:context=".CardEditActivity">
8+
9+
<LinearLayout
10+
android:layout_width="match_parent"
11+
android:layout_height="wrap_content"
12+
android:orientation="vertical">
13+
14+
<com.cooltechworks.creditcarddesign.CreditCardView
15+
android:id="@+id/credit_card_view"
16+
android:layout_width="wrap_content"
1817
android:layout_height="wrap_content"
19-
android:orientation="vertical">
20-
21-
<com.cooltechworks.creditcarddesign.CreditCardView
22-
android:id="@+id/credit_card_view"
23-
android:layout_width="wrap_content"
24-
android:layout_height="wrap_content"
25-
android:layout_gravity="center"
26-
27-
/>
28-
29-
<android.support.v4.view.ViewPager
30-
android:id="@+id/card_field_container_pager"
31-
android:layout_width="match_parent"
32-
android:layout_height="wrap_content"
33-
android:minHeight="120dp"
34-
android:orientation="horizontal"
35-
>
18+
android:layout_gravity="center"
3619

37-
</android.support.v4.view.ViewPager>
20+
/>
3821

39-
40-
</LinearLayout>
41-
42-
<LinearLayout
22+
<com.cooltechworks.creditcarddesign.views.HeightWrappingViewPager
23+
android:id="@+id/card_field_container_pager"
4324
android:layout_width="match_parent"
4425
android:layout_height="wrap_content"
45-
android:layout_gravity="bottom"
46-
android:layout_marginTop="@dimen/margin_small"
47-
android:orientation="horizontal">
48-
49-
<TextView
50-
android:id="@+id/previous"
51-
android:layout_width="0dp"
52-
android:layout_height="wrap_content"
53-
android:layout_weight="1"
54-
android:background="@color/green_continue"
55-
android:gravity="center"
56-
android:padding="@dimen/padding_normal"
57-
android:text="@string/previous"
58-
android:textColor="@android:color/white"
59-
android:textSize="@dimen/text_size_small"
26+
android:minHeight="120dp"
27+
android:orientation="horizontal"
28+
>
6029

61-
/>
30+
</com.cooltechworks.creditcarddesign.views.HeightWrappingViewPager>
6231

63-
<TextView
64-
android:id="@+id/next"
65-
android:layout_width="0dp"
66-
android:layout_height="wrap_content"
67-
android:layout_weight="1"
68-
android:background="@color/green_continue"
69-
android:gravity="center"
70-
android:padding="@dimen/padding_normal"
71-
android:text="@string/next"
72-
android:textColor="@android:color/white"
73-
android:textSize="@dimen/text_size_small"
7432

75-
/>
76-
</LinearLayout>
33+
</LinearLayout>
7734

35+
<LinearLayout
36+
android:layout_width="match_parent"
37+
android:layout_height="wrap_content"
38+
android:layout_gravity="bottom"
39+
android:layout_marginTop="@dimen/margin_small"
40+
android:orientation="horizontal">
7841

42+
<TextView
43+
android:id="@+id/previous"
44+
android:layout_width="0dp"
45+
android:layout_height="wrap_content"
46+
android:layout_weight="1"
47+
android:background="@color/green_continue"
48+
android:gravity="center"
49+
android:padding="@dimen/padding_normal"
50+
android:text="@string/previous"
51+
android:textColor="@android:color/white"
52+
android:textSize="@dimen/text_size_small"
53+
54+
/>
55+
56+
<TextView
57+
android:id="@+id/next"
58+
android:layout_width="0dp"
59+
android:layout_height="wrap_content"
60+
android:layout_weight="1"
61+
android:background="@color/green_continue"
62+
android:gravity="center"
63+
android:padding="@dimen/padding_normal"
64+
android:text="@string/next"
65+
android:textColor="@android:color/white"
66+
android:textSize="@dimen/text_size_small"
67+
68+
/>
7969
</LinearLayout>
8070

8171

82-
</RelativeLayout>
72+
</LinearLayout>

creditcarddesign/src/main/res/layout/lyt_card_cvv.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

33
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4-
xmlns:app="http://schemas.android.com/apk/res-auto"
5-
android:layout_width="match_parent"
6-
android:layout_height="wrap_content"
7-
android:orientation="vertical"
8-
android:padding="@dimen/padding_small">
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
5+
android:layout_width="match_parent"
6+
android:layout_height="wrap_content"
7+
android:orientation="vertical"
8+
android:padding="@dimen/padding_small">
99

1010
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
11-
xmlns:app="http://schemas.android.com/apk/res-auto"
12-
android:layout_width="match_parent"
13-
android:layout_height="wrap_content"
14-
android:layout_margin="@dimen/margin_small"
15-
android:orientation="vertical"
16-
android:padding="@dimen/margin_small"
17-
app:cardCornerRadius="@dimen/card_radius"
18-
app:cardElevation="@dimen/cardview_default_elevation"
19-
app:cardBackgroundColor="@android:color/white"
20-
app:cardPreventCornerOverlap="false">
11+
xmlns:app="http://schemas.android.com/apk/res-auto"
12+
android:layout_width="match_parent"
13+
android:layout_height="wrap_content"
14+
android:layout_margin="@dimen/margin_small"
15+
android:orientation="vertical"
16+
android:padding="@dimen/margin_small"
17+
app:cardBackgroundColor="@android:color/white"
18+
app:cardCornerRadius="@dimen/card_radius"
19+
app:cardElevation="@dimen/cardview_default_elevation"
20+
app:cardPreventCornerOverlap="false">
2121

2222
<LinearLayout
2323
android:layout_width="match_parent"

0 commit comments

Comments
 (0)