Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made verification page of app #2

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/compiler.xml

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

1 change: 1 addition & 0 deletions .idea/gradle.xml

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

3 changes: 1 addition & 2 deletions .idea/misc.xml

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

3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

android {
compileSdk 33
compileSdk 34

defaultConfig {
applicationId "com.example.votingapp"
Expand Down Expand Up @@ -33,6 +33,7 @@ dependencies {
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
implementation 'io.github.chaosleung:pinview:1.4.4'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
11 changes: 8 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@
android:theme="@style/Theme.VotingApp"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
android:name=".LoginPage"
android:exported="true"
android:parentActivityName=".LoginPage">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Verification_page"
android:exported="true"
android:windowSoftInputMode="adjustResize"/>

</application>

</manifest>
42 changes: 42 additions & 0 deletions app/src/main/java/com/example/votingapp/LoginPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.example.votingapp;

import static com.example.votingapp.R.id.signin;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class LoginPage extends AppCompatActivity{
Button button;
Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
getSupportActionBar().hide();
button =findViewById(signin);
button.setOnClickListener(this::click);



}

public void click(View view) {
Intent intent = new Intent(this, Verification_page.class);

startActivity(intent);
}
// public View.OnClickListener click(){
// Intent intent = new Intent(this, Verification_page.class);
//
// startActivity(intent);
//
// return null;
// }



}
91 changes: 91 additions & 0 deletions app/src/main/java/com/example/votingapp/Verification_page.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package com.example.votingapp;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.Toast;

import com.chaos.view.PinView;

public class Verification_page extends AppCompatActivity {
PinView pinView;
Button button;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_verification_page);

Intent intent=getIntent();
getSupportActionBar().hide();

pinView=findViewById(R.id.pinView);
button=findViewById(R.id.button1);
pinView.requestFocus();
InputMethodManager inputMethodManager=(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,InputMethodManager.HIDE_IMPLICIT_ONLY);

pinView.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if(charSequence.toString().length()==6 ){
button.setOnClickListener(this::btn_click);

}
else{
button.setOnClickListener(this::show);
}



}

private void btn_click(View view) {
click(view);
}
private void show(View view){
Toast.makeText(Verification_page.this, "Please enter the pin", Toast.LENGTH_SHORT).show();
}


@Override
public void afterTextChanged(Editable editable){


}


});


}

private void click(View view) {
Dialog dialog=new Dialog(this);
dialog.setContentView(R.layout.custom_dialog);
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
dialog.setCancelable(true);
dialog.show();
}






}
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@color/white" />
<stroke android:width="7dp" android:color="@color/white" />
<corners android:radius="30dp" />
</shape>
</item>
</layer-list>
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/edittext_cursor.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:ignore="ExtraText">
android:shape="rectangle" >
<size
android:width="1dp" />
<solid
android:color="@color/black" />

</shape>
Binary file added app/src/main/res/drawable/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/img1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/login_circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#1A43BF">
</solid>

</shape>
Binary file added app/src/main/res/drawable/login_pic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/font/nuniot2.ttf
Binary file not shown.
Binary file added app/src/main/res/font/nunito.ttf
Binary file not shown.
Binary file added app/src/main/res/font/signika.ttf
Binary file not shown.
Loading