Skip to content

Commit 63d810c

Browse files
committed
[swap] Use Paystak's PinPad to collect PIN
1 parent 2cdae83 commit 63d810c

2 files changed

Lines changed: 23 additions & 41 deletions

File tree

paystack/src/main/java/co/paystack/android/ui/PinActivity.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22

33
import android.os.Bundle;
44
import android.support.v7.app.AppCompatActivity;
5-
import android.view.View;
6-
import android.widget.Button;
75

8-
import com.alimuzaffar.lib.pin.PinEntryEditText;
6+
import co.paystack.android.design.widget.PinPadView;
97

108
import co.paystack.android.R;
119

1210
public class PinActivity extends AppCompatActivity {
1311

14-
private Button continueButton;
15-
private PinEntryEditText pinEntryView;
12+
private PinPadView pinpadView;
1613

1714
@Override
1815
protected void onCreate(Bundle savedInstanceState) {
@@ -24,22 +21,21 @@ protected void onCreate(Bundle savedInstanceState) {
2421
@Override
2522
protected void onResume() {
2623
super.onResume();
27-
continueButton = (Button) findViewById(R.id.continueButton);
2824

29-
pinEntryView = (PinEntryEditText) findViewById(R.id.pinEntryView);
30-
31-
continueButton.setOnClickListener(new View.OnClickListener() {
25+
pinpadView = (PinPadView) findViewById(R.id.pinpadView);
3226

27+
pinpadView.setOnCompletedListener(new PinPadView.OnCompletedListener() {
3328
@Override
34-
public void onClick(View view) {
29+
public void onCompleted(String pin) {
3530
PinSingleton si = PinSingleton.getInstance();
3631
synchronized (si) {
37-
si.setPin(pinEntryView.getText().toString());
32+
si.setPin(pin);
3833
si.notify();
3934

4035
}
4136
PinActivity.this.finish();
4237
}
4338
});
39+
4440
}
4541
}
Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,29 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout
2+
<FrameLayout
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
xmlns:tools="http://schemas.android.com/tools"
5+
xmlns:app="http://schemas.android.com/apk/res-auto"
56

6-
android:orientation="vertical"
77
android:layout_width="match_parent"
88
android:layout_height="match_parent"
99
android:paddingBottom="@dimen/activity_vertical_margin"
10-
android:paddingLeft="@dimen/activity_horizontal_margin"
11-
android:paddingRight="@dimen/activity_horizontal_margin"
1210
android:paddingTop="@dimen/activity_vertical_margin"
1311
tools:context=".ui.PinActivity">
1412

15-
<TextView
16-
android:id="@+id/pinPrompt"
13+
<co.paystack.android.design.widget.PinPadView
14+
android:id="@+id/pinpadView"
1715
android:layout_width="match_parent"
18-
android:layout_height="wrap_content"
19-
android:layout_marginLeft="@dimen/paystack_____view____margin"
20-
android:layout_marginRight="@dimen/paystack_____view____margin"
21-
android:gravity="center"
22-
android:padding="@dimen/paystack_____view____margin"
23-
android:text="To confirm that you are the owner of this card please enter your card PIN" />
24-
25-
<com.alimuzaffar.lib.pin.PinEntryEditText
26-
android:id="@+id/pinEntryView"
27-
android:layout_width="match_parent"
28-
android:layout_height="wrap_content"
29-
android:layout_marginLeft="@dimen/paystack_____view____margin"
30-
android:layout_marginRight="@dimen/paystack_____view____margin"
31-
android:padding="@dimen/paystack_____view____margin" />
32-
33-
<Button
34-
android:id="@+id/continueButton"
35-
android:layout_width="match_parent"
36-
android:layout_height="wrap_content"
37-
android:layout_marginLeft="@dimen/paystack_____view____margin"
38-
android:layout_marginRight="@dimen/paystack_____view____margin"
39-
android:padding="@dimen/paystack_____view____margin"
40-
android:text="Continue" />
16+
android:layout_height="match_parent"
17+
android:layout_weight="2"
18+
android:background="#292929"
19+
app:text_prompt="To confirm you're the owner of this card, please enter your card pin"
20+
app:prompt_textsize="15sp"
21+
app:button_numeric_textsize="17sp"
22+
app:button_alpha_textsize="8sp"
23+
app:button_drawable_size="24dp"
24+
app:pin_length="4"
25+
app:pin_indicator_stroke_width="1dp"
26+
app:text_color="@android:color/holo_blue_bright"/>
4127

4228

43-
</LinearLayout>
29+
</FrameLayout>

0 commit comments

Comments
 (0)