Skip to content

Commit

Permalink
Upload
Browse files Browse the repository at this point in the history
  • Loading branch information
W4W1R3 committed Oct 10, 2023
1 parent 625508c commit d74d5e3
Show file tree
Hide file tree
Showing 183 changed files with 2,729 additions and 1,527 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .idea/.gitignore
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion .idea/compiler.xml
100644 → 100755

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

2 changes: 2 additions & 0 deletions .idea/gradle.xml
100644 → 100755

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

Empty file modified .idea/jarRepositories.xml
100644 → 100755
Empty file.
4 changes: 1 addition & 3 deletions .idea/misc.xml
100644 → 100755

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

Empty file modified .vscode/settings.json
100644 → 100755
Empty file.
Empty file modified app/.gitignore
100644 → 100755
Empty file.
16 changes: 11 additions & 5 deletions app/build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,33 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
namespace 'com.example.intellimills'
buildToolsVersion '34.0.0'
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-auth:22.0.0'
implementation 'com.google.firebase:firebase-auth:22.1.1'
implementation 'com.google.firebase:firebase-database:20.2.2'
testImplementation 'junit:junit:'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

// Add the Firebase SDK dependencies
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:32.1.1')
implementation platform('com.google.firebase:firebase-bom:32.2.2')


// TODO: Add the dependencies for Firebase products you want to use
// When using the BoM, don't specify versions in Firebase dependencies
// https://firebase.google.com/docs/android/setup#available-libraries
implementation platform('com.google.firebase:firebase-bom:28.4.2')
implementation 'com.google.firebase:firebase-analytics'
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics:21.3.0'

// other dependencies may be listed here
testImplementation 'junit:junit:4.13.2' // For JUnit 4
// or
testImplementation 'junit:junit:4.13.2' // For JUnit 5
}
Empty file modified app/google-services.json
100644 → 100755
Empty file.
Empty file modified app/proguard-rules.pro
100644 → 100755
Empty file.
Empty file.
29 changes: 26 additions & 3 deletions app/src/main/AndroidManifest.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Design.Light" >
android:theme="@style/Theme.Design.Light">
<activity
android:name=".DriverLeaveFormActivity"
android:exported="false" />
<activity
android:name=".DriverPickFarmActivity"
android:exported="false"
android:theme="@style/Theme.Design.Light.NoActionBar" />
<activity
android:name=".AdminDashboardActivity"
android:exported="false"
android:theme="@style/Theme.Design.Light.NoActionBar" />
<activity
android:name=".DriverDashboardActivity"
android:exported="false"
android:theme="@style/Theme.Design.Light.NoActionBar" />
<activity
android:name=".DriverSignUpActivity"
android:exported="false"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".DriverLoginActivity"
android:exported="false"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".AdminLogin"
android:exported="true"
Expand Down Expand Up @@ -55,7 +78,7 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.IntelliMills" >
android:theme="@style/Theme.IntelliMills">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Empty file modified app/src/main/ic_launcher-playstore.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.intellimills;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class AdminDashboardActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_dashboard);
}
}
50 changes: 49 additions & 1 deletion app/src/main/java/com/example/intellimills/AdminLogin.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,60 @@

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.content.Intent;

public class AdminLogin extends AppCompatActivity {

// Define hardcoded admin credentials
private static final String ADMIN_USERNAME = "adminintel";
private static final String ADMIN_PASSWORD = "001122";

EditText editemail;
EditText editpasswrd;

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

editemail = findViewById(R.id.editTextTextEmailAddress2);
editpasswrd = findViewById(R.id.editTextTextPassword2);

Button button2 = findViewById(R.id.button2login);
button2.setOnClickListener(view -> loginUser());
}

private void loginUser() {
String email = editemail.getText().toString();
String password = editpasswrd.getText().toString();

if (TextUtils.isEmpty(email)) {
editemail.setError("Email cannot be empty");
editemail.requestFocus();
Toast.makeText(getApplicationContext(), "Please Enter Your Email", Toast.LENGTH_LONG).show();
} else if (TextUtils.isEmpty(password)) {
editpasswrd.setError("Password cannot be empty");
editpasswrd.requestFocus();
Toast.makeText(getApplicationContext(), "Please enter Password.", Toast.LENGTH_LONG).show();
} else {
// Check if the provided credentials match the hardcoded admin credentials
if (email.equals(ADMIN_USERNAME) && password.equals(ADMIN_PASSWORD)) {
// Admin login successful
Toast.makeText(AdminLogin.this, "Admin login successful", Toast.LENGTH_LONG).show();

// Start the AdminDashboardActivity
Intent adminDashboardIntent = new Intent(AdminLogin.this, AdminDashboardActivity.class);
startActivity(adminDashboardIntent);
// Optional: Finish the AdminLoginActivity to prevent going back to it
} else {
// Admin login failed
Toast.makeText(AdminLogin.this, "Admin login failed. Incorrect credentials.", Toast.LENGTH_LONG).show();
}
}
}
}
}
Empty file modified app/src/main/java/com/example/intellimills/Advert.java
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.example.intellimills;

