Search in sources :

Example 1 with TextAdapter

use of com.example.adapter.TextAdapter in project ExpandTabView by yueyueniao2012.

the class ViewMiddle method init.

private void init(Context context) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.view_region, this, true);
    regionListView = (ListView) findViewById(R.id.listView);
    plateListView = (ListView) findViewById(R.id.listView2);
    setBackgroundDrawable(getResources().getDrawable(R.drawable.choosearea_bg_left));
    for (int i = 0; i < 10; i++) {
        groups.add(i + "行");
        LinkedList<String> tItem = new LinkedList<String>();
        for (int j = 0; j < 15; j++) {
            tItem.add(i + "行" + j + "列");
        }
        children.put(i, tItem);
    }
    earaListViewAdapter = new TextAdapter(context, groups, R.drawable.choose_item_selected, R.drawable.choose_eara_item_selector);
    earaListViewAdapter.setTextSize(17);
    earaListViewAdapter.setSelectedPositionNoNotify(tEaraPosition);
    regionListView.setAdapter(earaListViewAdapter);
    earaListViewAdapter.setOnItemClickListener(new TextAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            if (position < children.size()) {
                childrenItem.clear();
                childrenItem.addAll(children.get(position));
                plateListViewAdapter.notifyDataSetChanged();
            }
        }
    });
    if (tEaraPosition < children.size())
        childrenItem.addAll(children.get(tEaraPosition));
    plateListViewAdapter = new TextAdapter(context, childrenItem, R.drawable.choose_item_right, R.drawable.choose_plate_item_selector);
    plateListViewAdapter.setTextSize(15);
    plateListViewAdapter.setSelectedPositionNoNotify(tBlockPosition);
    plateListView.setAdapter(plateListViewAdapter);
    plateListViewAdapter.setOnItemClickListener(new TextAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(View view, final int position) {
            showString = childrenItem.get(position);
            if (mOnSelectListener != null) {
                mOnSelectListener.getValue(showString);
            }
        }
    });
    if (tBlockPosition < childrenItem.size())
        showString = childrenItem.get(tBlockPosition);
    if (showString.contains("不限")) {
        showString = showString.replace("不限", "");
    }
    setDefaultSelect();
}
Also used : LayoutInflater(android.view.LayoutInflater) TextAdapter(com.example.adapter.TextAdapter) View(android.view.View) ListView(android.widget.ListView) LinkedList(java.util.LinkedList)

Example 2 with TextAdapter

use of com.example.adapter.TextAdapter in project ExpandTabView by yueyueniao2012.

the class ViewLeft method init.

private void init(Context context) {
    mContext = context;
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.view_distance, this, true);
    setBackgroundDrawable(getResources().getDrawable(R.drawable.choosearea_bg_mid));
    mListView = (ListView) findViewById(R.id.listView);
    adapter = new TextAdapter(context, items, R.drawable.choose_item_right, R.drawable.choose_eara_item_selector);
    adapter.setTextSize(17);
    if (mDistance != null) {
        for (int i = 0; i < itemsVaule.length; i++) {
            if (itemsVaule[i].equals(mDistance)) {
                adapter.setSelectedPositionNoNotify(i);
                showText = items[i];
                break;
            }
        }
    }
    mListView.setAdapter(adapter);
    adapter.setOnItemClickListener(new TextAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            if (mOnSelectListener != null) {
                showText = items[position];
                mOnSelectListener.getValue(itemsVaule[position], items[position]);
            }
        }
    });
}
Also used : LayoutInflater(android.view.LayoutInflater) TextAdapter(com.example.adapter.TextAdapter) View(android.view.View) ListView(android.widget.ListView)

Example 3 with TextAdapter

use of com.example.adapter.TextAdapter in project ExpandTabView by yueyueniao2012.

the class ViewRight method init.

private void init(Context context) {
    mContext = context;
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.view_distance, this, true);
    setBackgroundDrawable(getResources().getDrawable(R.drawable.choosearea_bg_right));
    mListView = (ListView) findViewById(R.id.listView);
    adapter = new TextAdapter(context, items, R.drawable.choose_item_right, R.drawable.choose_eara_item_selector);
    adapter.setTextSize(17);
    if (mDistance != null) {
        for (int i = 0; i < itemsVaule.length; i++) {
            if (itemsVaule[i].equals(mDistance)) {
                adapter.setSelectedPositionNoNotify(i);
                showText = items[i];
                break;
            }
        }
    }
    mListView.setAdapter(adapter);
    adapter.setOnItemClickListener(new TextAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            if (mOnSelectListener != null) {
                showText = items[position];
                mOnSelectListener.getValue(itemsVaule[position], items[position]);
            }
        }
    });
}
Also used : LayoutInflater(android.view.LayoutInflater) TextAdapter(com.example.adapter.TextAdapter) View(android.view.View) ListView(android.widget.ListView)

Aggregations

LayoutInflater (android.view.LayoutInflater)3 View (android.view.View)3 ListView (android.widget.ListView)3 TextAdapter (com.example.adapter.TextAdapter)3 LinkedList (java.util.LinkedList)1