All Projects → bravoborja → Focusresize

bravoborja / Focusresize

Licence: apache-2.0
A custom animation with scroll listener to recycler views

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Focusresize

Stormplane
✈️《沙漠风暴》是一款基于Android开发的纵版飞行射击游戏,以雷电(Shooting Game)为原型,参考微信打飞机大战,通过自定义的SurfaceView来实现游戏,游戏画面、音乐、战斗特效都不错(附带apk安装包,可直接运行)
Stars: ✭ 938 (-3.4%)
Mutual labels:  custom
Multilinedivider
Multi divider in RecyclerView on Android.
Stars: ✭ 13 (-98.66%)
Mutual labels:  recyclerview
Clapsview
Implemented the functionality of Medium.com Claps. 👏
Stars: ✭ 29 (-97.01%)
Mutual labels:  custom
Multisearchview
Yet another built-in animated search view for Android.
Stars: ✭ 837 (-13.8%)
Mutual labels:  custom
Mylittlecanvas
🎨Need to create a custom view ? You don't know how to use Canvas, use MyLittleCanvas instead !
Stars: ✭ 870 (-10.4%)
Mutual labels:  custom
Xamcustomlayouts
Xamarin.Forms Custom Layouts - Cards
Stars: ✭ 15 (-98.46%)
Mutual labels:  custom
Git Praise
A nicer git blame.
Stars: ✭ 24 (-97.53%)
Mutual labels:  custom
Nb Choices
Angular wrapper for choices.js, vanilla, lightweight, configurable select box/text input plugin
Stars: ✭ 32 (-96.7%)
Mutual labels:  custom
Featuredrecyclerview
Ultimate recycler view.
Stars: ✭ 872 (-10.2%)
Mutual labels:  recyclerview
Turn Layout Manager
A carousel layout manager for RecyclerView
Stars: ✭ 946 (-2.57%)
Mutual labels:  recyclerview
Mapme
The Android maps adapter
Stars: ✭ 844 (-13.08%)
Mutual labels:  recyclerview
Android scroll endless
Scroll endless for Android recyclerview
Stars: ✭ 12 (-98.76%)
Mutual labels:  recyclerview
Observableadapter
RecyclerView Adapter for RxJava, separates collection model from Android framework dependencies
Stars: ✭ 15 (-98.46%)
Mutual labels:  recyclerview
Slimadapter
A slim & clean & typeable Adapter without# VIEWHOLDER
Stars: ✭ 939 (-3.3%)
Mutual labels:  recyclerview
Simplerecyclerview
A RecyclerView extension for building list more easily.
Stars: ✭ 953 (-1.85%)
Mutual labels:  recyclerview
Celladapter
CellAdapter simplifies working with RecyclerView. It provides an opportunity to easily support multiple view types, to separate ViewHolders from Adapter class, map data to a view in a convenient way, register and handle UI callbacks for each ViewHolder.
Stars: ✭ 24 (-97.53%)
Mutual labels:  recyclerview
Candyview
Implement any RecyclerView in just 1 Line. CandyView handles everything for you.
Stars: ✭ 15 (-98.46%)
Mutual labels:  recyclerview
Videojscustomization
HTML5 视频播放器 自定制: React + video.js 详细讲解
Stars: ✭ 32 (-96.7%)
Mutual labels:  custom
Pager Layoutmanager
[暂停维护]Android 网格分页布局。
Stars: ✭ 956 (-1.54%)
Mutual labels:  recyclerview
Recyclerviewdemo
Android L 新增UI控件:RecyclerView CardView的简单使用
Stars: ✭ 15 (-98.46%)
Mutual labels:  recyclerview

FocusResize

A custom animation with scroll listener to recycler views

GIF of its use

Based in UltraVisual example of Ray Wenderlich.

Download

To add the FocusResize library to your Android Studio project, simply add the following gradle dependency, with min sdk version of 19:

compile 'com.borjabravo:focusresize:1.0.0'

Usage

To use the FocusResize on your app, you should create a custom adapter that extends from FocusResizeAdapter. For example:

public class DefaultAdapter extends FocusResizeAdapter<RecyclerView.ViewHolder> {

    private List<CustomObject> items;

    public DefaultAdapter(Context context, int height) {
        super(context, height);
        items = new ArrayList<>();
    }

    @Override
    public int getFooterItemCount() {
        // Return items size
        return items.size();
    }

    @Override
    public RecyclerView.ViewHolder onCreateFooterViewHolder(ViewGroup parent, int viewType) {
        // Inflate your custom item layout
        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_custom, parent, false);
        return new DefaultCustomViewHolder(v);
    }

    @Override
    public void onBindFooterViewHolder(RecyclerView.ViewHolder holder, int position) {
        // Set your data into your custom layout
        CustomObject customObject = items.get(position);
        fill((DefaultCustomViewHolder)holder, customObject);
    }

    private void fill(DefaultCustomViewHolder holder, CustomObject customObject) {
        holder.titleTextView.setText(customObject.getTitle());
        holder.subtitleTextView.setText(customObject.getSubTitle());
        holder.image.setImageResource(customObject.getDrawable());
    }

    @Override
    public void onItemBigResize(RecyclerView.ViewHolder viewHolder, int position, int dyAbs) {
        // The focused item will resize to big size while is scrolling
    }

    @Override
    public void onItemBigResizeScrolled(RecyclerView.ViewHolder viewHolder, int position, int dyAbs) {
        // The focused item resize to big size when scrolled is finished
    }

    @Override
    public void onItemSmallResizeScrolled(RecyclerView.ViewHolder viewHolder, int position, int dyAbs) {
        // All items except the focused item will resize to small size when scrolled is finished
    }

    @Override
    public void onItemSmallResize(RecyclerView.ViewHolder viewHolder, int position, int dyAbs) {
        // All items except the focused item will resize to small size while is scrolling
    }

    @Override
    public void onItemInit(RecyclerView.ViewHolder viewHolder) {
        // Init first item when the view is loaded
    }

After this, you'll add FocusResizeScrollListener to recycler view:

    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    DefaultAdapter defaultAdapter = new DefaultAdapter(this, (int) getResources().getDimension(R.dimen.custom_item_height));
    defaultAdapter.addItems(addItems());
    if (recyclerView != null) {
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.setHasFixedSize(true);
        recyclerView.setAdapter(defaultAdapter);
        recyclerView.addOnScrollListener(new FocusResizeScrollListener<>(defaultAdapter, linearLayoutManager));
    }

Important: In this version, the library only works with LinearLayoutManager.VERTICAL

License

Copyright 2016 Borja Bravo Álvarez

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].