Esempio n. 1
0
 public LazyAdapter(Activity a, String[] d) {
   activity = a;
   data = d;
   inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   imageLoader =
       new ImageLoader(activity.getApplicationContext(), R.drawable.stub, true, true, 70, 70);
   imageLoader.setMemoryCacheEnabled(true);
   // imageLoader.setTimeToCleanUnusedFiles(60000);
   imageLoader.setTimeToCheckChanges(60);
   imageLoader.setOriginalImageDensity(0); // don't care about densities
 }
Esempio n. 2
0
  public void setUser(ArrayList<MimicData> playdata) {
    this.mimicdatas = playdata;
    final MimicData x = mimicdatas.get(0);
    String na = x.geturl();
    ImageView dp = (ImageView) findViewById(R.id.commentpagedisplaypic);
    imageloader.DisplayImage(na, dp);
    TextView user = (TextView) findViewById(R.id.commentpageusername);
    user.setText(x.getUsername());
    TextView description = (TextView) findViewById(R.id.commentpagedescription);
    description.setText(x.getsharecount());
    TextView like = (TextView) findViewById(R.id.commentpagelikecount);
    like.setText(x.getlikecounter());
    TextView commentcount = (TextView) findViewById(R.id.commentpagereplycount);
    commentcount.setText(x.getcommentcounter());
    final ImageButton s = (ImageButton) findViewById(R.id.commentpagelike);

    final boolean w = x.getLikes();
    if (w == true) {
      s.setImageResource(R.drawable.liked);
    } else {
      s.setImageResource(R.drawable.like);
    }

    s.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            final liking likes = new liking();
            final dislike dislike = new dislike();
            if (w == true) {
              s.setImageResource(R.drawable.like);
              String m = Integer.toString(postid);
              dislike.execute(m);
            } else {
              s.setImageResource(R.drawable.liked);
              String m = Integer.toString(postid);
              likes.execute(m);
            }
          }
        });
    playpostbutton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            String url = x.getposturl();

            if (player.isPlaying()) {
              playpostbutton.setImageResource(R.drawable.playbutton);
              player.stop();
              startPlaying(url);
            } else {
              playpostbutton.setImageResource(R.drawable.playbutton);
              startPlaying(url);
            }
          }
        });
  }
Esempio n. 3
0
  public View getView(int position, View convertView, ViewGroup parent) {
    View vi = convertView;
    if (convertView == null) vi = inflater.inflate(R.layout.item, null);

    TextView text = (TextView) vi.findViewById(R.id.text);
    ;
    ImageView image = (ImageView) vi.findViewById(R.id.image);
    text.setText("item " + position);
    imageLoader.displayImage(data[position], image, activity.getApplicationContext());
    return vi;
  }