add cards design

This commit is contained in:
akaessens 2020-09-19 12:05:57 +02:00
parent 85e0d1ff24
commit fecf4ae4e8
2 changed files with 123 additions and 15 deletions

View File

@ -7,11 +7,14 @@ import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import com.google.android.material.textview.MaterialTextView;
import com.squareup.picasso.Picasso;
import java.util.List;
@ -43,7 +46,7 @@ public class EventAdapter extends
* Maps button: launch maps intent
*/
holder.layout_event_location.setEndIconOnClickListener(new View.OnClickListener() {
/*holder.layout_event_location.setEndIconOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String map_search = "geo:0,0?q=" + holder.edit_text_event_location.getText();
@ -54,7 +57,7 @@ public class EventAdapter extends
context.startActivity(map_intent);
}
}
});
});*/
return new ViewHolder(contact_view);
}
@ -96,6 +99,11 @@ public class EventAdapter extends
} else {
holder.edit_text_event_description.setText(event.description);
}
Picasso.get()
.load(event.image_url)
.placeholder(R.drawable.ic_banner_foreground)
.into(holder.image_view_event_image);
}
// Returns the total count of items in the list
@ -106,23 +114,25 @@ public class EventAdapter extends
public class ViewHolder extends RecyclerView.ViewHolder {
protected TextInputEditText edit_text_event_name;
protected TextInputEditText edit_text_event_start;
protected TextInputEditText edit_text_event_end;
protected TextInputEditText edit_text_event_location;
protected TextInputEditText edit_text_event_description;
protected TextInputLayout layout_event_location;
protected MaterialTextView edit_text_event_name;
protected MaterialTextView edit_text_event_start;
protected MaterialTextView edit_text_event_end;
protected MaterialTextView edit_text_event_location;
protected MaterialTextView edit_text_event_description;
protected ImageView image_view_event_image;
//protected TextInputLayout layout_event_location;
public ViewHolder(View item_view) {
super(item_view);
edit_text_event_name = (TextInputEditText) item_view.findViewById(R.id.edit_text_event_name);
edit_text_event_start = (TextInputEditText) item_view.findViewById(R.id.edit_text_event_start);
edit_text_event_end = (TextInputEditText) item_view.findViewById(R.id.edit_text_event_end);
edit_text_event_location = (TextInputEditText) item_view.findViewById(R.id.edit_text_event_location);
edit_text_event_description = (TextInputEditText) item_view.findViewById(R.id.edit_text_event_description);
layout_event_location = (TextInputLayout) item_view.findViewById(R.id.layout_event_location);
edit_text_event_name = (MaterialTextView) item_view.findViewById(R.id.edit_text_event_name);
edit_text_event_start = (MaterialTextView) item_view.findViewById(R.id.edit_text_event_start);
edit_text_event_end = (MaterialTextView) item_view.findViewById(R.id.edit_text_event_end);
edit_text_event_location = (MaterialTextView) item_view.findViewById(R.id.edit_text_event_location);
edit_text_event_description = (MaterialTextView) item_view.findViewById(R.id.edit_text_event_description);
image_view_event_image = (ImageView) item_view.findViewById(R.id.image_view_event_image);
//layout_event_location = (TextInputLayout) item_view.findViewById(R.id.layout_event_location);
}
}
}

View File

@ -1,5 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView android:id="@+id/card"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:strokeWidth="1dp"
app:strokeColor="#000000"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Media -->
<ImageView
android:id="@+id/image_view_event_image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:contentDescription="image" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<!-- Title, secondary and supporting text -->
<TextView
android:id="@+id/edit_text_event_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textAppearance="?attr/textAppearanceHeadline6"
/>
<TextView
android:id="@+id/edit_text_event_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="start"
android:textAppearance="?attr/textAppearanceBody2"
/>
<TextView
android:id="@+id/edit_text_event_end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="end"
android:textAppearance="?attr/textAppearanceBody2"
/>
<TextView
android:id="@+id/edit_text_event_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="location"
android:textAppearance="?attr/textAppearanceBody2"
android:textColor="?android:attr/textColorSecondary"
/>
<TextView
android:id="@+id/edit_text_event_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="description"
android:textAppearance="?attr/textAppearanceBody2"
android:textColor="?android:attr/textColorSecondary"
/>
</LinearLayout>
<!-- Buttons -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:text="add"
style="?attr/borderlessButtonStyle"
/>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dismiss"
style="?attr/borderlessButtonStyle"
/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<!--
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
@ -104,4 +202,4 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>-->