Back to project page frc-notebook.
The source code is released under:
GNU General Public License
If you think the Android project frc-notebook listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.plnyyanks.frcnotebook.adapters; // www . j a v a 2 s . c o m import android.app.Activity; import android.content.Intent; import android.media.Image; import android.util.SparseArray; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.CheckedTextView; import android.widget.ImageView; import com.plnyyanks.frcnotebook.R; import com.plnyyanks.frcnotebook.activities.ViewTeam; import com.plnyyanks.frcnotebook.datatypes.ListGroup; import com.plnyyanks.frcnotebook.datatypes.Note; /** * File created by phil on 2/23/2014. * Copyright 2014, Phil Lopreiato * This file is part of FRC Notebook. * FRC Notebook is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * FRC Notebook is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with FRC Notebook. If not, see http://www.gnu.org/licenses/. */ public abstract class CustomExapandableListAdapter extends BaseExpandableListAdapter implements AdapterInterface{ public final SparseArray<ListGroup> groups; public LayoutInflater inflater; public Activity activity; public CustomExapandableListAdapter(Activity act, SparseArray<ListGroup> groups) { activity = act; this.groups = groups; inflater = act.getLayoutInflater(); } @Override public Object getChild(int groupPosition, int childPosition) { return groups.get(groupPosition).children.get(childPosition); } public Object getChildKey(int groupPosition, int childPosition){ return groups.get(groupPosition).children_keys.get(childPosition); } @Override public long getChildId(int groupPosition, int childPosition) { return 0; } @Override public int getChildrenCount(int groupPosition) { if(groups == null || groups.get(groupPosition) == null) return 0; return groups.get(groupPosition).children.size(); } @Override public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Override public int getGroupCount() { return groups.size(); } @Override public void onGroupCollapsed(int groupPosition) { super.onGroupCollapsed(groupPosition); } @Override public void onGroupExpanded(int groupPosition) { super.onGroupExpanded(groupPosition); } @Override public long getGroupId(int groupPosition) { return 0; } @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.expandablelist_group, null); } ListGroup group = (ListGroup) getGroup(groupPosition); ((CheckedTextView) convertView).setText(group.string); ((CheckedTextView) convertView).setChecked(isExpanded); return convertView; } @Override public boolean hasStableIds() { return false; } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return false; } public void updateNote(Note note){} abstract public void addNote(Note note); }