Android Open Source - Ocypode O C List View






From Project

Back to project page Ocypode.

License

The source code is released under:

MIT License

If you think the Android project Ocypode 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.ocypode.widgets.list;
/*w  w w . j a  va2  s . c o  m*/
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ListView;

import com.ocypode.R;

public class OCListView extends ListView {

  public OCListView(Context context, AttributeSet attrs) {
    super(context, attrs);
    
    if (isInEditMode()) {
      return;
    }

    TypedArray styledAttrs = context.obtainStyledAttributes(attrs, R.styleable.OCLisView);
    int layoutHeaderResource = styledAttrs.getResourceId(R.styleable.OCLisView_layout_header_embedded, 0);
    int layoutFooterResource = styledAttrs.getResourceId(R.styleable.OCLisView_layout_footer_embedded, 0);
    styledAttrs.recycle();
    
    embedHeader(layoutHeaderResource);
    embedFooter(layoutFooterResource);
  }

  private void embedHeader(int layoutHeaderResource) {
    if (layoutHeaderResource != 0) {
      LayoutInflater inflater = LayoutInflater.from(getContext());
        View header = inflater.inflate(layoutHeaderResource, this, false);
        if (header != null) {
          addHeaderView(header, null, false);
        }
    }
  }
  
  private void embedFooter(int layoutFooterResource) {
    if (layoutFooterResource != 0) {
      LayoutInflater inflater = LayoutInflater.from(getContext());
        View footer = inflater.inflate(layoutFooterResource, this, false);
        if (footer != null) { 
          addFooterView(footer, null, false);
        }
    }
  }
  
  public View findViewInHeaderById(int id) {
    return findViewTraversal(id);
  }
  
  public View findViewInFooterById(int id) {
    return findViewTraversal(id);
  }
}




Java Source Code List

com.ocypode.BuildConfig.java
com.ocypode.BuildConfig.java
com.ocypode.activity.IResultCallbackActivity.java
com.ocypode.activity.robo.AbstractRoboActivity.java
com.ocypode.activity.robo.AbstractRoboFragmentActivity.java
com.ocypode.activity.robo.fragment.AbstractRoboFragment.java
com.ocypode.bluetooth.BluetoothHelper.java
com.ocypode.component.Typefaced.java
com.ocypode.component.animation.AnimationCallbackListener.java
com.ocypode.component.delegate.IStartActivityDelegate.java
com.ocypode.component.delegate.StartActivityDelegate.java
com.ocypode.component.delegate.adaptor.IStartActivityAdaptor.java
com.ocypode.component.delegate.adaptor.StartActivityAdaptor.java
com.ocypode.component.delegate.adaptor.StartFragmentAdaptor.java
com.ocypode.component.view.button.TypefacedButton.java
com.ocypode.component.view.dialog.AlertDialogBuilder.java
com.ocypode.component.view.dialog.ProgressDialogBuilder.java
com.ocypode.component.view.dialog.titledescription.TitleDescriptionArrayAdapter.java
com.ocypode.component.view.dialog.titledescription.TitleDescriptionModel.java
com.ocypode.component.view.edittext.TypefacedEditText.java
com.ocypode.component.view.imageview.CircleImageView.java
com.ocypode.component.view.listview.LockableListView.java
com.ocypode.component.view.scrollview.LockableScrollView.java
com.ocypode.component.view.textview.AutoResizeTextView.java
com.ocypode.component.view.textview.TypefacedTextView.java
com.ocypode.repository.AbstractRepository.java
com.ocypode.utility.ICallback.java
com.ocypode.utility.Logcat.java
com.ocypode.utility.Utility.java
com.ocypode.utility.bitmap.BitmapUtil.java
com.ocypode.utility.formatter.CurrencyFormatter.java
com.ocypode.utility.formatter.DateFormatter.java
com.ocypode.utility.formatter.NumberFormatter.java
com.ocypode.utility.validation.StringValidation.java
com.ocypode.widgets.list.OCListView.java