Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
Update Bottom Keyboard Position
Browse files Browse the repository at this point in the history
  • Loading branch information
cash-it committed May 15, 2020
1 parent 5edd267 commit 798cb96
Show file tree
Hide file tree
Showing 35 changed files with 403 additions and 156 deletions.
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/classAnalysis.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/jarAnalysis.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/javaCompile.lock
Binary file not shown.
Binary file modified .gradle/5.4.1/javaCompile/taskHistory.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
13 changes: 9 additions & 4 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,5 @@
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout:1.1.3@aar" level="project" />
<orderEntry type="module" module-name="loginnumber" />
<orderEntry type="module" module-name="loginnumber" />
<orderEntry type="module" module-name="loginnumber" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);

keyboardCashit= findViewById(R.id.keyboard);
keyboardCashit.KeyboardBuilder("Lupa kata sandi?",true,true);
keyboardCashit.KeyboardBuilder("Lupa kata sandi?", true, true, 6);
keyboardCashit.setClickListener(new KeyboardCashit.OnClickListener() {
@Override
public void onFingerClick() {
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/ck_Primary"
android:clickable="true"
android:focusable="true">

<com.vickykdv.loginnumber.KeyboardCashit
android:id="@+id/keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
</com.vickykdv.loginnumber.KeyboardCashit>
android:layout_alignParentBottom="true"
android:layout_centerInParent="false"></com.vickykdv.loginnumber.KeyboardCashit>

</RelativeLayout>
3 changes: 3 additions & 0 deletions loginnumber/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ dependencies {

group='com.github.CASH-IT-Developer'
implementation 'androidx.cardview:cardview:1.0.0'
// implementation 'com.chaos.view:pinview:1.4.2'
implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
3 changes: 3 additions & 0 deletions loginnumber/loginnumber.iml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout-solver:1.1.3@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.cardview:cardview:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.1.0@aar" level="project" />
Expand All @@ -129,5 +130,7 @@
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.github.mukeshsolanki:android-otpview-pinview:2.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout:1.1.3@aar" level="project" />
</component>
</module>
170 changes: 170 additions & 0 deletions loginnumber/src/main/java/com/vickykdv/loginnumber/DottedView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
package com.vickykdv.loginnumber;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

public class DottedView extends View {
/*private static final byte DV_ORIENTATION_HORIZONTAL = 0;
private static final byte DV_ORIENTATION_VERTICAL = 1;
private static final byte DV_ORIENTATION_BOTH = 2;
@IntDef({DV_ORIENTATION_HORIZONTAL,DV_ORIENTATION_VERTICAL,DV_ORIENTATION_BOTH})
@Retention(RetentionPolicy.SOURCE)
public @interface DvOrientation{}
@DvOrientation
public int getDvOrientation(int orientation){
switch (orientation){
case DV_ORIENTATION_HORIZONTAL : return DV_ORIENTATION_HORIZONTAL;
case DV_ORIENTATION_VERTICAL : return DV_ORIENTATION_VERTICAL;
case DV_ORIENTATION_BOTH : return DV_ORIENTATION_BOTH;
default:return DV_ORIENTATION_BOTH;
}
}*/

Paint mDotPaint;
Paint mDotStrokePaint;
Context mContext;

int mDotSize;
int mDotColor;
int mDotHSpace;
int mDotVSpace;
int mDotStrokeColor;
int mDotStrokeWidth;

/*@DvOrientation
int mOrientation;*/


public DottedView(Context context) {
super(context);
initAttrs(context, null);
init(context);
}

public DottedView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initAttrs(context, attrs);
init(context);
}

public DottedView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initAttrs(context, attrs);
init(context);
}

private void initAttrs(Context ctx, AttributeSet attrs) {
int defaultDotSize = ctx.getResources().getDimensionPixelSize(R.dimen.dv_default_dot_size);
int defaultDotColor = ContextCompat.getColor(ctx, R.color.dv_default_dot_color);
int defaultDotHSpace = ctx.getResources().getDimensionPixelSize(R.dimen.dv_default_dot_h_space);
int defaultDotVSpace = ctx.getResources().getDimensionPixelSize(R.dimen.dv_default_dot_v_space);
int defaultDotStrokeColor = ContextCompat.getColor(ctx, R.color.dv_default_dot_stroke_color);
int defaultDotStrokeWidth = ctx.getResources().getDimensionPixelSize(R.dimen.dv_default_dot_stroke_width);
/*int defaultOrientation = DV_ORIENTATION_BOTH;*/

if (attrs != null) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.DottedView);
try {
mDotSize = a.getDimensionPixelSize(R.styleable.DottedView_dv_dotSize, defaultDotSize);
} catch (Exception e) {
mDotSize = defaultDotSize;
}

try {
mDotColor = a.getColor(R.styleable.DottedView_dv_dotColor, defaultDotColor);
} catch (Exception e) {
mDotColor = defaultDotColor;
}

try {
mDotHSpace = a.getDimensionPixelSize(R.styleable.DottedView_dv_dotHSpace, defaultDotHSpace);
} catch (Exception e) {
mDotHSpace = defaultDotHSpace;
}

try {
mDotVSpace = a.getDimensionPixelSize(R.styleable.DottedView_dv_dotVSpace, defaultDotVSpace);
} catch (Exception e) {
mDotVSpace = defaultDotVSpace;
}

try {
mDotStrokeColor = a.getColor(R.styleable.DottedView_dv_dotStrokeColor, defaultDotStrokeColor);
} catch (Exception e) {
mDotStrokeColor = defaultDotStrokeColor;
}

try {
mDotStrokeWidth = a.getDimensionPixelSize(R.styleable.DottedView_dv_dotStrokeWidth, defaultDotStrokeWidth);
} catch (Exception e) {
mDotStrokeWidth = defaultDotStrokeWidth;
}

/*try {
mOrientation = getDvOrientation(a.getInt(R.styleable.DottedView_dv_orientation,defaultOrientation));
} catch (Exception e) {
mOrientation = defaultOrientation;
}*/

//Don't forget this
a.recycle();
} else {
mDotSize = defaultDotSize;
mDotColor = defaultDotColor;
mDotHSpace = defaultDotHSpace;
mDotVSpace = defaultDotVSpace;
mDotStrokeColor = defaultDotStrokeColor;
mDotStrokeWidth = defaultDotStrokeWidth;
/*mOrientation = defaultOrientation;*/
}
}

void init(Context ctx) {
mContext = ctx;

mDotPaint = new Paint();
mDotPaint.setColor(mDotColor);
mDotPaint.setAntiAlias(true);
mDotPaint.setStyle(Paint.Style.FILL);

mDotStrokePaint = new Paint();
mDotStrokePaint.setColor(mDotStrokeColor);
mDotStrokePaint.setStrokeWidth(mDotStrokeWidth);
mDotStrokePaint.setStyle(Paint.Style.STROKE);

}


@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}


@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int width = canvas.getWidth();
int height = canvas.getHeight();

int paddLeft = getPaddingLeft();
int paddRight = getPaddingRight();
int paddTop = getPaddingTop();
int paddBot = getPaddingBottom();

for (int y = (mDotSize / 2) + mDotStrokeWidth + paddLeft; y < height - paddBot; y += mDotSize + mDotVSpace)
for (int x = (mDotSize / 2) + mDotStrokeWidth + paddTop; x < width - paddRight; x += mDotSize + mDotHSpace) {
canvas.drawCircle(x, y, mDotSize / 2, mDotPaint);

if (mDotStrokeWidth != 0)
canvas.drawCircle(x, y, mDotSize / 2, mDotStrokePaint);
}
}
}
Loading

0 comments on commit 798cb96

Please sign in to comment.