Java Code Examples for android.os.bundle#putStringArray()

The following examples show how to use android.os.bundle#putStringArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EUExWindow.java    From appcan-android with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void setSelectedPopOverInMultiWindow(String[] parm) {
    if (isFirstParamExistAndIsJson(parm)){
        WindowJsonWrapper.setSelectedPopOverInMultiWindow(this,
                DataHelper.gson.fromJson(parm[0], WindowSetMultiPopoverSelectedVO.class));
    }

    if (parm == null || parm.length < 2) {
        errorCallback(0, EUExCallback.F_E_UEXWINDOW_EVAL, "Illegal parameter");
        return;
    }
    Message msg = new Message();
    msg.obj = this;
    msg.what = MSG_FUNCTION_SETSELECTEDPOPOVERINMULTIWINDOW;
    Bundle bd = new Bundle();
    bd.putStringArray(TAG_BUNDLE_PARAM, parm);
    msg.setData(bd);
    mHandler.sendMessage(msg);
}
 
Example 2
Source File: RecordsActivity.java    From android-auto-call-recorder with MIT License 6 votes vote down vote up
@Override
public void onSearchTextChanged(String oldQuery, String newQuery) {
    Log.d(TAG, "oldQuery = " + oldQuery + " | newQuery = " + newQuery);

    String contactIDsArguments = mSQLiteHelper
            .convertArrayToInOperatorArguments(mContactHelper
                    .getContactIDsByName(mContactHelper
                            .getContactCursorByName(newQuery)));

    String selection = RecordDbContract.RecordItem.COLUMN_NUMBER
            + " LIKE ?"
            + " OR "
            + RecordDbContract.RecordItem.COLUMN_CONTACT_ID
            + " IN "
            + contactIDsArguments;
    //+ "= 682";
    String[] selectionArgs = new String[]{"%" + newQuery + "%"};

    Bundle args = (Bundle) mArguments.clone();
    args.putString(RecordsActivity.args.selection.name(), selection);
    args.putStringArray(RecordsActivity.args.selectionArguments.name(), selectionArgs);

    refreshCursorLoader(args);
}
 
Example 3
Source File: FileBrowserWithCustomHandler.java    From Android-FileBrowser-FilePicker with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mContext = this;

    // Get File Storage Permission
    Intent in = new Intent(this, Permissions.class);
    Bundle bundle = new Bundle();
    bundle.putStringArray(Constants.APP_PREMISSION_KEY, Constants.APP_PREMISSIONS);
    in.putExtras(bundle);
    startActivityForResult(in, APP_PERMISSION_REQUEST);

    // Initialize Stuff
    mNavigationHelper = new NavigationHelper(mContext);
    mNavigationHelper.setmChangeDirectoryListener(this);
    io = new FileIO(mNavigationHelper, new Handler(Looper.getMainLooper()), mContext);
    op = Operations.getInstance(mContext);

    //set file filter (i.e display files with the given extension)
    String filterFilesWithExtension = getIntent().getStringExtra(Constants.ALLOWED_FILE_EXTENSIONS);
    if(filterFilesWithExtension != null && !filterFilesWithExtension.isEmpty()) {
        Set<String> allowedFileExtensions = new HashSet<String>(Arrays.asList(filterFilesWithExtension.split(";")));
        mNavigationHelper.setAllowedFileExtensionFilter(allowedFileExtensions);
    }

    mFileList = mNavigationHelper.getFilesItemsInCurrentDirectory();
}
 
