add share-to icon

This commit is contained in:
akaessens 2020-10-03 20:37:27 +02:00
parent 9e81e3d74a
commit 2479cd9c72
3 changed files with 37 additions and 4 deletions

View File

@ -206,6 +206,16 @@ public class EventAdapter extends
}; };
holder.image_view_event_image.setOnClickListener(listener); holder.image_view_event_image.setOnClickListener(listener);
holder.image_view_share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent share_intent = new Intent(android.content.Intent.ACTION_SEND);
share_intent.setType("text/plain");
share_intent.putExtra(Intent.EXTRA_TEXT, event.url);
view.getContext().startActivity(Intent.createChooser(share_intent, null));
}
});
} }
@ -228,6 +238,7 @@ public class EventAdapter extends
protected ImageView image_view_event_image; protected ImageView image_view_event_image;
protected ImageView image_view_event_location; protected ImageView image_view_event_location;
protected ImageView image_view_event_time; protected ImageView image_view_event_time;
protected ImageView image_view_share;
protected Button button_add_to_calendar; protected Button button_add_to_calendar;
protected boolean description_collapsed = true; protected boolean description_collapsed = true;
@ -243,6 +254,7 @@ public class EventAdapter extends
image_view_event_image = item_view.findViewById(R.id.image_view_event_image); image_view_event_image = item_view.findViewById(R.id.image_view_event_image);
image_view_event_location = item_view.findViewById(R.id.image_view_event_location); image_view_event_location = item_view.findViewById(R.id.image_view_event_location);
image_view_event_time = item_view.findViewById(R.id.image_view_event_time); image_view_event_time = item_view.findViewById(R.id.image_view_event_time);
image_view_share = item_view.findViewById(R.id.image_view_share);
button_add_to_calendar = item_view.findViewById(R.id.button_add_to_calendar); button_add_to_calendar = item_view.findViewById(R.id.button_add_to_calendar);
} }

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"
android:fillColor="#000000"/>
</vector>

View File

@ -51,9 +51,9 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:background="?android:attr/selectableItemBackground"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/ic_map" android:src="@drawable/ic_map"
android:background="?android:attr/selectableItemBackground"
app:tint="@color/material_on_surface_emphasis_high_type" /> app:tint="@color/material_on_surface_emphasis_high_type" />
<TextView <TextView
@ -73,8 +73,8 @@
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
style="?android:attr/borderlessButtonStyle"
android:id="@+id/image_view_event_time" android:id="@+id/image_view_event_time"
style="?android:attr/borderlessButtonStyle"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
@ -128,14 +128,26 @@
<Button <Button
android:id="@+id/button_add_to_calendar" android:id="@+id/button_add_to_calendar"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/button_add" android:text="@string/button_add"
android:textColor="@android:color/white" android:textColor="@android:color/white"
app:icon="@drawable/ic_event_available" app:icon="@drawable/ic_event_available"
app:iconGravity="textStart" app:iconGravity="textStart"
app:iconTint="@android:color/white" /> app:iconTint="@android:color/white" />
<ImageView
android:id="@+id/image_view_share"
style="?android:attr/borderlessButtonStyle"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="16dp"
android:background="?android:attr/selectableItemBackground"
android:scaleType="centerCrop"
android:src="@drawable/ic_share"
app:tint="@color/material_on_surface_emphasis_high_type" />
</LinearLayout> </LinearLayout>