Android Open Source - MultiWork Analyzer Expandable Adapter






From Project

Back to project page MultiWork.

License

The source code is released under:

Copyright (c) 2013, Torti Andr?s Fernando All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions a...

If you think the Android project MultiWork 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.protocolanalyzer.andres;
/*from   w w  w  .j  ava  2 s  . c om*/
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.multiwork.andres.R;
import com.tjerkw.slideexpandable.library.ActionSlideExpandableListView;

import java.util.ArrayList;

public class AnalyzerExpandableAdapter extends ArrayAdapter<String> {

    private final Context context;
    private final ArrayList<String> mDetails;
    private final ActionSlideExpandableListView mListView;

    static class ViewHolder {
        TextView title;
        TextView details;
    }

    public AnalyzerExpandableAdapter(Context ctx, ArrayList<String> titles, ArrayList<String> details,
                                     ActionSlideExpandableListView listView){
        super(ctx, R.layout.expandable_list_item, titles);
        context = ctx;
        mDetails = details;
        mListView = listView;
    }

    @Override
    public View getView(int position, View view, ViewGroup viewGroup) {
        String headerTitle = getItem(position);
        ViewHolder mViewHolder;

        if(view == null){
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.expandable_list_item, null);

            // Obtengo los TextView para no tener que llamar findViewById() cada vez que se ejecuta getView()
            mViewHolder = new ViewHolder();
            mViewHolder.title = (TextView) view.findViewById(R.id.title_view);
            mViewHolder.title.setTypeface(Typeface.createFromAsset(context.getAssets(), "SourceCodePro-Semibold.ttf"));

            mViewHolder.details = (TextView) view.findViewById(R.id.detail_view);
            mViewHolder.details.setTypeface(Typeface.createFromAsset(context.getAssets(), "SourceCodePro-Semibold.ttf"));

            // Guardo el ViewHolder en el View
            view.setTag(mViewHolder);
        }else{
            // Obtengo el ViewHolder
            mViewHolder = (ViewHolder) view.getTag();
        }

        if(mListView.isItemChecked(position)) view.setBackgroundResource(android.R.color.holo_blue_light);
        else view.setBackgroundResource(android.R.color.background_light);

        mViewHolder.title.setText(headerTitle);
        mViewHolder.details.setText(mDetails.get(position));

        return view;
    }
}




Java Source Code List

com.bluetoothutils.andres.BTSingleSynchTransfer.java
com.bluetoothutils.andres.BluetoothHelper.java
com.bluetoothutils.andres.DeviceScanner.java
com.bluetoothutils.andres.OnBluetoothConnected.java
com.bluetoothutils.andres.OnDeviceSelected.java
com.bluetoothutils.andres.OnNewBluetoothDataReceived.java
com.frecuencimeter.andres.FrecView.java
com.frecuencimeter.andres.Frecuencia.java
com.multiwork.andres.ApplicationContext.java
com.multiwork.andres.LCView.java
com.multiwork.andres.MainMenu.java
com.multiwork.andres.MainPrefs.java
com.multiwork.andres.MenuListAdapter.java
com.protocolanalyzer.andres.AnalyzerExpandableAdapter.java
com.protocolanalyzer.andres.CRC16.java
com.protocolanalyzer.andres.LogicAnalizerPrefsFragment.java
com.protocolanalyzer.andres.LogicAnalizerPrefs.java
com.protocolanalyzer.andres.LogicAnalyzerActivity.java
com.protocolanalyzer.andres.LogicAnalyzerChartFragment.java
com.protocolanalyzer.andres.LogicAnalyzerListFragment.java
com.protocolanalyzer.andres.OnActionBarClickListener.java
com.protocolanalyzer.andres.OnDataClearedListener.java
com.protocolanalyzer.andres.OnDataDecodedListener.java
com.roboticarm.andres.BrazoRobot.java
com.roboticarm.andres.JoystickView.java
com.roboticarm.andres.Joystick.java
com.tjerkw.slideexpandable.library.AbstractSlideExpandableListAdapter.java
com.tjerkw.slideexpandable.library.ActionSlideExpandableListView.java
com.tjerkw.slideexpandable.library.ExpandCollapseAnimation.java
com.tjerkw.slideexpandable.library.SlideExpandableListAdapter.java
com.tjerkw.slideexpandable.library.SlideExpandableListView.java
com.tjerkw.slideexpandable.library.WrapperListAdapterImpl.java
com.utils.andres.ConflictChecker.java
com.utils.andres.Dependency.java
com.utils.andres.Pair.java