Java Code Examples for android.content.Intent#getIntegerArrayListExtra()
The following examples show how to use
android.content.Intent#getIntegerArrayListExtra() .
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: InvalidationIntentProtocol.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
/** Returns the object ids for which to register contained in the intent. */ public static Set<ObjectId> getRegisteredObjectIds(Intent intent) { ArrayList<Integer> objectSources = intent.getIntegerArrayListExtra(EXTRA_REGISTERED_OBJECT_SOURCES); ArrayList<String> objectNames = intent.getStringArrayListExtra(EXTRA_REGISTERED_OBJECT_NAMES); if (objectSources == null || objectNames == null || objectSources.size() != objectNames.size()) { return null; } Set<ObjectId> objectIds = new HashSet<ObjectId>(objectSources.size()); for (int i = 0; i < objectSources.size(); i++) { objectIds.add(ObjectId.newInstance( objectSources.get(i), objectNames.get(i).getBytes())); } return objectIds; }
Example 2
Source File: InvalidationIntentProtocol.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
/** Returns the object ids for which to register contained in the intent. */ public static Set<ObjectId> getRegisteredObjectIds(Intent intent) { ArrayList<Integer> objectSources = intent.getIntegerArrayListExtra(EXTRA_REGISTERED_OBJECT_SOURCES); ArrayList<String> objectNames = intent.getStringArrayListExtra(EXTRA_REGISTERED_OBJECT_NAMES); if (objectSources == null || objectNames == null || objectSources.size() != objectNames.size()) { return null; } Set<ObjectId> objectIds = new HashSet<ObjectId>(objectSources.size()); for (int i = 0; i < objectSources.size(); i++) { objectIds.add(ObjectId.newInstance( objectSources.get(i), objectNames.get(i).getBytes())); } return objectIds; }
Example 3
Source File: InvalidationIntentProtocol.java From 365browser with Apache License 2.0 | 6 votes |
/** Returns the object ids for which to register contained in the intent. */ public static Set<ObjectId> getRegisteredObjectIds(Intent intent) { ArrayList<Integer> objectSources = intent.getIntegerArrayListExtra(EXTRA_REGISTERED_OBJECT_SOURCES); ArrayList<String> objectNames = intent.getStringArrayListExtra(EXTRA_REGISTERED_OBJECT_NAMES); if (objectSources == null || objectNames == null || objectSources.size() != objectNames.size()) { return null; } Set<ObjectId> objectIds = new HashSet<ObjectId>(objectSources.size()); for (int i = 0; i < objectSources.size(); i++) { objectIds.add( ObjectId.newInstance(objectSources.get(i), objectNames.get(i).getBytes())); } return objectIds; }
Example 4
Source File: TileDownloadService.java From android_maplibui with GNU Lesser General Public License v3.0 | 6 votes |
protected void addDownloadTask(Intent intent) { if (Constants.DEBUG_MODE) { Log.d(Constants.TAG, "Add task to download queue"); } String layerPathName = intent.getStringExtra(KEY_PATH); double dfMinX = intent.getDoubleExtra(KEY_MINX, 0); double dfMinY = intent.getDoubleExtra(KEY_MINY, 0); double dfMaxX = intent.getDoubleExtra(KEY_MAXX, GeoConstants.MERCATOR_MAX); double dfMaxY = intent.getDoubleExtra(KEY_MAXY, GeoConstants.MERCATOR_MAX); GeoEnvelope env = new GeoEnvelope(dfMinX, dfMaxX, dfMinY, dfMaxY); if (intent.hasExtra(KEY_ZOOM_FROM) && intent.hasExtra(KEY_ZOOM_TO)) { int zoomFrom = intent.getIntExtra(KEY_ZOOM_FROM, 0); int zoomTo = intent.getIntExtra(KEY_ZOOM_TO, 18); addTask(layerPathName, env, zoomFrom, zoomTo); } else if (intent.hasExtra(KEY_ZOOM_LIST)) { List<Integer> zoomList = intent.getIntegerArrayListExtra(KEY_ZOOM_LIST); addTask(layerPathName, env, zoomList); } }
Example 5
Source File: MultiredditOverview.java From Slide with GNU General Public License v3.0 | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 940 && adapter != null && adapter.getCurrentFragment() != null) { if (resultCode == RESULT_OK) { LogUtil.v("Doing hide posts"); ArrayList<Integer> posts = data.getIntegerArrayListExtra("seen"); ((MultiredditView) adapter.getCurrentFragment()).adapter.refreshView(posts); if (data.hasExtra("lastPage") && data.getIntExtra("lastPage", 0) != 0 && ((MultiredditView) adapter.getCurrentFragment()).rv.getLayoutManager() instanceof LinearLayoutManager) { ((LinearLayoutManager) ((MultiredditView) adapter.getCurrentFragment()).rv.getLayoutManager()) .scrollToPositionWithOffset(data.getIntExtra("lastPage", 0) + 1, mToolbar.getHeight()); } } else { ((MultiredditView) adapter.getCurrentFragment()).adapter.refreshView(); } } }
Example 6
Source File: SubredditView.java From Slide with GNU General Public License v3.0 | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Check which request we're responding to if (requestCode == 2) { // Make sure the request was successful pager.setAdapter(new OverviewPagerAdapter(getSupportFragmentManager())); } else if (requestCode == 1) { restartTheme(); } else if (requestCode == 940) { if (adapter != null && adapter.getCurrentFragment() != null) { if (resultCode == RESULT_OK) { LogUtil.v("Doing hide posts"); ArrayList<Integer> posts = data.getIntegerArrayListExtra("seen"); ((SubmissionsView) adapter.getCurrentFragment()).adapter.refreshView(posts); if (data.hasExtra("lastPage") && data.getIntExtra("lastPage", 0) != 0 && ((SubmissionsView) adapter.getCurrentFragment()).rv.getLayoutManager() instanceof LinearLayoutManager) { ((LinearLayoutManager) ((SubmissionsView) adapter.getCurrentFragment()).rv.getLayoutManager()) .scrollToPositionWithOffset(data.getIntExtra("lastPage", 0) + 1, mToolbar.getHeight()); } } else { ((SubmissionsView) adapter.getCurrentFragment()).adapter.refreshView(); } } } else { super.onActivityResult(requestCode, resultCode, data); } }
Example 7
Source File: MediaPlayerService.java From io2014-codelabs with Apache License 2.0 | 5 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { mStartId = startId; mHasLaunched = true; ArrayList<Integer> playlist = intent.getIntegerArrayListExtra("playlist"); if (playlist != null && playlist.size() > 0) { setPlaylist(playlist); play(); } return START_NOT_STICKY; }
Example 8
Source File: MediaPlayerService.java From io2014-codelabs with Apache License 2.0 | 5 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { mStartId = startId; mHasLaunched = true; ArrayList<Integer> playlist = intent.getIntegerArrayListExtra("playlist"); if (playlist != null && playlist.size() > 0) { setPlaylist(playlist); play(); } return START_NOT_STICKY; }
Example 9
Source File: ListViewFilterActivity.java From UltimateAndroid with Apache License 2.0 | 5 votes |
public void onHandleIntent(Intent intent) { this.mListSectionPos = intent.getIntegerArrayListExtra("mListSectionPos"); this.mListItems = intent.getStringArrayListExtra("mListItems"); this.mItems = intent.getStringArrayListExtra("mItems"); ArrayList<String> params = intent.getStringArrayListExtra("params"); mListItems.clear(); mListSectionPos.clear(); ArrayList<String> items = params; if (mItems.size() > 0) { // NOT forget to sort array Collections.sort(items); int i = 0; String prev_section = ""; while (i < items.size()) { String current_item = items.get(i).toString(); String current_section = current_item.substring(0, 1).toUpperCase(Locale.getDefault()); if (!prev_section.equals(current_section)) { mListItems.add(current_section); mListItems.add(current_item); // array list of section positions mListSectionPos.add(mListItems.indexOf(current_section)); prev_section = current_section; } else { mListItems.add(current_item); } i++; } } Intent resultIntent = new Intent(POPULATE_FILTER); resultIntent.putExtra("mListItems", mListItems); resultIntent.putExtra("mListSectionPos", mListSectionPos); LocalBroadcastManager.getInstance(this).sendBroadcast(resultIntent); }
Example 10
Source File: ListViewFilterActivity.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override public void onReceive(Context receiverContext, Intent receiverIntent) { mListItems = receiverIntent.getStringArrayListExtra("mListItems"); mListSectionPos = receiverIntent.getIntegerArrayListExtra("mListSectionPos"); if (mListItems.size() <= 0) { showEmptyText(mListView, mLoadingView, mEmptyView); } else { setListAdaptor(); showContent(mListView, mLoadingView, mEmptyView); } }
Example 11
Source File: SystemArticlesActivity.java From Yuan-WanAndroid with Apache License 2.0 | 5 votes |
/** * 获取一级知识Fragment传入的数据 */ private void getData() { Intent intent = getIntent(); mFirstSystemName = intent.getStringExtra(KEY_SYSTEM_FIRST_NAME); mSecondSystemNameList = intent.getStringArrayListExtra(KEY_SYSTEM_SECOND_NAME_LIST); mIdList = intent.getIntegerArrayListExtra(KEY_SYSTEM_SECOND_ID_LIST); }
Example 12
Source File: ClickerActivity.java From SmoothClicker with MIT License | 5 votes |
/** * Triggered when the activity results * @param requestCode - * @param resultCode - * @param data - */ @Override protected void onActivityResult( int requestCode, int resultCode, Intent data ){ switch ( requestCode ){ case SELECT_POINTS_ACTIVITY_RESULT_CODE: if ( resultCode == Activity.RESULT_OK ) { ArrayList<Integer> alp = data.getIntegerArrayListExtra(SELECT_POINTS_ACTIVITY_RESULT); handleMultiPointResult(alp); } break; default: break; } }
Example 13
Source File: WinActivity.java From privacy-friendly-ludo with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); if (prefs.getBoolean("keepScreenOn", true)) { // keep screen on getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } setContentView(R.layout.activity_win); ActionBar ab = getSupportActionBar(); if(ab != null) { ab.setDisplayHomeAsUpEnabled(true); // ab.setHomeAsUpIndicator(R.drawable.ic_close_black_24dp); } Intent old_intent = getIntent(); WinnerOrder = old_intent.getIntegerArrayListExtra("WinnerOrder"); rank_undefined = old_intent.getIntExtra("lastRank", 1); model = old_intent.getParcelableExtra("BoardModel"); players = model.getPlayers(); RecyclerView mPlayerList = (RecyclerView) findViewById(R.id.winDetailsList); // use this setting to improve performance if you know that changes // in content do not change the layout size of the RecyclerView RecyclerView.Adapter adapter = new RecyclerViewCollectionAdapter(); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext()); mPlayerList.setLayoutManager(mLayoutManager); mPlayerList.setItemAnimator(new DefaultItemAnimator()); mPlayerList.setAdapter(adapter); }
Example 14
Source File: AlarmClockActivity.java From SuntimesWidget with GNU General Public License v3.0 | 4 votes |
protected void handleIntent(Intent intent) { String param_action = intent.getAction(); intent.setAction(null); Uri param_data = intent.getData(); intent.setData(null); boolean selectItem = true; if (param_action != null) { if (param_action.equals(AlarmClock.ACTION_SET_ALARM)) { String param_label = intent.getStringExtra(AlarmClock.EXTRA_MESSAGE); int param_hour = intent.getIntExtra(AlarmClock.EXTRA_HOUR, -1); int param_minute = intent.getIntExtra(AlarmClock.EXTRA_MINUTES, -1); ArrayList<Integer> param_days = AlarmRepeatDialog.PREF_DEF_ALARM_REPEATDAYS; boolean param_vibrate = AlarmSettings.loadPrefVibrateDefault(this); Uri param_ringtoneUri = AlarmSettings.getDefaultRingtoneUri(this, AlarmClockItem.AlarmType.ALARM); if (Build.VERSION.SDK_INT >= 19) { param_vibrate = intent.getBooleanExtra(AlarmClock.EXTRA_VIBRATE, param_vibrate); String param_ringtoneUriString = intent.getStringExtra(AlarmClock.EXTRA_RINGTONE); if (param_ringtoneUriString != null) { param_ringtoneUri = (param_ringtoneUriString.equals(AlarmClock.VALUE_RINGTONE_SILENT) ? null : Uri.parse(param_ringtoneUriString)); } ArrayList<Integer> repeatOnDays = intent.getIntegerArrayListExtra(AlarmClock.EXTRA_DAYS); if (repeatOnDays != null) { param_days = repeatOnDays; } } SolarEvents param_event = SolarEvents.valueOf(intent.getStringExtra(AlarmClockActivity.EXTRA_SOLAREVENT), null); //Log.i(TAG, "ACTION_SET_ALARM :: " + param_label + ", " + param_hour + ", " + param_minute + ", " + param_event); addAlarm(AlarmClockItem.AlarmType.ALARM, param_label, param_event, param_hour, param_minute, param_vibrate, param_ringtoneUri, param_days); } else if (param_action.equals(ACTION_ADD_ALARM)) { //Log.d(TAG, "handleIntent: add alarm"); showAddDialog(AlarmClockItem.AlarmType.ALARM); } else if (param_action.equals(ACTION_ADD_NOTIFICATION)) { //Log.d(TAG, "handleIntent: add notification"); showAddDialog(AlarmClockItem.AlarmType.NOTIFICATION); } else if (param_action.equals(AlarmNotifications.ACTION_DELETE)) { //Log.d(TAG, "handleIntent: alarm deleted"); if (adapter != null && alarmList != null) { if (param_data != null) { final AlarmClockItem item = adapter.findItem(ContentUris.parseId(param_data)); if (item != null) { adapter.onAlarmDeleted(true, item, alarmList.getChildAt(adapter.getPosition(item))); selectItem = false; } } else { onClearAlarms(true); selectItem = false; } } } } long selectedID = intent.getLongExtra(EXTRA_SELECTED_ALARM, -1); if (selectItem && selectedID != -1) { Log.d(TAG, "handleIntent: selected id: " + selectedID); t_selectedItem = selectedID; setSelectedItem(t_selectedItem); } }
Example 15
Source File: ImUrlActivity.java From Zom-Android-XMPP with GNU General Public License v3.0 | 4 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent resultIntent) { if (resultCode == RESULT_OK) { if (requestCode == REQUEST_PICK_CONTACTS) { String username = resultIntent.getStringExtra(ContactsPickerActivity.EXTRA_RESULT_USERNAME); if (username != null) { long providerId = resultIntent.getLongExtra(ContactsPickerActivity.EXTRA_RESULT_PROVIDER, -1); long accountId = resultIntent.getLongExtra(ContactsPickerActivity.EXTRA_RESULT_ACCOUNT, -1); sendOtrInBand(username, providerId, accountId); startChat(providerId, accountId, username, true); } else { //send to multiple ArrayList<String> usernames = resultIntent.getStringArrayListExtra(ContactsPickerActivity.EXTRA_RESULT_USERNAMES); if (usernames != null) { ArrayList<Integer> providers = resultIntent.getIntegerArrayListExtra(ContactsPickerActivity.EXTRA_RESULT_PROVIDER); ArrayList<Integer> accounts = resultIntent.getIntegerArrayListExtra(ContactsPickerActivity.EXTRA_RESULT_ACCOUNT); if (providers != null && accounts != null) for (int i = 0; i < providers.size(); i++) { sendOtrInBand(usernames.get(i), providers.get(i), accounts.get(i)); } if (usernames.size() > 1) startActivity(new Intent(this,MainActivity.class)); else { startChat(providers.get(0), accounts.get(0), usernames.get(0), true); } } finish(); } } else if (requestCode == REQUEST_SIGNIN_ACCOUNT || requestCode == REQUEST_CREATE_ACCOUNT) { mHandlerRouter.postDelayed(new Runnable() { @Override public void run () { doOnCreate(); } }, 500); } } else { finish(); } }
Example 16
Source File: Main.java From currency with GNU General Public License v3.0 | 4 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Do nothing if cancelled if (resultCode != RESULT_OK) return; // Get index list from intent List<Integer> indexList = data.getIntegerArrayListExtra(CHOICE); // Add currencies from list for (int index : indexList) { // Don't add duplicates if (nameList.contains(CURRENCY_NAMES[index])) continue; flagList.add(CURRENCY_FLAGS[index]); nameList.add(CURRENCY_NAMES[index]); symbolList.add(CURRENCY_SYMBOLS[index]); longNameList.add(CURRENCY_LONGNAMES[index]); Double value = 1.0; try { value = (currentValue / convertValue) * valueMap.get(CURRENCY_NAMES[index]); } catch (Exception e) { } NumberFormat numberFormat = NumberFormat.getInstance(); numberFormat.setMinimumFractionDigits(digits); numberFormat.setMaximumFractionDigits(digits); String s = numberFormat.format(value); valueList.add(s); } // Get preferences SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); // Get editor SharedPreferences.Editor editor = preferences.edit(); // Get entries JSONArray nameArray = new JSONArray(nameList); JSONArray valueArray = new JSONArray(valueList); // Update preferences editor.putString(PREF_NAMES, nameArray.toString()); editor.putString(PREF_VALUES, valueArray.toString()); editor.apply(); adapter.notifyDataSetChanged(); }
Example 17
Source File: IntentUtil.java From Ticket-Analysis with MIT License | 4 votes |
public static ArrayList<Integer> getIntegerArrayListExtra(Intent intent, String name) { if (!hasIntent(intent) || !hasExtra(intent, name)) return null; return intent.getIntegerArrayListExtra(name); }
Example 18
Source File: ImUrlActivity.java From zom-android-matrix with Apache License 2.0 | 4 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent resultIntent) { if (resultCode == RESULT_OK) { if (requestCode == REQUEST_PICK_CONTACTS) { String username = resultIntent.getStringExtra(ContactsPickerActivity.EXTRA_RESULT_USERNAME); if (username != null) { long providerId = resultIntent.getLongExtra(ContactsPickerActivity.EXTRA_RESULT_PROVIDER, -1); long accountId = resultIntent.getLongExtra(ContactsPickerActivity.EXTRA_RESULT_ACCOUNT, -1); sendOtrInBand(username, providerId, accountId, null); startChat(providerId, accountId, username, true); } else { //send to multiple ArrayList<String> usernames = resultIntent.getStringArrayListExtra(ContactsPickerActivity.EXTRA_RESULT_USERNAMES); if (usernames != null) { ArrayList<Integer> providers = resultIntent.getIntegerArrayListExtra(ContactsPickerActivity.EXTRA_RESULT_PROVIDER); ArrayList<Integer> accounts = resultIntent.getIntegerArrayListExtra(ContactsPickerActivity.EXTRA_RESULT_ACCOUNT); if (providers != null && accounts != null) for (int i = 0; i < providers.size(); i++) { sendOtrInBand(usernames.get(i), providers.get(i), accounts.get(i), null); } if (usernames.size() > 1) startActivity(new Intent(this,MainActivity.class)); else { startChat(providers.get(0), accounts.get(0), usernames.get(0), true); } } finish(); } } else if (requestCode == REQUEST_SIGNIN_ACCOUNT || requestCode == REQUEST_CREATE_ACCOUNT) { mHandlerRouter.postDelayed(new Runnable() { @Override public void run () { doOnCreate(); } }, 500); } } else { finish(); } }