Example usage for android.widget AbsListView setRecyclerListener

List of usage examples for android.widget AbsListView setRecyclerListener

Introduction

In this page you can find the example usage for android.widget AbsListView setRecyclerListener.

Prototype

public void setRecyclerListener(RecyclerListener listener) 

Source Link

Document

Sets the recycler listener to be notified whenever a View is set aside in the recycler for later reuse.

Usage

From source file:medis.ourlab.labkita.activity.LiteListDemo.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.lite_list_demo);

    // Set a custom list adapter for a list of locations
    mAdapter = new MapAdapter(this, LIST_LOCATIONS);
    mList = (ListFragment) getSupportFragmentManager().findFragmentById(R.id.list);
    mList.setListAdapter(mAdapter);/*  w  ww  .  j a  va2 s .c o  m*/

    // Set a RecyclerListener to clean up MapView from ListView
    AbsListView lv = mList.getListView();
    lv.setRecyclerListener(mRecycleListener);

}

From source file:com.cyanogenmod.eleven.ui.fragments.AlbumFragment.java

/**
 * Sets up various helpers for both the list and grid
 * /*from w ww  .  j a v  a  2 s. c  o m*/
 * @param list The list or grid
 */
private void initAbsListView(final AbsListView list) {
    // Release any references to the recycled Views
    list.setRecyclerListener(new RecycleHolder());
    // Show the albums and songs from the selected artist
    list.setOnItemClickListener(this);
    // To help make scrolling smooth
    list.setOnScrollListener(this);
}

From source file:com.example.mapdemo.LiteListDemoActivity.java

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

    // creating GPS Class object
    // User location
    gps = new GPSTracker(this);
    Bundle b = getIntent().getExtras();/*from ww w.j  av a 2  s .com*/

    nearPlaces = (PlacesList) b.getSerializable("near_places");
    places = nearPlaces.results;

    LIST_LOCATIONS = new NamedLocation[nearPlaces.results.size()];
    imageUrls = new String[nearPlaces.results.size()];

    // TODO This i++ resembles C. Can be buggy memory leaks
    int i = 0;
    for (Place place : places) {
        // creating new HashMap
        HashMap<String, String> placesmap = new HashMap<String, String>();
        HashMap<String, NamedLocation> locationsmap = new HashMap<String, NamedLocation>();
        placesmap.put(KEY_ID, place.id);
        placesmap.put(KEY_ID, place.name);
        placesmap.put(KEY_ADDRESS, place.address);
        placesmap.put(KEY_THUMB_URL, place.office_image_url);
        placesList.add(placesmap);
        // Array to sort locations
        LIST_LOCATIONS[i] = new NamedLocation(place.name, new LatLng(place.location.lat, place.location.lng),
                place.formatted_phone_number, place.address, place.office_image_url, place.vicinity);

        locationmapList.add(locationsmap);
        locations.add(new NamedLocation(place.name, new LatLng(place.location.lat, place.location.lng),
                place.formatted_phone_number, place.address, place.office_image_url, place.vicinity));

        // Get image URL's
        imageUrls[i] = place.office_image_url;
        i++;
    }

    Collections.sort(locations);

    //  list=(ListView)findViewById(R.id.listview);
    // Getting adapter by passing xml data ArrayList
    //    lAdapter=new LazyAdapter(this.getApplicationContext(), places);
    //   list.setAdapter(lAdapter);
    GoogleType obj = b.getParcelable("GoogleType");

    // Set a custom list adapter for a list of locations
    mAdapter = new MapAdapter(this, R.layout.lite_list_demo_row, locations);

    // Set a custom list adapter for a list of locations
    //     mAdapter = new MapAdapter(this, locations_list);
    mList = (ListFragment) getSupportFragmentManager().findFragmentById(R.id.list);
    mList.setListAdapter(mAdapter);

    mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
    // Set a RecyclerListener to clean up MapView from ListView
    AbsListView lv = mList.getListView();
    lv.setRecyclerListener(mRecycleListener);
}

From source file:com.andrew.apollo.ui.fragments.AlbumFragment.java

/**
 * Sets up various helpers for both the list and grid
 * /* w  ww  . j ava  2  s.  com*/
 * @param list The list or grid
 */
private void initAbsListView(final AbsListView list) {
    // Release any references to the recycled Views
    list.setRecyclerListener(new RecycleHolder());
    // Listen for ContextMenus to be created
    list.setOnCreateContextMenuListener(this);
    // Show the albums and songs from the selected artist
    list.setOnItemClickListener(this);
    // To help make scrolling smooth
    list.setOnScrollListener(this);
}

From source file:com.andrew.apollo.ui.fragments.profile.ApolloFragment.java

/**
 * Sets up various helpers for both the list and grid
 *
 * @param list The list or grid/*from  w  ww  .ja va  2s . c  o  m*/
 */
private void initAbsListView(final AbsListView list) {
    // Release any references to the recycled Views
    list.setRecyclerListener(new RecycleHolder());
    // Listen for ContextMenus to be created
    list.setOnCreateContextMenuListener(this);
    // Show the albums and songs from the selected artist
    list.setOnItemClickListener(this);

    // To help make scrolling smooth
    if (mProfileTabCarousel != null) {
        list.setOnScrollListener(new VerticalScrollListener(null, mProfileTabCarousel, 0));
        // Remove the scrollbars and padding for the fast scroll
        list.setVerticalScrollBarEnabled(false);
        list.setFastScrollEnabled(false);
        list.setPadding(0, 0, 0, 0);
    }
}