Skip to content

Open Source Library for Holdable(partial-swipe) ViewHolder in RecyclerView

License

Notifications You must be signed in to change notification settings

yeon-kyu/HoldableSwipeHandler

Repository files navigation

HoldableSwipeHandler

Open Source Library for Holdable ViewHolder in RecyclerView

Gradle Setup

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.yeon-kyu.HoldableSwipeHandler:HoldableSwipeHandler:1.2.2'
}

Latest Version : 1.2.2

ScreenShot Examples

๐ŸŒด๐ŸŒด ๐ŸŒด๐ŸŒด

How To Use in Activity/Fragment with RecyclerView

val yourRecyclerView: RecyclerView
val yourAdapter: RecyclerView.Adapter or ListAdapter ..

HoldableSwipeHandler.Builder(requireContext())
    .setOnRecyclerView(yourRecyclerView) // mandatory.
    .setSwipeButtonAction(object : SwipeButtonAction { // mandatory.
        override fun onClickFirstButton(absoluteAdapterPosition: Int) {
            val item = yourAdapter.currentList[absoluteAdapterPosition]
            viewModel.deletePushDB(item.articleId) // this is an example.
        }
    })
    .setBackgroundColor("#ff0000") // optional. default value is pink color
    .setFirstItemDrawable(ContextCompat.getDrawable(context, R.drawable.ic_check)!!) // optional. default value is a 'trash can' icon
    .setFirstItemSideMarginDp(20) // optional. default value is 18. (in dip unit)
    .setDismissOnClickFirstItem(true) // optional. default value is 'true'
    .excludeFromHoldableViewHolder(10010) // optional. add ViewType that you want to exclude from holdable ViewHolder
    .build()

Version Updates

v.1.2.2

  • ์™ผ์ชฝ -> ์˜ค๋ฅธ์ชฝ ์Šค์™€์ดํ”„๋„ ๊ฐ€๋Šฅํ•˜๋„๋ก ๋ณ€๊ฒฝ
    • setDirectionAsRightToLeft() ํŒŒ๋ผ๋ฏธํ„ฐ์— false๋ฅผ ๋„ฃ์–ด์„œ ์ ์šฉ ๊ฐ€๋Šฅ (default๊ฐ’ : true)

v.1.2.0

  • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ Builder Pattern์œผ๋กœ ๋ฆฌํŒฉํ† ๋ง
    • ๊ธฐ์กด์˜ ๊ธฐ๋Šฅ๋“ค์€ ์ด์ „ ๋ฐฉ์‹(์ž๋ฐ”๋นˆ์ฆˆ ํŒจํ„ด)์œผ๋กœ๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋‚˜ ๊ถŒ์žฅํ•˜์ง€ ์•Š์Œ

v.1.1.1

  • ์ง€์ •ํ•œ ItemViewType์—๋Š” Swipe ๋ถˆ๊ฐ€๋Šฅํ•˜๊ฒŒ ๊ฐ€๋Šฅํ•˜๋„๋ก ์ˆ˜์ •
    • excludeFromHoldableViewHolder() ์ด์šฉ ๊ฐ€๋Šฅ
    • RecyclerView ๋‚ด์—์„œ ์•„์ดํ…œ ์ข…๋ฅ˜์— ๋”ฐ๋ผ ์—ฌ๋Ÿฌ ViewType์„ ๋‚˜๋ˆ„์—ˆ์„ ๋•Œ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅ

v.1.1.0

  • ๋ฒ„๊ทธ ์ˆ˜์ •
    • ์•„์ดํ…œ ์‚ญ์ œ๋˜๋Š” ๋„์ค‘์— HoldingBackground๊ฐ€ ์ข…์ข… ๋‚จ์•„์žˆ๋Š” ๋ฒ„๊ทธ ์ˆ˜์ •
    • ๋ทฐํ™€๋” ๋ฐฐ๊ฒฝ์ด ํˆฌ๋ช…ํ•œ ๊ฒฝ์šฐ์—์„œ์˜ UI ๋ฒ„๊ทธ ์ˆ˜์ •(๋‚จ์•„์žˆ๋Š” ํˆฌ๋ช… ํด๋ฆญ ๋ฆฌ์Šค๋„ˆ ์ด์Šˆ)
    • ๋ทฐํ™€๋” ์ž์ฒด์˜ ํด๋ฆญ ๋ฆฌ์Šค๋„ˆ๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ์—์„œ์˜ ๋ฒ„๊ทธ ์ฒ˜๋ฆฌ
  • ์•ˆ์ •์ ์ธ ๋ฒ„์ „ ์‹œ์ž‘

v.1.0.10

  • Holding ๋œ ๋ทฐํ™€๋”๊ฐ€ ์‚ญ์ œ๋˜๊ณ  ๋‚˜์„œ ํ•ด๋‹น ๋ทฐํ™€๋”๊ฐ€ ์žฌํ™œ์šฉ๋  ๋•Œ translationX๊ฐ€ ์›๋ณต๋˜์ง€ ์•Š์•˜๋˜ ์ด์Šˆ ์ˆ˜์ •

v.1.0.9

  • HoldingBackground ์˜ ๋ฒ„ํŠผ ํด๋ฆญ์‹œ ์•„์ดํ…œ์„ ์‚ฌ๋ผ์ง€๊ฒŒ ํ•˜๋Š”์ง€์— ๋Œ€ํ•œ ์˜ต์…˜
    • setDismissBackgroundOnClickFirstItem() ์ด์šฉ
      • default value : true

v.1.0.8

  • ๋ทฐํ™€๋”์˜ background๊ฐ€ ํˆฌ๋ช…ํ•œ ๊ฒฝ์šฐ UI ๋ฒ„๊ทธ ์ˆ˜์ •(๋ทฐํ™€๋” ์นจ๋ฒ” ์ด์Šˆ)

License

Designed and developed by 2021 yeon-kyu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.