Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Booking App COM5007
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
austin.blanke
Booking App COM5007
Commits
97555dfb
Commit
97555dfb
authored
May 27, 2023
by
austin.blanke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Performance List In progress
parent
e689cc5e
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
257 additions
and
23 deletions
+257
-23
gradle.xml
.idea/gradle.xml
+1
-0
DatabaseConnector.java
...om/example/bookingapp_austinblanke/DatabaseConnector.java
+144
-20
MainActivity.java
...ava/com/example/bookingapp_austinblanke/MainActivity.java
+24
-3
MyAdapter.java
...n/java/com/example/bookingapp_austinblanke/MyAdapter.java
+39
-0
MyViewHolder.java
...ava/com/example/bookingapp_austinblanke/MyViewHolder.java
+16
-0
performace.xml
app/src/main/res/layout/performace.xml
+31
-0
refs.xml
app/src/main/res/values/refs.xml
+2
-0
No files found.
.idea/gradle.xml
View file @
97555dfb
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"GradleMigrationSettings"
migrationVersion=
"1"
/>
<component
name=
"GradleSettings"
>
<component
name=
"GradleSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<option
name=
"linkedExternalProjectsSettings"
>
<GradleProjectSettings>
<GradleProjectSettings>
...
...
app/src/main/java/com/example/bookingapp_austinblanke/DatabaseConnector.java
View file @
97555dfb
...
@@ -8,38 +8,135 @@ import android.database.sqlite.SQLiteOpenHelper;
...
@@ -8,38 +8,135 @@ import android.database.sqlite.SQLiteOpenHelper;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
java.util.ArrayList
;
public
class
DatabaseConnector
extends
SQLiteOpenHelper
{
public
class
DatabaseConnector
extends
SQLiteOpenHelper
{
private
static
final
String
DB_NAME
=
"Registration.db"
;
private
static
final
String
DB_NAME
=
"Registration.db"
;
private
static
final
int
DB_VERSION
=
1
;
private
static
final
int
DB_VERSION
=
1
;
private
static
final
String
TABLE_USERS
=
"Users"
;
private
static
final
String
TABLE_USERS
=
"Users"
;
private
static
final
String
COLUMN_UID
=
"uid"
;
private
static
final
String
COLUMN_UID
=
"uid"
;
private
static
final
String
COLUMN_USERNAME
=
"username"
;
private
static
final
String
COLUMN_USERNAME
=
"username"
;
private
static
final
String
COLUMN_PASSWORD
=
"password"
;
private
static
final
String
COLUMN_PASSWORD
=
"password"
;
public
DatabaseConnector
(
Context
context
,
SQLiteDatabase
.
CursorFactory
factory
)
private
static
final
String
TABLE_PERFORMANCES
=
"performances"
;
{
private
static
final
String
COLUMN_PERFORMANCEID
=
"performanceID"
;
private
static
final
String
COLUMN_NAME
=
"name"
;
private
static
final
String
COLUMN_DATE
=
"date"
;
private
static
final
String
COLUMN_TIME
=
"time"
;
private
static
final
String
COLUMN_VENUE
=
"venue"
;
private
static
final
String
COLUMN_FLASH
=
"flash"
;
private
static
final
String
COLUMN_WHEELCHAIR
=
"wheelchair"
;
private
static
final
String
COLUMN_STEPS
=
"steps"
;
private
static
final
String
COLUMN_TICSEAT
=
"ticSeat"
;
private
static
final
String
COLUMN_TICSTAND
=
"ticStand"
;
private
static
final
String
COLUMN_TICSTAGE
=
"ticStage"
;
private
static
final
String
COLUMN_TICGRASS
=
"ticGrass"
;
private
static
final
String
COLUMN_TICBOATA
=
"ticBoatA"
;
private
static
final
String
COLUMN_TICBOATB
=
"ticBoatB"
;
private
static
final
String
COLUMN_TICRIVERBANK
=
"ticRiverBank"
;
private
static
final
String
COLUMN_TICINNERCIRCLE
=
"ticInnerCircle"
;
private
static
final
String
COLUMN_TICOUTTERCIRCLE
=
"ticOutterCircle"
;
public
DatabaseConnector
(
Context
context
,
SQLiteDatabase
.
CursorFactory
factory
)
{
super
(
context
,
DB_NAME
,
factory
,
DB_VERSION
);
super
(
context
,
DB_NAME
,
factory
,
DB_VERSION
);
}
}
@Override
@Override
public
void
onCreate
(
SQLiteDatabase
db
)
{
public
void
onCreate
(
SQLiteDatabase
db
)
{
String
CREATE_table
=
"CREATE TABLE "
+
TABLE_USERS
+
"("
+
String
CREATE_table
1
=
"CREATE TABLE "
+
TABLE_USERS
+
"("
+
COLUMN_UID
+
" INTEGER PRIMARY KEY, "
+
COLUMN_UID
+
" INTEGER PRIMARY KEY, "
+
COLUMN_USERNAME
+
" TEXT, "
+
COLUMN_USERNAME
+
" TEXT, "
+
COLUMN_PASSWORD
+
" TEXT)"
;
COLUMN_PASSWORD
+
" TEXT)"
;
db
.
execSQL
(
CREATE_table
);
db
.
execSQL
(
CREATE_table1
);
String
CREATE_table2
=
"CREATE TABLE "
+
TABLE_PERFORMANCES
+
"("
+
COLUMN_PERFORMANCEID
+
" INTEGER PRIMARY KEY, "
+
COLUMN_NAME
+
" TEXT, "
+
COLUMN_DATE
+
" TEXT, "
+
COLUMN_TIME
+
" TEXT, "
+
COLUMN_VENUE
+
" TEXT, "
+
COLUMN_FLASH
+
" TEXT, "
+
COLUMN_WHEELCHAIR
+
" TEXT, "
+
COLUMN_STEPS
+
" TEXT, "
+
COLUMN_TICSEAT
+
" TEXT, "
+
COLUMN_TICSTAND
+
" TEXT, "
+
COLUMN_TICSTAGE
+
" TEXT, "
+
COLUMN_TICGRASS
+
" TEXT, "
+
COLUMN_TICBOATA
+
" TEXT, "
+
COLUMN_TICBOATB
+
" TEXT, "
+
COLUMN_TICRIVERBANK
+
" TEXT, "
+
COLUMN_TICINNERCIRCLE
+
" TEXT, "
+
COLUMN_TICOUTTERCIRCLE
+
" TEXT)"
;
db
.
execSQL
(
CREATE_table2
);
ContentValues
play1
=
new
ContentValues
();
play1
.
put
(
COLUMN_NAME
,
"The Merchant of Venice by William Shakespeare"
);
play1
.
put
(
COLUMN_DATE
,
"Sunday April 23 2023"
);
play1
.
put
(
COLUMN_TIME
,
"20:00"
);
play1
.
put
(
COLUMN_VENUE
,
"Merchant Adventurer's Hall, York"
);
play1
.
put
(
COLUMN_WHEELCHAIR
,
"true"
);
play1
.
put
(
COLUMN_TICSEAT
,
"17,8"
);
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play1
);
ContentValues
play2
=
new
ContentValues
();
play2
.
put
(
COLUMN_NAME
,
"Hamlet by William Shakespeare"
);
play2
.
put
(
COLUMN_DATE
,
"Friday 19 May 2023"
);
play2
.
put
(
COLUMN_TIME
,
"18:00"
);
play2
.
put
(
COLUMN_VENUE
,
"Clifford's Tower, York"
);
play2
.
put
(
COLUMN_FLASH
,
"true"
);
play2
.
put
(
COLUMN_STEPS
,
"true"
);
play2
.
put
(
COLUMN_TICSEAT
,
"8,8"
);
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play2
);
ContentValues
play3
=
new
ContentValues
();
play3
.
put
(
COLUMN_NAME
,
"A Midsummer Night's Dream by William Shakespeare"
);
play3
.
put
(
COLUMN_DATE
,
"Saturday 3 June 2023"
);
play3
.
put
(
COLUMN_TIME
,
"19:00"
);
play3
.
put
(
COLUMN_VENUE
,
"Dean's Park, York"
);
play3
.
put
(
COLUMN_WHEELCHAIR
,
"true"
);
play3
.
put
(
COLUMN_FLASH
,
"true"
);
play3
.
put
(
COLUMN_TICSTAGE
,
"11,4"
);
play3
.
put
(
COLUMN_TICGRASS
,
"29,4"
);
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play3
);
ContentValues
play4
=
new
ContentValues
();
play4
.
put
(
COLUMN_NAME
,
"Oedipus the King by Sophocles"
);
play4
.
put
(
COLUMN_DATE
,
"Friday 28 July"
);
play4
.
put
(
COLUMN_TIME
,
"20:00"
);
play4
.
put
(
COLUMN_VENUE
,
"St Mary's Abbey, Museum Gardens, York"
);
play4
.
put
(
COLUMN_WHEELCHAIR
,
"true"
);
play4
.
put
(
COLUMN_TICSEAT
,
"5,9"
);
play4
.
put
(
COLUMN_TICSTAND
,
"12,7"
);
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play4
);
ContentValues
play5
=
new
ContentValues
();
play5
.
put
(
COLUMN_NAME
,
"The Tempest by William Shakespeare"
);
play5
.
put
(
COLUMN_DATE
,
"Saturday 19 August"
);
play5
.
put
(
COLUMN_TIME
,
"14:00"
);
play5
.
put
(
COLUMN_VENUE
,
"Millennium Bridge, York"
);
play5
.
put
(
COLUMN_WHEELCHAIR
,
"true"
);
play5
.
put
(
COLUMN_TICBOATA
,
"6,9"
);
play5
.
put
(
COLUMN_TICRIVERBANK
,
"10,7"
);
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play5
);
ContentValues
play6
=
new
ContentValues
();
play6
.
put
(
COLUMN_NAME
,
"Antigone by Sophocles"
);
play6
.
put
(
COLUMN_DATE
,
"Thursday 20 September"
);
play6
.
put
(
COLUMN_TIME
,
"21:00"
);
play6
.
put
(
COLUMN_VENUE
,
"Crypt, York Minster, York"
);
play6
.
put
(
COLUMN_STEPS
,
"true"
);
play6
.
put
(
COLUMN_TICINNERCIRCLE
,
"5,16"
);
play6
.
put
(
COLUMN_TICOUTTERCIRCLE
,
"8,13"
);
play6
.
put
(
COLUMN_TICSTAND
,
"10,10"
);
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play6
);
}
}
public
void
addNewUser
(
String
username
,
String
password
)
public
void
addNewUser
(
String
username
,
String
password
)
{
{
ContentValues
values
=
new
ContentValues
();
ContentValues
values
=
new
ContentValues
();
values
.
put
(
COLUMN_USERNAME
,
username
);
values
.
put
(
COLUMN_USERNAME
,
username
);
values
.
put
(
COLUMN_PASSWORD
,
password
);
values
.
put
(
COLUMN_PASSWORD
,
password
);
...
@@ -54,16 +151,15 @@ public class DatabaseConnector extends SQLiteOpenHelper {
...
@@ -54,16 +151,15 @@ public class DatabaseConnector extends SQLiteOpenHelper {
}
}
public
boolean
usernameRepeat
(
String
username
){
public
boolean
usernameRepeat
(
String
username
)
{
boolean
result
=
false
;
boolean
result
=
false
;
String
query
=
"SELECT * FROM "
+
TABLE_USERS
+
" WHERE "
+
COLUMN_USERNAME
+
" = \""
+
username
+
"\""
;
String
query
=
"SELECT * FROM "
+
TABLE_USERS
+
" WHERE "
+
COLUMN_USERNAME
+
" = \""
+
username
+
"\""
;
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
Cursor
cursor
=
db
.
rawQuery
(
query
,
null
);
Cursor
cursor
=
db
.
rawQuery
(
query
,
null
);
if
(
cursor
.
getCount
()
==
0
)
{
if
(
cursor
.
getCount
()
==
0
)
{
result
=
false
;
result
=
false
;
}
}
else
result
=
true
;
else
result
=
true
;
cursor
.
close
();
cursor
.
close
();
...
@@ -73,13 +169,13 @@ public class DatabaseConnector extends SQLiteOpenHelper {
...
@@ -73,13 +169,13 @@ public class DatabaseConnector extends SQLiteOpenHelper {
}
}
public
boolean
login
(
String
username
,
String
password
)
{
public
boolean
login
(
String
username
,
String
password
)
{
String
query
=
"SELECT * FROM "
+
TABLE_USERS
+
" WHERE "
+
COLUMN_USERNAME
+
" = \""
+
username
+
"\""
;
String
query
=
"SELECT * FROM "
+
TABLE_USERS
+
" WHERE "
+
COLUMN_USERNAME
+
" = \""
+
username
+
"\""
;
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
Cursor
cursor
=
db
.
rawQuery
(
query
,
null
);
Cursor
cursor
=
db
.
rawQuery
(
query
,
null
);
boolean
result
=
false
;
boolean
result
=
false
;
if
(
cursor
.
moveToFirst
()){
if
(
cursor
.
moveToFirst
())
{
if
(
cursor
.
getString
(
2
).
equals
(
password
))
if
(
cursor
.
getString
(
2
).
equals
(
password
))
result
=
true
;
result
=
true
;
else
else
...
@@ -91,4 +187,32 @@ public class DatabaseConnector extends SQLiteOpenHelper {
...
@@ -91,4 +187,32 @@ public class DatabaseConnector extends SQLiteOpenHelper {
return
result
;
return
result
;
}
}
public
ArrayList
performances
()
{
ArrayList
<
ArrayList
<
String
>>
performancesList
=
new
ArrayList
<>();
String
query
=
"SELECT * FROM "
+
TABLE_PERFORMANCES
;
SQLiteDatabase
db
=
this
.
getWritableDatabase
();
Cursor
cursor
=
db
.
rawQuery
(
query
,
null
);
String
info
;
cursor
.
moveToFirst
();
for
(
int
i
=
0
;
i
<
cursor
.
getCount
();
i
++)
{
ArrayList
<
String
>
tempList
=
new
ArrayList
<>();
for
(
int
column
=
1
;
column
<
cursor
.
getColumnCount
();
column
++)
{
info
=
cursor
.
getString
(
column
);
tempList
.
add
(
info
);
}
performancesList
.
add
(
tempList
);
cursor
.
moveToNext
();
}
cursor
.
close
();
db
.
close
();
return
performancesList
;
}
}
}
\ No newline at end of file
app/src/main/java/com/example/bookingapp_austinblanke/MainActivity.java
View file @
97555dfb
package
com
.
example
.
bookingapp_austinblanke
;
package
com
.
example
.
bookingapp_austinblanke
;
import
androidx.appcompat.app.ActionBar
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.appcompat.app.AppCompatActivity
;
import
java.util.ArrayList
;
public
class
MainActivity
extends
AppCompatActivity
{
public
class
MainActivity
extends
AppCompatActivity
{
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
setContentView
(
R
.
layout
.
activity_main
);
Bundle
loginBundle
=
getIntent
().
getExtras
();
String
currentUser
=
loginBundle
.
getString
(
"currentUser"
);
TextView
username
=
(
TextView
)
findViewById
(
R
.
id
.
Username
);
username
.
setText
(
currentUser
);
performanceList
=
new
ArrayList
<>();
RecyclerView
recyclerObj
=
findViewById
(
R
.
id
.
performanceRecycler
);
recyclerObj
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
adapter
=
new
performanceRecAdapter
(
this
,
performanceList
);
recyclerObj
.
setAdapter
(
adapter
);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/example/bookingapp_austinblanke/MyAdapter.java
0 → 100644
View file @
97555dfb
package
com
.
example
.
bookingapp_austinblanke
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
java.util.ArrayList
;
public
class
MyAdapter
extends
RecyclerView
.
Adapter
<
MyViewHolder
>
{
private
Context
context
;
private
ArrayList
name_id
;
public
MyAdapter
(
Context
context
,
ArrayList
name_id
)
{
this
.
context
=
context
;
this
.
name_id
=
name_id
;
}
@NonNull
@Override
public
MyViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
View
v
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
performance
,
parent
,
false
);
return
new
MyViewHolder
(
v
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
MyViewHolder
holder
,
int
position
)
{
}
@Override
public
int
getItemCount
()
{
return
0
;
}
}
app/src/main/java/com/example/bookingapp_austinblanke/MyViewHolder.java
0 → 100644
View file @
97555dfb
package
com
.
example
.
bookingapp_austinblanke
;
import
android.view.View
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
public
class
MyViewHolder
extends
RecyclerView
.
ViewHolder
{
TextView
name
;
public
MyViewHolder
(
@NonNull
View
itemView
)
{
super
(
itemView
);
}
}
app/src/main/res/layout/performace.xml
0 → 100644
View file @
97555dfb
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:cardElevation=
"12dp"
android:cardCornerRadius=
"16dp"
android:layout_margin=
"16dp"
android:backgroundTint=
"#efefef"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"16dp"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:layout_gravity=
"center_vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
androidtext=
"Performance"
android
</LinearLayout
>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
app/src/main/res/values/refs.xml
0 → 100644
View file @
97555dfb
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
\ No newline at end of file
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