List of usage examples for android.os Bundle putLong
public void putLong(@Nullable String key, long value)
From source file:org.dvbviewer.controller.ui.fragments.ChannelEpg.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { if (getUserVisibleHint()) { super.onCreateContextMenu(menu, v, menuInfo); getActivity().getMenuInflater().inflate(R.menu.context_menu_epg, menu); MenuItem switchItem = menu.findItem(R.id.menuSwitch) .setVisible(URLUtil.isValidUrl(ServerConsts.DVBVIEWER_URL)); switchItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override/*from w ww .j a v a2 s.co m*/ public boolean onMenuItemClick(MenuItem item) { if (getUserVisibleHint()) { String switchRequest = ServerConsts.URL_SWITCH_COMMAND + mCHannel.getPosition(); DVBViewerCommand command = new DVBViewerCommand(switchRequest); Thread exexuterTHread = new Thread(command); exexuterTHread.start(); return true; } return false; } }); /** * Damn Hack for Tablets, onContextItemSelected is not called, * But the Dialog appears... */ if (UIUtils.isTablet(getActivity())) { menu.findItem(R.id.menuTimer).setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { if (getUserVisibleHint()) { Cursor c = mAdapter.getCursor(); c.moveToPosition(selectedPosition); Timer timer = cursorToTimer(c); TimerDetails timerdetails = TimerDetails.newInstance(); Bundle args = new Bundle(); args.putString(TimerDetails.EXTRA_TITLE, timer.getTitle()); args.putString(TimerDetails.EXTRA_CHANNEL_NAME, timer.getChannelName()); args.putLong(TimerDetails.EXTRA_CHANNEL_ID, timer.getChannelId()); args.putLong(TimerDetails.EXTRA_START, timer.getStart().getTime()); args.putLong(TimerDetails.EXTRA_END, timer.getEnd().getTime()); timerdetails.setArguments(args); timerdetails.show(getSherlockActivity().getSupportFragmentManager(), TimerDetails.class.getName()); return true; } return false; } }); } } }
From source file:com.github.gorbin.asne.twitter.TwitterSocialNetwork.java
/** * Check if user by id is friend of current user * @param userID user id that should be checked as friend of current user * @param onCheckIsFriendCompleteListener listener for checking friend request *///w ww .j a va 2 s. c o m @Override public void requestCheckIsFriend(String userID, OnCheckIsFriendCompleteListener onCheckIsFriendCompleteListener) { super.requestCheckIsFriend(userID, onCheckIsFriendCompleteListener); Bundle args = new Bundle(); try { args.putLong(RequestCheckIsFriendAsyncTask.PARAM_USER_ID, Long.parseLong(userID)); } catch (NumberFormatException e) { throw new SocialNetworkException("userID should be long number"); } executeRequest(new RequestCheckIsFriendAsyncTask(), args, REQUEST_CHECK_IS_FRIEND); }
From source file:com.github.gorbin.asne.twitter.TwitterSocialNetwork.java
/** * Follow friend by id to current user/*from w w w . ja v a2s . c o m*/ * @param userID id of user that should be invited * @param onRequestAddFriendCompleteListener listener for invite result */ @Override public void requestAddFriend(String userID, OnRequestAddFriendCompleteListener onRequestAddFriendCompleteListener) { super.requestAddFriend(userID, onRequestAddFriendCompleteListener); Bundle args = new Bundle(); try { args.putLong(RequestAddFriendAsyncTask.PARAM_USER_ID, Long.parseLong(userID)); } catch (NumberFormatException e) { throw new SocialNetworkException("userID should be long number"); } executeRequest(new RequestAddFriendAsyncTask(), args, REQUEST_ADD_FRIEND); }
From source file:com.github.gorbin.asne.twitter.TwitterSocialNetwork.java
/** * Remove follows by id from current user * @param userID user id that should be removed from friends * @param onRequestRemoveFriendCompleteListener listener to remove friend request response *//*from w w w. ja v a 2 s . c o m*/ @Override public void requestRemoveFriend(String userID, OnRequestRemoveFriendCompleteListener onRequestRemoveFriendCompleteListener) { super.requestRemoveFriend(userID, onRequestRemoveFriendCompleteListener); Bundle args = new Bundle(); try { args.putLong(RequestRemoveFriendAsyncTask.PARAM_USER_ID, Long.parseLong(userID)); } catch (NumberFormatException e) { throw new SocialNetworkException("userID should be long number"); } executeRequest(new RequestRemoveFriendAsyncTask(), args, REQUEST_REMOVE_FRIEND); }
From source file:com.codetroopers.betterpickers.calendardatepicker.CalendarDatePickerDialogFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(KEY_SELECTED_YEAR, mCalendar.get(Calendar.YEAR)); outState.putInt(KEY_SELECTED_MONTH, mCalendar.get(Calendar.MONTH)); outState.putInt(KEY_SELECTED_DAY, mCalendar.get(Calendar.DAY_OF_MONTH)); outState.putInt(KEY_WEEK_START, mWeekStart); outState.putLong(KEY_DATE_START, mMinDate.getDateInMillis()); outState.putLong(KEY_DATE_END, mMaxDate.getDateInMillis()); outState.putInt(KEY_CURRENT_VIEW, mCurrentView); outState.putInt(KEY_THEME, mStyleResId); int listPosition = -1; if (mCurrentView == MONTH_AND_DAY_VIEW) { listPosition = mDayPickerView.getMostVisiblePosition(); } else if (mCurrentView == YEAR_VIEW) { listPosition = mYearPickerView.getFirstVisiblePosition(); outState.putInt(KEY_LIST_POSITION_OFFSET, mYearPickerView.getFirstPositionOffset()); }//w ww. j a va 2 s. co m outState.putInt(KEY_LIST_POSITION, listPosition); outState.putSparseParcelableArray(KEY_DISABLED_DAYS, mDisabledDays); }
From source file:com.github.gorbin.asne.twitter.TwitterSocialNetwork.java
/** * Request {@link com.github.gorbin.asne.core.persons.SocialPerson} by user id * @param userID id of Twitter user// www .ja v a 2 s . co m * @param onRequestSocialPersonCompleteListener listener for {@link com.github.gorbin.asne.core.persons.SocialPerson} request */ @Override public void requestSocialPerson(String userID, OnRequestSocialPersonCompleteListener onRequestSocialPersonCompleteListener) { super.requestSocialPerson(userID, onRequestSocialPersonCompleteListener); if (TextUtils.isEmpty(userID)) { throw new SocialNetworkException("userID can't be null or empty"); } Bundle args = new Bundle(); try { args.putLong(RequestGetSocialPersonAsyncTask.PARAM_USER_ID, Long.parseLong(userID)); } catch (NumberFormatException e) { throw new SocialNetworkException("userID should be long number"); } executeRequest(new RequestGetSocialPersonAsyncTask(), args, REQUEST_GET_PERSON); }
From source file:cat.wuyingren.rorhelper.activities.MainActivity.java
private void showManageSenatorDialog(boolean kill, boolean statesman) { if (isActionPossible()) { ManageSenatorDialogFragment dialog = new ManageSenatorDialogFragment(); Bundle args = new Bundle(); args.putBoolean(ManageSenatorDialogFragment.ARG_MODE, kill); args.putBoolean(ManageSenatorDialogFragment.ARG_TYPE, statesman); args.putLong(ManageSenatorDialogFragment.ARG_GAMEID, currentGameId); if (!kill) { String[] keys;/* w w w. j ava 2s. c o m*/ ArrayList<String> values = new ArrayList<String>(); if (statesman) { keys = new String[statesmanMap.size()]; keys = statesmanMap.keySet().toArray(keys); for (String key : keys) { values.add(statesmanMap.get(key).getName()); } } else { keys = new String[senatorMap.size()]; keys = senatorMap.keySet().toArray(keys); for (String key : keys) { values.add(senatorMap.get(key).getName()); } } args.putStringArray(ManageSenatorDialogFragment.ARG_ARRAY, keys); args.putStringArrayList(ManageSenatorDialogFragment.ARG_VALUES, values); } dialog.setArguments(args); dialog.show(getSupportFragmentManager(), ""); } }
From source file:biz.bokhorst.bpt.BPTService.java
private void sendLocation(Location location) { Bundle b = new Bundle(); b.putDouble("Latitude", location.getLatitude()); b.putDouble("Longitude", location.getLongitude()); b.putDouble("Altitude", location.getAltitude()); b.putFloat("Speed", location.getSpeed()); b.putFloat("Accuracy", location.getAccuracy()); b.putString("Provider", location.getProvider()); b.putLong("Time", location.getTime()); sendMessage(BackPackTrack.MSG_LOCATION, b); }
From source file:com.quarterfull.newsAndroid.NewsReaderListActivity.java
private void safeInstanceState(Bundle outState) { NewsReaderDetailFragment ndf = getNewsReaderDetailFragment(); if (ndf != null) { outState.putLong(OPTIONAL_FOLDER_ID, ndf.getIdFeed() == null ? ndf.getIdFolder() : ndf.getIdFeed()); outState.putBoolean(IS_FOLDER_BOOLEAN, ndf.getIdFeed() == null); outState.putLong(ID_FEED_STRING, ndf.getIdFeed() != null ? ndf.getIdFeed() : ndf.getIdFolder()); NewsListRecyclerAdapter adapter = (NewsListRecyclerAdapter) ndf.getRecyclerView().getAdapter(); if (adapter != null) { outState.putInt(LIST_ADAPTER_TOTAL_COUNT, adapter.getTotalItemCount()); outState.putInt(LIST_ADAPTER_PAGE_COUNT, adapter.getCachedPages()); }/* www . j ava2s. c o m*/ } }
From source file:com.nearnotes.NoteEdit.java
/** * Populates the checkboxes on the side by analyzing the current text from * the body of the note./*from w w w. j a va 2 s . co m*/ * * @param currentString * the current body of the note. * */ public ArrayList<NoteRow> populateBoxes(String currentString) { // Load ArrayList<String> mLines with the current bodytext seperated into seperate lines. mLines = Arrays.asList(currentString.split(System.getProperty("line.separator"))); // row counter to determine what the current line number is for the for loop int row = 0; // realRow counter to determine what line of text in the actual display we are on // used to get the number of characters on each line int realRow = 0; int activeRow = 0; int finishedCount = 0; ArrayList<NoteRow> tempRealRow = new ArrayList<NoteRow>(); for (String line : mLines) { NoteRow temp = new NoteRow(0, 1, row); // Create a note row object with rowType of 0 (invisible), lineSize of 1 and the current row number if (!line.isEmpty()) { activeRow++; temp.setType(1); // Set the NoteRow object to 1 (visible) // Determine how many lines the note takes up int internalCounter = 0; try { float lineLength = (float) line.length(); for (int k = 0; (lineLength / (getFloatLineEnd(realRow + k) - getFloatLineEnd(realRow - 1))) > 1; k++) { internalCounter++; } } catch (NullPointerException e) { e.printStackTrace(); } // Detemine if the note is supposed to be checked and set the NoteRow object to 2 (Checked) if (line.startsWith("[X]")) { finishedCount++; int spanstart = 0; StrikethroughSpan STRIKE_THROUGH_SPAN = new StrikethroughSpan(); Spannable spannable = (Spannable) mBodyText.getText(); // TableRow checkRow1 = (TableRow) View.inflate(getActivity(), R.layout.table_row, null); for (int j = 0; j < row; j++) { spanstart += mLines.get(j).length() + 1; } Object spansToRemove[] = spannable.getSpans(spanstart, spanstart + mLines.get(row).length(), Object.class); for (Object span : spansToRemove) { if (span instanceof CharacterStyle) spannable.removeSpan(span); } spannable.setSpan(STRIKE_THROUGH_SPAN, spanstart, spanstart + mLines.get(row).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); temp.setType(2); } temp.setSize(1 + internalCounter); // Set the amount of rows the note takes up realRow = realRow + internalCounter; // Determine the real line on the display text we are on } tempRealRow.add(temp); // NoteRow object has been finalized - add to the ListArray<NoteRow> realRow++; // Increase the noteRow and the displayRow for the next line row++; } if (finishedCount == activeRow && finishedCount != 0) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); boolean useListPref = sharedPref.getBoolean("pref_key_use_checklist_default", false); String stringlistPref = sharedPref.getString("pref_key_checklist_listPref", "2"); int listPref = Integer.parseInt(stringlistPref); ChecklistDialog newFragment = new ChecklistDialog(); if (mRowId == null) { saveState(); } Bundle args = new Bundle(); args.putLong("_id", mRowId); args.putBoolean("useDefault", useListPref); args.putInt("listPref", listPref); newFragment.setArguments(args); if (listPref == 2 && useListPref) { return tempRealRow; } if (getFragmentManager().findFragmentByTag("MyDialog") == null) { newFragment.show(getFragmentManager(), "MyDialog"); } } return tempRealRow; }