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


Java Intent.setClipData方法代码示例

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


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

示例1: setPhotosResult

import android.content.Intent; //导入方法依赖的package包/类
public void setPhotosResult() {
    final AlbumItem[] selected_items = SelectorModeManager
            .createAlbumItemArray(recyclerViewAdapter.cancelSelectorMode(this));

    Intent intent = new Intent("us.koller.RESULT_ACTION");
    if (allowMultiple) {
        ClipData clipData = createClipData(selected_items);
        intent.setClipData(clipData);
    } else {
        intent.setData(selected_items[0].getUri(this));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    setResult(RESULT_OK, intent);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        finishAfterTransition();
    } else {
        finish();
    }
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:20,代码来源:AlbumActivity.java

示例2: onFinished

import android.content.Intent; //导入方法依赖的package包/类
private void onFinished(Uri... uris) {
    Log.d(TAG, "onFinished() " + Arrays.toString(uris));
    final Intent intent = new Intent();
    if (uris.length == 1) {
        intent.setData(uris[0]);
    } else if (uris.length > 1) {
        final ClipData clipData = new ClipData(
                null, mState.acceptMimes, new ClipData.Item(uris[0]));
        for (int i = 1; i < uris.length; i++) {
            clipData.addItem(new ClipData.Item(uris[i]));
        }
        if(Utils.hasJellyBean()){
            intent.setClipData(clipData);
        }
        else{
            intent.setData(uris[0]);
        }
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION
            | Intent.FLAG_GRANT_WRITE_URI_PERMISSION
            | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
    setResult(Activity.RESULT_OK, intent);
    finish();
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:25,代码来源:StandaloneActivity.java

示例3: prepare

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Prepare the intent.
 * @param context
 *  the context
 * @return
 *  the intent.
 */
protected Intent prepare(Context context) {
    Intent intent = replacedIntent != null ? replacedIntent : getIntent();
    intent = intent == null ? new Intent() : intent;
    if(callback != null) {
        callback.prepare(intent);
    }
    if(flags != 0) {
        intent.addFlags(flags);
    }
    if(!TextUtils.isEmpty(mimeType)) {
        intent.setType(mimeType);
    }
    if(clipData != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        intent.setClipData(clipData);
    }
    return intent;
}
 
开发者ID:foreveruseful,项目名称:smartkey,代码行数:25,代码来源:Target.java

示例4: onFinished

import android.content.Intent; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void onFinished(Uri... uris) {
    Log.d(TAG, "onFinished() " + Arrays.toString(uris));

    final Intent intent = new Intent();
    if (uris.length == 1) {
        intent.setData(uris[0]);
    } else if (uris.length > 1) {
        final ClipData clipData = new ClipData(
                null, mState.acceptMimes, new ClipData.Item(uris[0]));
        for (int i = 1; i < uris.length; i++) {
            clipData.addItem(new ClipData.Item(uris[i]));
        }
        if(Utils.hasJellyBean()){
            intent.setClipData(clipData);	
        }
        else{
        	intent.setData(uris[0]);
        }
    }

    if (mState.action == DocumentsActivity.State.ACTION_GET_CONTENT) {
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    } else if (mState.action == ACTION_OPEN_TREE) {
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION
                | Intent.FLAG_GRANT_WRITE_URI_PERMISSION
                | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
                | Intent.FLAG_GRANT_PREFIX_URI_PERMISSION);
    } else {
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION
                | Intent.FLAG_GRANT_WRITE_URI_PERMISSION
                | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
    }

    setResult(Activity.RESULT_OK, intent);
    finish();
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:38,代码来源:DocumentsActivity.java

示例5: getShareIntent

import android.content.Intent; //导入方法依赖的package包/类
@VisibleForTesting
public static Intent getShareIntent(Activity activity, String title, String text, String url,
        Uri offlineUri, Uri screenshotUri) {
    if (!TextUtils.isEmpty(url)) {
        url = DomDistillerUrlUtils.getOriginalUrlFromDistillerUrl(url);
        if (!TextUtils.isEmpty(text)) {
            // Concatenate text and URL with a space.
            text = text + " " + url;
        } else {
            text = url;
        }
    }

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.addFlags(ApiCompatibilityUtils.getActivityNewDocumentFlag());
    intent.putExtra(Intent.EXTRA_SUBJECT, title);
    intent.putExtra(Intent.EXTRA_TEXT, text);
    intent.putExtra(EXTRA_TASK_ID, activity.getTaskId());

    if (screenshotUri != null) {
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    }
    if (screenshotUri != null) {
        // To give read access to an Intent target, we need to put |screenshotUri| in clipData
        // because adding Intent.FLAG_GRANT_READ_URI_PERMISSION doesn't work for
        // EXTRA_SHARE_SCREENSHOT_AS_STREAM.
        intent.setClipData(ClipData.newRawUri("", screenshotUri));
        intent.putExtra(EXTRA_SHARE_SCREENSHOT_AS_STREAM, screenshotUri);
    }
    if (offlineUri == null) {
        intent.setType("text/plain");
    } else {
        intent.setType("multipart/related");
        intent.putExtra(Intent.EXTRA_STREAM, offlineUri);
    }
    return intent;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:38,代码来源:ShareHelper.java

示例6: addResultsToIntent

import android.content.Intent; //导入方法依赖的package包/类
static void addResultsToIntent(RemoteInput[] remoteInputs, Intent intent, Bundle results) {
    Bundle resultsBundle = new Bundle();
    for (RemoteInput remoteInput : remoteInputs) {
        Object result = results.get(remoteInput.getResultKey());
        if (result instanceof CharSequence) {
            resultsBundle.putCharSequence(remoteInput.getResultKey(), (CharSequence) result);
        }
    }
    Intent clipIntent = new Intent();
    clipIntent.putExtra("android.remoteinput.resultsData", resultsBundle);
    intent.setClipData(ClipData.newIntent("android.remoteinput.results", clipIntent));
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:RemoteInputCompatJellybean.java


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