Implemented camera deletion

This commit is contained in:
Daniele Verducci (Slimpenguin) 2022-02-01 13:05:59 +01:00
parent 85be9af409
commit a99a657cc1
3 changed files with 30 additions and 1 deletions

View File

@ -53,7 +53,15 @@ public class SettingsRecyclerViewAdapter extends RecyclerView.Adapter<SettingsRe
holder.root.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
clickListener.onItemClick(position);
clickListener.onItemClick(holder.getBindingAdapterPosition());
}
});
holder.deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mValues.remove(holder.getBindingAdapterPosition());
notifyItemRemoved(holder.getBindingAdapterPosition());
}
});
}
@ -105,6 +113,7 @@ public class SettingsRecyclerViewAdapter extends RecyclerView.Adapter<SettingsRe
public View root;
public TextView name;
public TextView url;
public View deleteButton;
public View dragHandle;
public ViewHolder(FragmentSettingsItemBinding binding) {
@ -113,6 +122,7 @@ public class SettingsRecyclerViewAdapter extends RecyclerView.Adapter<SettingsRe
this.root = binding.getRoot();
this.name = binding.cameraName;
this.url = binding.cameraUrl;
this.deleteButton = binding.cameraDelete;
this.dragHandle = binding.cameraDragHandle;
}
}

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>

View File

@ -41,6 +41,15 @@
</LinearLayout>
<ImageView
android:id="@+id/camera_delete"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="10dp"
android:layout_weight="0"
app:srcCompat="@drawable/ic_delete"
app:tint="@color/purple_200" />
<ImageView
android:id="@+id/camera_drag_handle"
android:layout_width="wrap_content"