Android Open Source - android-mimic-ui U I Table View






From Project

Back to project page android-mimic-ui.

License

The source code is released under:

Apache License

If you think the Android project android-mimic-ui 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.mimic.ui.tableview;
//from   ww  w  .  ja  v  a  2 s. c o  m
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.mimic.ui.R;

public class UITableView extends LinearLayout {

  private LayoutInflater mInflater;
  private LinearLayout mMainContainer;
  private LinearLayout mItemsContainer;
  
  private List<IListItem> mItemList;

  public UITableView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mItemList = new ArrayList<IListItem>();
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mMainContainer = (LinearLayout) mInflater.inflate(R.layout.uitableview, null);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
        ViewGroup.LayoutParams.FILL_PARENT,
        ViewGroup.LayoutParams.FILL_PARENT);
    addView(mMainContainer, params);
    mItemsContainer = (LinearLayout) mMainContainer.findViewById(R.id.itemsContainer);
  }

  public void addItem(IListItem item) {
    mItemList.add(item);
  }

  public void commit() {
    for (IListItem item : mItemList) {
      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
          ViewGroup.LayoutParams.FILL_PARENT,
          ViewGroup.LayoutParams.FILL_PARENT);
      params.setMargins(0, 20, 0, 30);
      mItemsContainer.addView(item.getItemView(), params);
    }
  }

  public int getItemCount() {
    return mItemList.size();
  }

  public void clear() {
    mItemList.clear();
    mItemsContainer.removeAllViews();
  }
}




Java Source Code List

com.mimic.ui.tableview.IListItem.java
com.mimic.ui.tableview.UITableViewActivity.java
com.mimic.ui.tableview.UITableViewItem.java
com.mimic.ui.tableview.UITableViewSection.java
com.mimic.ui.tableview.UITableView.java
com.mimic.ui.tableview.support.UIButtonItem.java
com.mimic.ui.tableview.support.UIMultiChoiceListSection.java
com.mimic.ui.tableview.support.UIProgressItem.java
com.mimic.ui.tableview.support.UISingleChoiceListSection.java
com.mimic.ui.tableview.support.UISliderItem.java
com.mimic.ui.tableview.support.UISwitchItem.java
com.mimic.ui.tableview.support.UITextInputItem.java
com.mimic.ui.tableview.support.UIVolumeControlItem.java