Commit 0ccd2f7a authored by austin.blanke's avatar austin.blanke

More Info Page in Progress

parent 824f7047
...@@ -212,9 +212,21 @@ public class DatabaseConnector extends SQLiteOpenHelper { ...@@ -212,9 +212,21 @@ public class DatabaseConnector extends SQLiteOpenHelper {
Cursor cursor = db.rawQuery(query, null); Cursor cursor = db.rawQuery(query, null);
cursor.moveToFirst(); cursor.moveToFirst();
for(int i=0;i< cursor.getCount();i++){ for(int i=0;i< cursor.getCount();i++){
if (filter1 && filter2 && filter3) if (filter1) {
if(cursor.getString(5).equals("false") && cursor.getString(5).equals("true") && cursor.getString(5).equals("false")){ if (cursor.getString(5).equals("false")) {
performances.add(cursor.getString(1)); performances.add(cursor.getString(1));
}
}
else if(filter2) {
if (cursor.getString(6).equals("true")) {
performances.add(cursor.getString(1));
}
}
else if(filter3) {
if (cursor.getString(7).equals("false")) {
performances.add(cursor.getString(1));
}
}
else{performances.add(cursor.getString(1));} //No filter present else{performances.add(cursor.getString(1));} //No filter present
cursor.moveToNext(); cursor.moveToNext();
} }
......
package com.example.bookingapp_austinblanke;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class MoreInfoActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.moreinfo);
Intent intent = getIntent();
String name = intent.getStringExtra("name");
}
}
package com.example.bookingapp_austinblanke; package com.example.bookingapp_austinblanke;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
...@@ -14,6 +17,7 @@ public class adapter extends RecyclerView.Adapter<adapter.ViewHolder>{ ...@@ -14,6 +17,7 @@ public class adapter extends RecyclerView.Adapter<adapter.ViewHolder>{
private List<String> mData; private List<String> mData;
private LayoutInflater mInflater; private LayoutInflater mInflater;
Context context;
adapter(Context context, List<String> data){ adapter(Context context, List<String> data){
this.mInflater = LayoutInflater.from(context); this.mInflater = LayoutInflater.from(context);
...@@ -22,7 +26,7 @@ public class adapter extends RecyclerView.Adapter<adapter.ViewHolder>{ ...@@ -22,7 +26,7 @@ public class adapter extends RecyclerView.Adapter<adapter.ViewHolder>{
@Override @Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType){ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
View view = mInflater.inflate(R.layout.performance, parent, false); View view = mInflater.inflate(R.layout.performance,parent, false);
return new ViewHolder(view); return new ViewHolder(view);
} }
...@@ -30,6 +34,7 @@ public class adapter extends RecyclerView.Adapter<adapter.ViewHolder>{ ...@@ -30,6 +34,7 @@ public class adapter extends RecyclerView.Adapter<adapter.ViewHolder>{
public void onBindViewHolder(@NonNull ViewHolder holder, int position) { public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
String name = mData.get(position); String name = mData.get(position);
holder.myTextView.setText(name); holder.myTextView.setText(name);
} }
@Override @Override
...@@ -37,12 +42,21 @@ public class adapter extends RecyclerView.Adapter<adapter.ViewHolder>{ ...@@ -37,12 +42,21 @@ public class adapter extends RecyclerView.Adapter<adapter.ViewHolder>{
return mData.size(); return mData.size();
} }
public class ViewHolder extends RecyclerView.ViewHolder { public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
TextView myTextView; TextView myTextView;
ViewHolder(View v){ ViewHolder(View v){
super(v); super(v);
myTextView = itemView.findViewById(R.id.performance); myTextView = itemView.findViewById(R.id.performance);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View view) {
int position = getAdapterPosition();
Intent intent = new Intent(context,MoreInfoActivity.class);
intent.putExtra("name", mData.get(position));
context.startActivity(intent);
} }
} }
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
<TextView <TextView
android:id="@+id/performance" android:id="@+id/performance"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="66dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true" android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical" android:layout_alignParentTop="true"
android:text="Line 1" android:layout_alignParentRight="true"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:textSize="18sp"/> android:gravity="center_vertical"
android:text="Line 1"
android:textSize="24sp" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -25,11 +25,5 @@ ...@@ -25,11 +25,5 @@
android:background="#CCCCCC" android:background="#CCCCCC"
/> />
<Button
android:id="@+id/moreInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="moreInfo" />
</LinearLayout> </LinearLayout>
\ 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