Android Open Source - KendaliPintuAndroid Log Adapter

From Project

Back to project page KendaliPintuAndroid.


The source code is released under:

GNU General Public License

If you think the Android project KendaliPintuAndroid 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

 * Copyright (c) 2014 Dimas Rullyan Danu
 * //from  w ww .j a  v a  m
 * Kendali Pintu 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.
 * Kendali Pintu is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with Kendali Pintu. If not, see <>.
package com.dimasdanz.kendalipintu.logmodel;

import java.util.HashMap;
import java.util.List;

import com.dimasdanz.kendalipintu.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;

public class LogAdapter extends BaseExpandableListAdapter {
  private Context context;
    private List<String> listDataHeader;
    private HashMap<String, List<LogModel>> listDataChild;
    public LogAdapter(Context context, List<String> listDataHeader, HashMap<String, List<LogModel>> listChildData) {
        this.context = context;
        this.listDataHeader = listDataHeader;
        this.listDataChild = listChildData;
    //Child View 
    public Object getChild(int groupPosition, int childPosititon) {
        return this.listDataChild.get(this.listDataHeader.get(groupPosition)).get(childPosititon);
    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        final LogModel lm = (LogModel)getChild(groupPosition, childPosition);
        if (convertView == null) {
            LayoutInflater infalInflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = infalInflater.inflate(R.layout.list_item_log, null);
        TextView txtListChild = (TextView) convertView.findViewById(;
        TextView txtListDesc = (TextView) convertView.findViewById(;
        return convertView;
    public int getChildrenCount(int groupPosition) {
        return this.listDataChild.get(this.listDataHeader.get(groupPosition)).size();
    //End of Child View
    //Group View
    public Object getGroup(int groupPosition) {
        return this.listDataHeader.get(groupPosition);
    public int getGroupCount() {
        return this.listDataHeader.size();
    public long getGroupId(int groupPosition) {
        return groupPosition;
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
        String headerTitle = (String) getGroup(groupPosition);
        if (convertView == null) {
            LayoutInflater infalInflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = infalInflater.inflate(R.layout.list_group_log, null);
        TextView lblListHeader = (TextView) convertView.findViewById(;
        lblListHeader.setTypeface(null, Typeface.BOLD);
        return convertView;
    //End of Group View
    public boolean hasStableIds() {
        return false;
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;
    public void refreshView(){

Java Source Code List