Android Open Source - TrackEveryPenny Android Device Public Storage Gateway Impl






From Project

Back to project page TrackEveryPenny.

License

The source code is released under:

Apache License

If you think the Android project TrackEveryPenny 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 ca.jbrains.upfp.model.android;
/*from  w  w  w.  j  a v  a 2s  . c  o  m*/
import android.os.Environment;
import ca.jbrains.upfp.controller.android.*;

import java.io.File;

public class AndroidDevicePublicStorageGatewayImpl
    implements AndroidDevicePublicStorageGateway {
  public String getExternalStorageState() {
    return Environment.getExternalStorageState();
  }

  public File getExternalStoragePublicDirectory() {
    return Environment.getExternalStoragePublicDirectory(
        Environment.DIRECTORY_DOWNLOADS);
  }

  @Override
  public File findPublicExternalStorageDirectory()
      throws PublicStorageMediaNotAvailableException,
             PublicStorageMediaNotWritableException {
    if (Environment.MEDIA_MOUNTED.equals(
        getExternalStorageState()))
      return getExternalStoragePublicDirectory();

    if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(
        getExternalStorageState()))
      throw new PublicStorageMediaNotWritableException(
          getExternalStoragePublicDirectory());

    throw new PublicStorageMediaNotAvailableException();
  }
}




Java Source Code List

ca.jbrains.toolkit.ProgrammerMistake.java
ca.jbrains.upfp.BrowseTransactionsActivity.java
ca.jbrains.upfp.Conveniences.java
ca.jbrains.upfp.controller.android.AndroidDevicePublicStorageGateway.java
ca.jbrains.upfp.controller.android.PublicStorageMediaNotAvailableException.java
ca.jbrains.upfp.controller.android.PublicStorageMediaNotWritableException.java
ca.jbrains.upfp.model.Amount.java
ca.jbrains.upfp.model.BrowseTransactionsModel.java
ca.jbrains.upfp.model.Category.java
ca.jbrains.upfp.model.InternalStorageException.java
ca.jbrains.upfp.model.Transaction.java
ca.jbrains.upfp.model.android.AndroidDevicePublicStorageGatewayImpl.java
ca.jbrains.upfp.presenter.BrowseTransactionsPresenter.java
ca.jbrains.upfp.presenter.ExportAllTransactionsAction.java
ca.jbrains.upfp.presenter.ExportAllTransactionsAsCsvToFileAction.java
ca.jbrains.upfp.presenter.RendersView.java
ca.jbrains.upfp.presenter.WriteTextAction.java
ca.jbrains.upfp.view.AmountCsvFormat.java
ca.jbrains.upfp.view.BrowseTransactionsView.java
ca.jbrains.upfp.view.CategoryCsvFormat.java
ca.jbrains.upfp.view.CsvFormat.java
ca.jbrains.upfp.view.CsvHeaderFormat.java
ca.jbrains.upfp.view.DateCsvFormat.java
ca.jbrains.upfp.view.SurroundWithQuotes.java
ca.jbrains.upfp.view.TransactionCsvFormat.java
ca.jbrains.upfp.view.TransactionsCsvFileFormat.java
ca.jbrains.upfp.view.TransactionsCsvHeader.java
ca.jbrains.upfp.view.WriteTextToFileAction.java
ca.jbrains.upfp.view.android.AndroidBrowseTransactionsView.java