Commit 87ff3eb7 authored by a-j.towse's avatar a-j.towse

working filter

working more info page, just add more play info
parent f2850306
...@@ -8,7 +8,7 @@ android { ...@@ -8,7 +8,7 @@ android {
defaultConfig { defaultConfig {
applicationId "com.example.no1theatrecompany" applicationId "com.example.no1theatrecompany"
minSdk 19 minSdk 25
targetSdk 33 targetSdk 33
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
......
...@@ -32,6 +32,14 @@ ...@@ -32,6 +32,14 @@
android:name=".MainActivity" android:name=".MainActivity"
android:exported="false"> android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".performanceInfoPage"
android:exported="false">
<meta-data <meta-data
android:name="android.app.lib_name" android:name="android.app.lib_name"
android:value="" /> android:value="" />
......
...@@ -107,8 +107,8 @@ public class DBConnector extends SQLiteOpenHelper { ...@@ -107,8 +107,8 @@ public class DBConnector extends SQLiteOpenHelper {
play3.put(COLUMN_DATE, "Saturday 3 June 2023"); play3.put(COLUMN_DATE, "Saturday 3 June 2023");
play3.put(COLUMN_TIME, "19:00"); play3.put(COLUMN_TIME, "19:00");
play3.put(COLUMN_VENUE, "Dean's Park, York"); play3.put(COLUMN_VENUE, "Dean's Park, York");
play3.put(COLUMN_WHEELACCESS, "true");
play3.put(COLUMN_FLASH, "true"); play3.put(COLUMN_FLASH, "true");
play3.put(COLUMN_WHEELACCESS, "true");
play3.put(COLUMN_TIXSTAGE, "11,4"); play3.put(COLUMN_TIXSTAGE, "11,4");
play3.put(COLUMN_TIXGRASS, "29,4"); play3.put(COLUMN_TIXGRASS, "29,4");
...@@ -147,7 +147,6 @@ public class DBConnector extends SQLiteOpenHelper { ...@@ -147,7 +147,6 @@ public class DBConnector extends SQLiteOpenHelper {
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
} }
//Method to add new user into table //Method to add new user into table
......
...@@ -82,28 +82,35 @@ public class MainActivity extends AppCompatActivity { ...@@ -82,28 +82,35 @@ public class MainActivity extends AppCompatActivity {
//connect to DBConnector //connect to DBConnector
DBConnector connector = new DBConnector(this, null); DBConnector connector = new DBConnector(this, null);
ArrayList performanceInfoList = connector.getPerformanceInfo(); ArrayList performanceInfoList = connector.getPerformanceInfo();
ArrayList<ArrayList> filtIndexList = new ArrayList<>();
int performanceNum = performanceInfoList.size();
for (int i = 0; i < performanceInfoList.size(); i++) { for (int i = 0; i < performanceNum; i++) {
ArrayList tempList = (ArrayList) performanceInfoList.get(i); ArrayList tempFilterList = (ArrayList) performanceInfoList.get(i);
if (flashIsChecked == true) { if (flashIsChecked == true) {
if (tempList.get(5) == null) { if (tempFilterList.get(4) == null ) {
performanceInfoList.remove(i); filtIndexList.add(tempFilterList);
} }
} }
else if (stepsIsChecked == true) { if (wheelIsChecked == true) {
if (tempList.get(6) == null) { if (tempFilterList.get(5) == null) {
performanceInfoList.remove(i); filtIndexList.add(tempFilterList);
} }
} }
else if (wheelIsChecked == true) { if (stepsIsChecked == true) {
if (tempList.get(7) == null) { if (tempFilterList.get(6) == null) {
performanceInfoList.remove(i); filtIndexList.add(tempFilterList);
} }
} }
} }
System.out.println(filtIndexList);
for (int x=0; x < filtIndexList.size();x++) {
performanceInfoList.remove(filtIndexList.get(x));
}
System.out.println(performanceInfoList);
performanceList = new ArrayList<>(); performanceList = new ArrayList<>();
RecyclerView recyclerObj = findViewById(R.id.performanceRecycler); RecyclerView recyclerObj = findViewById(R.id.performanceRecycler);
......
package com.example.no1theatrecompany;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import java.util.List;
public class performanceInfoPage extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.performance_infopage);
Intent intent = getIntent();
String selectedPerformance = intent.getStringExtra("selectedPlay");
setInfo(selectedPerformance);
}
public void backBtn (View view) {
onBackPressed();
}
void setInfo(String performance) {
System.out.println(performance);
TextView nameTextView = (TextView) findViewById(R.id.performanceTitle);
TextView dateTimeTextView = (TextView) findViewById(R.id.dateTimetextView);
switch(performance) {
case "The Tempest":
nameTextView.setText("The Tempest");
case "A Midsummer Night's Dream by William Shakespeare":
nameTextView.setText("A Midsummer Night's Dream by William Shakespeare");
dateTimeTextView.setText("Saturday 3 June 2023, 19:00");
}
}
}
package com.example.no1theatrecompany; package com.example.no1theatrecompany;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.telecom.Call;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -28,10 +30,21 @@ public class performanceRecAdapter extends RecyclerView.Adapter<IdleViewHolder> ...@@ -28,10 +30,21 @@ public class performanceRecAdapter extends RecyclerView.Adapter<IdleViewHolder>
return new IdleViewHolder(view); return new IdleViewHolder(view);
} }
@Override @Override
public void onBindViewHolder(@NonNull IdleViewHolder holder, int position) { public void onBindViewHolder(@NonNull IdleViewHolder holder, int position) {
IdleData data = mData.get(position); IdleData data = mData.get(position);
holder.setData(data); holder.setData(data);
holder.nameText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(view.getContext(), performanceInfoPage.class);
intent.putExtra("selectedPlay",mData.get(position).name);
view.getContext().startActivity(intent);
}
});
} }
@Override @Override
......
<?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">
<Button
android:id="@+id/backBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Back"
android:onClick="backBtn"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/backBtn">
<TextView
android:id="@+id/performanceTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:text="TextView"
android:textAlignment="center"
android:textSize="20sp" />
<TextView
android:id="@+id/dateTimetextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
</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