List of usage examples for android.content Intent putIntegerArrayListExtra
public @NonNull Intent putIntegerArrayListExtra(String name, ArrayList<Integer> value)
From source file:com.kaliturin.blacklist.fragments.GetContactsFragment.java
@Override protected void addContacts(List<Contact> contacts, LongSparseArray<ContactNumber> singleContactNumbers) { // prepare returning arguments - data of the chosen contacts ArrayList<String> names = new ArrayList<>(); ArrayList<String> numbers = new ArrayList<>(); ArrayList<Integer> types = new ArrayList<>(); for (Contact contact : contacts) { ContactNumber contactNumber = singleContactNumbers.get(contact.id); if (contactNumber != null) { // add single number of the contact names.add(contact.name);// w w w.ja v a 2s.co m numbers.add(contactNumber.number); types.add(contactNumber.type); } else { // all numbers of the contact for (ContactNumber _contactNumber : contact.numbers) { names.add(contact.name); numbers.add(_contactNumber.number); types.add(_contactNumber.type); } } } // return arguments Intent intent = new Intent(); intent.putStringArrayListExtra(CONTACT_NAMES, names); intent.putStringArrayListExtra(CONTACT_NUMBERS, numbers); intent.putIntegerArrayListExtra(CONTACT_NUMBER_TYPES, types); getActivity().setResult(Activity.RESULT_OK, intent); getActivity().finish(); }
From source file:com.example.topnewgrid.choosephotos.choosephotos.photoviewer.photoviewerinterface.ViewPagerDeleteActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_pager_delete); mViewPager = (HackyViewPager) findViewById(R.id.view_pager); // this.files = this.getIntent().getStringArrayExtra(FILES); this.files = this.getIntent().getParcelableArrayListExtra(FILES); this.index = this.getIntent().getIntExtra(CURRENT_INDEX, 0); iniSize = files.size();// ww w .jav a2 s. c o m for (int i = 0; i < iniSize; i++) { remainIndexs.add(i); } Button btnBack = (Button) findViewById(R.id.btnBack); btnBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); remainToDelete(); intent.putIntegerArrayListExtra("deleteIndexs", deleteIndexs); intent.putParcelableArrayListExtra("files", files); setResult(RESULT_OK, intent); ViewPagerDeleteActivity.this.finish(); } }); btnDelete = (Button) findViewById(R.id.btnCheck); btnDelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int position = mViewPager.getCurrentItem(); if (files.size() > 1) { files.remove(position); remainIndexs.remove(position); } else { files.remove(0); remainIndexs.remove(0); } mViewPager.setAdapter(new SamplePagerAdapter()); if (files.size() > 0) { if (position == files.size()) { mViewPager.setCurrentItem(position - 1); } else { mViewPager.setCurrentItem(position); } } else { Intent intent = new Intent(); remainToDelete(); intent.putIntegerArrayListExtra("deleteIndexs", deleteIndexs); setResult(RESULT_OK, intent); ViewPagerDeleteActivity.this.finish(); } } }); SamplePagerAdapter spAdapter = new SamplePagerAdapter(); mViewPager.setAdapter(spAdapter); mViewPager.setCurrentItem(index); }
From source file:com.anand.music.PlaylistFragment.java
/** * Launches the {@link com.jarekandshawnmusic.m.MediaPlayerService} * to play the requested playlist, or re-initializes an existing * {@link com.jarekandshawnmusic.m.MediaPlayerService} with a new playlist. * @param playlist the list of songs to play *///w ww . ja v a 2s.c o m public void setPlaylist(ArrayList<Integer> playlist) { if (mBound) { mMediaPlayerService.setPlaylist(playlist); mMediaPlayerService.play(); } else { Activity containerActivity = getActivity(); Intent playlistIntent = new Intent(containerActivity, MediaPlayerService.class); playlistIntent.putIntegerArrayListExtra("playlist", playlist); containerActivity.startService(playlistIntent); // We start this service and then bind to it, so we can control the playback // and get progress updates. containerActivity.bindService(playlistIntent, mConnection, Context.BIND_AUTO_CREATE); } }
From source file:com.nextome.geojsonviewer.MainActivity.java
public void openMap(Class<?> activity) { if (fileUris != null) { Intent mapsIntent = new Intent(this, activity); mapsIntent.putStringArrayListExtra(GeoJsonViewerConstants.INTENT_EXTRA_JSON_URI, fileUris); mapsIntent.putIntegerArrayListExtra(GeoJsonViewerConstants.INTENT_EXTRA_JSON_COLORS, layerColors); startActivity(mapsIntent);/*from ww w .j a va2s .co m*/ } else { Toast.makeText(getApplicationContext(), R.string.geojson_opener_unable_to_read, Toast.LENGTH_LONG) .show(); finish(); } }
From source file:ph.devcon.android.attendee.AttendeesFragment.java
@OnItemClick(R.id.lvw_attendee) public void onItemClick(int position) { Intent intent = new Intent(getActivity(), AttendeeDetailsActivity.class); intent.putExtra(AttendeeDetailsActivity.POSITION, position); intent.putIntegerArrayListExtra(AttendeeDetailsActivity.ID_ITEMS, getIds()); startActivity(intent);/*from www . j av a2 s . c o m*/ }
From source file:org.awesomeapp.messenger.ui.ContactsPickerActivity.java
private void multiFinish(SparseBooleanArray positions) { ArrayList<String> users = new ArrayList<String>(); ArrayList<Integer> providers = new ArrayList<Integer>(); ArrayList<Integer> accounts = new ArrayList<Integer>(); for (int i = 0; i < positions.size(); i++) { if (positions.valueAt(i)) { Cursor cursor = (Cursor) mAdapter.getItem(i); users.add(cursor.getString(ContactListItem.COLUMN_CONTACT_USERNAME)); providers.add((int) cursor.getLong(ContactListItem.COLUMN_CONTACT_PROVIDER)); accounts.add((int) cursor.getLong(ContactListItem.COLUMN_CONTACT_ACCOUNT)); }/*w w w. j a va 2 s .c o m*/ } Intent data = new Intent(); data.putStringArrayListExtra(EXTRA_RESULT_USERNAMES, users); data.putIntegerArrayListExtra(EXTRA_RESULT_PROVIDER, providers); data.putIntegerArrayListExtra(EXTRA_RESULT_ACCOUNT, accounts); setResult(RESULT_OK, data); finish(); }
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);// w ww .ja v a2 s .com 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:pt.aptoide.backupapps.Aptoide.java
private void login(ViewListIds uploads, EnumAppsLists action) { Intent login = new Intent(Aptoide.this, BazaarLogin.class); login.putExtra("InvoqueType", BazaarLogin.InvoqueType.NO_CREDENTIALS_SET.ordinal()); if (uploads != null) { if (action.equals(EnumAppsLists.BACKUP)) { login.putIntegerArrayListExtra("uploads", uploads); } else {//from w w w .java2s.c o m login.putIntegerArrayListExtra("restores", uploads); } } startActivity(login); }
From source file:pt.aptoide.backupapps.Aptoide.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!isRunning) { Thread.currentThread().setPriority(Thread.MAX_PRIORITY); theme = new ContextThemeWrapper(this, R.style.DialogTheme); // currentAppsList = EnumAppsLists.Backup; // handlingMyapps = new ArrayList<ViewMyapp>(); queuedFlipperChanges = new ArrayList<EnumAptoideInterfaceTasks>(); // swypeDetector = new GestureDetector(new SwypeDetector()); // swypeListener = new View.OnTouchListener() { // @Override // public boolean onTouch(View v, MotionEvent event) { // return swypeDetector.onTouchEvent(event); // } // }; // swyping = new AtomicBoolean(false); // swypeDelayHandler = new Handler(); synchronizingInstalledApps = new AtomicBoolean(false); loadingRepos = new AtomicBoolean(false); // resettingFlipper = new AtomicBoolean(false); highPriority = new AtomicBoolean(true); makeSureServiceDataIsRunning();/* w w w . j a v a 2s .c o m*/ isRunning = true; setContentView(R.layout.aptoide); // searchView = (ImageView) findViewById(R.id.search_button); // searchView.setOnTouchListener(new SearchClickListener()); // previousViewArrow = (ImageView) findViewById(R.id.previous); // previousViewArrow.setOnClickListener(new OnPreviousClickedListener()); // previousViewArrow.setVisibility(View.INVISIBLE); // previousListTitle = (TextView) findViewById(R.id.previous_title); // previousListTitle.setText(getString(R.string.available)); // previousListTitle.setOnClickListener(new OnPreviousClickedListener()); // previousListTitle.setVisibility(View.INVISIBLE); // currentListTitle = (TextView) findViewById(R.id.current_title); // currentListTitle.setText(getString(R.string.available)); // currentListTitle.setClickable(false); // nextListTitle = (TextView) findViewById(R.id.next_title); // nextListTitle.setText(getString(R.string.installed)); // nextListTitle.setOnClickListener(new OnNextClickedListener()); // nextViewArrow = (ImageView) findViewById(R.id.next); // nextViewArrow.setOnClickListener(new OnNextClickedListener()); // View categoriesView = LinearLayout.inflate(this, R.layout.apps_list, appsListFlipper); View availableView = LinearLayout.inflate(this, R.layout.list_apps, appsListPager); View installedView = LinearLayout.inflate(this, R.layout.list_apps, appsListPager); // View updatableView = LinearLayout.inflate(this, R.layout.list_apps, appsListFlipper); // emptyCategoriesList = categoriesView.findViewById(android.R.id.empty); // emptyCategoriesList.setVisibility(View.GONE); // emptyAvailableAppsList = LinearLayout.inflate(this, R.layout.list_apps_empty, appsListFlipper); emptyAvailableAppsList = availableView.findViewById(android.R.id.empty); emptyAvailableAppsList.setVisibility(View.GONE); emptyAvailableAppsList.setTag(EnumAppsLists.RESTORE); // emptyInstalledAppsList = LinearLayout.inflate(this, R.layout.list_apps_empty, appsListFlipper); emptyInstalledAppsList = installedView.findViewById(android.R.id.empty); emptyInstalledAppsList.setVisibility(View.GONE); emptyInstalledAppsList.setTag(EnumAppsLists.BACKUP); // emptyUpdatableAppsList = LinearLayout.inflate(this, R.layout.list_apps_empty, appsListFlipper); // emptyUpdatableAppsList = updatableView.findViewById(android.R.id.empty); // emptyUpdatableAppsList.setVisibility(View.GONE); // emptyUpdatableAppsList.setTag(EnumAppsLists.Updates); // loadingCategoriesList = categoriesView.findViewById(R.id.loading); // loadingAvailableAppsList = LinearLayout.inflate(this, R.layout.list_loading, appsListFlipper); loadingAvailableAppsList = availableView.findViewById(R.id.loading); loadingAvailableAppsList.setTag(EnumAppsLists.RESTORE); loadingAppsTitle = loadingAvailableAppsList.findViewById(R.id.loading_title); loadingAppsTitleWaitingOnServer = loadingAvailableAppsList .findViewById(R.id.loading_title_waiting_on_server); loadingAvailableAppsUnknownProgress = (ProgressBar) loadingAvailableAppsList .findViewById(R.id.loading_bar); loadingAvailableAppsProgress = (ProgressBar) loadingAvailableAppsList .findViewById(R.id.loading_progress_bar); loadingAvailableAppsProgressCompletionTarget = new AtomicInteger(0); loadingAvailableAppsProgressCurrent = new AtomicInteger(0); // loadingInstalledAppsList = LinearLayout.inflate(this, R.layout.list_loading, appsListFlipper); loadingInstalledAppsList = installedView.findViewById(R.id.loading); loadingInstalledAppsList.setTag(EnumAppsLists.BACKUP); // loadingUpdatableAppsList = LinearLayout.inflate(this, R.layout.list_loading, appsListFlipper); // loadingUpdatableAppsList = updatableView.findViewById(R.id.loading); // loadingUpdatableAppsList.setTag(EnumAppsLists.Updates); // categoriesListView = new ListView(this); // categoriesListView = (ListView) categoriesView.findViewById(android.R.id.list); // categoriesListView.setCacheColorHint(Color.TRANSPARENT); // categoriesListView.setOnTouchListener(swypeListener); // categoriesListView.setOnItemClickListener(this); // categoriesListView.setTag(EnumAppsLists.Available); // categoriesListView.setPersistentDrawingCache(ViewGroup.PERSISTENT_ALL_CACHES); // availableAppsListView = new ListView(this); availableAppsListView = (ListView) availableView.findViewById(android.R.id.list); availableAppsListView.setCacheColorHint(Color.TRANSPARENT); // availableAppsListView.setOnTouchListener(swypeListener); availableAppsListView.setOnItemClickListener(this); availableAppsListView.setTag(EnumAppsLists.RESTORE); availableAppsListView.setPersistentDrawingCache(ViewGroup.PERSISTENT_ALL_CACHES); // appsListFlipper.addView(availableAppsList); // installedAppsListView = new ListView(this); installedAppsListView = (ListView) installedView.findViewById(android.R.id.list); installedAppsListView.setCacheColorHint(Color.TRANSPARENT); // installedAppsListView.setOnTouchListener(swypeListener); installedAppsListView.setOnItemClickListener(this); installedAppsListView.setTag(EnumAppsLists.BACKUP); installedAppsListView.setPersistentDrawingCache(ViewGroup.PERSISTENT_ALL_CACHES); // appsListFlipper.addView(installedAppsList); // updatableAppsListView = new ListView(this); // updatableAppsListView = (ListView) updatableView.findViewById(android.R.id.list); // updatableAppsListView.setCacheColorHint(Color.TRANSPARENT); // updatableAppsListView.setOnTouchListener(swypeListener); // updatableAppsListView.setOnItemClickListener(this); // updatableAppsListView.setTag(EnumAppsLists.Updates); // updatableAppsListView.setPersistentDrawingCache(ViewGroup.PERSISTENT_ALL_CACHES); // appsListFlipper.addView(updatableAppsList); Button backup = (Button) installedView.findViewById(R.id.action); backup.setText(R.string.backup_selected_apps); backup.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.d("Aptoide-AppsBackup", "Clicked on backup"); // if(selectedVersion.getRepoUri() != null){ // if(authenticationToken == null){ // try { // authenticationToken = serviceDataCaller.callGetServerToken(); // } catch (RemoteException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } // if(authenticationToken == null){ // Log.d("Aptoide-AppsBackup", "No login set"); // DialogLogin loginComments = new DialogLogin(AppInfo.this, serviceDataCaller, DialogLogin.InvoqueNature.NO_CREDENTIALS_SET); // loginComments.setOnDismissListener(new OnDismissListener() { // @Override // public void onDismiss(DialogInterface dialog) { // addAppVersionComment(); // } // }); // loginComments.show(); // }else{ // addAppVersionComment(); // } // } try { authenticationToken = serviceDataCaller.callGetServerToken(); } catch (RemoteException e) { e.printStackTrace(); } ViewListIds uploads = new ViewListIds(); for (int i = 0; i < installedAdapter.getCount(); i++) { if (((ViewDisplayApplicationBackup) installedAdapter.getItem(i)).isChecked()) { uploads.add(installedAdapter.getItem(i).getAppHashid()); } } if (uploads.size() > 0) { installedAdapter.unselectAll(); if (authenticationToken != null) { Intent upload = new Intent(Aptoide.this, Upload.class); upload.putIntegerArrayListExtra("uploads", uploads); startActivity(upload); } else { AptoideLog.d(Aptoide.this, "can't backup with no server login configured"); // Toast.makeText(Aptoide.this, R.string.login_required, Toast.LENGTH_SHORT).show(); login(uploads, EnumAppsLists.BACKUP); } } } }); Button restore = (Button) availableView.findViewById(R.id.action); restore.setText(R.string.restore_selected_apps); restore.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.d("Aptoide-AppsBackup", "Clicked on restore"); try { anyReposInUse = serviceDataCaller.callAnyReposInUse(); } catch (RemoteException e) { e.printStackTrace(); } ViewListIds restores = new ViewListIds(); ViewDisplayApplicationBackup app; for (int i = 0; i < availableAdapter.getCount(); i++) { app = ((ViewDisplayApplicationBackup) availableAdapter.getItem(i)); if (app.isChecked()) { restores.add(availableAdapter.getItem(i).getAppHashid()); Toast.makeText(Aptoide.this, getString(R.string.restoring_app, availableAdapter.getItem(i).getAppName()), Toast.LENGTH_SHORT).show(); } } availableAdapter.unselectAll(); if (anyReposInUse) { for (Integer appHashid : restores) { try { serviceDataCaller.callInstallApp(appHashid); } catch (RemoteException e) { e.printStackTrace(); } } } else { AptoideLog.d(Aptoide.this, "can't restore with no repo configured"); // Toast.makeText(Aptoide.this, R.string.login_required, Toast.LENGTH_SHORT).show(); login(restores, EnumAppsLists.RESTORE); } } }); ArrayList<View> pages = new ArrayList<View>(); pages.add(installedView); pages.add(availableView); appsListPager = (ViewPager) findViewById(R.id.list_pager); ViewPagerAdapter pagerAdapter = new ViewPagerAdapter(pages); appsListPager.setAdapter(pagerAdapter); pageIndicator = (FixedTabsView) findViewById(R.id.indicator); pageIndicatorAdapter = new FixedTabsAdapter(this); pageIndicator.setAdapter(pageIndicatorAdapter); pageIndicator.setViewPager(appsListPager); // appsListFlipper.addView(loadingAvailableAppsList); // appsListFlipper.addView(loadingInstalledAppsList); // appsListFlipper.addView(loadingUpdatableAppsList); // appsListPager.addView(availableView); // appsListPager.addView(installedView); // appsListFlipper.addView(updatableView); } }
From source file:com.openerp.services.ExpenseSyncService.java
/** * Perform sync.//from w w w . j a v a 2 s .co m * * @param context the context * @param account the account * @param extras the extras * @param authority the authority * @param provider the provider * @param syncResult the sync result */ public void performSync(Context context, Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { Log.d(TAG, "ExpenseSyncService->performSync()"); Intent intent = new Intent(); Intent updateWidgetIntent = new Intent(); updateWidgetIntent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); intent.setAction(SyncFinishReceiver.SYNC_FINISH); OEUser user = OpenERPAccountManager.getAccountDetail(context, account.name); try { ExpenseDBHelper expense_db = new ExpenseDBHelper(context); expense_db.setAccountUser(user); OEHelper oe = expense_db.getOEInstance(); if (oe == null) { return; } int user_id = user.getUser_id(); // Updating User Context for OE-JSON-RPC JSONObject newContext = new JSONObject(); //newContext.put("default_model", "res.users"); //newContext.put("default_res_id", user_id); OEArguments arguments = new OEArguments(); // Param 1 : domain //OEDomain domain = new OEDomain(); //arguments.add(domain); // Param 2 : context arguments.add(oe.updateContext(newContext)); //??? List<Integer> ids = expense_db.ids(); if (oe.syncWithMethod("get_waiting_audit_expenses", arguments, true)) { int affected_rows = oe.getAffectedRows(); Log.d(TAG, "ExpenseSyncService[arguments]:" + arguments.toString()); Log.d(TAG, "ExpenseSyncService->affected_rows:" + affected_rows); List<Integer> affected_ids = oe.getAffectedIds(); boolean notification = true; ActivityManager am = (ActivityManager) context.getSystemService(ACTIVITY_SERVICE); List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(1); ComponentName componentInfo = taskInfo.get(0).topActivity; if (componentInfo.getPackageName().equalsIgnoreCase("com.openerp")) { notification = false; } if (notification && affected_rows > 0) { OENotificationHelper mNotification = new OENotificationHelper(); Intent mainActiivty = new Intent(context, MainActivity.class); mainActiivty.setAction("EXPENSES"); mNotification.setResultIntent(mainActiivty, context); String notify_title = context.getResources().getString(R.string.expenses_sync_notify_title); notify_title = String.format(notify_title, affected_rows); String notify_body = context.getResources().getString(R.string.expenses_sync_notify_body); notify_body = String.format(notify_body, affected_rows); mNotification.showNotification(context, notify_title, notify_body, authority, R.drawable.ic_oe_notification); } intent.putIntegerArrayListExtra("new_ids", (ArrayList<Integer>) affected_ids); } //?expense? List<Integer> updated_ids = updateOldExpenses(expense_db, oe, user, ids); } catch (Exception e) { e.printStackTrace(); } if (user.getAndroidName().equals(account.name)) { context.sendBroadcast(intent); //context.sendBroadcast(updateWidgetIntent); } }