当前位置: 首页>>代码示例>>Java>>正文


Java Environment.DIRECTORY_PICTURES属性代码示例

本文整理汇总了Java中android.os.Environment.DIRECTORY_PICTURES属性的典型用法代码示例。如果您正苦于以下问题:Java Environment.DIRECTORY_PICTURES属性的具体用法?Java Environment.DIRECTORY_PICTURES怎么用?Java Environment.DIRECTORY_PICTURES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.os.Environment的用法示例。


在下文中一共展示了Environment.DIRECTORY_PICTURES属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveAllSelectedStatus

private void saveAllSelectedStatus(ArrayList<String> statuses){
    String fileType = Environment.DIRECTORY_PICTURES;
    for(String status : statuses){
        if(status.endsWith(".jpg")){
            fileType = "Pictures";
        }else if(status.endsWith(".gif")){
            fileType ="Gifs";
        }else if(status.endsWith(".mp4")){
            fileType="Videos";
        }
        String [] splitStatus = status.split("/");
        String destinationFilename = android.os.Environment.getExternalStorageDirectory().getAbsolutePath()
                +"/WhatsAppSaver"+File.separatorChar+splitStatus[splitStatus.length-1];
        try {
            copyFile(new File(status),new File(destinationFilename));
            Intent intent = new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE");
            intent.setData(Uri.fromFile(new File(destinationFilename)));
            sendBroadcast(intent);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:Lekky71,项目名称:WhatsAppStatusSaver,代码行数:23,代码来源:StatusSavingService.java

示例2: getOutputMediaFile

private File getOutputMediaFile(int type) {
    // Get environment directory type id from requested media type.
    String environmentDirectoryType;
    if (type == MEDIA_TYPE_IMAGE) {
        environmentDirectoryType = Environment.DIRECTORY_PICTURES;
    } else if (type == MEDIA_TYPE_VIDEO) {
        environmentDirectoryType = Environment.DIRECTORY_MOVIES;
    } else {
        Log.e(TAG, "Unsupported media type:" + type);
        return null;
    }

    return getOutputFile(
            type,
            Environment.getExternalStoragePublicDirectory(environmentDirectoryType)
    );
}
 
开发者ID:jonathan68,项目名称:react-native-camera,代码行数:17,代码来源:RCTCameraModule.java

示例3: createImageFile

private File createImageFile() throws IOException {
    // Create an image file name
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    String imageFileName = (isVideo ? "MPEG_" : "JPEG_") + timeStamp + "_";
    String dirType = isVideo ? Environment.DIRECTORY_MOVIES : Environment.DIRECTORY_PICTURES;
    File storageDir = isPublic ? getExternalStoragePublicDirectory(dirType) :
                                 getExternalFilesDir(dirType);
    if( !storageDir.exists() ) {
        storageDir.mkdirs();
    }
    File image = File.createTempFile(
            imageFileName,
            isVideo ? ".mp4" : ".jpg",
            storageDir
    );

    return image;
}
 
开发者ID:richardszabo,项目名称:androidCameraTest,代码行数:18,代码来源:PhotoIntentTest.java

示例4: getOutputMediaFile

private File getOutputMediaFile(String fileName) {
    // Get environment directory type id from requested media type.
    String environmentDirectoryType;
    environmentDirectoryType = Environment.DIRECTORY_PICTURES;

    return getOutputFile(
            fileName + ".jpeg",
            Environment.getExternalStoragePublicDirectory(environmentDirectoryType)
    );
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:10,代码来源:WebRTCModule.java

示例5: openFilePickerDialog

/**
 * Open a file picker dialog to ease select a new image from external storage.
 */
public void openFilePickerDialog() {
    DialogProperties properties = new DialogProperties();

    properties.selection_mode = DialogConfigs.SINGLE_MODE;
    properties.selection_type = DialogConfigs.FILE_SELECT;
    // initial directory should be pictures directory
    properties.offset = new File("/mnt/sdcard" + File.separator + Environment.DIRECTORY_PICTURES);
    // show accepted image format only
    properties.extensions = new String[]{"jpg","jpeg","png","gif","bmp","webp"};

    FilePickerDialog dialog = new FilePickerDialog(getActivity(), properties);
    dialog.setTitle(R.string.dialog_edit_doc_cover_image_select_title);
    dialog.setPositiveBtnName(getString(R.string.dialog_edit_doc_cover_image_select_ok));
    dialog.setNegativeBtnName(getString(android.R.string.cancel));

    dialog.setDialogSelectionListener(new DialogSelectionListener() {
        @Override
        public void onSelectedFilePaths(String[] files) {
            if (files.length > 0) {
                mImagePath = files[0];
                updateImage();
            }
        }
    });

    dialog.show();

    // There is a problem with library dialog theme, it does not support a light
    // primary color because header text color is always white.
    // With this hack (we had to study library layout) it ensures that header background
    // is ok.
    dialog.findViewById(R.id.header).setBackgroundColor(
            ContextCompat.getColor(getActivity(), R.color.colorAccent));
}
 
开发者ID:nfdz,项目名称:foco,代码行数:37,代码来源:EditDocCoverDialog.java

示例6: getDirectoryPath

private String getDirectoryPath() {
    if (directoryPath == null || directoryPath.isEmpty()) {
        return Environment.DIRECTORY_PICTURES;
    } else {
        return directoryPath;
    }
}
 
开发者ID:Muddz,项目名称:Viewshot,代码行数:7,代码来源:Viewshot.java

示例7: getImageDir

public static File getImageDir() throws NoExternalStorageException {
  return new File(getSignalStorageDir(), Environment.DIRECTORY_PICTURES);
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:3,代码来源:StorageUtil.java


注:本文中的android.os.Environment.DIRECTORY_PICTURES属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。