diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..30aa626 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..99202cc --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..072b145 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..ae5a63a --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,29 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 28 + defaultConfig { + minSdkVersion 19 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:28.0.0-rc01' + implementation 'com.android.support:support-v4:28.0.0-rc01' + implementation 'com.android.support.constraint:constraint-layout:1.1.2' + implementation 'com.android.support:design:28.0.0-rc01' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/hamsoftug/numerickeyboard/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/hamsoftug/numerickeyboard/ExampleInstrumentedTest.java new file mode 100644 index 0000000..685361d --- /dev/null +++ b/app/src/androidTest/java/com/hamsoftug/numerickeyboard/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.hamsoftug.numerickeyboard; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.hamsoftug.numerickeyboard", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..5ee34de --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/hamsoftug/numerickeyboard/Nk_board.java b/app/src/main/java/com/hamsoftug/numerickeyboard/Nk_board.java new file mode 100644 index 0000000..74dadde --- /dev/null +++ b/app/src/main/java/com/hamsoftug/numerickeyboard/Nk_board.java @@ -0,0 +1,191 @@ +package com.hamsoftug.numerickeyboard; + + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.os.Handler; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + + +/** + * A simple {@link Fragment} subclass. + */ +public class Nk_board extends Fragment { + + private static final int DELAY = 500; + + private TextView pass1; + private TextView pass2; + private TextView pass3; + private TextView pass4; + + private int length = 0; + + public interface OnKeyBoard { + void onPasscodeEntered(String pass); + void onOnDeletePressed(); + void onKeyPressed(int value); + } + + private OnKeyBoard listener; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View rootView = inflater.inflate(R.layout.fragment_nk_board, container, false); + + pass1 = rootView.findViewById(R.id.passcode1); + pass2 = rootView.findViewById(R.id.passcode2); + pass3 = rootView.findViewById(R.id.passcode3); + pass4 = rootView.findViewById(R.id.passcode4); + + rootView.findViewById(R.id.one_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + add("1"); + } + }); + rootView.findViewById(R.id.two_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + add("2"); + } + }); + rootView.findViewById(R.id.three_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + add("3"); + } + }); + rootView.findViewById(R.id.four_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + add("4"); + } + }); + rootView.findViewById(R.id.five_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + add("5"); + } + }); + rootView.findViewById(R.id.six_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + add("6"); + } + }); + rootView.findViewById(R.id.seven_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + add("7"); + } + }); + rootView.findViewById(R.id.eight_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + add("8"); + } + }); + rootView.findViewById(R.id.nine_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + add("9"); + } + }); + rootView.findViewById(R.id.zero_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + add("0"); + } + }); + rootView.findViewById(R.id.delete_btn).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + switch (length) { + case 1: + pass1.setText(null); + length--; + break; + case 2: + pass2.setText(null); + length--; + break; + case 3: + pass3.setText(null); + length--; + break; + case 4: + pass4.setText(null); + length--; + } + listener.onOnDeletePressed(); + } + }); + + return rootView; + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + try { + listener = (OnKeyBoard) activity; + } catch (ClassCastException e) { + throw new ClassCastException(activity.toString() + " must implement " + + OnKeyBoard.class); + } + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + + try { + listener = (OnKeyBoard) context; + } catch (ClassCastException e) { + throw new ClassCastException(context.toString() + " must implement " + + OnKeyBoard.class); + } + + } + + private void add(String num) { + listener.onKeyPressed(Integer.parseInt(num)); + switch (length + 1) { + case 1: + pass1.setText(num); + length++; + break; + case 2: + pass2.setText(num); + length++; + break; + case 3: + pass3.setText(num); + length++; + break; + case 4: + pass4.setText(num); + length++; + + new Handler().postDelayed(new Runnable() { + public void run() { + listener.onPasscodeEntered(pass1.getText().toString() + pass2.getText() + + pass3.getText() + pass4.getText()); + pass1.setText(null); + pass2.setText(null); + pass3.setText(null); + pass4.setText(null); + length = 0; + } + }, DELAY); + } + } + +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/numeric_button.xml b/app/src/main/res/drawable/numeric_button.xml new file mode 100644 index 0000000..97b5180 --- /dev/null +++ b/app/src/main/res/drawable/numeric_button.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_nk_board.xml b/app/src/main/res/layout/fragment_nk_board.xml new file mode 100644 index 0000000..20a3c72 --- /dev/null +++ b/app/src/main/res/layout/fragment_nk_board.xml @@ -0,0 +1,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_action_backspace.png b/app/src/main/res/mipmap-hdpi/ic_action_backspace.png new file mode 100644 index 0000000..5980431 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_action_backspace.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a2f5908 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..1b52399 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_action_backspace.png b/app/src/main/res/mipmap-mdpi/ic_action_backspace.png new file mode 100644 index 0000000..2046071 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_action_backspace.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..ff10afd Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..115a4c7 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_action_backspace.png b/app/src/main/res/mipmap-xhdpi/ic_action_backspace.png new file mode 100644 index 0000000..50caef1 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_action_backspace.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..dcd3cd8 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..459ca60 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_action_backspace.png b/app/src/main/res/mipmap-xxhdpi/ic_action_backspace.png new file mode 100644 index 0000000..b4e4a73 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_action_backspace.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..8ca12fe Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..8e19b41 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..b824ebd Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..4c19a13 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..0d6dfbf --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,8 @@ + + + #3F51B5 + #303F9F + #FF4081 + #2E7D32 + #4cc552 + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..1f30928 --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,6 @@ + + + 70dp + 10dp + 16dp + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..5a7e7e2 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,29 @@ + + NumericKeyBoard + Passcode + + + 1 + + + 2 + ABC + 3 + DEF + 4 + GHI + 5 + JKL + 6 + MNO + 7 + PQRS + 8 + TUV + 9 + WXYZ + 0 + + + MainActivity + + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..ea929a8 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,32 @@ + + + + + + + + + +