├── .bundle └── config ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE.md ├── ci-gradle.properties ├── config │ └── configuration.json └── workflows │ └── ci.yml ├── .gitignore ├── .idea └── dictionaries │ └── benji.xml ├── CHANGELOG.md ├── CONTRIBUTORS.md ├── DEV ├── code-style.xml ├── default-detekt-config.yml ├── functiongraphic │ └── functiongraphic.png ├── github │ ├── screenshots1.jpg │ └── screenshots1.png ├── ic_launcher │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ └── drawable-xxxhdpi │ │ │ └── ic_launcher.png │ └── web_hi_res_512.png ├── inspections.xml └── screenshots │ ├── Screenshot_20160119-231900.png │ ├── Screenshot_20160119-231905.png │ ├── Screenshot_20160119-231914.png │ ├── Screenshot_20160119-231928.png │ ├── Screenshot_20160119-231945.png │ ├── Screenshot_20160119-231952.png │ └── Screenshot_20160119-231959.png ├── Dangerfile ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── MIGRATION.md ├── README.md ├── _config.yml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ └── com │ │ └── mikepenz │ │ └── fastadapter │ │ └── app │ │ ├── AdvancedSampleActivity.kt │ │ ├── CheckBoxSampleActivity.kt │ │ ├── CustomApplication.kt │ │ ├── DiffUtilActivity.kt │ │ ├── DragAndDropActivity.kt │ │ ├── EndlessScrollListActivity.kt │ │ ├── ExpandableMultiselectDeleteSampleActivity.kt │ │ ├── ExpandableSampleActivity.kt │ │ ├── IconGridActivity.kt │ │ ├── ImageListActivity.kt │ │ ├── ModelItemActivity.kt │ │ ├── MultiTypeModelItemActivity.kt │ │ ├── MultiselectSampleActivity.kt │ │ ├── PagedActivity.kt │ │ ├── RadioButtonSampleActivity.kt │ │ ├── RealmActivity.kt │ │ ├── SampleActivity.kt │ │ ├── SimpleItemListActivity.kt │ │ ├── SortActivity.kt │ │ ├── StickyHeaderSampleActivity.kt │ │ ├── SwipeDrawerListActivity.kt │ │ ├── SwipeListActivity.kt │ │ ├── adapters │ │ ├── FastScrollIndicatorAdapter.kt │ │ ├── IDraggableViewHolder.java │ │ ├── SampleWrapAdapter.kt │ │ └── StickyHeaderAdapter.kt │ │ ├── binding │ │ └── BindingIconItem.kt │ │ ├── dummy │ │ └── ImageDummyData.kt │ │ ├── items │ │ ├── CheckBoxSampleItem.kt │ │ ├── DraggableSingleLineItem.kt │ │ ├── HeaderSelectionItem.kt │ │ ├── IconItem.kt │ │ ├── ImageItem.kt │ │ ├── LetterItem.kt │ │ ├── RadioButtonSampleItem.kt │ │ ├── RealmSampleUserItem.kt │ │ ├── SectionHeaderItem.kt │ │ ├── SimpleImageItem.kt │ │ ├── SimpleItem.kt │ │ ├── SmallIconSingleLineItem.kt │ │ ├── SwipeableDrawerItem.kt │ │ ├── SwipeableItem.kt │ │ └── expandable │ │ │ ├── SimpleSubExpandableItem.kt │ │ │ └── SimpleSubItem.kt │ │ ├── model │ │ ├── IconModel.kt │ │ ├── ModelIconItem.kt │ │ ├── RightIconModel.kt │ │ └── RightModelIconItem.kt │ │ ├── paged │ │ ├── DemoEntitiesDB.kt │ │ ├── DemoEntity.kt │ │ ├── DemoEntityLocalDAO.kt │ │ ├── DemoEntityViewModel.kt │ │ └── LocalRepository.kt │ │ ├── utils │ │ └── Utils.kt │ │ └── view │ │ ├── DraggableFrameLayout.kt │ │ └── RecyclerViewBackgroundDrawable.kt │ └── res │ ├── anim │ └── alpha_on.xml │ ├── animator │ └── draggable_state_list_anim.xml │ ├── drawable-v21 │ └── button_rect_list_normal.xml │ ├── drawable │ ├── button_rect_list_normal.xml │ ├── gradient.xml │ └── ic_drag_handle.xml │ ├── layout │ ├── activity_main.xml │ ├── activity_sample.xml │ ├── checkbox_sample_item.xml │ ├── draggable_single_line_item.xml │ ├── expandable_item.xml │ ├── icon_item.xml │ ├── image_item.xml │ ├── letter_item.xml │ ├── native_ad_item.xml │ ├── radiobutton_sample_item.xml │ ├── right_icon_item.xml │ ├── sample_item.xml │ ├── section_header_item.xml │ ├── simple_image_item.xml │ ├── small_single_line_item.xml │ ├── swipeable_drawer_item.xml │ ├── swipeable_item.xml │ └── view_header.xml │ ├── menu │ ├── cab.xml │ ├── menu.xml │ ├── menu_add.xml │ ├── refresh.xml │ ├── search.xml │ └── sort.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── values-land │ └── integers.xml │ ├── values-night │ └── colors.xml │ └── values │ ├── colors.xml │ ├── ic_launcher_background.xml │ ├── ids.xml │ ├── integers.xml │ ├── strings.xml │ ├── styles.xml │ └── themes.xml ├── build.gradle ├── configurations.gradle ├── detekt.gradle ├── fastadapter-extensions-binding ├── .gitignore ├── build.gradle ├── consumer-proguard-rules.pro ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── mikepenz │ └── fastadapter │ └── binding │ ├── AbstractBindingItem.kt │ ├── BaseBindingItemVHFactory.kt │ ├── BindingViewHolder.kt │ ├── ModelAbstractBindingItem.kt │ └── listeners │ └── BindingEventHookExtensions.kt ├── fastadapter-extensions-diff ├── .gitignore ├── build.gradle ├── consumer-proguard-rules.pro ├── gradle.properties ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ └── mikepenz │ │ └── fastadapter │ │ └── diff │ │ ├── DiffCallback.kt │ │ ├── DiffCallbackImpl.kt │ │ └── FastAdapterDiffUtil.kt │ └── test │ ├── java │ └── com │ │ └── mikepenz │ │ └── fastadapter │ │ └── diff │ │ ├── FastAdapterDiffUtilTest.java │ │ ├── TestDataGenerator.java │ │ └── TestItem.java │ └── resources │ └── robolectric.properties ├── fastadapter-extensions-drag ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── mikepenz │ └── fastadapter │ └── drag │ ├── IDraggable.kt │ ├── IExtendedDraggable.kt │ ├── ItemTouchCallback.kt │ └── SimpleDragCallback.kt ├── fastadapter-extensions-expandable ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ └── mikepenz │ │ └── fastadapter │ │ ├── expandable │ │ ├── ExpandableExtension.kt │ │ ├── ExpandableExtensionFactory.kt │ │ └── items │ │ │ ├── AbstractExpandableItem.kt │ │ │ └── ModelAbstractExpandableItem.kt │ │ └── utils │ │ ├── AdapterUtil.kt │ │ └── SubItemUtil.kt │ └── test │ └── java │ └── com │ └── mikepenz │ └── fastadapter │ ├── ExpandableFastAdapterTest.kt │ ├── ExpandableTestDataGenerator.java │ ├── ExpandableTestItem.java │ └── NoneExpandableTestItem.java ├── fastadapter-extensions-paged ├── .gitignore ├── build.gradle ├── consumer-proguard-rules.pro ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── mikepenz │ └── fastadapter │ └── paged │ ├── PagedItemListImpl.kt │ └── PagedModelAdapter.kt ├── fastadapter-extensions-scroll ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ ├── androidx │ └── recyclerview │ │ └── widget │ │ └── com_mikepenz_fastadapter_extensions_scroll.kt │ └── com │ └── mikepenz │ └── fastadapter │ └── scroll │ ├── EndlessRecyclerOnScrollListener.kt │ ├── EndlessRecyclerOnTopScrollListener.kt │ └── EndlessScrollHelper.kt ├── fastadapter-extensions-swipe ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── mikepenz │ └── fastadapter │ └── swipe │ ├── Extensions.kt │ ├── IDrawerSwipeableViewHolder.kt │ ├── ISwipeable.kt │ ├── SimpleSwipeCallback.kt │ └── SimpleSwipeDrawerCallback.kt ├── fastadapter-extensions-ui ├── .gitignore ├── build.gradle ├── consumer-proguard-rules.pro ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── mikepenz │ │ └── fastadapter │ │ └── ui │ │ ├── dialog │ │ ├── FastAdapterBottomSheetDialog.kt │ │ └── FastAdapterDialog.kt │ │ ├── items │ │ ├── ProgressItem.kt │ │ ├── SingleLineItem.kt │ │ ├── ThreeLineItem.kt │ │ └── TwoLineItem.kt │ │ └── utils │ │ ├── FastAdapterUIUtils.kt │ │ ├── FixStateListDrawable.kt │ │ ├── ImageHolder.kt │ │ └── StringHolder.kt │ └── res │ ├── layout │ ├── progress_item.xml │ ├── single_line_item.xml │ ├── three_line_item.xml │ └── two_line_item.xml │ └── values │ └── ids.xml ├── fastadapter-extensions-utils ├── .gitignore ├── build.gradle ├── consumer-proguard-rules.pro ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── mikepenz │ └── fastadapter │ ├── adapters │ ├── AbstractWrapAdapter.kt │ ├── FastItemAdapter.kt │ └── WrapAdapter.kt │ ├── helpers │ ├── ActionModeHelper.kt │ ├── HeaderHelper.kt │ ├── RangeSelectorHelper.kt │ └── UndoHelper.kt │ ├── swipe_drag │ ├── SimpleSwipeDragCallback.kt │ └── SimpleSwipeDrawerDragCallback.kt │ └── utils │ └── DragDropUtil.kt ├── fastadapter ├── .gitignore ├── build.gradle ├── consumer-proguard-rules.pro ├── gradle.properties ├── proguard-rules.txt └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── mikepenz │ │ │ └── fastadapter │ │ │ ├── AbstractAdapter.kt │ │ │ ├── FastAdapter.kt │ │ │ ├── IAdapter.kt │ │ │ ├── IAdapterExtension.kt │ │ │ ├── IAdapterNotifier.kt │ │ │ ├── IClickable.kt │ │ │ ├── IExpandable.kt │ │ │ ├── IHookable.kt │ │ │ ├── IIdDistributor.kt │ │ │ ├── IIdentifyable.kt │ │ │ ├── IItem.kt │ │ │ ├── IItemAdapter.kt │ │ │ ├── IItemList.kt │ │ │ ├── IItemVHFactory.kt │ │ │ ├── IItemVHFactoryCache.kt │ │ │ ├── IItemViewGenerator.kt │ │ │ ├── IModelItem.kt │ │ │ ├── IParentItem.kt │ │ │ ├── ISelectionListener.kt │ │ │ ├── ISubItem.kt │ │ │ ├── MutableSubItemList.kt │ │ │ ├── VerboseLogger.kt │ │ │ ├── adapters │ │ │ ├── ItemAdapter.kt │ │ │ ├── ItemFilter.kt │ │ │ └── ModelAdapter.kt │ │ │ ├── dsl │ │ │ └── FastAdapterDsl.kt │ │ │ ├── extensions │ │ │ ├── ExtensionFactory.kt │ │ │ └── ExtensionsFactories.kt │ │ │ ├── items │ │ │ ├── AbstractItem.kt │ │ │ ├── BaseItem.kt │ │ │ ├── ModelAbstractItem.kt │ │ │ └── ModelBaseItem.kt │ │ │ ├── listeners │ │ │ ├── ClickEventHook.kt │ │ │ ├── CustomEventHook.kt │ │ │ ├── EventHook.kt │ │ │ ├── ItemFilterListener.kt │ │ │ ├── LongClickEventHook.kt │ │ │ ├── OnBindViewHolderListener.kt │ │ │ ├── OnBindViewHolderListenerImpl.kt │ │ │ ├── OnCreateViewHolderListener.kt │ │ │ ├── OnCreateViewHolderListenerImpl.kt │ │ │ └── TouchEventHook.kt │ │ │ ├── select │ │ │ ├── SelectExtension.kt │ │ │ └── SelectExtensionFactory.kt │ │ │ └── utils │ │ │ ├── AdapterPredicate.kt │ │ │ ├── ComparableItemListImpl.kt │ │ │ ├── DefaultIdDistributor.kt │ │ │ ├── DefaultIdDistributorImpl.kt │ │ │ ├── DefaultItemList.kt │ │ │ ├── DefaultItemListImpl.kt │ │ │ ├── DefaultItemVHFactoryCache.kt │ │ │ ├── EventHookUtil.kt │ │ │ ├── InterceptorUtil.kt │ │ │ ├── Sort.kt │ │ │ └── Triple.kt │ └── res │ │ └── values │ │ ├── ids.xml │ │ └── library_fastadapter_strings.xml │ └── test │ ├── java │ └── com │ │ └── mikepenz │ │ └── fastadapter │ │ ├── FastAdapterTest.java │ │ ├── TestDataGenerator.java │ │ └── TestItem.java │ └── resources │ └── robolectric.properties ├── gradle-release.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── release.sh └── settings.gradle /.bundle/config: -------------------------------------------------------------------------------- 1 | --- 2 | BUNDLE_PATH: "vendor/bundle" 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [mikepenz] 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## About this issue 2 | 3 | - Briefly describe the issue 4 | - How can the issue be reproduced / sample code 5 | 6 | ## Details 7 | - [ ] Used library version 8 | - [ ] Used support library version 9 | - [ ] Used gradle build tools version 10 | - [ ] Used tooling / Android Studio version 11 | - [ ] Other used libraries, potential conflicting libraries 12 | 13 | ## Checklist 14 | 15 | - [ ] Searched for [similar issues](https://github.com/mikepenz/FastAdapter/issues) 16 | - [ ] Checked out the [sample application](https://github.com/mikepenz/FastAdapter/tree/develop/app) 17 | - [ ] Read the [README](https://github.com/mikepenz/FastAdapter/blob/develop/README.md) 18 | - [ ] Checked out the [CHANGELOG](https://github.com/mikepenz/FastAdapter/releases) 19 | - [ ] Checked out the [MIGRATION GUIDE](https://github.com/mikepenz/FastAdapter/blob/develop/MIGRATION.md) 20 | -------------------------------------------------------------------------------- /.github/ci-gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.daemon=true 2 | org.gradle.parallel=true 3 | org.gradle.workers.max=2 4 | org.gradle.jvmargs=-Xmx6G 5 | org.gradle.caching=true 6 | org.gradle.configureondemand=true 7 | # parallel kapt 8 | kapt.use.worker.api=true 9 | -------------------------------------------------------------------------------- /.github/config/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "categories": [ 3 | { 4 | "title": "## 🚀 Features", 5 | "labels": [ 6 | "feature" 7 | ] 8 | }, 9 | { 10 | "title": "## 🐛 Fixes", 11 | "labels": [ 12 | "fix" 13 | ] 14 | }, 15 | { 16 | "title": "## 🧪 Tests", 17 | "labels": [ 18 | "test" 19 | ] 20 | }, 21 | { 22 | "title": "## 💬 Other", 23 | "labels": [ 24 | "other" 25 | ] 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | /*/build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | #IntelliJ files 30 | *.iml 31 | .idea/* 32 | !.idea/dictionaries 33 | 34 | *.DS_STORE 35 | /vendor/* 36 | -------------------------------------------------------------------------------- /.idea/dictionaries/benji.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | aleksander 5 | alireza 6 | bergander 7 | chaudhary 8 | claide 9 | configureondemand 10 | ctor 11 | descr 12 | detekt 13 | expandables 14 | fabianterhorst 15 | fastadapter 16 | flisar 17 | gagan 18 | gulko 19 | hookable 20 | iconics 21 | identifiables 22 | isegran 23 | jasonsparc 24 | jetpack 25 | jvmargs 26 | kapt 27 | kramdown 28 | mielczarek 29 | mikepenz 30 | mopub 31 | multiselect 32 | octokit 33 | paypal 34 | penz 35 | performant 36 | rchardet 37 | rects 38 | rexml 39 | rubengees 40 | shubham 41 | snackbar 42 | spek 43 | stickyheadersrecyclerview 44 | subitem 45 | subitems 46 | sublists 47 | swipeable 48 | terhorst 49 | timehop 50 | unselect 51 | unswipe 52 | unswiped 53 | usecases 54 | viewholder 55 | 56 | 57 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | You can find a detailed change log in the [release section](https://github.com/mikepenz/FastAdapter/releases) 2 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | FastAdapter contributors (sorted alphabetically) 2 | ============================================ 3 | 4 | * **[Fabian Terhorst](https://github.com/FabianTerhorst)** 5 | 6 | * EndlessScroll-Listener (EndlessScroll Sample) 7 | * Improvements to the `SimpleDragCallback` 8 | * Add additional tests 9 | * Add `FastAdapterDialog` 10 | * Add additional default `Items` 11 | 12 | * **[MFlisar](https://github.com/MFlisar)** 13 | 14 | * Improvements to the Expandable / SubItems implementation 15 | 16 | * **[Mattias Isegran Bergander](https://github.com/mattiasbe)** 17 | 18 | * "Leave-Behind"-Pattern (SwipeList Sample) 19 | 20 | * **[Rainer Lang](https://github.com/Rainer-Lang)** 21 | 22 | * CheckBoxSample 23 | * RadioButtonSample 24 | 25 | * **[rubengees](https://github.com/rubengees)** 26 | 27 | * SortSample with comparator 28 | 29 | * **[Shubham Chaudhary](https://github.com/shubhamchaudhary)** 30 | 31 | * Basic Unit-Tests 32 | 33 | * **[Alireza](https://github.com/meNESS)** 34 | 35 | * EndlessRecyclerOnTopScrollListener 36 | 37 | * **[jasonsparc](https://github.com/jasonsparc)** 38 | 39 | * Added `EndlessScrollHelper` -------------------------------------------------------------------------------- /DEV/functiongraphic/functiongraphic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/functiongraphic/functiongraphic.png -------------------------------------------------------------------------------- /DEV/github/screenshots1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/github/screenshots1.jpg -------------------------------------------------------------------------------- /DEV/github/screenshots1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/github/screenshots1.png -------------------------------------------------------------------------------- /DEV/ic_launcher/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/ic_launcher/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /DEV/ic_launcher/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/ic_launcher/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /DEV/ic_launcher/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/ic_launcher/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /DEV/ic_launcher/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/ic_launcher/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /DEV/ic_launcher/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/ic_launcher/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /DEV/ic_launcher/web_hi_res_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/ic_launcher/web_hi_res_512.png -------------------------------------------------------------------------------- /DEV/inspections.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /DEV/screenshots/Screenshot_20160119-231900.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/screenshots/Screenshot_20160119-231900.png -------------------------------------------------------------------------------- /DEV/screenshots/Screenshot_20160119-231905.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/screenshots/Screenshot_20160119-231905.png -------------------------------------------------------------------------------- /DEV/screenshots/Screenshot_20160119-231914.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/screenshots/Screenshot_20160119-231914.png -------------------------------------------------------------------------------- /DEV/screenshots/Screenshot_20160119-231928.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/screenshots/Screenshot_20160119-231928.png -------------------------------------------------------------------------------- /DEV/screenshots/Screenshot_20160119-231945.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/screenshots/Screenshot_20160119-231945.png -------------------------------------------------------------------------------- /DEV/screenshots/Screenshot_20160119-231952.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/screenshots/Screenshot_20160119-231952.png -------------------------------------------------------------------------------- /DEV/screenshots/Screenshot_20160119-231959.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/DEV/screenshots/Screenshot_20160119-231959.png -------------------------------------------------------------------------------- /Dangerfile: -------------------------------------------------------------------------------- 1 | github.dismiss_out_of_range_messages 2 | 3 | # Make it more obvious that a PR is a work in progress and shouldn't be merged yet. 4 | has_wip_label = github.pr_labels.any? { |label| label.include? "Engineers at work" } 5 | has_wip_title = github.pr_title.include? "[WIP]" 6 | 7 | if has_wip_label || has_wip_title 8 | warn("PR is marked as Work in Progress") 9 | end 10 | 11 | # Ensure the PR is not marked as DO NOT MERGE 12 | fail("PR specifies label DO NOT MERGE") if github.pr_labels.any? { |label| label.include? "DO NOT MERGE" } 13 | 14 | # Warn when there is a big PR 15 | warn("Big PR") if git.lines_of_code > 5000 16 | 17 | File.open("settings.gradle", "r") do |file_handle| 18 | file_handle.each_line do |setting| 19 | if setting.include? "include" 20 | gradleModule = setting[10, setting.length-12] 21 | 22 | # AndroidLint 23 | androidLintFile = String.new(gradleModule + "/build/reports/lint-results.xml") 24 | androidLintDebugFile = String.new(gradleModule + "/build/reports/lint-results-debug.xml") 25 | if File.file?(androidLintFile) || File.file?(androidLintDebugFile) 26 | android_lint.skip_gradle_task = true 27 | android_lint.severity = "Warning" 28 | if File.file?(androidLintFile) 29 | android_lint.report_file = androidLintFile 30 | else 31 | android_lint.report_file = androidLintDebugFile 32 | end 33 | android_lint.filtering = true 34 | android_lint.lint(inline_mode: true) 35 | end 36 | 37 | # Detekt 38 | detektFile = String.new(gradleModule + "/build/reports/detekt.xml") 39 | if File.file?(detektFile) 40 | kotlin_detekt.report_file = detektFile 41 | kotlin_detekt.skip_gradle_task = true 42 | kotlin_detekt.severity = "warning" 43 | kotlin_detekt.filtering = true 44 | kotlin_detekt.detekt(inline_mode: true) 45 | end 46 | end 47 | end 48 | end -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } 6 | 7 | gem 'danger' 8 | gem 'danger-android_lint' 9 | gem 'danger-kotlin_detekt' -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | title: FastAdapter 2 | description: The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction... 3 | show_downloads: true 4 | theme: jekyll-theme-minimal 5 | 6 | gems: 7 | - jekyll-mentions 8 | - jekyll-readme-index 9 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Entwicklung/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepenz/FastAdapter/77761873d8f5c469a3dcc49766e2960826bbe62b/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/CustomApplication.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app 2 | 3 | import androidx.multidex.MultiDexApplication 4 | import io.realm.Realm 5 | import io.realm.RealmConfiguration 6 | 7 | /** 8 | * Created by mikepenz on 04.07.16. 9 | */ 10 | 11 | class CustomApplication : MultiDexApplication() { 12 | override fun onCreate() { 13 | super.onCreate() 14 | // The Realm file will be located in Context.getFilesDir() with name "default.realm" 15 | Realm.init(this) 16 | val config = RealmConfiguration.Builder().build() 17 | Realm.setDefaultConfiguration(config) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/adapters/IDraggableViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.adapters; 2 | 3 | /** 4 | * Helper interface to allow a viewHolder to react to drag events. 5 | */ 6 | public interface IDraggableViewHolder { 7 | /** 8 | * Called when an item enters drag state 9 | */ 10 | void onDragged(); 11 | 12 | /** 13 | * Called when an item has been dropped 14 | */ 15 | void onDropped(); 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/adapters/SampleWrapAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.adapters 2 | 3 | import androidx.recyclerview.widget.RecyclerView 4 | 5 | import com.mikepenz.fastadapter.IItem 6 | import com.mikepenz.fastadapter.adapters.AbstractWrapAdapter 7 | 8 | /** 9 | * Created by mikepenz on 03.03.16. 10 | */ 11 | class SampleWrapAdapter, VH : RecyclerView.ViewHolder>(list: List) : AbstractWrapAdapter(list) { 12 | 13 | override fun shouldInsertItemAtPosition(position: Int): Boolean { 14 | return position == 10 15 | } 16 | 17 | override fun itemInsertedBeforeCount(position: Int): Int { 18 | return if (position > 10) { 19 | 1 20 | } else 0 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/binding/BindingIconItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.binding 2 | 3 | import android.view.LayoutInflater 4 | import android.view.ViewGroup 5 | import com.mikepenz.fastadapter.IExpandable 6 | import com.mikepenz.fastadapter.IParentItem 7 | import com.mikepenz.fastadapter.ISubItem 8 | import com.mikepenz.fastadapter.app.R 9 | import com.mikepenz.fastadapter.app.databinding.IconItemBinding 10 | import com.mikepenz.fastadapter.app.utils.getThemeColor 11 | import com.mikepenz.fastadapter.binding.AbstractBindingItem 12 | import com.mikepenz.fastadapter.binding.BindingViewHolder 13 | import com.mikepenz.iconics.IconicsDrawable 14 | import com.mikepenz.iconics.typeface.IIcon 15 | import com.mikepenz.iconics.utils.colorInt 16 | 17 | /** 18 | * Created by mikepenz on 28.12.15. 19 | */ 20 | class BindingIconItem : AbstractBindingItem(), IExpandable> { 21 | var icon: IIcon? = null 22 | 23 | override var parent: IParentItem<*>? = null 24 | override var isExpanded: Boolean = false 25 | 26 | override var subItems: MutableList> 27 | get() = mutableListOf() 28 | set(_) { 29 | } 30 | 31 | override val isAutoExpanding: Boolean 32 | get() = true 33 | 34 | /** 35 | * defines the type defining this item. must be unique. preferably an id 36 | * 37 | * @return the type 38 | */ 39 | override val type: Int 40 | get() = R.id.fastadapter_icon_item_id 41 | 42 | /** 43 | * setter method for the Icon 44 | * 45 | * @param icon the icon 46 | * @return this 47 | */ 48 | fun withIcon(icon: IIcon): BindingIconItem { 49 | this.icon = icon 50 | return this 51 | } 52 | 53 | /** 54 | * binds the data of this item onto the viewHolder 55 | */ 56 | override fun bindView(binding: IconItemBinding, payloads: List) { 57 | //define our data for the view 58 | icon?.let { 59 | binding.icon.icon = IconicsDrawable(binding.icon.context, it).apply { 60 | colorInt = binding.root.context.getThemeColor(R.attr.colorOnSurface) 61 | } 62 | } 63 | binding.name.text = icon?.name 64 | } 65 | 66 | override fun unbindView(binding: IconItemBinding) { 67 | binding.icon.setImageDrawable(null) 68 | } 69 | 70 | override fun createBinding(inflater: LayoutInflater, parent: ViewGroup?): IconItemBinding { 71 | return IconItemBinding.inflate(inflater, parent, false) 72 | } 73 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/items/DraggableSingleLineItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.items 2 | 3 | import android.graphics.drawable.Drawable 4 | import android.view.MotionEvent 5 | import android.view.View 6 | import android.widget.ImageView 7 | import android.widget.TextView 8 | import androidx.recyclerview.widget.RecyclerView 9 | import com.mikepenz.fastadapter.FastAdapter 10 | import com.mikepenz.fastadapter.app.R 11 | import com.mikepenz.fastadapter.drag.IDraggable 12 | import com.mikepenz.fastadapter.items.AbstractItem 13 | import com.mikepenz.fastadapter.listeners.TouchEventHook 14 | import com.mikepenz.fastadapter.ui.utils.ImageHolder 15 | import com.mikepenz.fastadapter.ui.utils.StringHolder 16 | 17 | class DraggableSingleLineItem(icon: Drawable, name: String) : AbstractItem(), IDraggable { 18 | val icon: ImageHolder = ImageHolder(icon) 19 | val name: StringHolder = StringHolder(name) 20 | 21 | override val isDraggable: Boolean = true 22 | 23 | override val type: Int 24 | get() = R.id.fastadapter_draggable_single_line_item 25 | 26 | override val layoutRes: Int 27 | get() = R.layout.draggable_single_line_item 28 | 29 | override fun bindView(holder: ViewHolder, payloads: List) { 30 | super.bindView(holder, payloads) 31 | ImageHolder.applyToOrSetGone(icon, holder.icon) 32 | name.applyTo(holder.name) 33 | } 34 | 35 | override fun unbindView(holder: ViewHolder) { 36 | holder.icon.setImageDrawable(null) 37 | holder.name.text = null 38 | } 39 | 40 | override fun getViewHolder(v: View): ViewHolder = ViewHolder(v) 41 | 42 | class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { 43 | var icon: ImageView = view.findViewById(R.id.icon) 44 | var name: TextView = view.findViewById(R.id.name) 45 | var dragHandle: View = view.findViewById(R.id.drag_handle) 46 | } 47 | } 48 | 49 | class DragHandleTouchEvent(val action: (position: Int) -> Unit) : TouchEventHook() { 50 | override fun onBind(viewHolder: RecyclerView.ViewHolder): View? { 51 | return if (viewHolder is DraggableSingleLineItem.ViewHolder) viewHolder.dragHandle else null 52 | } 53 | 54 | override fun onTouch( 55 | v: View, 56 | event: MotionEvent, 57 | position: Int, 58 | fastAdapter: FastAdapter, 59 | item: DraggableSingleLineItem 60 | ): Boolean { 61 | return if (event.action == MotionEvent.ACTION_DOWN) { 62 | action(position) 63 | true 64 | } else { 65 | false 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/items/HeaderSelectionItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.items 2 | 3 | import android.graphics.Color 4 | import androidx.core.view.ViewCompat 5 | import com.mikepenz.fastadapter.app.items.expandable.SimpleSubExpandableItem 6 | import com.mikepenz.fastadapter.ui.utils.FastAdapterUIUtils 7 | import com.mikepenz.materialdrawer.holder.StringHolder 8 | 9 | /** 10 | * Created by flisar on 21.09.2016. 11 | */ 12 | 13 | open class HeaderSelectionItem : SimpleSubExpandableItem() { 14 | 15 | var mSubSelectionProvider: (() -> Int)? = null 16 | 17 | fun withSubSelectionProvider(subSelectionProvider: () -> Int) { 18 | this.mSubSelectionProvider = subSelectionProvider 19 | } 20 | 21 | override fun bindView(holder: ViewHolder, payloads: List) { 22 | super.bindView(holder, payloads) 23 | 24 | //get the context 25 | val ctx = holder.itemView.context 26 | 27 | //set the background for the item 28 | holder.view.clearAnimation() 29 | ViewCompat.setBackground(holder.view, FastAdapterUIUtils.getSelectableBackground(ctx, Color.RED, true)) 30 | //set the text for the name 31 | StringHolder.applyTo(name, holder.name) 32 | //set the text for the description or hide 33 | 34 | var selectedSubItems = 0 35 | if (mSubSelectionProvider != null) 36 | selectedSubItems = mSubSelectionProvider?.invoke() ?: 0 37 | val descr = StringHolder(if (selectedSubItems > 0) description?.textString else "Selected children: " + selectedSubItems + "/" + subItems.size) 38 | StringHolder.applyToOrHide(descr, holder.description) 39 | 40 | holder.description.setTextColor(if (selectedSubItems == 0) Color.BLACK else Color.RED) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/items/LetterItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.items 2 | 3 | import android.view.View 4 | import android.widget.TextView 5 | import androidx.recyclerview.widget.RecyclerView 6 | import com.mikepenz.fastadapter.app.R 7 | import com.mikepenz.fastadapter.items.AbstractItem 8 | 9 | class LetterItem(var letter: String) : AbstractItem() { 10 | 11 | override val type: Int 12 | get() = R.id.fastadapter_letter_item_id 13 | 14 | override val layoutRes: Int 15 | get() = R.layout.letter_item 16 | 17 | override fun bindView(holder: ViewHolder, payloads: List) { 18 | super.bindView(holder, payloads) 19 | holder.text.text = letter 20 | } 21 | 22 | override fun unbindView(holder: ViewHolder) { 23 | super.unbindView(holder) 24 | holder.text.text = null 25 | } 26 | 27 | override fun getViewHolder(v: View): ViewHolder { 28 | return ViewHolder(v) 29 | } 30 | 31 | class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { 32 | var text: TextView = view.findViewById(R.id.text) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/items/SectionHeaderItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.items 2 | 3 | import android.view.View 4 | import android.widget.TextView 5 | import androidx.recyclerview.widget.RecyclerView 6 | import com.mikepenz.fastadapter.app.R 7 | import com.mikepenz.fastadapter.items.AbstractItem 8 | import com.mikepenz.fastadapter.ui.utils.StringHolder 9 | 10 | class SectionHeaderItem(text: String) : AbstractItem() { 11 | val text: StringHolder = StringHolder(text) 12 | 13 | override val type: Int 14 | get() = R.id.fastadapter_section_header_item 15 | 16 | override val layoutRes: Int 17 | get() = R.layout.section_header_item 18 | 19 | override fun bindView(holder: ViewHolder, payloads: List) { 20 | super.bindView(holder, payloads) 21 | text.applyTo(holder.text) 22 | } 23 | 24 | override fun unbindView(holder: ViewHolder) { 25 | holder.text.text = null 26 | } 27 | 28 | override fun getViewHolder(v: View): ViewHolder = ViewHolder(v) 29 | 30 | class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { 31 | var text: TextView = view.findViewById(R.id.text) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/items/SmallIconSingleLineItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.items 2 | 3 | import android.graphics.drawable.Drawable 4 | import android.view.View 5 | import android.widget.ImageView 6 | import android.widget.TextView 7 | import androidx.recyclerview.widget.RecyclerView 8 | import com.mikepenz.fastadapter.app.R 9 | import com.mikepenz.fastadapter.items.AbstractItem 10 | import com.mikepenz.fastadapter.ui.utils.ImageHolder 11 | import com.mikepenz.fastadapter.ui.utils.StringHolder 12 | 13 | class SmallIconSingleLineItem(icon: Drawable, name: String) : AbstractItem() { 14 | val icon: ImageHolder = ImageHolder(icon) 15 | val name: StringHolder = StringHolder(name) 16 | 17 | override val type: Int 18 | get() = R.id.fastadapter_small_icon_single_line_item 19 | 20 | override val layoutRes: Int 21 | get() = R.layout.small_single_line_item 22 | 23 | override fun bindView(holder: ViewHolder, payloads: List) { 24 | super.bindView(holder, payloads) 25 | ImageHolder.applyToOrSetGone(icon, holder.icon) 26 | name.applyTo(holder.name) 27 | } 28 | 29 | override fun unbindView(holder: ViewHolder) { 30 | holder.icon.setImageDrawable(null) 31 | holder.name.text = null 32 | } 33 | 34 | override fun getViewHolder(v: View): ViewHolder = ViewHolder(v) 35 | 36 | class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { 37 | var icon: ImageView = view.findViewById(R.id.icon) 38 | var name: TextView = view.findViewById(R.id.name) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/model/IconModel.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.model 2 | 3 | import com.mikepenz.iconics.typeface.IIcon 4 | 5 | /** 6 | * Created by mikepenz on 18.01.16. 7 | */ 8 | open class IconModel(var icon: IIcon) 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/model/ModelIconItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.model 2 | 3 | import android.view.View 4 | import android.widget.TextView 5 | import androidx.recyclerview.widget.RecyclerView 6 | import com.mikepenz.fastadapter.app.R 7 | import com.mikepenz.fastadapter.app.utils.getThemeColor 8 | import com.mikepenz.fastadapter.items.ModelAbstractItem 9 | import com.mikepenz.iconics.IconicsDrawable 10 | import com.mikepenz.iconics.utils.colorInt 11 | import com.mikepenz.iconics.view.IconicsImageView 12 | 13 | /** 14 | * Created by mikepenz on 28.12.15. 15 | */ 16 | open class ModelIconItem(icon: IconModel) : ModelAbstractItem(icon) { 17 | 18 | /** 19 | * defines the type defining this item. must be unique. preferably an id 20 | * 21 | * @return the type 22 | */ 23 | override val type: Int 24 | get() = R.id.fastadapter_model_icon_item_id 25 | 26 | /** 27 | * defines the layout which will be used for this item in the list 28 | * 29 | * @return the layout for this item 30 | */ 31 | override val layoutRes: Int 32 | get() = R.layout.icon_item 33 | 34 | /** 35 | * binds the data of this item onto the viewHolder 36 | * 37 | * @param holder the viewHolder of this item 38 | */ 39 | override fun bindView(holder: ViewHolder, payloads: List) { 40 | super.bindView(holder, payloads) 41 | 42 | //define our data for the view 43 | holder.image.icon = IconicsDrawable(holder.image.context, model.icon).apply { 44 | colorInt = holder.view.context.getThemeColor(R.attr.colorOnSurface) 45 | } 46 | holder.name.text = model.icon.name 47 | } 48 | 49 | override fun unbindView(holder: ViewHolder) { 50 | super.unbindView(holder) 51 | holder.image.setImageDrawable(null) 52 | holder.name.text = null 53 | } 54 | 55 | override fun getViewHolder(v: View): ViewHolder { 56 | return ViewHolder(v) 57 | } 58 | 59 | /** 60 | * our ViewHolder 61 | */ 62 | class ViewHolder(val view: View) : RecyclerView.ViewHolder(view) { 63 | var name: TextView = view.findViewById(R.id.name) 64 | var image: IconicsImageView = view.findViewById(R.id.icon) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/model/RightIconModel.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.model 2 | 3 | import com.mikepenz.iconics.typeface.IIcon 4 | 5 | /** 6 | * Created by mikepenz on 18.01.16. 7 | */ 8 | class RightIconModel(icon: IIcon) : IconModel(icon) 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/model/RightModelIconItem.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.model 2 | 3 | import com.mikepenz.fastadapter.app.R 4 | 5 | /** 6 | * Created by mikepenz on 28.12.15. 7 | */ 8 | class RightModelIconItem(icon: IconModel) : ModelIconItem(icon) { 9 | 10 | /** 11 | * defines the type defining this item. must be unique. preferably an id 12 | * 13 | * @return the type 14 | */ 15 | override val type: Int 16 | get() = R.id.fastadapter_right_Model_icon_item_id 17 | 18 | /** 19 | * defines the layout which will be used for this item in the list 20 | * 21 | * @return the layout for this item 22 | */ 23 | override val layoutRes: Int 24 | get() = R.layout.right_icon_item 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/paged/DemoEntitiesDB.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.paged 2 | 3 | import androidx.room.Database 4 | import androidx.room.RoomDatabase 5 | 6 | /** 7 | * https://www.zoftino.com/pagination-in-android-using-paging-library 8 | */ 9 | @Database(entities = [DemoEntity::class], version = 1) 10 | abstract class DemoEntitiesDB : RoomDatabase() { 11 | abstract fun demoEntityDAO(): DemoEntityLocalDAO 12 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/paged/DemoEntity.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.paged 2 | 3 | import androidx.room.Entity 4 | import androidx.room.PrimaryKey 5 | 6 | /** 7 | * https://www.zoftino.com/pagination-in-android-using-paging-library 8 | */ 9 | @Entity 10 | class DemoEntity() { 11 | @PrimaryKey(autoGenerate = true) 12 | var identifier: Int = 0 13 | var data1: String? = null 14 | var data2: String? = null 15 | 16 | constructor(data1: String, data2: String) : this() { 17 | this.data1 = data1 18 | this.data2 = data2 19 | } 20 | 21 | override fun equals(other: Any?): Boolean { 22 | if (other === this) 23 | return true 24 | val demoEntity = other as DemoEntity? 25 | return demoEntity!!.identifier == this.identifier && 26 | demoEntity.data1 === demoEntity.data1 && 27 | demoEntity.data2 === demoEntity.data2 28 | } 29 | 30 | override fun hashCode(): Int { 31 | var result = identifier 32 | result = 31 * result + (data1?.hashCode() ?: 0) 33 | result = 31 * result + (data2?.hashCode() ?: 0) 34 | return result 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/paged/DemoEntityLocalDAO.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.paged 2 | 3 | import androidx.paging.DataSource 4 | import androidx.room.Dao 5 | import androidx.room.Insert 6 | import androidx.room.Query 7 | 8 | 9 | /** 10 | * https://www.zoftino.com/pagination-in-android-using-paging-library 11 | */ 12 | @Dao 13 | interface DemoEntityLocalDAO { 14 | //to fetch data required to display in each page 15 | @Query("SELECT * FROM DemoEntity") 16 | fun getAll(): DataSource.Factory 17 | 18 | //this is used to populate db 19 | @Insert 20 | fun insertDemoEntities(demoEntities: List) 21 | 22 | @Query("UPDATE DemoEntity SET data1 = -data1") 23 | fun updateDemoEntities() 24 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/paged/DemoEntityViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.paged 2 | 3 | import android.app.Application 4 | import androidx.lifecycle.LiveData 5 | import androidx.lifecycle.ViewModel 6 | import androidx.lifecycle.ViewModelProvider 7 | import androidx.paging.LivePagedListBuilder 8 | import androidx.paging.PagedList 9 | import io.reactivex.Completable 10 | import io.reactivex.android.schedulers.AndroidSchedulers 11 | import io.reactivex.schedulers.Schedulers 12 | 13 | 14 | /** 15 | * https://www.zoftino.com/pagination-in-android-using-paging-library 16 | */ 17 | class DemoEntityViewModel(val application: Application) : ViewModel() { 18 | //PagedList controls data loading using data source 19 | private val dao: DemoEntityLocalDAO = 20 | LocalRepository.getDemoEntityDB(application).demoEntityDAO() 21 | var demoEntitiesList: LiveData> 22 | 23 | init { 24 | val pagedListConfig = PagedList.Config.Builder() 25 | .setPageSize(20) 26 | .setPrefetchDistance(20) 27 | .setEnablePlaceholders(true) 28 | .build() 29 | 30 | demoEntitiesList = LivePagedListBuilder(dao.getAll(), pagedListConfig).build() 31 | } 32 | 33 | fun updateEntities() { 34 | Completable.fromRunnable { dao.updateDemoEntities() } 35 | .subscribeOn(Schedulers.io()) 36 | .observeOn(AndroidSchedulers.mainThread()) 37 | .subscribe() 38 | } 39 | 40 | //factory for creating view model, 41 | // required because we need to pass Application to view model object 42 | class DemoEntityViewModelFactory(private val mApplication: Application) : 43 | ViewModelProvider.NewInstanceFactory() { 44 | override fun create(viewModel: Class): T { 45 | return DemoEntityViewModel(mApplication) as T 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/utils/Utils.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.utils 2 | 3 | import android.content.Context 4 | import android.util.TypedValue 5 | import androidx.annotation.AttrRes 6 | import androidx.annotation.ColorInt 7 | import androidx.annotation.RestrictTo 8 | import androidx.core.content.ContextCompat 9 | import androidx.core.content.res.ResourcesCompat 10 | 11 | internal fun Context.getThemeColor(attr: Int): Int { 12 | val tv = TypedValue() 13 | return if (this.theme.resolveAttribute(attr, tv, true)) { 14 | if (tv.resourceId != 0) { 15 | ContextCompat.getColor(this, tv.resourceId) 16 | } else { 17 | tv.data 18 | } 19 | } else { 20 | 0 21 | } 22 | } 23 | 24 | 25 | /** 26 | * a helper method to get the color from an attribute 27 | * @hide 28 | */ 29 | @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) 30 | fun Context.getThemeColor(@AttrRes attr: Int, @ColorInt def: Int = 0): Int { 31 | val tv = TypedValue() 32 | return if (theme.resolveAttribute(attr, tv, true)) { 33 | if (tv.resourceId != 0) ResourcesCompat.getColor(resources, tv.resourceId, theme) else tv.data 34 | } else def 35 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/view/DraggableFrameLayout.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.view 2 | 3 | import android.content.Context 4 | import android.util.AttributeSet 5 | import android.widget.FrameLayout 6 | import com.google.android.material.R 7 | 8 | 9 | private val DRAGGED_STATE_SET = intArrayOf( 10 | R.attr.state_dragged, 11 | // When the item is dragged we also set the 'pressed' state so the item background is changed 12 | android.R.attr.state_pressed 13 | ) 14 | 15 | class DraggableFrameLayout : FrameLayout { 16 | constructor(context: Context) : super(context) 17 | constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) 18 | constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) 19 | 20 | var isDragged: Boolean = false 21 | set(value) { 22 | field = value 23 | refreshDrawableState() 24 | invalidate() 25 | } 26 | 27 | override fun onCreateDrawableState(extraSpace: Int): IntArray? { 28 | val drawableState = super.onCreateDrawableState(extraSpace + DRAGGED_STATE_SET.size) 29 | if (isDragged) { 30 | mergeDrawableStates(drawableState, DRAGGED_STATE_SET) 31 | } 32 | return drawableState 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/mikepenz/fastadapter/app/view/RecyclerViewBackgroundDrawable.kt: -------------------------------------------------------------------------------- 1 | package com.mikepenz.fastadapter.app.view 2 | 3 | import android.graphics.Canvas 4 | import android.graphics.ColorFilter 5 | import android.graphics.Paint 6 | import android.graphics.PixelFormat 7 | import android.graphics.drawable.Drawable 8 | import androidx.recyclerview.widget.RecyclerView 9 | 10 | // Based on https://stackoverflow.com/a/49825927/1800174 11 | class RecyclerViewBackgroundDrawable internal constructor(private val color: Int) : Drawable() { 12 | private var recyclerView: RecyclerView? = null 13 | private val paint: Paint = Paint().apply { 14 | color = this@RecyclerViewBackgroundDrawable.color 15 | } 16 | 17 | fun attachTo(recyclerView: RecyclerView?) { 18 | this.recyclerView = recyclerView 19 | recyclerView?.background = this 20 | } 21 | 22 | override fun draw(canvas: Canvas) { 23 | val recyclerView = recyclerView ?: return 24 | if (recyclerView.childCount == 0) { 25 | return 26 | } 27 | 28 | var bottom = recyclerView.getChildAt(recyclerView.childCount - 1).bottom 29 | if (bottom >= recyclerView.bottom) { 30 | bottom = recyclerView.bottom 31 | } 32 | 33 | canvas.drawRect( 34 | recyclerView.left.toFloat(), 35 | recyclerView.top.toFloat(), 36 | recyclerView.right.toFloat(), 37 | bottom.toFloat(), 38 | paint 39 | ) 40 | } 41 | 42 | override fun setAlpha(alpha: Int) = Unit 43 | 44 | override fun setColorFilter(colorFilter: ColorFilter?) = Unit 45 | 46 | override fun getOpacity(): Int = PixelFormat.OPAQUE 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/res/anim/alpha_on.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/animator/draggable_state_list_anim.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 18 | 19 | 20 | 21 | 22 | 23 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/button_rect_list_normal.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_rect_list_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_drag_handle.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 12 | 13 | 22 | 23 | 33 | 34 | 35 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_sample.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 18 | 19 | 27 | 28 | 32 | 33 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/checkbox_sample_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 24 | 25 | 36 | 37 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/draggable_single_line_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 19 | 20 | 31 | 32 | 41 | 42 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/layout/expandable_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 19 | 20 | 31 | 32 | 43 | 44 | 45 | 53 | 54 | -------------------------------------------------------------------------------- /app/src/main/res/layout/icon_item.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 28 | 29 | 40 | 41 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/letter_item.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/native_ad_item.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 15 | 16 | 26 | 27 | 36 | 37 |