List of usage examples for android.content Intent putStringArrayListExtra
public @NonNull Intent putStringArrayListExtra(String name, ArrayList<String> value)
From source file:com.xbm.android.matisse.ui.MatisseActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != RESULT_OK) return;/*from www . ja v a2 s. c o m*/ if (requestCode == REQUEST_CODE_PREVIEW) { Bundle resultBundle = data.getBundleExtra(BasePreviewActivity.EXTRA_RESULT_BUNDLE); ArrayList<Item> selected = resultBundle.getParcelableArrayList(SelectedItemCollection.STATE_SELECTION); int collectionType = resultBundle.getInt(SelectedItemCollection.STATE_COLLECTION_TYPE, SelectedItemCollection.COLLECTION_UNDEFINED); if (data.getBooleanExtra(BasePreviewActivity.EXTRA_RESULT_APPLY, false)) { Intent result = new Intent(); ArrayList<Uri> selectedUris = new ArrayList<>(); ArrayList<String> selectedPaths = new ArrayList<>(); if (selected != null) { for (Item item : selected) { selectedUris.add(item.getContentUri()); selectedPaths.add(PathUtils.getPath(this, item.getContentUri())); } } result.putParcelableArrayListExtra(EXTRA_RESULT_SELECTION, selectedUris); result.putStringArrayListExtra(EXTRA_RESULT_SELECTION_PATH, selectedPaths); setResult(RESULT_OK, result); finish(); } else { mSelectedCollection.overwrite(selected, collectionType); Fragment mediaSelectionFragment = getSupportFragmentManager() .findFragmentByTag(MediaSelectionFragment.class.getSimpleName()); if (mediaSelectionFragment instanceof MediaSelectionFragment) { ((MediaSelectionFragment) mediaSelectionFragment).refreshMediaGrid(); } updateBottomToolbar(); } } else if (requestCode == REQUEST_CODE_CAPTURE) { // Just pass the data back to previous calling Activity. Uri contentUri = mMediaStoreCompat.getCurrentPhotoUri(); String path = mMediaStoreCompat.getCurrentPhotoPath(); ArrayList<Uri> selected = new ArrayList<>(); selected.add(contentUri); ArrayList<String> selectedPath = new ArrayList<>(); selectedPath.add(path); Intent result = new Intent(); result.putParcelableArrayListExtra(EXTRA_RESULT_SELECTION, selected); result.putStringArrayListExtra(EXTRA_RESULT_SELECTION_PATH, selectedPath); setResult(RESULT_OK, result); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) MatisseActivity.this.revokeUriPermission(contentUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); finish(); } }
From source file:org.wso2.iot.agent.services.operation.OperationManagerBYOD.java
@Override public void restrictAccessToApplications(Operation operation) throws AndroidAgentException { AppRestriction appRestriction = CommonUtils.getAppRestrictionTypeAndList(operation, getResultBuilder(), getContextResources());//from ww w.j a v a2s . c o m String ownershipType = Preference.getString(getContext(), Constants.DEVICE_TYPE); if (Constants.AppRestriction.WHITE_LIST.equals(appRestriction.getRestrictionType())) { //Persisting white-listed app list. JSONArray whiteListApps = new JSONArray(); ArrayList appList = (ArrayList) appRestriction.getRestrictedList(); for (Object appObj : appList) { JSONObject app = new JSONObject(); try { app.put(Constants.AppRestriction.PACKAGE_NAME, appObj.toString()); app.put(Constants.AppRestriction.RESTRICTION_TYPE, Constants.AppRestriction.WHITE_LIST); whiteListApps.put(app); } catch (JSONException e) { operation.setStatus(getContextResources().getString(R.string.operation_value_error)); operation.setOperationResponse("Error in parsing app white-list payload."); getResultBuilder().build(operation); throw new AndroidAgentException("Invalid JSON format for app white-list bundle.", e); } } if (Constants.OWNERSHIP_COPE.equals(ownershipType)) { //Removing existing non-white-listed apps. List<String> installedAppPackages = CommonUtils.getInstalledAppPackages(getContext()); List<String> toBeHideApps = new ArrayList<>(installedAppPackages); toBeHideApps.removeAll(appList); for (String packageName : toBeHideApps) { CommonUtils.callSystemApp(getContext(), operation.getCode(), "false", packageName); } } Preference.putString(getContext(), Constants.AppRestriction.WHITE_LIST_APPS, whiteListApps.toString()); } else if (Constants.AppRestriction.BLACK_LIST.equals(appRestriction.getRestrictionType())) { if (Constants.OWNERSHIP_BYOD.equals(ownershipType)) { Intent restrictionIntent = new Intent(getContext(), AppLockService.class); restrictionIntent.setAction(Constants.APP_LOCK_SERVICE); restrictionIntent.putStringArrayListExtra(Constants.AppRestriction.APP_LIST, (ArrayList) appRestriction.getRestrictedList()); PendingIntent pendingIntent = PendingIntent.getService(getContext(), 0, restrictionIntent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarmManager = (AlarmManager) getContext().getSystemService(Context.ALARM_SERVICE); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.add(Calendar.SECOND, 1); // First time long frequency = 1 * 1000; // In ms alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), frequency, pendingIntent); getContext().startService(restrictionIntent); } else if (Constants.OWNERSHIP_COPE.equals(ownershipType)) { for (String packageName : appRestriction.getRestrictedList()) { CommonUtils.callSystemApp(getContext(), operation.getCode(), "false", packageName); } } } operation.setStatus(getContextResources().getString(R.string.operation_value_completed)); getResultBuilder().build(operation); }
From source file:com.zhihuigu.sosoOffice.RegisterThirdActivity.java
@Override public void onClick(View v) { if (v == backBtn) { Intent intent = new Intent(this, LoginActivity.class); startActivity(intent);/* w w w. ja v a 2 s .c o m*/ finish(); } else if (v == submitBtn) { if (textValidate()) { new Thread(runnable).start(); } } else if (v == linearGetImage) { int height = MyApplication.getInstance(this).getScreenHeight(); if (photo_tag) { shareBtn3.setVisibility(View.VISIBLE); if (height == 1280) { chazhi = 670; } else if (height == 800) { chazhi = 340; } else if (height == 960) { chazhi = 500; } else if (height == 854) { chazhi = 400; } else if (height == 480) { chazhi = 175; } } else { shareBtn3.setVisibility(View.GONE); if (height == 1280) { chazhi = 800; } else if (height == 800) { chazhi = 440; } else if (height == 960) { chazhi = 600; } else if (height == 854) { chazhi = 492; } else if (height == 480) { chazhi = 240; } } CommonUtils.hideSoftKeyboard(this);// new Thread(runnableForShowDialog).start(); } else if (v == shareBtn1) { dismiss(); Intent openCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); fileName = CommonUtils.getFileName(); MyApplication.getInstance(this).setFileName(fileName); File file = new File(SDCARD_ROOT_PATH + SAVE_PATH_IN_SDCARD); if (!file.exists()) { file.mkdirs(); } if (CommonUtils.isHasSdcard()) { openCamera.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(SDCARD_ROOT_PATH + SAVE_PATH_IN_SDCARD, fileName))); } startActivityForResult(openCamera, REQUEST_CODE_TAKE_PICTURE); } else if (v == shareBtn2) { dismiss(); Intent getAlbum = new Intent(Intent.ACTION_GET_CONTENT); getAlbum.setType(IMAGE_TYPE); startActivityForResult(getAlbum, IMAGE_CODE); } else if (v == shareBtn3) { dismiss(); // Intent intent = new Intent(this,ImagePreViewActivity.class); // intent.putExtra("path", path); // startActivityForResult(intent, 6); ArrayList<String> al = new ArrayList<String>(); al.clear(); al.add(path); Intent it = new Intent(this, ImageSwitcher.class); it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); it.putStringArrayListExtra("pathes", al); it.putExtra("index", 0); startActivity(it); } else if (v == cancleBtn) { dismiss(); } super.onClick(v); }
From source file:org.lol.reddit.fragments.CommentListingFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); final Context context = getSupportActivity(); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); commentFontScale = PrefsUtility.appearance_fontscale_comments(context, prefs); headerItems = PrefsUtility.appearance_comment_header_items(context, prefs); mShowLinkButtons = PrefsUtility.pref_appearance_linkbuttons(context, prefs); final LinearLayout outer = new LinearLayout(context); outer.setOrientation(android.widget.LinearLayout.VERTICAL); loadingView = new LoadingView(context, context.getString(R.string.download_waiting), true, true); notifications = new LinearLayout(context); notifications.setOrientation(android.widget.LinearLayout.VERTICAL); lv = new ListView(context); lv.setSmoothScrollbarEnabled(false); lv.setVerticalFadingEdgeEnabled(false); final LinearLayout listHeader = createVerticalLinearLayout(context); this.listHeaderPost = createVerticalLinearLayout(context); this.listHeaderNotifications = createVerticalLinearLayout(context); this.listHeaderSelftext = createVerticalLinearLayout(context); listHeader.addView(listHeaderPost);/* w w w.ja v a2 s.c o m*/ listHeader.addView(listHeaderNotifications); listHeader.addView(listHeaderSelftext); listFooter = createVerticalLinearLayout(context); lv.addHeaderView(listHeader); lv.addFooterView(listFooter, null, false); commentListAdapter = new CommentListingAdapter(context, this); outerAdapter = commentListAdapter; if (!mAllUrls.isEmpty() && mAllUrls.get(0).pathType() == RedditURLParser.PathType.PostCommentListingURL && mAllUrls.get(0).asPostCommentListURL().commentId != null) { final SpecificCommentThreadView specificCommentThreadView = new SpecificCommentThreadView( getSupportActivity(), mAllUrls.get(0).asPostCommentListURL()); outerAdapter = new HeaderAdapter(specificCommentThreadView, outerAdapter); } lv.setAdapter(outerAdapter); registerForContextMenu(lv); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (view instanceof RedditCommentView) { onCommentClicked((RedditCommentView) view); } else if (view instanceof LoadMoreCommentsView) { final ArrayList<String> urls = new ArrayList<String>(16); for (PostCommentListingURL url : ((LoadMoreCommentsView) view).getUrls()) { urls.add(url.toString()); } final Intent intent = new Intent(context, MoreCommentsListingActivity.class); intent.putStringArrayListExtra("urls", urls); getSupportActivity().startActivity(intent); } else if (position == 0 && mPost != null && !mPost.src.is_self) { LinkHandler.onLinkClicked(getSupportActivity(), mPost.url, false, mPost.src); } else if (view instanceof SpecificCommentThreadView) { final PostCommentListingURL allComments = ((SpecificCommentThreadView) view).getUrl() .commentId(null); LinkHandler.onLinkClicked(getSupportActivity(), allComments.toString()); } } }); outer.addView(notifications); outer.addView(lv); final FrameLayout outerFrame = new FrameLayout(context); outerFrame.addView(outer); final SideToolbarOverlay toolbarOverlay = new SideToolbarOverlay(context); final BezelSwipeOverlay bezelOverlay = new BezelSwipeOverlay(context, new BezelSwipeOverlay.BezelSwipeListener() { public boolean onSwipe(BezelSwipeOverlay.SwipeEdge edge) { if (mPost == null) return false; toolbarOverlay .setContents(mPost.generateToolbar(getSupportActivity(), true, toolbarOverlay)); toolbarOverlay.show(edge == BezelSwipeOverlay.SwipeEdge.LEFT ? SideToolbarOverlay.SideToolbarPosition.LEFT : SideToolbarOverlay.SideToolbarPosition.RIGHT); return true; } public boolean onTap() { if (toolbarOverlay.isShown()) { toolbarOverlay.hide(); return true; } return false; } }); outerFrame.addView(bezelOverlay); outerFrame.addView(toolbarOverlay); bezelOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; bezelOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; toolbarOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; toolbarOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; makeNextRequest(context); return outerFrame; }
From source file:com.sefford.beauthentic.activities.LoginActivity.java
void notifyLoginToGCM(final int type, final String name, final String password, final String authtoken) { final Account primaryAccount = Sessions.getPrimaryPhoneAccount(AccountManager.get(getApplicationContext())); if (primaryAccount == null) { return;//w ww.j a va 2s .c o m } final Firebase firebase = new Firebase(Constants.FIREBASE_USER_URL + Hasher.hash(primaryAccount.name)); final Firebase devices = firebase.child("devices"); if (primaryAccount != null) { devices.addListenerForSingleValueEvent(new ValueEventListenerAdapter() { @Override public void onDataChange(DataSnapshot snapshot) { if (snapshot.exists()) { Intent intent = new Intent(LoginActivity.this, LoginGCMNotificationService.class); intent.putExtra(LoginGCMNotificationService.EXTRA_TYPE, type); intent.putExtra(LoginGCMNotificationService.EXTRA_NAME, name); intent.putExtra(LoginGCMNotificationService.EXTRA_PASSWORD, password); intent.putExtra(LoginGCMNotificationService.EXTRA_AUTHTOKEN, authtoken); intent.putStringArrayListExtra(LoginGCMNotificationService.EXTRA_DEVICES, (ArrayList<String>) snapshot.getValue()); startService(intent); } } }); } }
From source file:com.upnext.blekit.BLEKit.java
private void sendUpdateBeacons(List<Beacon> beacons) { Intent intent = getServiceIntent(); intent.putExtra(BLEKitService.Extra.EXTRA_COMMAND, BLEKitService.Extra.COMMAND_UPDATE_BEACONS); intent.putStringArrayListExtra(BLEKitService.Extra.EXTRA_BEACONS_LIST, beaconsToIds(beacons)); sendCommandToService(intent);/*from www. jav a 2 s .co m*/ }
From source file:org.tomahawk.libtomahawk.infosystem.InfoSystem.java
public void onLoggedOpsSent(ArrayList<String> doneRequestsIds, boolean success) { List<InfoRequestData> loggedOps = new ArrayList<InfoRequestData>(); HashSet<Integer> requestTypes = new HashSet<Integer>(); HashSet<String> playlistIds = new HashSet<String>(); for (String doneRequestId : doneRequestsIds) { if (mSentRequests.containsKey(doneRequestId)) { InfoRequestData loggedOp = mSentRequests.get(doneRequestId); loggedOps.add(loggedOp);//ww w. j a va2 s . co m requestTypes.add(loggedOp.getType()); if (loggedOp.getType() == InfoRequestData.INFOREQUESTDATA_TYPE_PLAYLISTS_PLAYLISTENTRIES) { playlistIds.add(loggedOp.getQueryParams().playlist_local_id); } else if (loggedOp.getType() == InfoRequestData.INFOREQUESTDATA_TYPE_PLAYLISTS) { HatchetPlaylistEntries entries = loggedOp.getResult(HatchetPlaylistEntries.class); if (entries != null && entries.playlists.size() > 0) { playlistIds.add(entries.playlists.get(0).id); Playlist.getPlaylistById(loggedOp.getQueryParams().playlist_local_id) .setHatchetId(entries.playlists.get(0).id); } } mLoggedOpsMap.remove(loggedOp.getLoggedOpId()); } } if (success) { for (InfoRequestData loggedOp : loggedOps) { mPlaylistsLoggedOpsMap.remove(loggedOp.getLoggedOpId()); } trySendingQueuedOps(); DatabaseHelper.getInstance().removeOpsFromInfoSystemOpLog(loggedOps); if (DatabaseHelper.getInstance().getLoggedOpsCount() == 0) { if (!requestTypes.isEmpty()) { Intent reportIntent = new Intent(INFOSYSTEM_OPLOGISEMPTIED); reportIntent.putIntegerArrayListExtra(INFOSYSTEM_OPLOGISEMPTIED_REQUESTTYPES, new ArrayList<Integer>(requestTypes)); if (!playlistIds.isEmpty()) { reportIntent.putStringArrayListExtra(INFOSYSTEM_OPLOGISEMPTIED_IDS, new ArrayList<String>(playlistIds)); } TomahawkApp.getContext().sendBroadcast(reportIntent); } } } }
From source file:com.upnext.blekit.BLEKit.java
private void sendStart(List<Beacon> beacons) { Intent intent = getServiceIntent(); intent.putExtra(BLEKitService.Extra.EXTRA_COMMAND, BLEKitService.Extra.COMMAND_START_SCAN); intent.putExtra(BLEKitService.Extra.EXTRA_BACKGROUND_MODE, mBackgroundMode.inBackground); intent.putStringArrayListExtra(BLEKitService.Extra.EXTRA_BEACONS_LIST, beaconsToIds(beacons)); sendCommandToService(intent);/*from w w w .j a v a 2 s . c o m*/ }
From source file:com.android.projectz.teamrocket.thebusapp.adapters.MainRecyclerAdapter.java
@Override public void onBindViewHolder(final MainRecyclerAdapter.ViewHolder holder, final int position) { int lastPosition = -1; if (position > lastPosition) { Animation animation = AnimationUtils.loadAnimation(context, (position > lastPosition) ? R.anim.up_from_bottom : R.anim.down_from_top); holder.itemView.startAnimation(animation); lastPosition = position;/*from w w w . j a v a2 s .c o m*/ } if (SharedPreferencesUtils.getSelectedTheme(context).equals("ThemeDark")) { holder.cardView.setBackgroundColor(ContextCompat.getColor(context, R.color.cardview_dark_background)); holder.txtTitle.setTextColor(ContextCompat.getColor(context, android.R.color.primary_text_dark)); holder.txtSubtitle.setTextColor(ContextCompat.getColor(context, android.R.color.secondary_text_dark)); holder.txtOther.setTextColor(ContextCompat.getColor(context, android.R.color.secondary_text_dark)); image = DrawableCompat.wrap(ContextCompat.getDrawable(context, R.drawable.ic_arrow_row)); DrawableCompat.setTint(image, context.getResources().getColor(R.color.iconDark)); } else { holder.cardView.setBackgroundColor(ContextCompat.getColor(context, R.color.cardview_light_background)); holder.txtTitle.setTextColor(ContextCompat.getColor(context, android.R.color.primary_text_light)); holder.txtSubtitle.setTextColor(ContextCompat.getColor(context, android.R.color.secondary_text_light)); holder.txtOther.setTextColor(ContextCompat.getColor(context, android.R.color.secondary_text_light)); image = DrawableCompat.wrap(ContextCompat.getDrawable(context, R.drawable.ic_arrow_row)); DrawableCompat.setTint(image, context.getResources().getColor(R.color.iconLight)); } holder.txtTitle.setText(myObjects.get(position).getTextTitle()); holder.txtSubtitle.setText(myObjects.get(position).getTextSubtitle()); holder.txtOther.setText(myObjects.get(position).getTextOther()); holder.imageView.setImageResource(myObjects.get(position).getImageId()); holder.arrowRow.setImageDrawable(image); //ascoltatore del *tap* sulla card holder.relativeLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(context, "Loading...", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(context, DetailViewerActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); //senza di esso va in crash, perch bisogna creare l'intent come se fosse una nuova activity intent.putExtra("title", myObjects.get(position).getTextTitle()); intent.putExtra("subtitle", myObjects.get(position).getTextSubtitle()); intent.putExtra("other", myObjects.get(position).getTextOther()); intent.putExtra("fermataId", myObjects.get(position).getFermataId()); ArrayList<String> holderData = new ArrayList<String>(); holderData.add(myObjects.get(position).getTextTitle()); holderData.add(myObjects.get(position).getTextSubtitle()); holderData.add(myObjects.get(position).getTextOther()); intent.putStringArrayListExtra("holderData", holderData); context.startActivity(intent); } }); //MainActivity.recyclerView.scrollToPosition(myObjects.get(position).isNear != -1 ? position : null); }