Android Open Source - led-notifier Sectioned Cursor Adapter






From Project

Back to project page led-notifier.

License

The source code is released under:

Apache License

If you think the Android project led-notifier 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.ciubotariu_levy.lednotifier;
/*from   ww  w .j a v  a 2 s.  c o m*/
import android.content.Context;
import android.database.Cursor;
import android.support.v4.widget.SimpleCursorAdapter;
import android.widget.AlphabetIndexer;
import android.widget.SectionIndexer;

public class SectionedCursorAdapter extends SimpleCursorAdapter implements SectionIndexer{
  private static final String TAG = SectionedCursorAdapter.class.getName();
  
  private AlphabetIndexer mIndexer;
  private String mAlphabetColumn;
  public SectionedCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags, String alphabetColumn){
    super(context,layout,c,from, to, flags);
    
    mAlphabetColumn = alphabetColumn;
  }

  @Override
  public int getPositionForSection(int sectionIndex) {
    return mIndexer.getPositionForSection(sectionIndex);
  }

  @Override
  public int getSectionForPosition(int position) {
    return mIndexer.getSectionForPosition(position);
  }

  @Override
  public Object[] getSections() {
    return mIndexer.getSections();
  }

  @Override
  public Cursor swapCursor (Cursor c){
    if (c != null){
      if (mIndexer != null){
        mIndexer.setCursor(c);
      }
      else {
        mIndexer = new AlphabetIndexer(c, c.getColumnIndex(mAlphabetColumn),
            " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
      }
    }
    return super.swapCursor(c);
  }     
}




Java Source Code List

com.ciubotariu_levy.lednotifier.AboutActivity.java
com.ciubotariu_levy.lednotifier.AlarmDismissReceiver.java
com.ciubotariu_levy.lednotifier.BoldCheckedView.java
com.ciubotariu_levy.lednotifier.BootBroadcastReceiver.java
com.ciubotariu_levy.lednotifier.CircularColorView.java
com.ciubotariu_levy.lednotifier.ColorDialog.java
com.ciubotariu_levy.lednotifier.ColorVibrateDialog.java
com.ciubotariu_levy.lednotifier.ContactsFragment.java
com.ciubotariu_levy.lednotifier.CustomContactsFragment.java
com.ciubotariu_levy.lednotifier.DataFetcher.java
com.ciubotariu_levy.lednotifier.DefaultColorChooserContainer.java
com.ciubotariu_levy.lednotifier.FastScrollThemedListView.java
com.ciubotariu_levy.lednotifier.LEDCancelReceiver.java
com.ciubotariu_levy.lednotifier.MainActivity.java
com.ciubotariu_levy.lednotifier.NotificationService.java
com.ciubotariu_levy.lednotifier.NotificationUtils.java
com.ciubotariu_levy.lednotifier.ObserverService.java
com.ciubotariu_levy.lednotifier.SMSAppAdapter.java
com.ciubotariu_levy.lednotifier.SMSAppChooserContainer.java
com.ciubotariu_levy.lednotifier.SMSReceiver.java
com.ciubotariu_levy.lednotifier.SectionedCursorAdapter.java
com.ciubotariu_levy.lednotifier.SettingsActivity.java
com.ciubotariu_levy.lednotifier.SmsAppChooserDialog.java
com.ciubotariu_levy.lednotifier.providers.LedContactInfo.java
com.ciubotariu_levy.lednotifier.providers.LedContactProvider.java
com.ciubotariu_levy.lednotifier.providers.LedContacts.java
com.larswerkman.holocolorpicker.ColorPicker.java
com.larswerkman.holocolorpicker.EndColorPicker.java
com.larswerkman.holocolorpicker.LinearColorPicker.java
com.larswerkman.holocolorpicker.OnColorChangedListener.java
com.larswerkman.holocolorpicker.OpacityBar.java
com.larswerkman.holocolorpicker.SVBar.java
com.larswerkman.holocolorpicker.SaturationBar.java
com.larswerkman.holocolorpicker.ValueBar.java
com.makeramen.RoundedDrawable.java
com.makeramen.RoundedTransformationBuilder.java