Android Open Source - AbsListViewHelper Main Activity






From Project

Back to project page AbsListViewHelper.

License

The source code is released under:

MIT License

If you think the Android project AbsListViewHelper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.felipecsl.abslistviewhelper.app;
/*from   w ww.  j ava2  s .  c  o m*/
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ArrayAdapter;
import android.widget.GridView;

import com.felipecsl.abslistviewhelper.library.AbsListViewHelper;

import java.util.ArrayList;
import java.util.List;


public class MainActivity extends ActionBarActivity {

    private AbsListViewHelper helper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final GridView gridView = (GridView) findViewById(R.id.gridView);
        final View gridHeader = findViewById(R.id.gridHeader);
        final View gridFooter = findViewById(R.id.gridFooter);

        List<String> items = new ArrayList<>();
        for (int i = 0; i < 100; i++)
            items.add("Item " + i);

        helper = new AbsListViewHelper(gridView, savedInstanceState)
                .setHeaderView(gridHeader)
                .setFooterView(gridFooter);

        gridView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, items));
    }

    @Override protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        helper.onSaveInstanceState(outState);
    }
}




Java Source Code List

com.felipecsl.abslistviewhelper.app.MainActivity.java
com.felipecsl.abslistviewhelper.library.AbsListViewHelper.java
com.felipecsl.abslistviewhelper.library.CompositeAbsListViewOnScrollListener.java
com.felipecsl.abslistviewhelper.library.widget.FooterAbsListViewScrollListener.java
com.felipecsl.abslistviewhelper.library.widget.HeaderAbsListViewScrollListener.java