// Path: library/src/main/java/br/com/cybereagle/androidwidgets/helper/ListViewWithLoadingIndicatorHelper.java
// public class ListViewWithLoadingIndicatorHelper implements ListViewWithLoadingIndicator {
// 
//     private ListView listView;
// 
//     private View loadingView;
//     private boolean loadingViewAttached;
//     private View dummyView;
// 
//     public ListViewWithLoadingIndicatorHelper(ListView listView){
//         this.listView = listView;
//     }
// 
//     public void beforeSetAdapter(ListAdapter listAdapter){
//         dummyView = new View(listView.getContext());
//         listView.addFooterView(dummyView, null, false);
//     }
// 
//     public void afterSetAdapter(ListAdapter listAdapter){
//         listView.removeFooterView(dummyView);
//         dummyView = null;
//     }
// 
//     @Override
//     public void showLoadingView(){
//         if(loadingView != null && !loadingViewAttached){
//             listView.addFooterView(loadingView, null, false);
//             loadingViewAttached = true;
//         }
//     }
// 
//     @Override
//     public void hideLoadingView(){
//         if(loadingView != null && loadingViewAttached){
//             listView.removeFooterView(loadingView);
//             loadingViewAttached = false;
//         }
// 
//     }
// 
//     @Override
//     public boolean isLoadingViewVisible(){
//         return loadingViewAttached;
//     }
// 
//     @Override
//     public View getLoadingView() {
//         return loadingView;
//     }
// 
//     @Override
//     public void setLoadingView(View loadingView) {
//         this.loadingView = loadingView;
//     }
// }
// 
// Path: library/src/main/java/br/com/cybereagle/androidwidgets/interfaces/ListViewWithLoadingIndicator.java
// public interface ListViewWithLoadingIndicator {
// 
//     void showLoadingView();
//     void hideLoadingView();
//     boolean isLoadingViewVisible();
//     View getLoadingView();
//     void setLoadingView(View loadingView);
// 
// }


import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import br.com.cybereagle.androidwidgets.helper.ListViewWithLoadingIndicatorHelper;
import br.com.cybereagle.androidwidgets.interfaces.ListViewWithLoadingIndicator;

    @Override
    public View getLoadingView() {
        return listViewWithLoadingIndicatorHelper.getLoadingView();
    }

    @Override
    public void setLoadingView(View loadingView) {
        listViewWithLoadingIndicatorHelper.setLoadingView(loadingView);
    }

    @Override
    public void setAdapter(ListAdapter adapter) {
        listViewWithLoadingIndicatorHelper.beforeSetAdapter(adapter);
        super.setAdapter(adapter);
        listViewWithLoadingIndicatorHelper.afterSetAdapter(adapter);
    }

    @Override
    public void showLoadingView(){
        listViewWithLoadingIndicatorHelper.showLoadingView();
    }

    @Override
    public void hideLoadingView(){
        listViewWithLoadingIndicatorHelper.hideLoadingView();
    }

    @Override
    public boolean isLoadingViewVisible(){
// Path: library/src/main/java/br/com/cybereagle/androidwidgets/helper/ListViewWithLoadingIndicatorHelper.java
// public class ListViewWithLoadingIndicatorHelper implements ListViewWithLoadingIndicator {
// 
//     private ListView listView;
// 
//     private View loadingView;
//     private boolean loadingViewAttached;
//     private View dummyView;
// 
//     public ListViewWithLoadingIndicatorHelper(ListView listView){
//         this.listView = listView;
//     }
// 
//     public void beforeSetAdapter(ListAdapter listAdapter){
//         dummyView = new View(listView.getContext());
//         listView.addFooterView(dummyView, null, false);
//     }
// 
//     public void afterSetAdapter(ListAdapter listAdapter){
//         listView.removeFooterView(dummyView);
//         dummyView = null;
//     }
// 
//     @Override
//     public void showLoadingView(){
//         if(loadingView != null && !loadingViewAttached){
//             listView.addFooterView(loadingView, null, false);
//             loadingViewAttached = true;
//         }
//     }
// 
//     @Override
//     public void hideLoadingView(){
//         if(loadingView != null && loadingViewAttached){
//             listView.removeFooterView(loadingView);
//             loadingViewAttached = false;
//         }
// 
//     }
// 
//     @Override
//     public boolean isLoadingViewVisible(){
//         return loadingViewAttached;
//     }
// 
//     @Override
//     public View getLoadingView() {
//         return loadingView;
//     }
// 
//     @Override
//     public void setLoadingView(View loadingView) {
//         this.loadingView = loadingView;
//     }
// }
// 
// Path: library/src/main/java/br/com/cybereagle/androidwidgets/interfaces/ListViewWithLoadingIndicator.java
// public interface ListViewWithLoadingIndicator {
// 
//     void showLoadingView();
//     void hideLoadingView();
//     boolean isLoadingViewVisible();
//     View getLoadingView();
//     void setLoadingView(View loadingView);
// 
// }


// Path: library/src/main/java/br/com/cybereagle/androidwidgets/view/SimpleListViewWithLoadingIndicator.java
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import br.com.cybereagle.androidwidgets.helper.ListViewWithLoadingIndicatorHelper;
import br.com.cybereagle.androidwidgets.interfaces.ListViewWithLoadingIndicator;


    @Override
    public View getLoadingView() {
        return listViewWithLoadingIndicatorHelper.getLoadingView();
    }

    @Override
    public void setLoadingView(View loadingView) {
        listViewWithLoadingIndicatorHelper.setLoadingView(loadingView);
    }

    @Override
    public void setAdapter(ListAdapter adapter) {
        listViewWithLoadingIndicatorHelper.beforeSetAdapter(adapter);
        super.setAdapter(adapter);
        listViewWithLoadingIndicatorHelper.afterSetAdapter(adapter);
    }

    @Override
    public void showLoadingView(){
        listViewWithLoadingIndicatorHelper.showLoadingView();
    }

    @Override
    public void hideLoadingView(){
        listViewWithLoadingIndicatorHelper.hideLoadingView();
    }

    @Override
    public boolean isLoadingViewVisible(){
        return listViewWithLoadingIndicatorHelper.isLoadingViewVisible();