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

Updated fragment_dashboard.xml #18

Open
wants to merge 4 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
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ android {
}

dependencies {

implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment:2.7.4'
implementation 'androidx.navigation:navigation-ui:2.7.4'
testImplementation 'junit:junit:4.13.2'
implementation 'io.github.chaosleung:pinview:1.4.4'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@
tools:targetApi="31" >
<activity
android:name=".SignUpPage"
android:exported="false" />
<activity
android:name=".DashboardActivity"
android:exported="true"
android:parentActivityName=".SignUpPage" >
<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" />
<activity android:name=".DashboardActivity"/>
</application>

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

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
Expand All @@ -17,19 +19,19 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().hide();
setContentView(R.layout.activity_dashboard);

bottomNavigationView = findViewById(R.id.bottom_navigation);
bottomNavigationView = findViewById(R.id.bottom_navigation_view);
bottomNavigationView.setOnNavigationItemSelectedListener(item -> {
switch (item.getItemId()) {
case R.id.home_screen:
case R.id.homeFragment:
loadFragment(new HomeFragment());
return true;
case R.id.candidate_list:
case R.id.candidateListFragment:
loadFragment(new CandidateListFragment());
return true;
case R.id.election_list:
case R.id.electionListFragment:
loadFragment(new ElectionListFragment());
return true;
case R.id.dashboard:
case R.id.dashboardFragment:
loadFragment(new DashboardFragment());
return true;
default:
Expand All @@ -43,7 +45,7 @@ protected void onCreate(Bundle savedInstanceState) {
private void loadFragment(Fragment fragment) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.replace(R.id.fragment_holder, fragment);
transaction.replace(R.id.nav_fragment, fragment);
transaction.addToBackStack(null);
transaction.commit();
}
Expand Down
72 changes: 29 additions & 43 deletions app/src/main/java/com/example/votingapp/Verification_page.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,74 +18,60 @@

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

Button verifyButton;

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

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

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

verifyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDialog();
}
});

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);
}



// Remove showDialog() call here
}

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){


public void afterTextChanged(Editable editable) {
}


});


}

private void click(View view) {
Dialog dialog=new Dialog(this);
private void showDialog() {
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.custom_dialog);
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
Button button1 = dialog.findViewById(R.id.button); // Use dialog's view
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
navigate();
}
});
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
dialog.setCancelable(true);
dialog.show();
}






private void navigate() {
Intent intent = new Intent(this, DashboardActivity.class);
startActivity(intent);
}
}
28 changes: 16 additions & 12 deletions app/src/main/res/layout/activity_dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@
android:layout_height="match_parent"
tools:context=".DashboardActivity">


<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_holder"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
app:layout_constraintEnd_toEndOf="parent"
android:id="@+id/nav_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation_view" />


<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:id="@+id/bottom_navigation_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background= "#0A2472"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/fragment_holder"
app:menu="@menu/layout_nav" />

app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:itemIconTint="@color/white"
app:menu="@menu/bottom_nav"/>

</androidx.constraintlayout.widget.ConstraintLayout>
30 changes: 13 additions & 17 deletions app/src/main/res/layout/fragment_dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,41 +69,37 @@
android:id="@+id/kedarDashboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="86dp"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="139dp"
android:layout_marginBottom="600dp"
android:layout_marginEnd="180dp"

android:layout_marginBottom="2dp"
android:text="@string/kedar"
android:textColor="#000000"
android:textFontWeight="800"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/timePeriod"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constLayoutDashboard"
app:layout_constraintVertical_bias="0.0" />
app:layout_constraintStart_toEndOf="@+id/circleDashboard"
app:layout_constraintTop_toBottomOf="@+id/constLayoutDashboard" />

<TextView
android:id="@+id/timePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="86dp"
android:layout_marginTop="44dp"
android:layout_marginEnd="150dp"
android:layout_marginBottom="595dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"

android:layout_marginEnd="250dp"
android:layout_marginBottom="29dp"
android:text="@string/timePeriod"
android:textColor="#6E7B96"
android:textFontWeight="600"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/cardView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constLayoutDashboard"
app:layout_constraintVertical_bias="0.2" />
app:layout_constraintStart_toEndOf="@+id/circleDashboard"
app:layout_constraintTop_toBottomOf="@+id/kedarDashboard" />

<androidx.cardview.widget.CardView
android:id="@+id/cardView"
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/fragment_election_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="38dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="37dp"
android:layout_marginBottom="635dp"
android:layout_marginBottom="680dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
20 changes: 20 additions & 0 deletions app/src/main/res/menu/bottom_nav.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/homeFragment"
android:title=""
android:icon="@drawable/home_selector"/>
<item
android:id="@+id/candidateListFragment"
android:title=""
android:icon="@drawable/candidate_list_selector"/>
<item
android:id="@+id/electionListFragment"
android:title=""
android:icon="@drawable/election_list_selector"/>
<item
android:id="@+id/dashboardFragment"
android:title=""
android:icon="@drawable/dashboard_selector"/>
</menu>
21 changes: 0 additions & 21 deletions app/src/main/res/menu/layout_nav.xml

This file was deleted.