use of org.moire.ultrasonic.util.ImageLoader in project ultrasonic by ultrasonic.
the class ChatAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ChatMessage message = this.getItem(position);
ViewHolder holder;
int layout;
String messageUser = message.getUsername();
Date messageTime = new java.util.Date(message.getTime());
String messageText = message.getMessage();
String me = Util.getUserName(activity, Util.getActiveServer(activity));
layout = messageUser.equals(me) ? R.layout.chat_item_reverse : R.layout.chat_item;
if (convertView == null) {
convertView = inflateView(layout, parent);
holder = createViewHolder(layout, convertView);
} else {
holder = (ViewHolder) convertView.getTag();
if (!holder.chatMessage.equals(message)) {
convertView = inflateView(layout, parent);
holder = createViewHolder(layout, convertView);
}
}
holder.chatMessage = message;
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(activity);
String messageTimeFormatted = String.format("[%s]", timeFormat.format(messageTime));
ImageLoader imageLoader = activity.getImageLoader();
if (imageLoader != null) {
imageLoader.loadAvatarImage(holder.avatar, messageUser, false, holder.avatar.getWidth(), false, true);
}
holder.username.setText(messageUser);
holder.message.setText(messageText);
holder.time.setText(messageTimeFormatted);
return convertView;
}
use of org.moire.ultrasonic.util.ImageLoader in project ultrasonic by ultrasonic.
the class SubsonicTabActivity method getImageLoader.
public synchronized ImageLoader getImageLoader() {
if (IMAGE_LOADER == null || !IMAGE_LOADER.isRunning()) {
IMAGE_LOADER = new ImageLoader(this, Util.getImageLoaderConcurrency(this));
IMAGE_LOADER.startImageLoader();
}
return IMAGE_LOADER;
}
use of org.moire.ultrasonic.util.ImageLoader in project ultrasonic by ultrasonic.
the class SettingsFragment method setImageLoaderConcurrency.
private static void setImageLoaderConcurrency(int concurrency) {
SubsonicTabActivity instance = SubsonicTabActivity.getInstance();
if (instance != null) {
ImageLoader imageLoader = instance.getImageLoader();
if (imageLoader != null) {
imageLoader.stopImageLoader();
imageLoader.setConcurrency(concurrency);
}
}
}
Aggregations