// 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;
/*
 * Copyright 2013 Cyber Eagle
 *
 *    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.
 */

package br.com.cybereagle.androidwidgets.view;


public class SimpleListViewWithLoadingIndicator extends ListView implements ListViewWithLoadingIndicator {

    private ListViewWithLoadingIndicatorHelper listViewWithLoadingIndicatorHelper;

    public SimpleListViewWithLoadingIndicator(Context context) {
        this(context, null, 0);
    }

    public SimpleListViewWithLoadingIndicator(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }


    public SimpleListViewWithLoadingIndicator(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        this.listViewWithLoadingIndicatorHelper = new ListViewWithLoadingIndicatorHelper(this);
    }

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

// 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;

/*
 * Copyright 2013 Cyber Eagle
 *
 *    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.
 */

package br.com.cybereagle.androidwidgets.view;


public class SimpleListViewWithLoadingIndicator extends ListView implements ListViewWithLoadingIndicator {

    private ListViewWithLoadingIndicatorHelper listViewWithLoadingIndicatorHelper;

    public SimpleListViewWithLoadingIndicator(Context context) {
        this(context, null, 0);
    }

    public SimpleListViewWithLoadingIndicator(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }


    public SimpleListViewWithLoadingIndicator(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        this.listViewWithLoadingIndicatorHelper = new ListViewWithLoadingIndicatorHelper(this);
    }

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

    @Override