Android Open Source - bbcplayer Util






From Project

Back to project page bbcplayer.

License

The source code is released under:

GNU General Public License

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

/*
 * Util methods//  w w w.j a  v  a 2s.c  o  m
 */

package com.rmgoncalo.bbcplayer;

import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import android.annotation.SuppressLint;
import android.util.Log;

public class Util {

  private final static String rtJson = 
      "http://api.rottentomatoes.com/api/public/v1.0/movies.json?"
      + "apikey=qrbt5gajqa75qutk6mftdjvk&q=";
  private final static String logtag = "Util";
  
  public void sortList(List<Entry> entries) {
    Collections.sort(entries, new TitlesComparator());
  }

  public class TitlesComparator implements Comparator<Entry> {

    @Override
    public int compare(Entry a, Entry b) {
      return a.getTitle().compareTo(b.getTitle());
    }
  }

  public static void CopyStream(InputStream is, OutputStream os) {
    final int buffer_size = 1024;
    try {
      byte[] bytes = new byte[buffer_size];
      for (;;) {
        int count = is.read(bytes, 0, buffer_size);
        if (count == -1)
          break;
        os.write(bytes, 0, count);
      }
    } catch (Exception ex) {
    }
  }
  
  public static String formatURLString(String title){
    
    String newTitle = title.toLowerCase().replaceAll("\\s","");
    Log.d(logtag, "title: " + newTitle);
    
    return new StringBuilder(rtJson).append(newTitle).toString();
  }
  
}




Java Source Code List

com.rmgoncalo.bbcplayer.EntryArrayAdapter.java
com.rmgoncalo.bbcplayer.Entry.java
com.rmgoncalo.bbcplayer.FileCache.java
com.rmgoncalo.bbcplayer.ImageLoader.java
com.rmgoncalo.bbcplayer.JsonParser.java
com.rmgoncalo.bbcplayer.MainActivity.java
com.rmgoncalo.bbcplayer.MemoryCache.java
com.rmgoncalo.bbcplayer.Util.java
com.rmgoncalo.bbcplayer.XmlParser.java