示例#1
0
 /* Check permissions and start image picker */
 private void selectFromImagePicker() {
   // request read permissions
   PermissionHelper permissionHelper = new PermissionHelper(mActivity, mRootView);
   if (permissionHelper.requestReadExternalStorage(
       TransistorKeys.PERMISSION_REQUEST_IMAGE_PICKER_READ_EXTERNAL_STORAGE)) {
     // get system picker for images
     Intent pickImageIntent =
         new Intent(
             Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
     startActivityForResult(pickImageIntent, TransistorKeys.REQUEST_LOAD_IMAGE);
   }
 }
示例#2
0
  /* Handles tap on streaming link */
  private void handleStreamingLink(Intent intent) {
    mNewStationUri = intent.getData();

    // clear the intent
    intent.setAction("");

    // check for null and type "http"
    if (mNewStationUri != null && mNewStationUri.getScheme().startsWith("http")) {
      // download and add new station
      fetchNewStation(mNewStationUri);
    } else if (mNewStationUri != null && mNewStationUri.getScheme().startsWith("file")) {
      // check for read permission
      PermissionHelper permissionHelper = new PermissionHelper(mActivity, mRootView);
      if (permissionHelper.requestReadExternalStorage(
          TransistorKeys.PERMISSION_REQUEST_STATION_FETCHER_READ_EXTERNAL_STORAGE)) {
        // read and add new station
        fetchNewStation(mNewStationUri);
      }
    }
    // unsuccessful - log failure
    else {
      LogHelper.v(LOG_TAG, "Received an empty intent");
    }
  }