Commit a0366559 authored by ankitasingh's avatar ankitasingh

Item details screen change

parent 4cb4265b
This diff is collapsed.
...@@ -8,9 +8,12 @@ import android.os.Bundle; ...@@ -8,9 +8,12 @@ import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
public class ItemDetails extends AppCompatActivity implements View.OnClickListener { import com.squareup.picasso.Picasso;
public class ItemDetails extends AppCompatActivity {
String category, name, key; String category, name, key;
int type; int type;
Bundle details_bundle; Bundle details_bundle;
...@@ -19,21 +22,26 @@ Bundle details_bundle; ...@@ -19,21 +22,26 @@ Bundle details_bundle;
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_details); setContentView(R.layout.activity_item_details);
Intent intent = getIntent(); CreateFoundObject objectfound = (CreateFoundObject)getIntent().getSerializableExtra("FoundObject");
details_bundle = intent.getExtras(); Log.v("desc",objectfound.getmDescription());
((TextView)findViewById(R.id.category)).setText(details_bundle.getString("category")); ((TextView)findViewById(R.id.categorycontent)).setText(objectfound.getmCategory());
((TextView)findViewById(R.id.name)).setText(details_bundle.getString("name")); ((TextView)findViewById(R.id.namecontent)).setText(objectfound.getmTitle());
((TextView) findViewById(R.id.place)).setText(details_bundle.getString("place")); ((TextView) findViewById(R.id.placecontent)).setText(objectfound.getmLocation());
((TextView) findViewById(R.id.description)).setText(details_bundle.getString("description")); ((TextView) findViewById(R.id.descriptioncontent)).setText(objectfound.getmDescription());
((TextView) findViewById(R.id.date)).setText(details_bundle.getString("date")); ((TextView) findViewById(R.id.datecontent)).setText(objectfound.getDate());
ImageView camera = findViewById(R.id.imagecam);
Picasso.with(ItemDetails.this).load(objectfound.getImageUrl())
.fit()
.centerCrop()
.into(camera);
findViewById(R.id.edit_post).setOnClickListener(this); // findViewById(R.id.edit_post).setOnClickListener(this);
findViewById(R.id.resolve_post).setOnClickListener(this); // findViewById(R.id.resolve_post).setOnClickListener(this);
} }
@Override /* @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()){ switch (v.getId()){
case R.id.edit_post: case R.id.edit_post:
...@@ -51,5 +59,5 @@ Bundle details_bundle; ...@@ -51,5 +59,5 @@ Bundle details_bundle;
case R.id.resolve_post: case R.id.resolve_post:
break; break;
} }
} }*/
} }
...@@ -81,7 +81,14 @@ public class MyPostsFoundRV extends AppCompatActivity implements MyPostsAdaptor. ...@@ -81,7 +81,14 @@ public class MyPostsFoundRV extends AppCompatActivity implements MyPostsAdaptor.
} }
@Override @Override
public void onItemClick(int position) { public void onItemClick(int position) {
Toast.makeText(this, "Normal click at position: " + position, Toast.LENGTH_SHORT).show(); Log.v("position =",String.valueOf(position));
CreateFoundObject selectedItem = mPosts.get(position);
final String selectedKey = selectedItem.getKey();
Intent intent = new Intent(MyPostsFoundRV.this, ItemDetails.class);
intent.putExtra("FoundObject", selectedItem);
intent.putExtra("CallingClass","MyPosts");
intent.putExtra("username",username);
startActivity(intent);
} }
@Override @Override
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <!--<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -13,6 +13,20 @@ ...@@ -13,6 +13,20 @@
android:orientation="vertical" android:orientation="vertical"
tools:layout_editor_absoluteX="50dp" tools:layout_editor_absoluteX="50dp"
tools:layout_editor_absoluteY="50dp"> tools:layout_editor_absoluteY="50dp">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/imagecam"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/cameraup"
android:minWidth="80dp"
android:minHeight="100dp"></ImageView>
</TableRow>
<TableRow <TableRow
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -134,4 +148,150 @@ ...@@ -134,4 +148,150 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> -->
\ No newline at end of file <RelativeLayout 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"
android:orientation="vertical"
tools:context=".ItemDetails">
<ImageView
android:id="@+id/imagecam"
android:layout_width="170dp"
android:layout_height="170dp"
android:layout_centerHorizontal="true"
android:layout_margin="20dp"
android:layout_alignParentTop="true"
android:background="@drawable/cameraup"
android:scaleType="centerCrop" />
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"
android:visibility="gone"/>
<TextView
android:id="@+id/category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imagecam"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:text="Category"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/categorycontent"
android:layout_width="270dp"
android:layout_marginTop="8dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/category"
android:layout_below="@id/imagecam"
android:layout_marginLeft="20dp"
android:layout_toEndOf="@+id/category"
android:fontFamily="sans-serif"
android:textSize="20dp"
android:textStyle="italic"/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/category"
android:layout_marginTop="25dp"
android:layout_marginLeft="8dp"
android:text="Title"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/namecontent"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:layout_below="@+id/categorycontent"
android:layout_marginLeft="20dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="@+id/name"
android:textSize="20dp"
android:textStyle="italic"
/>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/name"
android:layout_marginTop="25dp"
android:layout_marginLeft="8dp"
android:text="Description"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/descriptioncontent"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:layout_below="@+id/namecontent"
android:layout_marginLeft="20dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="@+id/description"
android:textSize="20dp"
android:textStyle="italic"/>
<TextView
android:id="@+id/place"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/description"
android:layout_marginTop="25dp"
android:layout_marginLeft="8dp"
android:text="Place"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/placecontent"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:layout_below="@+id/descriptioncontent"
android:layout_marginLeft="20dp"
android:layout_marginTop="25dp"
android:textSize="20dp"
android:textStyle="italic"
android:layout_toEndOf="@+id/place" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/place"
android:layout_marginTop="25dp"
android:layout_marginLeft="8dp"
android:text="Date"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/datecontent"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:layout_below="@+id/placecontent"
android:layout_marginLeft="20dp"
android:layout_marginTop="25dp"
android:textSize="20dp"
android:textStyle="italic"
android:layout_toEndOf="@+id/date" />
</RelativeLayout>
\ 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