ProviderAdapter

Introduction: 仿手淘首页 针对 ListView Adapter 进行封装,协同开发效率更高,性能更优。
More: Author   ReportBugs   
Tags:

一、简介

RecyclerView 为何在大厂还不够普及?因为他们 ListView 封装的足够好!

本项目注重如何性能最优、如何敏捷开发、如何功能划分

所以,刚入手可能会觉得比常规写 adapter 会多出几个类,几行代码。以手淘项目为例。

二、初衷

  • 复杂界面 adapter 代码量过大,过多的类型判断难以阅读。

  • 每次迭代、维护都是一个头痛的问题,改其中一处就得动整个 adapter,工作量过大,并且改动风险也大

  • 一个界面业务功能过多,业务牵连广泛,如何责任划分、协同开发?

  • 拆分 View 采用模板方式,可以最大化的 View 复用。

三、核心类

  • 源码都有注释 这里不做详细介绍

ProviderAdapter

  • 模板普通写法

GuessProviderBannerProvider

  • 模板进阶写法

action

此写法无任何 xml,无任何 inflate 操作,并且添加了缓存机制,尽可能的减小了内存消耗

四、项目效果图

点我查看效果图

License

Copyright [2018] [Victory-Over]

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.
Apps
About Me
GitHub: Trinea
Facebook: Dev Tools