Coder Social home page Coder Social logo

android-section-list's People

Contributors

drecom-jenkins avatar

Watchers

 avatar

android-section-list's Issues

Is there an example of how to use this?

I'm trying to test this widget for possible use, but without an example and 
with the given documentation, it's mostly futile.  Currently I get an 
exception: 

java.io.FileNotFoundException: 
res/drawable-hdpi/divider_horizontal_bright_opaque.9.png
07-04

Rather than try to run that down though, since I'm probably doing something 
wrong to begin with.  Can you post some kind of simple example implementation?

Original issue reported on code.google.com by [email protected] on 4 Jul 2011 at 6:12

Checkboxes getting unexpected checked

What steps will reproduce the problem?
1. Activate a checkbox from the project sample
2. Scroll down 
3. Another checkbox that was previously not checked is now also checked

What is the expected output? What do you see instead?
Only the selected checkbox should be checked. But other checkboxes become also 
checked when scrolling up and down. 

What version of the product are you using? On what operating system?
Currently active version 

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 10 Dec 2013 at 10:33

onItemClickListener only called for sections

When I click add an onItemClickListener ass below, it will only get called if 
it's a section being clicked, not if it is a regular row.

Does anyone know how to fix this?

// Create and set adapter
        this.arrayAdapter = new StandardArrayAdapter(this, R.id.artists_list_view_title, this.sectionListItems);
        this.sectionAdapter = new SectionListAdapter(getLayoutInflater(), this.arrayAdapter);
        this.listView = (SectionListView) findViewById(R.id.artists_list_view);
        this.listView.setAdapter(this.sectionAdapter);

        //
        this.sectionAdapter.setOnItemClickListener(new OnItemClickListener()
        {
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
                Log.d(LOG_TAG, "Clicked.");
            }
        });
        this.listView.setOnItemClickListener(this.sectionAdapter);

Original issue reported on code.google.com by [email protected] on 28 Jan 2012 at 7:32

  • Merged into: #3

Library project compilation fails because of non-final resource ids used in switch statement

What steps will reproduce the problem?

Use as Android Library project, build with ADT14+

What is the expected output? What do you see instead?

Build fails because resource IDs are used in a switch statement. This no longer 
works for library projects starting at ADT 14, see this link: 
http://tools.android.com/tips/non-constant-fields

Original issue reported on code.google.com by [email protected] on 1 Oct 2012 at 9:10

Unable to setOnItemClick listener

What steps will reproduce the problem?
1. It does not recognizes which item is clicked.
I set listView.setOnItemClickListener and implemented the OnItemClickListener 
method of android, which simply toasts the item position.
To my surprise, if I tap on the section item, the toast is shown. But it does 
not recognizing the onItemClick for the listView rows.
How to fix this?

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.
Here is my sample code:
package pl.polidea.sectionedlist;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import android.widget.Toast;

/**
 * Example activity.
 */
public class SectionListActivity extends Activity {

    private class StandardArrayAdapter extends ArrayAdapter<SectionListItem> {

        private final SectionListItem[] items;

        public StandardArrayAdapter(final Context context,
                final int textViewResourceId, final SectionListItem[] items) {
            super(context, textViewResourceId, items);
            this.items = items;
        }

        @Override
        public View getView(final int position, final View convertView,
                final ViewGroup parent) {
            View view = convertView;
            if (view == null) {
                final LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                view = vi.inflate(R.layout.example_list_view, null);
            }
            final SectionListItem currentItem = items[position];
            if (currentItem != null) {
                final TextView textView = (TextView) view
                        .findViewById(R.id.example_text_view);
                final TextView textView2 = (TextView) view
                .findViewById(R.id.example_text_view2);
                if (textView != null) {
                    textView.setText(currentItem.item.toString());
                }
                if (textView2 != null) {
                    textView2.setText(currentItem.item.toString());
                }
            }
            return view;
        }
    }

    SectionListItem[] exampleArray = { // Comment to prevent re-format
    new SectionListItem("Test 1 - A", "A"), //
            new SectionListItem("Test 2 - A", "A"), //
            new SectionListItem("Test 3 - A", "A"), //
            new SectionListItem("Test 4 - A", "A"), //
            new SectionListItem("Test 5 - A", "A"), //
            new SectionListItem("Test 6 - B", "B"), //
            new SectionListItem("Test 7 - B", "B"), //
            new SectionListItem("Test 8 - B", "B"), //
            new SectionListItem("Test 9 - Long", "Long section"), //
            new SectionListItem("Test 10 - Long", "Long section"), //
            new SectionListItem("Test 11 - Long", "Long section"), //
            new SectionListItem("Test 12 - Long", "Long section"), //
            new SectionListItem("Test 13 - Long", "Long section"), //
            new SectionListItem("Test 14 - A again", "A"), //
            new SectionListItem("Test 15 - A again", "A"), //
            new SectionListItem("Test 16 - A again", "A"), //
            new SectionListItem("Test 17 - B again", "B"), //
            new SectionListItem("Test 18 - B again", "B"), //
            new SectionListItem("Test 19 - B again", "B"), //
            new SectionListItem("Test 20 - B again", "B"), //
            new SectionListItem("Test 21 - B again", "B"), //
            new SectionListItem("Test 22 - B again", "B"), //
            new SectionListItem("Test 23 - C", "C"), //
            new SectionListItem("Test 24 - C", "C"), //
            new SectionListItem("Test 25 - C", "C"), //
            new SectionListItem("Test 26 - C", "C"), //
    };

