Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Theatre Booking App
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
a-j.towse
Theatre Booking App
Commits
f9ce8443
Commit
f9ce8443
authored
May 18, 2023
by
a-j.towse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed dbconnection error
parent
544c033c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
18 deletions
+17
-18
DBConnector.java
.../main/java/com/example/no1theatrecompany/DBConnector.java
+2
-6
LoginActivity.java
...ain/java/com/example/no1theatrecompany/LoginActivity.java
+3
-4
MainActivity.java
...main/java/com/example/no1theatrecompany/MainActivity.java
+12
-8
No files found.
app/src/main/java/com/example/no1theatrecompany/DBConnector.java
View file @
f9ce8443
...
@@ -43,7 +43,6 @@ public class DBConnector extends SQLiteOpenHelper {
...
@@ -43,7 +43,6 @@ public class DBConnector extends SQLiteOpenHelper {
private
static
final
String
COLUMN_TIXRIVERBANK
=
"tixRiverBank"
;
private
static
final
String
COLUMN_TIXRIVERBANK
=
"tixRiverBank"
;
private
static
final
String
COLUMN_TIXINCIRC
=
"tixInCirc"
;
private
static
final
String
COLUMN_TIXINCIRC
=
"tixInCirc"
;
private
static
final
String
COLUMN_TIXOUTCIRC
=
"tixOutCirc"
;
private
static
final
String
COLUMN_TIXOUTCIRC
=
"tixOutCirc"
;
private
static
final
String
COLUMN_TIXOUTCIRCP
=
"tixOutCircP"
;
//Constructor method - create DB
//Constructor method - create DB
public
DBConnector
(
Context
context
,
SQLiteDatabase
.
CursorFactory
factory
)
{
public
DBConnector
(
Context
context
,
SQLiteDatabase
.
CursorFactory
factory
)
{
...
@@ -141,15 +140,13 @@ public class DBConnector extends SQLiteOpenHelper {
...
@@ -141,15 +140,13 @@ public class DBConnector extends SQLiteOpenHelper {
play6
.
put
(
COLUMN_TIXOUTCIRC
,
"8,13"
);
play6
.
put
(
COLUMN_TIXOUTCIRC
,
"8,13"
);
play6
.
put
(
COLUMN_TIXSTAND
,
"10,10"
);
play6
.
put
(
COLUMN_TIXSTAND
,
"10,10"
);
SQLiteDatabase
database
=
this
.
getWritableDatabase
();
//Create DB access object
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play1
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play1
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play2
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play2
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play3
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play3
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play4
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play4
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play5
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play5
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play6
);
//Store play details
db
.
insert
(
TABLE_PERFORMANCES
,
null
,
play6
);
//Store play details
db
.
close
();
}
}
...
@@ -252,7 +249,7 @@ public class DBConnector extends SQLiteOpenHelper {
...
@@ -252,7 +249,7 @@ public class DBConnector extends SQLiteOpenHelper {
}
}
//Upgrade DB (to satisfy extends f SQLiteOpenHelper
//Upgrade DB (to satisfy extends f SQLiteOpenHelper
)
@Override
@Override
public
void
onUpgrade
(
SQLiteDatabase
db
,
int
oldVersion
,
int
newVersion
)
{
public
void
onUpgrade
(
SQLiteDatabase
db
,
int
oldVersion
,
int
newVersion
)
{
...
@@ -260,4 +257,3 @@ public class DBConnector extends SQLiteOpenHelper {
...
@@ -260,4 +257,3 @@ public class DBConnector extends SQLiteOpenHelper {
}
}
app/src/main/java/com/example/no1theatrecompany/LoginActivity.java
View file @
f9ce8443
...
@@ -39,17 +39,16 @@ public class LoginActivity extends AppCompatActivity {
...
@@ -39,17 +39,16 @@ public class LoginActivity extends AppCompatActivity {
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
//create bundle to pass current username
//create bundle to pass current username
Bundle
currentUserBundle
=
new
Bundle
();
Bundle
currentUserBundle
=
new
Bundle
();
currentUserBundle
.
putString
(
"currentUser"
,
username
.
getText
().
toString
());
currentUserBundle
.
putString
(
"currentUser"
,
username
.
getText
().
toString
());
//add bundle to intent
//add bundle to intent
intent
.
putExtras
(
currentUserBundle
);
intent
.
putExtras
(
currentUserBundle
);
//start intent
//start intent
startActivity
(
intent
);
startActivity
(
intent
);
}
}
else
else
Toast
.
makeText
(
this
,
"Username / Password not recognised"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
this
,
"Username / Password not recognised"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
public
void
createAccountLoginBtn
(
View
view
)
{
public
void
createAccountLoginBtn
(
View
view
)
{
startActivity
(
new
Intent
(
LoginActivity
.
this
,
RegisterActivity
.
class
));
startActivity
(
new
Intent
(
LoginActivity
.
this
,
RegisterActivity
.
class
));
}
}
}
}
\ No newline at end of file
app/src/main/java/com/example/no1theatrecompany/MainActivity.java
View file @
f9ce8443
...
@@ -29,20 +29,24 @@ public class MainActivity extends AppCompatActivity {
...
@@ -29,20 +29,24 @@ public class MainActivity extends AppCompatActivity {
TextView
usernameTextView
=
(
TextView
)
findViewById
(
R
.
id
.
usernameTextView
);
TextView
usernameTextView
=
(
TextView
)
findViewById
(
R
.
id
.
usernameTextView
);
usernameTextView
.
setText
(
currentUser
);
usernameTextView
.
setText
(
currentUser
);
performanceList
=
new
ArrayList
<>();
/*
performanceList = new ArrayList<>();
RecyclerView recyclerObj = findViewById(R.id.performanceRecycler);
RecyclerView recyclerObj = findViewById(R.id.performanceRecycler);
recyclerObj.setLayoutManager(new LinearLayoutManager(this));
recyclerObj.setLayoutManager(new LinearLayoutManager(this));
adapter = new performanceRecAdapter(this, performanceList);
adapter = new performanceRecAdapter(this, performanceList);
recyclerObj.setAdapter(adapter);
recyclerObj.setAdapter(adapter);
for
()
//Connect to DB
performanceList
.
add
(
performanceList
.
size
(),
new
IdleData
(
"Test1 "
));
DBConnector connector = new DBConnector(this, null);
this
.
adapter
.
notifyItemInserted
(
this
.
adapter
.
getItemCount
());
ArrayList performanceInfoList = connector.getPerformanceInfo();
performanceList
.
add
(
performanceList
.
size
(),
new
IdleData
(
"Test2 "
));
this
.
adapter
.
notifyItemInserted
(
this
.
adapter
.
getItemCount
());
for (int i = 0;i<performanceInfoList.size();i++) {
performanceList
.
add
(
performanceList
.
size
(),
new
IdleData
(
"Test3 "
));
performanceList.add(performanceList.size(),
this
.
adapter
.
notifyItemInserted
(
this
.
adapter
.
getItemCount
());
new IdleData(performanceInfoList.get(i).toString()));
this.adapter.notifyItemInserted(this.adapter.getItemCount());
}*/
}
}
public
void
logOutBtn
(
View
view
)
{
public
void
logOutBtn
(
View
view
)
{
...
...
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