Example 4
Source File: SearchListener.java    From android-auto-call-recorder with MIT License 5 votes vote down vote up
@Override
public void onSearchTextChanged(String oldQuery, String newQuery) {
    Log.d(TAG, "oldQuery = " + oldQuery + " | newQuery = " + newQuery);

    Bundle args = (Bundle) mArguments.clone();

    if (!(newQuery.isEmpty() && oldQuery.length() > newQuery.length() && newQuery.length() == 0)) {
        String contactIDsArguments = mSQLiteHelper
                .convertArrayToInOperatorArguments(mContactHelper
                        .getContactIDsByName(mContactHelper
                                .getContactCursorByName(newQuery)));

        String selection = RecordDbContract.RecordItem.COLUMN_NUMBER
                + " LIKE ?"
                + " OR "
                + RecordDbContract.RecordItem.COLUMN_CONTACT_ID
                + " IN "
                + contactIDsArguments;
        //+ "= 682";
        String[] selectionArgs = new String[]{"%" + newQuery + "%"};


        String mainSelection = args.getString(Config.args.selection.name());

        if (mainSelection != null && mainSelection.length() > 0) {
            selection += " AND " + mainSelection;
        }

        String[] mainSelectionArgs = args.getStringArray(Config.args.selectionArguments.name());

        if (mainSelectionArgs != null && mainSelectionArgs.length > 0) {
            selectionArgs = ArrayUtils.addAll(selectionArgs, mainSelectionArgs);
        }

        args.putString(RecordsActivity.args.selection.name(), selection);
        args.putStringArray(RecordsActivity.args.selectionArguments.name(), selectionArgs);
    }
    mEventBus.post(new OnQueryChangedEvent(args));
}
 
Example 5
Source File: TuSDKEditorBarFragment.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
public static TuSDKEditorBarFragment newInstance(String[] mFilterGroup, String[] mCartoonFilterGroup,boolean hasMonsterFace) {
    TuSDKEditorBarFragment fragment = new TuSDKEditorBarFragment();
    Bundle bundle = new Bundle();
    bundle.putStringArray("FilterGroup", mFilterGroup);
    bundle.putStringArray("CartoonFilterGroup", mCartoonFilterGroup);
    bundle.putBoolean("hasMonsterFace",hasMonsterFace);
    fragment.setArguments(bundle);
    return fragment;
}
 
Example 6
Source File: EUExWindow.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void insertBelow(String[] parm) {
    if (!mBrwView.checkType(EBrwViewEntry.VIEW_TYPE_POP) || parm.length < 1) {
        return;
    }
    Message msg = new Message();
    msg.obj = this;
    msg.what = MSG_FUNCTION_INSERTBELOW;
    Bundle bd = new Bundle();
    bd.putStringArray(TAG_BUNDLE_PARAM, parm);
    msg.setData(bd);
    mHandler.sendMessage(msg);
}
 
Example 7
Source File: ActionSheet.java    From android-ActionSheet with MIT License 5 votes vote down vote up
public Bundle prepareArguments() {
    Bundle bundle = new Bundle();
    bundle.putString(ARG_CANCEL_BUTTON_TITLE, mCancelButtonTitle);
    bundle.putStringArray(ARG_OTHER_BUTTON_TITLES, mOtherButtonTitles);
    bundle.putBoolean(ARG_CANCELABLE_ONTOUCHOUTSIDE,
            mCancelableOnTouchOutside);
    return bundle;
}
 
Example 8
Source File: InAppBillingFragment.java    From wallpaperboard with Apache License 2.0 5 votes vote down vote up
private static InAppBillingFragment newInstance(String key, String[] productId) {
    InAppBillingFragment fragment = new InAppBillingFragment();
    Bundle bundle = new Bundle();
    bundle.putString(Extras.EXTRA_KEY, key);
    bundle.putStringArray(Extras.EXTRA_PRODUCT_ID, productId);
    fragment.setArguments(bundle);
    return fragment;
}
 
Example 9
Source File: EUExWindow.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
@AppCanAPI
public void hidePluginViewContainer(String[] parm) {
    Message msg = mHandler.obtainMessage();
    msg.what = MSG_PLUGINVIEW_CONTAINER_HIDE;
    msg.obj = this;
    Bundle bd = new Bundle();
    bd.putStringArray(TAG_BUNDLE_PARAM, parm);
    msg.setData(bd);
    mHandler.sendMessage(msg);
}
 
