If you think the Android project EBrowser 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
/*
* Zirco Browser for Android//www.java2s.com
*
* Copyright (C) 2010 J. Devauchelle and contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 3 as published by the Free Software Foundation.
*
* This program 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.
*/package org.zirco.model.adapters;
import com.mrpej.ebrowser.R;
import android.content.Context;
import android.database.Cursor;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.SimpleCursorAdapter;
/**
* Adapter for suggestions.
*/publicclass UrlSuggestionCursorAdapter extends SimpleCursorAdapter {
publicstaticfinal String URL_SUGGESTION_ID = "_id";
publicstaticfinal String URL_SUGGESTION_TITLE = "URL_SUGGESTION_TITLE";
publicstaticfinal String URL_SUGGESTION_URL = "URL_SUGGESTION_URL";
publicstaticfinal String URL_SUGGESTION_TYPE = "URL_SUGGESTION_TYPE";
/**
* Constructor.
* @param context The context.
* @param layout The layout.
* @param c The Cursor.
* @param from Input array.
* @param to Output array.
*/public UrlSuggestionCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) {
super(context, layout, c, from, to);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View superView = super.getView(position, convertView, parent);
ImageView iconView = (ImageView) superView.findViewById(R.id.AutocompleteImageView);
int resultType;
try {
resultType = Integer.parseInt(getCursor().getString(getCursor().getColumnIndex(URL_SUGGESTION_TYPE)));
} catch (Exception e) {
resultType = 0;
}
switch (resultType) {
case 1: iconView.setImageResource(R.drawable.ic_tab_history_unselected); break;
case 2: iconView.setImageResource(R.drawable.ic_tab_bookmarks_unselected); break;
case 3: iconView.setImageResource(R.drawable.ic_tab_weave_unselected); break;
default: break;
}
return superView;
}
}