    private StandardArrayAdapter arrayAdapter;

    private SectionListAdapter sectionAdapter;

    private SectionListView listView;

    @Override
    public void onCreate(final Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);

        arrayAdapter = new StandardArrayAdapter(this, R.id.example_text_view,
                exampleArray);
        sectionAdapter = new SectionListAdapter(getLayoutInflater(),
                arrayAdapter);
        listView = (SectionListView) findViewById(getResources().getIdentifier(
                "section_list_view", "id",
                this.getClass().getPackage().getName()));
        listView.setAdapter(sectionAdapter);
        listView.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView< ? > arg0, View arg1, int arg2,
                    long arg3) {
                Toast.makeText(SectionListActivity.this, "Item : " + arg2, Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.test_menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case R.id.standard_list:
            arrayAdapter = new StandardArrayAdapter(this,
                    R.id.example_text_view, exampleArray);
            sectionAdapter = new SectionListAdapter(getLayoutInflater(),
                    arrayAdapter);
            listView.setAdapter(sectionAdapter);
            return true;
        case R.id.empty_list:
            arrayAdapter = new StandardArrayAdapter(this,
                    R.id.example_text_view, new SectionListItem[] {});
            sectionAdapter = new SectionListAdapter(getLayoutInflater(),
                    arrayAdapter);
            listView.setAdapter(sectionAdapter);
            return true;
        default:
            return super.onOptionsItemSelected(item);
        }
    }
}

Original issue reported on code.google.com by [email protected] on 2 Sep 2013 at 11:22

How to add the seachView and more importantly the filter for StandardArrayAdapter or SectionListAdapter ?

I'm trying to add searchbar/seachView for this section list

//============================================================

  private TextWatcher textWatcher = new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            //mArrayAdapter.getFilter().filter(s);

            SectionListActivity.this.arrayAdapter.getFilter().filter(s.toString());

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

        @Override
        public void afterTextChanged(Editable s) {}
    };

//===============================================================

not able to get the required results after entering the text in search bar

I have to implement filters for custom StandardArrayAdapter or 
SectionListAdapter?  

please suggest the search solution for this section list. 

Original issue reported on code.google.com by [email protected] on 26 Dec 2012 at 5:42

How to/best way to reload/refresh

Hi! and thank you for a great library! I works great, even for an android 
newbie like me. This may be an obvious question, but your library is so 
complete, I bet you've even thought of it, so please bear with me...

I'm trying out your sectionlist in a small hobby project of mine, where I 
download data from a json service I've made, that gets updated relatively often 
- several times a day.

I've started out with your:

public class SectionListActivity extends Activity 

and I've added an asynctask that goes something like this:


    private class SectionDownloader extends AsyncTask<String, Integer, Integer>
    {
        protected void onPreExecute(){
            //Setup is done here
        }

        protected Integer doInBackground(String... params) {
                   //populate json array much like your SectionListItem[] exampleArray
                   return Integer length of exampleArray
               } 

        protected void onPostExecute(Integer json_lngth)
        {
            if (json_lngth != null && exampleArray != null)
            {
                arrayAdapter = new StandardArrayAdapter(getApplicationContext(), R.id.example_text_view,
                        exampleArray);
                sectionAdapter = new SectionListAdapter(getLayoutInflater(),
                        arrayAdapter);

                listView = (SectionListView) findViewById(getResources().getIdentifier(
                        "section_list_view", "id",
                        this_package_name));
                listView.setAdapter(sectionAdapter);
            }
            else
            {
                // no network error
            }
        }
        protected void onProgressUpdate(Integer... params){
            //Update a progress bar here, or ignore it, it's up to you
        }

        protected void onCancelled(){
        }

    }

And it works great!


What I am wondering is how to use your option menu to implement a refresh 
button to force a reload of the json array, ie to go out and fetch new data 
from the server and update the list.

I've read about adapter.notifyDataSetChanged() and similar things, but it seems 
to me i have to call the async task first, but when I do that I get an 
exveption like:

08-17 23:21:08.251: E/AndroidRuntime(295): java.lang.NullPointerException
08-17 23:21:08.251: E/AndroidRuntime(295):  at 
pl.polidea.sectionedlist.SectionListAdapter.updateSessionCache(SectionListAdapte
r.java:75)


So as far as I can see something "wrong" happens in your updateSessionCache 
when I do it this way.

What would you suggest the proper way to reload data and update the sectionlist?

Thanks in advance, and sorry if this is a totally inappropriate question...



Original issue reported on code.google.com by [email protected] on 17 Aug 2012 at 9:55

OnItemClickListener doesn't seem to get called

I tried adding an OnItemClickListener to both the adapter and the 
SectionListView, but neither gets called when I click an item.

