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

4th with museum details

parent d216ed85
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
......
......@@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.APPPPPpp">
<activity android:name=".MuseumList"></activity>
<activity android:name=".fulldetails"></activity>
<activity android:name=".MuseumList" />
<activity android:name=".HelpPage" />
<activity android:name=".Register" />
<activity android:name=".LogIn" />
......
......@@ -18,6 +18,7 @@ class adapter extends RecyclerView.Adapter<adapter.ViewHolder> {
private List<MuseumNames> myMuseums;
private LayoutInflater myInflater;
Context myContext;
// pass the data list into the constructor
adapter(Context context, ArrayList<MuseumNames> data){
......@@ -40,17 +41,17 @@ class adapter extends RecyclerView.Adapter<adapter.ViewHolder> {
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
String names = myMuseums.get(position).name; //modified
String descriptions = myMuseums.get(position).desc; //modified
holder.MuseumText.setText(names);
holder.DescriptionText.setText(descriptions);
String name = myMuseums.get(position).name; //modified
String desc = myMuseums.get(position).desc; //modified
holder.MuseumText.setText(name);
holder.DescriptionText.setText(desc);
holder.MuseumText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), MuseumNames.class);
intent.putExtra ( "selectedFruit", myMuseums.get(position).name);
Intent intent = new Intent(v.getContext(), fulldetails.class);
intent.putExtra ( "selectedMuseum", myMuseums.get(position).name);
v.getContext().startActivity(intent);
}
......@@ -71,6 +72,7 @@ class adapter extends RecyclerView.Adapter<adapter.ViewHolder> {
public class ViewHolder extends RecyclerView.ViewHolder{
TextView MuseumText;
TextView DescriptionText; //add
ViewHolder(View v){
super(v);
MuseumText = itemView.findViewById(R.id.MuseumText);
......
package com.example.appppppp;
public class DetailMuseums {
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
public class DetailMuseums extends AppCompatActivity {
@Override
protected void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fulldetails);
Intent intent = getIntent();
String selectedMuseum = intent.getStringExtra("selectedMuseum");
((TextView)findViewById(R.id.check)).setText(selectedMuseum);
//setDetail(selectedMuseum);
}
/* void setDetail(String s){
switch(s) {
case "Louvre":
((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":
((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":
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.vatican);
((TextView)findViewById(R.id.thetext)).setText( "Vatican d jka ");
break;
case "Metropolitan Museum of Art":
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.metropolitan);
((TextView)findViewById(R.id.thetext)).setText( "The metropolitan asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
default:
((TextView)findViewById(R.id.thetext)).setText("Not Added");
break;
}
} */
}
......@@ -24,12 +24,16 @@ public class MuseumList extends AppCompatActivity {
dataList = new ArrayList<>();
dataList.add(new MuseumNames ("Apple", "An apple is an edible fruit produced by an apple tree."));
dataList.add(new MuseumNames ("Pear", "Pears are sweet, bell-shaped fruits that have been enjoyed since ancient times."));
dataList.add(new MuseumNames ("Pineapple", "description "));
dataList.add(new MuseumNames ("Kiwi", "description "));
dataList.add(new MuseumNames("Banana", "description "));
dataList.add(new MuseumNames("Watermelon", "description "));
dataList.add(new MuseumNames ("Louvre", "Paris, France : £10"));
dataList.add(new MuseumNames ("National Museum of China", "Beijing, China : £10"));
dataList.add(new MuseumNames ("Vatican Museums", "Vatican City, Vatican : £10 "));
dataList.add(new MuseumNames ("Metropolitan Museum of Art", "New York City, New York : £10 "));
dataList.add(new MuseumNames("British Museum", "London, UK : £10 "));
dataList.add(new MuseumNames("Tate Modern", "London, UK : £5 "));
dataList.add(new MuseumNames("National Gallery", "London, UK : £5 "));
dataList.add(new MuseumNames("Natural History Museum", "London, UK : £5 "));
dataList.add(new MuseumNames("American Museum of Natural History", "New York City, New York : £5 "));
dataList.add(new MuseumNames("State Hermitage Museum", "Saint Petersburg, Russia : £5 "));
// set up the recyclerview
......
package com.example.appppppp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
public class fulldetails extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fulldetails);
Intent intent = getIntent();
String selectedMuseum = intent.getStringExtra("selectedMuseum");
((TextView)findViewById(R.id.check)).setText(selectedMuseum);
setDetail(selectedMuseum);
}
void setDetail(String s){
switch(s) {
case "Louvre":
((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":
((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":
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.vatican);
((TextView)findViewById(R.id.thetext)).setText( "Vatican d jka ");
break;
case "Metropolitan Museum of Art":
((ImageView)findViewById(R.id.theimage)).setImageResource(R.drawable.metropolitan);
((TextView)findViewById(R.id.thetext)).setText( "The metropolitan asdaskjhdasdlkasda al s dlasdajsdjasjd jka ");
break;
default:
((TextView)findViewById(R.id.thetext)).setText("Not Added");
break;
}
}
}
<?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=".fulldetails">
<TextView
android:id="@+id/check"
android:layout_width="291dp"
android:layout_height="36dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.023" />
<EditText
android:id="@+id/thetext"
android:layout_width="292dp"
android:layout_height="225dp"
android:ems="10"
android:gravity="start|top"
android:inputType="textMultiLine"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/check"
app:layout_constraintVertical_bias="0.495" />
<ImageView
android:id="@+id/theimage"
android:layout_width="189dp"
android:layout_height="162dp"
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" />
</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