Giter VIP home page Giter VIP logo

provideradapter's Introduction

ProviderAdapter 模板化开发

一、简介

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.

provideradapter's People

Contributors

victory-over avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.