mrmike / Diffutil Sample
Licence: apache-2.0
Android sample app in Kotlin showing usage of DiffUtil class.
Stars: ✭ 202
Programming Languages
kotlin
9241 projects
Projects that are alternatives of or similar to Diffutil Sample
Babypiganimation
基本动画、位移动画、缩放动画、旋转动画、组动画、关键帧动画、贝塞尔曲线、进度条动画、复杂动画、OC动画、aniamtion、basicanimation等。
Stars: ✭ 192 (-4.95%)
Mutual labels: demo
Koa Vue Notes Web
🤓 This is a simple SPA built using Koa as the backend, Vue as the first frontend, and React as the second frontend. Features MySQL integration, user authentication, CRUD note actions, and Vuex store modules.
Stars: ✭ 200 (-0.99%)
Mutual labels: demo
Vue Switches
An on/off switch component for Vue.js with theme support.
Stars: ✭ 188 (-6.93%)
Mutual labels: demo
Dekryptize
A ncurses animation to make decryption look like, well, decryption.
Stars: ✭ 201 (-0.5%)
Mutual labels: demo
Awesome Spring Boot
springboot 各种资料整理(demo、教程、网站、starter文档等),持续更新,欢迎pr。
Stars: ✭ 198 (-1.98%)
Mutual labels: demo
Imodels
Interpretable ML package 🔍 for concise, transparent, and accurate predictive modeling (sklearn-compatible).
Stars: ✭ 194 (-3.96%)
Mutual labels: demo
Mocapnet
We present MocapNET2, a real-time method that estimates the 3D human pose directly in the popular Bio Vision Hierarchy (BVH) format, given estimations of the 2D body joints originating from monocular color images. Our contributions include: (a) A novel and compact 2D pose NSRM representation. (b) A human body orientation classifier and an ensemble of orientation-tuned neural networks that regress the 3D human pose by also allowing for the decomposition of the body to an upper and lower kinematic hierarchy. This permits the recovery of the human pose even in the case of significant occlusions. (c) An efficient Inverse Kinematics solver that refines the neural-network-based solution providing 3D human pose estimations that are consistent with the limb sizes of a target person (if known). All the above yield a 33% accuracy improvement on the Human 3.6 Million (H3.6M) dataset compared to the baseline method (MocapNET) while maintaining real-time performance (70 fps in CPU-only execution).
Stars: ✭ 194 (-3.96%)
Mutual labels: demo
DiffUtil Android Sample - Kotlin
Example of usage DiffUtil utility class added originally in Support Library 24.2.0.
Demo
Implementation
calculateDiff method from DiffUtill class requires DiffUtil.Callback object as parameter.
ActorDiffCallback.kt
DiffUtil callback -Implements 4 methods:
- getOldListSize - returns size of the old list
- getNewListSize - returns size of the new list
- areItemsTheSame - returns true if two items are the same, e.g. have the same ids
- areContentsTheSame - returns true if displayed content was not changed. In our case we only display actor's name so we're detecing name's change.
ActorAdapter.swap()
Applying diff result -DiffResult can be applied to adapter by calling diffResult.dispatchUpdatesTo(adapter)
.
fun swap(actors: List<Actor>) {
val diffCallback = ActorDiffCallback(this.actors, actors)
val diffResult = DiffUtil.calculateDiff(diffCallback)
this.actors.clear()
this.actors.addAll(actors)
diffResult.dispatchUpdatesTo(this)
}
Resources
License
Copyright 2016 Michał Moczulski
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.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].