The UI of password page changes and shrinks sometimes.
See original GitHub issueActivity File
`import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.Toast;
import com.declaree.declaree.R; import com.kevalpatel.passcodeview.KeyNamesBuilder; import com.kevalpatel.passcodeview.PinView; import com.kevalpatel.passcodeview.indicators.CircleIndicator; import com.kevalpatel.passcodeview.interfaces.AuthenticationListener; import com.kevalpatel.passcodeview.keys.RoundKey;
public class PinActivity extends AppCompatActivity {
private int failureCount = 0;
private boolean success = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pin);
PinView pinView = findViewById(R.id.pin_view);
pinView.setCorrectPin(new int[]{1, 2, 3, 4});
pinView.setKeyNames(new KeyNamesBuilder()
.setKeyOne(this, R.string.key_1)
.setKeyTwo(this, R.string.key_2)
.setKeyThree(this, R.string.key_3)
.setKeyFour(this, R.string.key_4)
.setKeyFive(this, R.string.key_5)
.setKeySix(this, R.string.key_6)
.setKeySeven(this, R.string.key_7)
.setKeyEight(this, R.string.key_8)
.setKeyNine(this, R.string.key_9)
.setKeyZero(this, R.string.key_0));
pinView.setKey(new RoundKey.Builder(pinView)
.setKeyPadding(R.dimen.key_padding)
.setKeyStrokeColorResource(R.color.colorAccent)
.setKeyStrokeWidth(R.dimen.key_stroke_width)
.setKeyTextColorResource(R.color.colorPrimaryDark)
.setKeyTextSize(R.dimen.key_text_size)
.build());
pinView.setIndicator(new CircleIndicator.Builder(pinView)
.setIndicatorRadius(R.dimen.indicator_radius)
.setIndicatorFilledColorResource(R.color.colorPrimaryDark)
.setIndicatorStrokeColorResource(R.color.colorAccent)
.setIndicatorStrokeWidth(R.dimen.indicator_stroke_width)
.build());
pinView.setTitle("Use fingerprint or enter PIN to unlock");
pinView.setAuthenticationListener(new AuthenticationListener() {
@Override
public void onAuthenticationSuccessful() {
//User authenticated successfully.
//Navigate to next screens.
Toast.makeText(PinActivity.this, "Success", Toast.LENGTH_SHORT).show();
success = true;
onBackPressed();
}
@Override
public void onAuthenticationFailed() {
//Calls whenever authentication is failed or user is unauthorized.
//Do something if you want to handle unauthorized user.
failureCount++;
success = false;
if (failureCount > 4)
Toast.makeText(PinActivity.this, "You are logged out as entered wrong password", Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onBackPressed() {
if (success)
super.onBackPressed();
}
} `
UI file code
`<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/logo_dark"
android:visibility="gone"
android:contentDescription="@string/app_name"/>
<com.kevalpatel.passcodeview.PinView
android:id="@+id/pin_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/imageView"
app:dividerColor="@color/colorPrimaryDark"
app:fingerprintDefaultText="Scan your finger to unlock application"
app:fingerprintEnable="true"
app:fingerprintTextColor="@color/colorPrimaryDark"
app:fingerprintTextSize="@dimen/finger_print_text_size"
app:titleTextColor="@android:color/white"/>
</RelativeLayout>
`Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top GitHub Comments
Same issue, can we get an update on this @kevalpatel2106?
Version 1.2.1 released with the fix.
On 06-Feb-2018 8:05 AM, “Mohammed Mansoor” notifications@github.com wrote: