FileDocCategorySizeDatePackage
RemoteInputCompatJellybean.javaAPI DocAndroid 5.1 API4458Thu Mar 12 22:22:56 GMT 2015android.support.v4.app

RemoteInputCompatJellybean

public class RemoteInputCompatJellybean extends Object

Fields Summary
public static final String
RESULTS_CLIP_LABEL
Label used to denote the clip data type used for remote input transport
public static final String
EXTRA_RESULTS_DATA
Extra added to a clip data intent object to hold the results bundle.
private static final String
KEY_RESULT_KEY
private static final String
KEY_LABEL
private static final String
KEY_CHOICES
private static final String
KEY_ALLOW_FREE_FORM_INPUT
private static final String
KEY_EXTRAS
Constructors Summary
Methods Summary
static voidaddResultsToIntent(RemoteInputCompatBase.RemoteInput[] remoteInputs, android.content.Intent intent, android.os.Bundle results)

        Bundle resultsBundle = new Bundle();
        for (RemoteInputCompatBase.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(EXTRA_RESULTS_DATA, resultsBundle);
        intent.setClipData(ClipData.newIntent(RESULTS_CLIP_LABEL, clipIntent));
    
static RemoteInputCompatBase.RemoteInputfromBundle(android.os.Bundle data, RemoteInputCompatBase.RemoteInput.Factory factory)


       
              
        return factory.build(data.getString(KEY_RESULT_KEY),
                data.getCharSequence(KEY_LABEL),
                data.getCharSequenceArray(KEY_CHOICES),
                data.getBoolean(KEY_ALLOW_FREE_FORM_INPUT),
                data.getBundle(KEY_EXTRAS));
    
static RemoteInputCompatBase.RemoteInput[]fromBundleArray(android.os.Bundle[] bundles, RemoteInputCompatBase.RemoteInput.Factory factory)

        if (bundles == null) {
            return null;
        }
        RemoteInputCompatBase.RemoteInput[] remoteInputs = factory.newArray(bundles.length);
        for (int i = 0; i < bundles.length; i++) {
            remoteInputs[i] = fromBundle(bundles[i], factory);
        }
        return remoteInputs;
    
static android.os.BundlegetResultsFromIntent(android.content.Intent intent)

        ClipData clipData = intent.getClipData();
        if (clipData == null) {
            return null;
        }
        ClipDescription clipDescription = clipData.getDescription();
        if (!clipDescription.hasMimeType(ClipDescription.MIMETYPE_TEXT_INTENT)) {
            return null;
        }
        if (clipDescription.getLabel().equals(RESULTS_CLIP_LABEL)) {
            return clipData.getItemAt(0).getIntent().getExtras().getParcelable(EXTRA_RESULTS_DATA);
        }
        return null;
    
static android.os.BundletoBundle(RemoteInputCompatBase.RemoteInput remoteInput)

        Bundle data = new Bundle();
        data.putString(KEY_RESULT_KEY, remoteInput.getResultKey());
        data.putCharSequence(KEY_LABEL, remoteInput.getLabel());
        data.putCharSequenceArray(KEY_CHOICES, remoteInput.getChoices());
        data.putBoolean(KEY_ALLOW_FREE_FORM_INPUT, remoteInput.getAllowFreeFormInput());
        data.putBundle(KEY_EXTRAS, remoteInput.getExtras());
        return data;
    
static android.os.Bundle[]toBundleArray(RemoteInputCompatBase.RemoteInput[] remoteInputs)

        if (remoteInputs == null) {
            return null;
        }
        Bundle[] bundles = new Bundle[remoteInputs.length];
        for (int i = 0; i < remoteInputs.length; i++) {
            bundles[i] = toBundle(remoteInputs[i]);
        }
        return bundles;