Android Open Source - EnklawaPlayer Storage Manager

From Project

Back to project page EnklawaPlayer.


The source code is released under:

GNU General Public License

If you think the Android project EnklawaPlayer 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 macbury.pod.managers;
/*from www.  ja va 2 s.  c  o  m*/
import android.content.Context;
import android.os.Environment;
import android.util.Log;


import macbury.pod.R;
import macbury.pod.db.models.Episode;
import macbury.pod.db.models.EpisodeFile;

 * Created by macbury on 23.09.14.
public class StorageManager {
  private static final String TAG            = "StorageManager";
  private final Context context;
  private final String downloadPrefix;

  public StorageManager(Context context) {
    this.context = context;
    this.downloadPrefix = context.getString(R.string.download_prefix);
    Log.i(TAG, "Storage dir is: " + getPodcastStorageDirectory().getAbsolutePath());


  public File getPodcastStorageDirectory() {
    File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PODCASTS), downloadPrefix);
    return file;

  public File getEpisodeFile(EpisodeFile epf) {
    return new File(getPodcastStorageDirectory(), "episode_"".mp3");

  public Uri getEpisodeUri(Episode episode) {
    if (episode.getFile() != null) {
      File episodeFile = getEpisodeFile(episode.getFile());
      if (episodeFile.exists()) {
        return Uri.fromFile(episodeFile);
    return Uri.parse(episode.mp3);

Java Source Code List