import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class DriverDashboardActivity extends AppCompatActivity {

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

// Get references to the buttons
Button pickHarvestButton = findViewById(R.id.buttonPickHarvest);
Button reportIssueButton = findViewById(R.id.buttonReportIssue);
Button applyLeaveButton = findViewById(R.id.buttonApplyLeave); // Added

// Set OnClickListener for the "Pick a Harvest" button
pickHarvestButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Open the DriverPickFarmActivity when "Pick a Harvest" button is clicked
Intent pickFarmIntent = new Intent(DriverDashboardActivity.this, DriverPickFarmActivity.class);
startActivity(pickFarmIntent);
}
});

// Set OnClickListener for the "Report an Issue" button
reportIssueButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Open the MessagingActivity when "Report an Issue" button is clicked
Intent messagingIntent = new Intent(DriverDashboardActivity.this, Messaging.class);
startActivity(messagingIntent);
}
});

// Set OnClickListener for the "Apply Leave" button (Added)
applyLeaveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Open the DriverLeaveFormActivity when "Apply Leave" button is clicked
Intent applyLeaveIntent = new Intent(DriverDashboardActivity.this, DriverLeaveFormActivity.class);
startActivity(applyLeaveIntent);
}
});

// Rest of your onCreate code...
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.intellimills;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class DriverLeaveFormActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_driver_leave_form);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.example.intellimills;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.content.Intent;
import android.os.Handler;

import com.google.firebase.auth.FirebaseAuth;

public class DriverLoginActivity extends AppCompatActivity {

FirebaseAuth mAuth;
EditText editemail;
EditText editpasswrd;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_driver_login);
editemail =findViewById(R.id.editTextTextEmailAddress2);
editpasswrd = findViewById(R.id.editTextTextPassword2);

// Initialize FirebaseAuth
mAuth = FirebaseAuth.getInstance(); // Add this line to initialize Firebase Authentication

Button signupdriver = findViewById(R.id.signupdriver);
signupdriver.setOnClickListener(view -> {
Toast.makeText(DriverLoginActivity.this, "Loading Driver Sign Up Page." , Toast.LENGTH_LONG).show();

signupdriver.setClickable(false);
new Handler().postDelayed(() -> {
Intent signdrv = new Intent(DriverLoginActivity.this,DriverSignUpActivity.class);
startActivity(signdrv);
finish();
},3000);
});
Button button2 =findViewById(R.id.button2login);
button2.setOnClickListener(view -> loginUser());
}
private void loginUser(){
editemail =findViewById(R.id.editTextTextEmailAddress2);
editpasswrd = findViewById(R.id.editTextTextPassword2);

String email = editemail.getText().toString();
String password =editpasswrd.getText().toString();
Button button2 =findViewById(R.id.button2login);

if (TextUtils.isEmpty(email)){
editemail.setError("Email cannot be empty");
editemail.requestFocus();
Toast.makeText(getApplicationContext(),"Please Enter Your Email",Toast.LENGTH_LONG).show();
}else if (TextUtils.isEmpty(password)){
editpasswrd.setError("Password cannot be empty");
editpasswrd.requestFocus();
Toast.makeText(getApplicationContext(),"Please enter Password.",Toast.LENGTH_LONG).show();
}else{
button2.setClickable(true);
mAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(task -> {
if (task.isSuccessful()){
Toast.makeText(DriverLoginActivity.this, "Welcome.", Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(),"Verifying.......",Toast.LENGTH_LONG).show();
new Handler().postDelayed(() -> {
editemail.setText("");
editpasswrd.setText("");
Intent advert = new Intent(DriverLoginActivity.this, DriverDashboardActivity.class);
startActivity(advert);
finish();

},2000);
}else {
Toast.makeText(DriverLoginActivity.this, "Login Error" +task.getException().getMessage(), Toast.LENGTH_LONG).show();
button2.setClickable(true);
}
});

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.intellimills;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class DriverPickFarmActivity extends AppCompatActivity {

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

0 comments on commit d74d5e3

Please sign in to comment.