Example 10
Source File: CompileDialogFragment.java    From EdXposedManager with GNU General Public License v3.0 5 votes vote down vote up
public static CompileDialogFragment newInstance(ApplicationInfo appInfo,
                                                String msg, String[] commands) {
    Bundle arguments = new Bundle();
    arguments.putParcelable(KEY_APP_INFO, appInfo);
    arguments.putString(KEY_MSG, msg);
    arguments.putStringArray(KEY_COMMANDS, commands);
    CompileDialogFragment fragment = new CompileDialogFragment();
    fragment.setArguments(arguments);
    fragment.setCancelable(false);
    return fragment;
}
 
Example 11
Source File: CollectionFragment.java    From AnkiDroid-Wear with GNU General Public License v2.0 5 votes vote down vote up
public static CollectionFragment newInstance(String[] collectionList) {
    CollectionFragment fragment = new CollectionFragment();
    Bundle args = new Bundle();
    args.putStringArray(ARG_PARAM1, collectionList);
    fragment.setArguments(args);
    return fragment;
}
 
Example 12
Source File: ShareLinkToDialog.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
public static ShareLinkToDialog newInstance(Intent intent, String[] packagesToExclude) {
    ShareLinkToDialog f = new ShareLinkToDialog();
    Bundle args = new Bundle();
    args.putParcelable(ARG_INTENT, intent);
    args.putStringArray(ARG_PACKAGES_TO_EXCLUDE, packagesToExclude);
    f.setArguments(args);
    return f;
}
 
Example 13
Source File: WatchlistLoggingHandler.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Insert network traffic event to watchlist async queue processor.
 */
public void asyncNetworkEvent(String host, String[] ipAddresses, int uid) {
    final Message msg = obtainMessage(LOG_WATCHLIST_EVENT_MSG);
    final Bundle bundle = new Bundle();
    bundle.putString(WatchlistEventKeys.HOST, host);
    bundle.putStringArray(WatchlistEventKeys.IP_ADDRESSES, ipAddresses);
    bundle.putInt(WatchlistEventKeys.UID, uid);
    bundle.putLong(WatchlistEventKeys.TIMESTAMP, System.currentTimeMillis());
    msg.setData(bundle);
    sendMessage(msg);
}
 
Example 14
Source File: ConfirmImportantSitesDialogFragment.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new instance of the important sites dialog fragment.
 * @param importantDomains The list of important domains to display.
 * @param importantDomainReasons The reasons for choosing each important domain.
 * @param faviconURLs The list of favicon urls that correspond to each importantDomains.
 * @return An instance of ConfirmImportantSitesDialogFragment with the bundle arguments set.
 */
public static ConfirmImportantSitesDialogFragment newInstance(
        String[] importantDomains, int[] importantDomainReasons, String[] faviconURLs) {
    ConfirmImportantSitesDialogFragment dialogFragment =
            new ConfirmImportantSitesDialogFragment();
    Bundle bundle = new Bundle();
    bundle.putStringArray(IMPORTANT_DOMAINS_TAG, importantDomains);
    bundle.putIntArray(IMPORTANT_DOMAIN_REASONS_TAG, importantDomainReasons);
    bundle.putStringArray(FAVICON_URLS_TAG, faviconURLs);
    dialogFragment.setArguments(bundle);
    return dialogFragment;
}
 
Example 15
Source File: FileChooser.java    From Android-FileBrowser-FilePicker with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mContext = this;

    // Get File Storage Permission
    Intent in = new Intent(this, Permissions.class);
    Bundle bundle = new Bundle();
    bundle.putStringArray(Constants.APP_PREMISSION_KEY, Constants.APP_PREMISSIONS);
    in.putExtras(bundle);
    startActivityForResult(in, APP_PERMISSION_REQUEST);

    // Initialize Stuff
    mSelectionMode = getIntent().getIntExtra(Constants.SELECTION_MODE, Constants.SELECTION_MODES.SINGLE_SELECTION.ordinal());
    mNavigationHelper = new NavigationHelper(mContext);
    mNavigationHelper.setmChangeDirectoryListener(this);
    io = new FileIO(mNavigationHelper, new Handler(Looper.getMainLooper()), mContext);
    op = Operations.getInstance(mContext);

    //set file filter (i.e display files with the given extension)
    String filterFilesWithExtension = getIntent().getStringExtra(Constants.ALLOWED_FILE_EXTENSIONS);
    if (filterFilesWithExtension != null && !filterFilesWithExtension.isEmpty()) {
        Set<String> allowedFileExtensions = new HashSet<String>(Arrays.asList(filterFilesWithExtension.split(";")));
        mNavigationHelper.setAllowedFileExtensionFilter(allowedFileExtensions);
    }

    mFileList = mNavigationHelper.getFilesItemsInCurrentDirectory();
}
 
