Commit f91b79f3 authored by lucy.hemingway's avatar lucy.hemingway

5 commit - login started

parent b5891779
......@@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.APPPPPpp">
<activity android:name=".fulldetails"></activity>
<activity android:name=".Booking"></activity>
<activity android:name=".fulldetails" />
<activity android:name=".MuseumList" />
<activity android:name=".HelpPage" />
<activity android:name=".Register" />
......
package com.example.appppppp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class Booking extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_booking);
}
}
\ No newline at end of file
package com.example.appppppp;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
public class DBconnect extends SQLiteOpenHelper {
private static final int db_version = 1;
private static final String db_name = "Registered.db";
private static final String table_users = "Users";
private static final String column_id = "ID";
private static final String column_name = "First Name";
private static final String column_last = "Last Name";
private static final String column_email = "Email";
private static final String column_pass = "Password";
public DBconnect(Context context, String name,SQLiteDatabase.CursorFactory factory, int version) {
super(context, db_name, factory, db_version);
}
@Override
public void onCreate(SQLiteDatabase db) {
//create table for storing users
String create = "CREATE TABLE " +
table_users + "(" +
column_id + "INTEGER PRIMARY KEY," +
column_name + "TEXT," +
column_last + "TEXT," +
column_email + "TEXT," +
column_pass + "INTEGER" + ")";
//create
db.execSQL(create);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
public void addNew(String name,String last, String email, String password){
ContentValues values = new ContentValues();
values.put(column_name, name);
values.put(column_last, last);
values.put(column_email, email);
values.put(column_pass,password);
SQLiteDatabase db = this.getWritableDatabase();
db.insert(table_users, null, values);
db.close();
}
public boolean check(String Email, String password){
//check password variable
boolean checked = false;
//query check email
String email = "SELECT * FROM " + table_users + "WHERE " + column_email +
"= \"" + Email + "\"";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(email, null);
if ( cursor.moveToFirst()) {
if(cursor.getString(4).equals(password) ) {
checked = true;
}
} else {
checked = false;
}
cursor.close();
db.close();
return checked;
}
public String find(String Email){
//store result
String f = null;
String query = "SELECT * FROM " + table_users + "WHERE " + column_email +
"= \"" + Email + "\"";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()){
f = Integer.parseInt(cursor.getString(0)) +
cursor.getString(1) +
cursor.getString(2) +
cursor.getString(3) +
cursor.getString(4);
}
cursor.close();
db.close();
return f;
}
}
......@@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
......@@ -20,30 +21,119 @@ public class fulldetails extends AppCompatActivity {
setDetail(selectedMuseum);
}
void setDetail(String s){
//variables for next page if this museum is selected
String mname = "";
int price = 0;
int i = 0;
switch(s) {
case "Louvre":
mname = "Louvre";
price = 10;
i = 1;
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.louvre);
((TextView)findViewById(R.id.thetext)).setText( "The Louvre asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
case "National Museum of China":
mname="National Museum of China";
price=10;
i=2;
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.china);
((TextView)findViewById(R.id.thetext)).setText( "China asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
case "Vatican Museums":
mname="Vatican Museums";
price=10;
i= 3;
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.vatican);
((TextView)findViewById(R.id.thetext)).setText( "Vatican d jka ");
break;
case "Metropolitan Museum of Art":
mname = "Metropolitan Museum of Art";
price= 10;
i = 4;
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.metropolitan);
((TextView)findViewById(R.id.thetext)).setText( "The metropolitan asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
case "British Museum":
mname = "British Museum";
price= 10;
i = 5;
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.british);
((TextView)findViewById(R.id.thetext)).setText( "The metropolitan asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
case "Tate Modern":
mname = "Tate Modern";
price= 5;
i = 6;
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.tate);
((TextView)findViewById(R.id.thetext)).setText( "The metropolitan asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
case "National Gallery":
mname = "National Gallery";
price= 5;
i = 7;
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.national);
((TextView)findViewById(R.id.thetext)).setText( "The metropolitan asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
case "Natural History Museum":
mname = "Natural History Museum";
price= 5;
i = 8;
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.natural);
((TextView)findViewById(R.id.thetext)).setText( "The metropolitan asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
case "American Museum of Natural History":
mname = "American Museum of Natural History";
price= 5;
i = 9;
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.american);
((TextView)findViewById(R.id.thetext)).setText( "The metropolitan asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
case "State Hermitage Museum":
mname = "State Hermitage Museum";
price= 5;
i = 10;
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.state);
((TextView)findViewById(R.id.thetext)).setText( "The metropolitan asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
default:
((TextView)findViewById(R.id.thetext)).setText("Not Added");
break;
}
//send price and name of museum to next page when pressing book now button
Bundle n = getIntent().getExtras();
Intent book = new Intent (this, Booking.class);
book.putExtra("museumname", mname);
book.putExtra("fee",price);
book.putExtra("number",i);
}
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Booking">
<TextView
android:id="@+id/name1"
android:layout_width="192dp"
android:layout_height="32dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.169"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.089" />
<CalendarView
android:id="@+id/calendarView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="42dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.491"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/name1"
app:layout_constraintVertical_bias="0.023" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -33,12 +33,24 @@
<ImageView
android:id="@+id/theimage"
android:layout_width="189dp"
android:layout_height="162dp"
android:layout_width="283dp"
android:layout_height="194dp"
app:layout_constraintBottom_toTopOf="@+id/thetext"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/check"
app:layout_constraintVertical_bias="0.428"
tools:srcCompat="@tools:sample/avatars" />
<Button
android:id="@+id/button9"
android:layout_width="124dp"
android:layout_height="42dp"
android:layout_marginTop="49dp"
android:text="Book Now"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/thetext"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment