Yaaic/app/src/main/java/org/yaaic/view/MessageListView.java

75 lines
2.0 KiB
Java
Raw Normal View History

/*
2010-03-12 14:35:25 -05:00
Yaaic - Yet Another Android IRC Client
2013-01-21 15:32:43 -05:00
Copyright 2009-2013 Sebastian Kaspari
This file is part of Yaaic.
Yaaic 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.
Yaaic 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 Yaaic. If not, see <http://www.gnu.org/licenses/>.
2011-01-25 15:02:27 -05:00
*/
package org.yaaic.view;
import org.yaaic.R;
import org.yaaic.adapter.MessageListAdapter;
import org.yaaic.listener.MessageClickListener;
import android.content.Context;
import android.widget.ListView;
/**
2011-01-25 15:02:27 -05:00
* A customized ListView for Messages
*
* @author Sebastian Kaspari <sebastian@yaaic.org>
*/
public class MessageListView extends ListView
{
2010-11-18 12:52:19 -05:00
/**
* Create a new MessageListView
*
2010-11-18 12:52:19 -05:00
* @param context
*/
public MessageListView(Context context)
2010-11-18 12:52:19 -05:00
{
super(context);
2011-01-25 15:02:27 -05:00
setOnItemClickListener(MessageClickListener.getInstance());
2011-01-25 15:02:27 -05:00
setDivider(null);
setCacheColorHint(0x000000);
setVerticalFadingEdgeEnabled(false);
setBackgroundResource(R.drawable.conversation_background);
setScrollBarStyle(SCROLLBARS_OUTSIDE_INSET);
// Scale padding by screen density
float density = context.getResources().getDisplayMetrics().density;
int padding = (int) (5 * density);
setPadding(padding, padding, padding, padding);
setTranscriptMode(TRANSCRIPT_MODE_NORMAL);
2010-11-18 12:52:19 -05:00
}
2011-01-25 15:02:27 -05:00
2010-11-18 12:52:19 -05:00
/**
* Get the adapter of this MessageListView
* (Helper to avoid casting)
*
2010-11-18 12:52:19 -05:00
* @return The MessageListAdapter
*/
2011-01-25 15:02:27 -05:00
@Override
2010-11-18 12:52:19 -05:00
public MessageListAdapter getAdapter()
{
return (MessageListAdapter) super.getAdapter();
}
}