Example 16
Source File: FavoriteCharacterDialogFragment.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
private static void show(FragmentManager fm, int requestCode, String title, String[] items){
	FavoriteCharacterDialogFragment dialog = new FavoriteCharacterDialogFragment();
	Bundle args = new Bundle();
	args.putString(ARG_TITLE, title);
	args.putStringArray(ARG_ITEMS, items);
	args.putInt(ARG_REQUEST_CODE, requestCode);
	dialog.setArguments(args);
	dialog.show(fm, TAG);
}
 
Example 17
Source File: EUExWindow.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void insertPopoverAbovePopover(String[] parm) {
    if (!mBrwView.checkType(EBrwViewEntry.VIEW_TYPE_MAIN)
            || parm.length < 2) {
        return;
    }
    Message msg = new Message();
    msg.obj = this;
    msg.what = MSG_FUNCTION_INSERTPOPOVERABOVEPOPOVER;
    Bundle bd = new Bundle();
    bd.putStringArray(TAG_BUNDLE_PARAM, parm);
    msg.setData(bd);
    mHandler.sendMessage(msg);
}
 
Example 18
Source File: ImageProvider.java    From storage-samples with Apache License 2.0 4 votes vote down vote up
@Override
public Cursor query(Uri uri, String[] projection, Bundle queryArgs,
        CancellationSignal cancellationSignal) {
    int match = sUriMatcher.match(uri);
    // We only support a query for multiple images, return null for other form of queries
    // including a query for a single image.
    switch (match) {
        case IMAGES:
            break;
        default:
            return null;
    }
    MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));

    File[] files = mBaseDir.listFiles();
    int offset = queryArgs.getInt(ContentResolver.QUERY_ARG_OFFSET, 0);
    int limit = queryArgs.getInt(ContentResolver.QUERY_ARG_LIMIT, Integer.MAX_VALUE);
    Log.d(TAG, "queryChildDocuments with Bundle, Uri: " +
            uri + ", offset: " + offset + ", limit: " + limit);
    if (offset < 0) {
        throw new IllegalArgumentException("Offset must not be less than 0");
    }
    if (limit < 0) {
        throw new IllegalArgumentException("Limit must not be less than 0");
    }

    if (offset >= files.length) {
        return result;
    }

    for (int i = offset, maxIndex = Math.min(offset + limit, files.length); i < maxIndex; i++) {
        includeFile(result, files[i]);
    }

    Bundle bundle = new Bundle();
    bundle.putInt(ContentResolver.EXTRA_SIZE, files.length);
    String[] honoredArgs = new String[2];
    int size = 0;
    if (queryArgs.containsKey(ContentResolver.QUERY_ARG_OFFSET)) {
        honoredArgs[size++] = ContentResolver.QUERY_ARG_OFFSET;
    }
    if (queryArgs.containsKey(ContentResolver.QUERY_ARG_LIMIT)) {
        honoredArgs[size++] = ContentResolver.QUERY_ARG_LIMIT;
    }
    if (size != honoredArgs.length) {
        honoredArgs = Arrays.copyOf(honoredArgs, size);
    }
    bundle.putStringArray(ContentResolver.EXTRA_HONORED_ARGS, honoredArgs);
    result.setExtras(bundle);
    return result;
}
 
