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


Java SafRequestActivity类代码示例

本文整理汇总了Java中com.kanedias.vanilla.plugins.saf.SafRequestActivity的典型用法代码示例。如果您正苦于以下问题:Java SafRequestActivity类的具体用法?Java SafRequestActivity怎么用?Java SafRequestActivity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: writeFile

import com.kanedias.vanilla.plugins.saf.SafRequestActivity; //导入依赖的package包/类
/**
 * Writes file to backing filesystem provider, this may be either SAF-managed sdcard or internal storage.
 */
public void writeFile() {
    if (SafUtils.isSafNeeded(mAudioFile.getFile(), this)) {
        if (mPrefs.contains(PREF_SDCARD_URI)) {
            // we already got the permission!
            persistThroughSaf(null);
            return;
        }

        // request SAF permissions in SAF activity
        Intent safIntent = new Intent(this, SafRequestActivity.class);
        safIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        safIntent.putExtra(PluginConstants.EXTRA_PARAM_PLUGIN_APP, getApplicationInfo());
        safIntent.putExtras(mLaunchIntent);
        startActivity(safIntent);
        // it will pass us URI back after the work is done
    } else {
        persistThroughFile();
    }
}
 
开发者ID:vanilla-music,项目名称:vanilla-music-tag-editor,代码行数:23,代码来源:PluginService.java

示例2: persistAsFolderJpg

import com.kanedias.vanilla.plugins.saf.SafRequestActivity; //导入依赖的package包/类
/**
 * Click listener for handling writing tag as folder.jpg
 */
public void persistAsFolderJpg() {
    Uri fileUri = getIntent().getParcelableExtra(EXTRA_PARAM_URI);
    if (fileUri == null) {
        // wrong intent passed?
        return;
    }

    File mediaFile = new File(fileUri.getPath());
    if (!mediaFile.exists()) {
        // file deleted while launching intent or player db is not refreshed
        return;
    }

    // image must be present because this button enables only after it's downloaded
    Bitmap bitmap = ((BitmapDrawable) mCoverImage.getDrawable()).getBitmap();
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 90, stream);
    byte[] imgData = stream.toByteArray();

    File folderTarget = new File(mediaFile.getParent(), "folder.jpg");
    if (isSafNeeded(mediaFile)) {
        if (mPrefs.contains(PREF_SDCARD_URI)) {
            // we already got the permission!
            writeThroughSaf(imgData, mediaFile, folderTarget.getName());
            return;
        }

        // request SAF permissions in SAF activity
        Intent safIntent = new Intent(CoverShowActivity.this, SafRequestActivity.class);
        safIntent.putExtra(PluginConstants.EXTRA_PARAM_PLUGIN_APP, getApplicationInfo());
        safIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        safIntent.putExtras(getIntent());
        startActivity(safIntent);
        // it will pass us URI back after the work is done
    } else {
        writeThroughFile(imgData, mediaFile, folderTarget);
    }
}
 
开发者ID:vanilla-music,项目名称:vanilla-music-cover-fetch,代码行数:42,代码来源:CoverShowActivity.java

示例3: persistAsLrcFile

import com.kanedias.vanilla.plugins.saf.SafRequestActivity; //导入依赖的package包/类
/**
 * Write lyrics as a *.lrc file - selects SAF/File routine based on target access.
 * Resulting file should be placed in the same directory as media file but with *.lrc extension instead.
 */
private void persistAsLrcFile() {
    Uri fileUri = getIntent().getParcelableExtra(EXTRA_PARAM_URI);
    if (fileUri == null) {
        // wrong intent passed?
        return;
    }

    File mediaFile = new File(fileUri.getPath());
    if (!mediaFile.exists()) {
        // file deleted while launching intent or player db is not refreshed
        return;
    }

    String lrcFilename = lyricsForFile(mediaFile);
    File lrcTarget = new File(mediaFile.getParent(), lrcFilename);
    byte[] data = mLyricsText.getText().toString().getBytes(Charset.forName("UTF-8"));
    if (isSafNeeded(mediaFile, this)) {
        if (mPrefs.contains(PREF_SDCARD_URI)) {
            // we already got the permission!
            writeThroughSaf(data, mediaFile, lrcTarget.getName());
            return;
        }

        // request SAF permissions in SAF activity
        Intent safIntent = new Intent(this, SafRequestActivity.class);
        safIntent.putExtra(PluginConstants.EXTRA_PARAM_PLUGIN_APP, getApplicationInfo());
        safIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        safIntent.putExtras(getIntent());
        startActivity(safIntent);
        // it will pass us URI back after the work is done
    } else {
        writeThroughFile(data, mediaFile, lrcTarget);
    }
}
 
开发者ID:vanilla-music,项目名称:vanilla-music-lyrics-search,代码行数:39,代码来源:LyricsShowActivity.java


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