Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-235 Vehicle parking system
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2022-235
2022-235 Vehicle parking system
Commits
a0c10949
Commit
a0c10949
authored
Nov 02, 2022
by
chamodya99
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update setup file
parent
bd38f879
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
281 additions
and
0 deletions
+281
-0
app/src/main/java/com/example/vehicleparkingsystem/Login.java
...src/main/java/com/example/vehicleparkingsystem/Login.java
+80
-0
app/src/main/java/com/example/vehicleparkingsystem/Models/BaseURL.java
...java/com/example/vehicleparkingsystem/Models/BaseURL.java
+8
-0
app/src/main/java/com/example/vehicleparkingsystem/Models/Users.java
...n/java/com/example/vehicleparkingsystem/Models/Users.java
+72
-0
app/src/main/java/com/example/vehicleparkingsystem/SQLite/Sqlitedb.java
...ava/com/example/vehicleparkingsystem/SQLite/Sqlitedb.java
+121
-0
No files found.
app/src/main/java/com/example/vehicleparkingsystem/Login.java
0 → 100644
View file @
a0c10949
package
com.example.vehicleparkingsystem
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.CheckBox
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
com.google.android.gms.tasks.OnCompleteListener
;
import
com.google.android.gms.tasks.Task
;
import
com.google.firebase.auth.AuthResult
;
import
com.google.firebase.auth.FirebaseAuth
;
public
class
Login
extends
AppCompatActivity
{
Button
reg
;
EditText
editText1
;
EditText
editText2
;
Button
log
;
CheckBox
checkBox
;
FirebaseAuth
firebaseAuth
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_login
);
editText1
=(
EditText
)
findViewById
(
R
.
id
.
Lemail
);
editText2
=(
EditText
)
findViewById
(
R
.
id
.
Lpass
);
log
=(
Button
)
findViewById
(
R
.
id
.
login
);
reg
=(
Button
)
findViewById
(
R
.
id
.
register
);
checkBox
=(
CheckBox
)
findViewById
(
R
.
id
.
remember
);
firebaseAuth
=
FirebaseAuth
.
getInstance
();
reg
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Intent
intent
=
new
Intent
(
Login
.
this
,
Register
.
class
);
startActivity
(
intent
);
}
});
log
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
final
String
emaill
=
editText1
.
getText
().
toString
();
final
String
passwordd
=
editText2
.
getText
().
toString
();
if
(
emaill
.
isEmpty
())
{
editText1
.
setError
(
"Correct email required"
);
}
if
(
passwordd
.
isEmpty
())
{
editText2
.
setError
(
"Correct Password required"
);
}
else
{
firebaseAuth
.
signInWithEmailAndPassword
(
emaill
,
passwordd
)
.
addOnCompleteListener
(
Login
.
this
,
new
OnCompleteListener
<
AuthResult
>()
{
@Override
public
void
onComplete
(
@NonNull
Task
<
AuthResult
>
task
)
{
if
(
task
.
isSuccessful
())
{
Toast
.
makeText
(
Login
.
this
,
"Successfully sign in"
,
Toast
.
LENGTH_SHORT
).
show
();
Intent
intent
=
new
Intent
(
Login
.
this
,
Dashboard
.
class
);
startActivity
(
intent
);
}
else
{
Toast
.
makeText
(
Login
.
this
,
"Sign in failed"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
});
}
}
});
}
}
\ No newline at end of file
app/src/main/java/com/example/vehicleparkingsystem/Models/BaseURL.java
0 → 100644
View file @
a0c10949
package
com.example.vehicleparkingsystem.Models
;
public
class
BaseURL
{
public
static
String
get_url
(){
return
"http://192.168.43.164:5000/"
;
}
}
app/src/main/java/com/example/vehicleparkingsystem/Models/Users.java
0 → 100644
View file @
a0c10949
package
com.example.vehicleparkingsystem.Models
;
public
class
Users
{
String
name
;
String
email
;
String
age
;
String
phone
;
String
vehicleNumber
;
String
password
;
public
Users
()
{
}
public
Users
(
String
name
,
String
email
,
String
age
,
String
phone
,
String
vehicleNumber
,
String
password
)
{
this
.
name
=
name
;
this
.
email
=
email
;
this
.
age
=
age
;
this
.
phone
=
phone
;
this
.
vehicleNumber
=
vehicleNumber
;
this
.
password
=
password
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getEmail
()
{
return
email
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
public
String
getAge
()
{
return
age
;
}
public
void
setAge
(
String
age
)
{
this
.
age
=
age
;
}
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
public
String
getVehicleNumber
()
{
return
vehicleNumber
;
}
public
void
setVehicleNumber
(
String
vehicleNumber
)
{
this
.
vehicleNumber
=
vehicleNumber
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
}
app/src/main/java/com/example/vehicleparkingsystem/SQLite/Sqlitedb.java
0 → 100644
View file @
a0c10949
package
com.example.vehicleparkingsystem.SQLite
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.database.Cursor
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.widget.Toast
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Locale
;
import
java.util.Map
;
public
class
Sqlitedb
{
private
static
SQLiteDatabase
database
;
private
static
Cursor
cursor
;
private
static
boolean
isBoolean
;
@SuppressLint
(
"WrongConstant"
)
public
static
SQLiteDatabase
sqLiteDatabase
(
Context
context
)
{
try
{
database
=
context
.
openOrCreateDatabase
(
"mydb.db"
,
SQLiteDatabase
.
CREATE_IF_NECESSARY
,
null
);
database
.
setVersion
(
1
);
database
.
setLocale
(
Locale
.
getDefault
());
database
.
setLockingEnabled
(
true
);
return
database
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
database
;
}
public
static
void
CreateTabels
(
Context
context
,
String
TabelName
,
boolean
Drop
,
String
ColumNames
)
{
try
{
SQLiteDatabase
database
=
Sqlitedb
.
sqLiteDatabase
(
context
);
if
(
Drop
)
{
database
.
execSQL
(
"DROP TABLE IF EXISTS "
+
TabelName
);
database
.
execSQL
(
"CREATE TABLE IF NOT EXISTS "
+
TabelName
+
"(ID_No INTEGER PRIMARY KEY AUTOINCREMENT,"
+
ColumNames
+
")"
);
}
else
{
database
.
execSQL
(
"CREATE TABLE IF NOT EXISTS "
+
TabelName
+
"(ID_No INTEGER PRIMARY KEY AUTOINCREMENT,"
+
ColumNames
+
")"
);
}
Toast
.
makeText
(
context
,
"Creating table "
+
TabelName
+
" successful"
,
Toast
.
LENGTH_SHORT
).
show
();
database
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
static
boolean
InsertData
(
Context
context
,
String
TabelName
,
String
Colums
,
String
Data
)
{
try
{
SQLiteDatabase
database
=
Sqlitedb
.
sqLiteDatabase
(
context
);
database
.
execSQL
(
"INSERT INTO "
+
TabelName
+
"("
+
Colums
+
") VALUES ("
+
Data
+
")"
);
System
.
out
.
println
(
"INSERT INTO "
+
TabelName
+
"("
+
Colums
+
") VALUES ("
+
Data
+
")"
);
// Toast.makeText(context, " Data saving successful", Toast.LENGTH_SHORT).show();
database
.
close
();
isBoolean
=
true
;
}
catch
(
Exception
e
)
{
isBoolean
=
false
;
// Toast.makeText(context, " Data saving unsuccessful", Toast.LENGTH_SHORT).show();
e
.
printStackTrace
();
}
return
isBoolean
;
}
public
static
ArrayList
<
Map
<
String
,
String
>>
Search
(
Context
context
,
String
Qury
,
int
colum_count
)
{
ArrayList
<
Map
<
String
,
String
>>
prolist2
=
new
ArrayList
<>();
try
{
SQLiteDatabase
sqLiteDatabase
=
Sqlitedb
.
sqLiteDatabase
(
context
);
cursor
=
sqLiteDatabase
.
rawQuery
(
Qury
,
null
);
cursor
.
moveToFirst
();
if
(
cursor
.
moveToFirst
())
{
for
(
int
i
=
0
;
i
<
cursor
.
getCount
();
i
++)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
for
(
int
j
=
0
;
j
<
colum_count
;
j
++)
{
map
.
put
(
""
+
j
,
cursor
.
getString
(
j
));
}
prolist2
.
add
(
map
);
cursor
.
moveToNext
();
}
}
sqLiteDatabase
.
close
();
System
.
out
.
println
(
prolist2
.
toString
());
return
prolist2
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
prolist2
.
toString
());
return
prolist2
;
}
public
static
void
DeleteData
(
Context
context
,
String
TabelDetail
)
{
try
{
SQLiteDatabase
database
=
Sqlitedb
.
sqLiteDatabase
(
context
);
database
.
execSQL
(
"DELETE FROM "
+
TabelDetail
);
database
.
close
();
Toast
.
makeText
(
context
,
"Item delete successful"
,
Toast
.
LENGTH_SHORT
).
show
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
UpdateData
(
Context
context
,
String
Table_name
,
String
ColumsANDValues
,
String
qury
)
{
try
{
SQLiteDatabase
database
=
Sqlitedb
.
sqLiteDatabase
(
context
);
database
.
execSQL
(
" UPDATE "
+
Table_name
+
" SET "
+
ColumsANDValues
+
" WHERE "
+
qury
);
Toast
.
makeText
(
context
,
"Table "
+
Table_name
+
" Update successful"
,
Toast
.
LENGTH_SHORT
).
show
();
database
.
close
();
System
.
out
.
println
(
" UPDATE "
+
Table_name
+
" SET "
+
ColumsANDValues
+
" WHERE "
+
qury
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment