Android Open Source - youku_api_android_framework Movie Detail Adapter






From Project

Back to project page youku_api_android_framework.

License

The source code is released under:

Apache License

If you think the Android project youku_api_android_framework 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

package com.android.intro.movieslist.adpater;
//from   ww  w .j av a2  s  .c o  m
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.VideoView;

import com.android.intro.custorm.imageview.NetworkedCacheableImageView;
import com.android.intro.moiveslist.R;
import com.android.intro.moiveslist.YoukuVideoView;
import com.aphidmobile.flip.FlipViewController;
import com.aphidmobile.utils.AphidLog;
import com.aphidmobile.utils.UI;
import android.support.v4.app.FragmentManager;

public class MovieDetailAdapter extends BaseAdapter {

  private FlipViewController controller;

  private Context context;

  private LayoutInflater inflater;

  private ArrayList<HashMap<String, String>> movices;
  
  private Integer intent_position;


  public MovieDetailAdapter(Context context, FlipViewController controller, ArrayList<HashMap<String, String>> movices) {
    inflater = LayoutInflater.from(context);
    this.context = context;
    this.controller = controller;
    this.movices = movices;
  }
  
  public void appendToDataSet(ArrayList<HashMap<String, String>> ms){
    movices.addAll(ms);
  }

  @Override
  public int getCount() {
    return null != movices ? movices.size() : 0;
  }

  @Override
  public Object getItem(int position) {
    return position;
  }

  @Override
  public long getItemId(int position) {
    return position;
  }

  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {

    ViewHolder holder;
    if (convertView == null) {
      convertView = inflater.inflate(R.layout.detail, null);

      holder = new ViewHolder();
      holder.titleTextView = (TextView) convertView.findViewById(R.id.title);
      holder.title_bottomTextView = (TextView) convertView.findViewById(R.id.title_bottom);
      holder.photoView = (NetworkedCacheableImageView) convertView.findViewById(R.id.photo);
      holder.photoView.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
            Intent intent = new Intent(v.getContext(),YoukuVideoView.class);
            HashMap m= movices.get(position);
          intent.putExtra("vid", m.get("_id").toString());
          context.startActivity(intent);
          }
      });
      
      convertView.setTag(holder);
      
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    // get data by index position
    HashMap<String, String> data = movices.get(position);

    // set view by data
    holder.titleTextView.setText(String.format("%d. %s", position + 1,
        data.get("title")));
    holder.titleTextView.setBackgroundColor(context.getResources()
        .getColor(R.color.green));
    
    holder.title_bottomTextView.setText(String.format("%s",
        data.get("subtitle")));
    holder.title_bottomTextView.setBackgroundColor(context.getResources()
        .getColor(R.color.red));
    
    final boolean fromCache = holder.photoView.loadImage(data.get("thumb"), false, null);

    return convertView;
  }
  
  
  static class ViewHolder {
    TextView titleTextView;
    TextView title_bottomTextView;
    NetworkedCacheableImageView photoView;
  }

}




Java Source Code List

com.android.intro.custorm.imageview.NetworkedCacheableImageView.java
com.android.intro.custorm.imageview.SDK11.java
com.android.intro.custorm.imageview.SampleApplication.java
com.android.intro.moiveslist.MainActivity.java
com.android.intro.moiveslist.MoiveChannelFragment.java
com.android.intro.moiveslist.MoiveDetailAvctivity.java
com.android.intro.moiveslist.MovieHome.java
com.android.intro.moiveslist.SearchActivity.java
com.android.intro.moiveslist.SplashActivity.java
com.android.intro.moiveslist.YoukuVideoView.java
com.android.intro.moiveslist.models.BaseModel.java
com.android.intro.moiveslist.models.HttpCallBackHandler.java
com.android.intro.moiveslist.models.MoiveModel.java
com.android.intro.moiveslist.models.PlayModel.java
com.android.intro.moiveslist.models.SearchSuggestModel.java
com.android.intro.moviceslist.base.BaseActivity.java
com.android.intro.moviceslist.base.MenuFragment.java
com.android.intro.movieslist.adpater.MovieAdapter.java
com.android.intro.movieslist.adpater.MovieDetailAdapter.java
com.makeramen.RoundedDrawable.java
com.makeramen.RoundedImageView.java
uk.co.senab.bitmapcache.BitmapLruCache.java
uk.co.senab.bitmapcache.BitmapMemoryLruCache.java
uk.co.senab.bitmapcache.CacheableBitmapDrawable.java
uk.co.senab.bitmapcache.CacheableImageView.java
uk.co.senab.bitmapcache.Constants.java
uk.co.senab.bitmapcache.IoUtils.java
uk.co.senab.bitmapcache.Md5.java
uk.co.senab.bitmapcache.SDK11.java
uk.co.senab.bitmapcache.WeakReferenceRunnable.java