Search in sources :

Example 11 with Animation

use of com.zhan_dui.model.Animation in project AnimeTaste by daimajia.

the class DownloadAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView thumb;
    TextView title, content, progress;
    ViewHolder holder;
    if (convertView == null) {
        convertView = mLayoutInflater.inflate(R.layout.download_item, null);
        thumb = (ImageView) convertView.findViewById(R.id.thumbImage);
        title = (TextView) convertView.findViewById(R.id.title);
        content = (TextView) convertView.findViewById(R.id.content);
        progress = (TextView) convertView.findViewById(R.id.progress);
        holder = new ViewHolder(title, progress, content, thumb);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
        title = holder.title;
        content = holder.content;
        progress = holder.progress;
        thumb = holder.thumb;
    }
    if (position > getCount() - 1) {
        return null;
    }
    Object mission = getItem(position);
    Animation animation = null;
    if (mission instanceof DownloadRecord) {
        animation = DownloadRecord.getAnimation((DownloadRecord) mission);
        progress.setVisibility(View.INVISIBLE);
    } else if (mission instanceof M3U8Mission) {
        Mission m = (M3U8Mission) mission;
        Object extra = m.getExtraInformation(m.getUri());
        animation = (Animation) extra;
        if (m.isDone()) {
            progress.setVisibility(View.INVISIBLE);
        } else {
            progress.setVisibility(View.VISIBLE);
            progress.setText(m.getReadablePercentage());
        }
    }
    holder.animation = animation;
    Picasso.with(mContext).load(animation.HomePic).placeholder(R.drawable.placeholder_thumb).error(R.drawable.placeholder_fail).into(thumb);
    title.setText(animation.Name);
    content.setText(animation.Brief);
    return convertView;
}
Also used : Animation(com.zhan_dui.model.Animation) TextView(android.widget.TextView) ImageView(android.widget.ImageView) Mission(com.zhan_dui.download.alfred.missions.Mission) M3U8Mission(com.zhan_dui.download.alfred.missions.M3U8Mission) M3U8Mission(com.zhan_dui.download.alfred.missions.M3U8Mission) DownloadRecord(com.zhan_dui.model.DownloadRecord)

Example 12 with Animation

use of com.zhan_dui.model.Animation in project AnimeTaste by daimajia.

the class MissionSaver method getAnimation.

private Animation getAnimation(M3U8Mission mission) {
    Object obj = mission.getExtraInformation(mission.getUri());
    Animation animation = null;
    if (obj != null)
        animation = (Animation) obj;
    return animation;
}
Also used : Animation(com.zhan_dui.model.Animation)

Aggregations

Animation (com.zhan_dui.model.Animation)12 Intent (android.content.Intent)4 Message (android.os.Message)2 NotificationCompat (android.support.v4.app.NotificationCompat)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 AlertDialog (android.app.AlertDialog)1 PendingIntent (android.app.PendingIntent)1 DialogInterface (android.content.DialogInterface)1 OnClickListener (android.content.DialogInterface.OnClickListener)1 Cursor (android.database.Cursor)1 Uri (android.net.Uri)1 View (android.view.View)1 OnLongClickListener (android.view.View.OnLongClickListener)1 JsonHttpResponseHandler (com.loopj.android.http.JsonHttpResponseHandler)1 DownloadAdapter (com.zhan_dui.adapters.DownloadAdapter)1 RecommendAdapter (com.zhan_dui.adapters.RecommendAdapter)1 AnimeTasteDB (com.zhan_dui.data.AnimeTasteDB)1 M3U8Mission (com.zhan_dui.download.alfred.missions.M3U8Mission)1 Mission (com.zhan_dui.download.alfred.missions.Mission)1