I modified the onCreate in the SectionListActivity sample to:

    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        arrayAdapter = new StandardArrayAdapter(this, R.id.example_text_view, exampleArray);
        sectionAdapter = new SectionListAdapter(getLayoutInflater(), arrayAdapter);
        sectionAdapter.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {
              Log.i("test","adapter onclick called");
            }
          });
        final SectionListView listView = (SectionListView) findViewById(getResources().getIdentifier(
                "section_list_view", "id", this.getClass().getPackage().getName()));
        listView.setAdapter(sectionAdapter);
        listView.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {
              Log.i("test","view onclick called");
            }
          });
    }

I never get a log message though when I click an item in the list.

Original issue reported on code.google.com by [email protected] on 5 Jul 2011 at 12:13

getting an exception when using it as a library

Since i'm a beginner i can't figure it out why i'm getting this exception.
i have added 

library_name=pl.polidea.sectionedlist

<uses-library
android:name="@string/library_name"   
android:required="true"/> 

in manifest.xml file and added it as a library also and 
and i have changed the main manifest file as you have indicated in the sample 
to use the sectionListView 

but i'm getting this error:

"java.lang.RunTimeException:Unable to start activity componentInfo 
{pl.polidea.sectionedList/my.package.listActivity}: 
java.lang.NullpointerException"


Android 2.2

i have attached my testing code. please have look at my issue. thanks in 
advance 

Original issue reported on code.google.com by [email protected] on 7 Mar 2012 at 9:02

Support non-sectioned headers

What steps will reproduce the problem?
1. Try to attach a header view.
2.
3.

What is the expected output? What do you see instead?
Even though the header view is displayed correctly, the Section view is not 
displayed on the top of the listView, like it does if no other header view are 
attached. 


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 18 Sep 2012 at 5:43

Problem with implementing SELECTOR

Hi, 

I have a problem with using selector and your section-list. Nomatter how I have 
already try it, I really can't change list view item background. Can you help 
me ? With some easy sample  ? 

Original issue reported on code.google.com by [email protected] on 13 Dec 2014 at 9:03

i want list view click intent to another activity


        nama = new String[] { "2 Potong Ayam", "Wing Bucket" };

@Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3){

                     Intent i = null;
                if (equals("2 Potong ayam")){
                 i = new Intent(Kfc.this, Ayam.class);
                } else if (equals("Wing Bucket")){
                    i = new Intent(Kfc.this, Bucket.class);
                } startActivity(i);
            }
        });



when i clicked listview,, always force close.

Original issue reported on code.google.com by [email protected] on 13 Feb 2014 at 2:57

Moving section is overlapped

This issue appears when i try to load all the section adapter again.

My app loads the sections and data dynamically, therefore, i can change the 
filters and the data and sections will change.

The problem is that i see in the first section the old section i had, and on 
top of it, the new section (the one with the new data).

The image attached is self descriptive.

To reproduce it (following your example), add a button somewhere, or use the 
menu, and initialize all the data again.
Use another array of data to see the problem clearly.



//on menu button click event, do this
arrayAdapter = new StandardArrayAdapter(this,R.id.example_text_view, 
differentArray);
sectionAdapter = new SectionListAdapter(getLayoutInflater(), arrayAdapter);
final SectionListView listView = (SectionListView) 
findViewById(R.id.section_list_view);
listView.setAdapter(sectionAdapter);

Thanks a lot!

Original issue reported on code.google.com by [email protected] on 1 Jul 2011 at 6:02

Attachments:

While list view item height increases the section header visible/change timing changes!

What steps will reproduce the problem?
1. Increasing the list view item height!
2.more time in a list view item
3.or simply when item size expands

What is the expected output? What do you see instead?

Should work normally when section width as it is! but Section header 
visible/change timing changes while item size expands
What version of the product are you using? On what operating system?
Latest

Please provide any additional information below.
in simple line when item in listview expands it will effect the section list 
display/ change timings

Original issue reported on code.google.com by [email protected] on 30 Apr 2013 at 11:17

SectionedList crash when attempting to fastscroll

What steps will reproduce the problem?
1.Enabled fastscroll by adding "android:fastScrollEnabled="true" in the 
pl.polidea.sectionedlist.SectionListView section of the main.xml layout file. 

2.  Added a few more items to the list to exceed the 35 count
3.  Launched app.  Started manual scrolling. After fastscroll tab appeared, 
attempting to fast scroll by dragging the fastscroll tab resulted in a crash. 

What is the expected output? What do you see instead?
I expected to see the list scrolling quickly.  Instead a crash message 
appeared:  "The application SectionList (process pl.polidea.sectionedlist) has 
stopped unexpectedly.  Please try again."

What version of the product are you using? On what operating system?
This was reproduced on the emulator (2.2 and 2.3) as well as the HTC Sensation.


Please provide any additional information below.
Would appreciate guidance on how to make fastscroll work and also how to have 
the section headers appear in a box as in the alphabetindexer.

Thank you


Original issue reported on code.google.com by [email protected] on 5 Sep 2011 at 4:58

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.