If you think the Android project CampusUB1 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) 2013 CampusUB1 Development Team
*/*www.java2s.com*/
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/package com.dev.campus.home;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
/**
* Custom ListView adapter responsible for handling home menu items
* @author CampusUB1 Development Team
*
*/publicclass HomeAdapter extends ArrayAdapter<HomeItem> {
private ArrayList<HomeItem> mItems;
private LayoutInflater mLayoutInflater;
publicenum HomeItemType {
ENTRY_ITEM, SEPARATOR_ITEM;
}
public HomeAdapter(Activity context, ArrayList<HomeItem> items) {
super(context, 0, items);
mLayoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mItems = items;
}
@Override
publicint getViewTypeCount() {
return HomeItemType.values().length;
}
@Override
publicint getItemViewType(int position) {
return mItems.get(position).getViewType();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return mItems.get(position).getView(mLayoutInflater, convertView);
}
}