Example 19
Source File: RestrictionsManager.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private static Bundle addRestrictionToBundle(Bundle bundle, RestrictionEntry entry) {
    switch (entry.getType()) {
        case RestrictionEntry.TYPE_BOOLEAN:
            bundle.putBoolean(entry.getKey(), entry.getSelectedState());
            break;
        case RestrictionEntry.TYPE_CHOICE:
        case RestrictionEntry.TYPE_CHOICE_LEVEL:
        case RestrictionEntry.TYPE_MULTI_SELECT:
            bundle.putStringArray(entry.getKey(), entry.getAllSelectedStrings());
            break;
        case RestrictionEntry.TYPE_INTEGER:
            bundle.putInt(entry.getKey(), entry.getIntValue());
            break;
        case RestrictionEntry.TYPE_STRING:
        case RestrictionEntry.TYPE_NULL:
            bundle.putString(entry.getKey(), entry.getSelectedString());
            break;
        case RestrictionEntry.TYPE_BUNDLE:
            RestrictionEntry[] restrictions = entry.getRestrictions();
            Bundle childBundle = convertRestrictionsToBundle(Arrays.asList(restrictions));
            bundle.putBundle(entry.getKey(), childBundle);
            break;
        case RestrictionEntry.TYPE_BUNDLE_ARRAY:
            RestrictionEntry[] bundleRestrictionArray = entry.getRestrictions();
            Bundle[] bundleArray = new Bundle[bundleRestrictionArray.length];
            for (int i = 0; i < bundleRestrictionArray.length; i++) {
                RestrictionEntry[] bundleRestrictions =
                        bundleRestrictionArray[i].getRestrictions();
                if (bundleRestrictions == null) {
                    // Non-bundle entry found in bundle array.
                    Log.w(TAG, "addRestrictionToBundle: " +
                            "Non-bundle entry found in bundle array");
                    bundleArray[i] = new Bundle();
                } else {
                    bundleArray[i] = convertRestrictionsToBundle(Arrays.asList(
                            bundleRestrictions));
                }
            }
            bundle.putParcelableArray(entry.getKey(), bundleArray);
            break;
        default:
            throw new IllegalArgumentException(
                    "Unsupported restrictionEntry type: " + entry.getType());
    }
    return bundle;
}
 
Example 20
Source File: Operation.java    From DeviceConnect-Android with MIT License 4 votes vote down vote up
@Override
public Bundle toBundle() {
    Bundle bundle = new Bundle();

    if (mTags != null) {
        bundle.putStringArray("tags", mTags.toArray(new String[0]));
    }

    if (mSummary != null) {
        bundle.putString("summary", mSummary);
    }

    if (mDescription != null) {
        bundle.putString("description", mDescription);
    }

    if (mExternalDocs != null) {
        bundle.putParcelable("externalDocs", mExternalDocs.toBundle());
    }

    if (mOperationId != null) {
        bundle.putString("operationId", mOperationId);
    }

    if (mConsumes != null) {
        bundle.putStringArray("consumes", mConsumes.toArray(new String[0]));
    }

    if (mProduces != null) {
        bundle.putStringArray("produces", mProduces.toArray(new String[0]));
    }

    if (mParameters != null && !mParameters.isEmpty()) {
        List<Bundle> bundles = new ArrayList<>();
        for (Parameter parameter : mParameters) {
            bundles.add(parameter.toBundle());
        }
        bundle.putParcelableArray("parameters", bundles.toArray(new Bundle[0]));
    }

    if (mResponses != null) {
        bundle.putParcelable("responses", mResponses.toBundle());
    }

    if (mSchemes != null) {
        bundle.putStringArray("schemes", mSchemes.toArray(new String[0]));
    }

    if (mDeprecated != null) {
        bundle.putBoolean("deprecated", mDeprecated);
    }

    if (mSecurityRequirement != null && !mSecurityRequirement.isEmpty()) {
        Bundle security = new Bundle();
        for (Map.Entry<String, String> entry : mSecurityRequirement.entrySet()) {
            security.putString(entry.getKey(), entry.getValue());
        }
        bundle.putParcelable("security", security);
    }

    if (mXEvent != null) {
        bundle.putParcelable("x-event", mXEvent.toBundle());
    }

    if (mXType != null) {
        bundle.putString("x-type", mXType.getName());
    }

    copyVendorExtensions(bundle);

    return bundle;
}