GithubHelp home page GithubHelp logo

alamkanak / android-empty-layout Goto Github PK

View Code? Open in Web Editor NEW
601.0 601.0 164.0 981 KB

A library for showing different types of layouts when a list view is empty

License: Apache License 2.0

Java 100.00%

android-empty-layout's Introduction

Hi, Iโ€™m Raquib-ul.

Professionally, I work as a Senior Software Engineer with a flavor of Deep Learning integration. My software engineering experiences span over 10 years.

Academically, my research focusses on medical image and signal processing towards the development of machine learning and statistical models.

You can see some of my work in my portfolio.

android-empty-layout's People

Contributors

alamkanak avatar nantaphop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-empty-layout's Issues

Crash the SwipeRefreshLayout

SwipeRefreshLayout (from support v4 19.1) can has only 1 child.
Currently my solution is to check if the parent is that, and then get its parent (should also check if he has parent, but in my code it always has a parent):

ViewGroup parent = (ViewGroup) mListView.getParent();
            // Start editing
            if (parent instanceof SwipeRefreshLayout) {
                parent = (ViewGroup) parent.getParent();
            }
            // End editing

Advice: the 'Empty View' should stay in center of list instead of its parent container.

hello, I found a problem while learning your code. see the usage below:
image
then, you add "Empty View" into the parent of mListView (see EmptyLayout.java:463)
You view looks like this:
image
Obviously, I want the picture in center of list view instead of its parent.

image

Now I make a little change at EmptyLayout.java:changeEmptyType(), you can easily understand.

~~~
    // insert views in the root view
    if (!mViewsAdded) {
        RelativeLayout.LayoutParams lp = new LayoutParams(mListView.getWidth(), mListView.getHeight());
        lp.topMargin = mListView.getTop();
        lp.leftMargin = mListView.getLeft();
        RelativeLayout rl = new RelativeLayout(mContext);
        rl.setLayoutParams(lp);
        if (mEmptyView!=null) {
            rl.addView(mEmptyView);
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mEmptyView.getLayoutParams();
            layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
            mEmptyView.setLayoutParams(layoutParams);
        }
        if (mLoadingView!=null) {
            rl.addView(mLoadingView);
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mLoadingView.getLayoutParams();
            layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
            mLoadingView.setLayoutParams(layoutParams);
        }
        if (mErrorView!=null) {
            rl.addView(mErrorView);
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mErrorView.getLayoutParams();
            layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
            mErrorView.setLayoutParams(layoutParams);
        }
        mViewsAdded = true;

        ViewGroup parent = (ViewGroup) mListView.getParent();
        parent.addView(rl);
        mListView.setEmptyView(rl);
    }
~~~

Thanks for your good code.

Test issue

this issue is to test if i get an sms

Empty button not shown

mEmptyLayout.setEmptyMessage(emptyMessage);
mEmptyLayout.setShowEmptyButton(showEmptyButton);
mEmptyLayout.setEmptyButtonClickListener(listener);
mEmptyLayout.showEmpty();

That is my code, when showEmptyButton is true.
The problem is that the empty button isn't shown

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.