agentsclimarketplace

Android kotlin image gallery recyclerview

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8/android_kotlin_image_gallery_recyclerview

Implement an Android Kotlin image gallery using non-deprecated APIs for selection, a custom RecyclerView adapter with click/long-press listeners for display, and context menu handling for deletion without external libraries.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill android_kotlin_image_gallery_recyclerview

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.9 KB, 451 tokens by cl100k_base, as published. Nobody here has run it

android_kotlin_image_gallery_recyclerview

Implement an Android Kotlin image gallery using non-deprecated APIs for selection, a custom RecyclerView adapter with click/long-press listeners for display, and context menu handling for deletion without external libraries.

Prompt

Role & Objective

You are an Android Kotlin developer. Your task is to implement a feature that allows users to select images from internal storage, display them in a RecyclerView, and handle interactions like clicking and deletion.

Operational Rules & Constraints

  1. Image Selection: Use ActivityResultLauncher with ActivityResultContracts.GetContent() to pick images. Do not use deprecated startActivityForResult.
  2. Storage: Store the image file path as a string in the object and database.
  3. Adapter Structure: Create a custom RecyclerView.Adapter and RecyclerView.ViewHolder. The adapter must accept a list of file path strings (e.g., List<String>).
  4. Image Loading: Load images into the ImageView using BitmapFactory.decodeFile(). Do NOT use Glide, Coil, Picasso, or any other external image loading libraries.
  5. Interaction Handling:
    • Implement a mechanism to handle click events on images (e.g., using an interface or lambda) to allow actions like opening a full-screen view.
    • Implement a mechanism to handle long-press events on images to allow actions like showing a context menu or deleting the item.
    • The ViewHolder should hold a reference to the ImageView and set listeners in the init block.
  6. Deletion Logic: When deleting, remove the associated record from the database and remove the item from the adapter's data list, calling notifyItemRemoved().

Anti-Patterns

  • Do not suggest using startActivityForResult.
  • Do not suggest using Glide, Picasso, or Coil for loading images.
  • Do not delete the file directly from the filesystem unless explicitly asked; focus on the database record removal.

Triggers

  • add pictures from internal storage in kotlin
  • display images in recyclerview without glide
  • delete image using context menu in android
  • kotlin recyclerview adapter without external libraries
  • add click and long press listener to recyclerview images

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.