Git Product home page Git Product logo

superlistview's Introduction

Deprecated

SuperListview

Pull requests are answered with all my love and a cookie.

Description

This library is making listview way more easy to use. No need to embed the listview in a framelayout to add the progressbar or the emptyview. It's all right here.

Features built in:

  • ProgressBar while adapter hasn't been set
  • EmptyView if adapter is empty
  • SwipeRefreshLayout (Google's one)
  • Infinite scrolling, when you reach the X last item, load more of them.
  • Swipe To Dismiss for the SuperListView (doesn't make sense for a gridview) (Thanks [Roman Nurik][roman-swipe-to-dismiss])
  • GridView with SuperGridView
  • Open to suggestions (and Pull Request ofc) for others :)

[Sample apk][apk] (pull to add item to the adapter)

Integration

Just add it to you dependencies

For release version:

    compile 'com.quentindommerc.superlistview:library:1.5.2'

For snapshot version:

    https://oss.sonatype.org/content/repositories/snapshots/
    compile 'com.quentindommerc.superlistview:library:1.5.1-SNAPSHOT'

Usage

  • Use directly SuperListview:
   <com.quentindommerc.superlistview.SuperListview
            xmlns:superlistview="http://schemas.android.com/apk/res-auto"
            android:id="@+id/list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            superlistview:superlv__listClipToPadding="false"
            superlistview:superlv__listDivider="@android:color/transparent"
            superlistview:superlv__listDividerHeight="10dp"
            superlistview:superlv__listPadding="10dp"
            superlistview:superlv__empty="@layout/emptyview"
            superlistview:superlv__scrollbarStyle="outsideOverlay" >
    </com.quentindommerc.superlistview.SuperListview>

For Gridview

    <com.quentindommerc.superlistview.SuperGridview
            xmlns:superlistview="http://schemas.android.com/apk/res-auto"
            android:id="@+id/list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            superlistview:superlv__listClipToPadding="false"
            superlistview:superlv__listDivider="@android:color/transparent"
            superlistview:superlv__listDividerHeight="10dp"
            superlistview:superlv__listPadding="10dp"
            superlistview:superlv__empty="@layout/emptyview"
            superlistview:supergv__columns="2"
            superlistview:supergv__verticalSpacing="10dp"
            superlistview:supergv__horizontalSpacing="10dp"
            superlistview:superlv__scrollbarStyle="outsideOverlay" >
    </com.quentindommerc.superlistview.SuperGridview>
  • Current Attributes supported:
         <attr name="superlv__listSelector" format="reference"/>
         <attr name="superlv__empty" format="reference"/>
         <attr name="superlv__moreProgress" format="reference"/>
         <attr name="superlv__progress" format="reference"/>
         <attr name="superlv__listDivider" format="reference"/>
         <attr name="superlv__listDividerHeight" format="dimension"/>
         <attr name="superlv__listClipToPadding" format="boolean"/>
         <attr name="superlv__listPadding" format="dimension"/>
         <attr name="superlv__listPaddingTop" format="dimension"/>
         <attr name="superlv__listPaddingBottom" format="dimension"/>
         <attr name="superlv__listPaddingLeft" format="dimension"/>
         <attr name="superlv__listPaddingRight" format="dimension"/>
         <attr name="superlv__scrollbarStyle">
             <flag name="insideOverlay" value="0x0"/>
             <flag name="insideInset" value="0x01000000"/>
             <flag name="outsideOverlay" value="0x02000000"/>
             <flag name="outsideInset" value="0x03000000"/>
         </attr>

         <!-- Layout to build a superList. Default values are  @layout/view_progress_listview for a list and
          @layout/view_progress_gridview for a grid-->
         <attr name="superlv_mainLayoutID" format="reference"/>

SuperListView Java Usage

    list.setRefreshListener(new SwipeRefreshLayout.OnRefreshListener {
      @Override
      public void onRefresh() {
          // Do your refresh
      });

    // when there is only 10 items to see in the list, this is triggered
    list.setupMoreListener(new OnMoreListener() {
      @Override
      public void onMoreAsked(int numberOfItems, int numberBeforeMore, int currentItemPos) {
        // Fetch more from Api or DB
      }}, 10);


    // the 2nd parameters is true if you want SuperListView to automatically
    // delete the item from the listview or false if you don't
    list.setupSwipeToDismiss(new SwipeDismissListViewTouchListener.DismissCallbacks() {
      @Override
      public boolean canDismiss(int position) {
        return true
      }

      @Override
      public void onDismiss(ListView listView, int[] reverseSortedPositions) {
        // Do your stuff like call an Api or update your db
      }}, true);

[Sample java][sample java]

Contributors

Arasthel Github

Gabriele Mariotti Github, Google+

Kochkin Artem Github

License

Copyright (c) 2014 Quentin Dommerc

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.
Come on, don't tell me you read that.

Analytics [sample java]:https://github.com/dommerq/SuperListview/blob/dev/Sample/src/main/java/com/quentindommerc/superlistview/sample/ListSample.java [apk]:https://github.com/dommerq/SuperListview/blob/dev/sample.apk [roman-swipe-to-dismiss]:https://github.com/romannurik/Android-SwipeToDismiss

superlistview's People

Contributors

quentin23soleil avatar malinskiy avatar andaag avatar johnjohndoe avatar gabrielemariotti avatar sunng87 avatar jmartinesp avatar jonids avatar bryant1410 avatar kolipass avatar mahdihijazi 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.