List of usage examples for android.os Bundle getLong
public long getLong(String key, long defaultValue)
From source file:com.coinblesk.client.KeyboardFragment.java
@Override public void onActivityCreated(Bundle inState) { super.onActivityCreated(inState); if (inState != null) { if (inState.containsKey(KEY_AMOUNT_BTC)) { amountBTC = inState.getLong(KEY_AMOUNT_BTC, 0); }/*from ww w .j a va 2s. com*/ if (inState.containsKey(KEY_AMOUNT_FIAT)) { amountFiat = inState.getLong(KEY_AMOUNT_FIAT, 0); } if (inState.containsKey(KEY_IS_BITCOIN_LARGE_AMOUNT)) { isBitcoinPrimary = inState.getBoolean(KEY_IS_BITCOIN_LARGE_AMOUNT, true); } if (inState.containsKey(KEY_DIGIT_COUNTER)) { digitCounter = inState.getInt(KEY_DIGIT_COUNTER, 0); } if (inState.containsKey(KEY_IS_BITCOIN_LARGE_AMOUNT)) { dotAtPos = inState.getInt(KEY_DOT_AT_POS, -1); } } }
From source file:bikebadger.RideFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(Constants.APP.TAG, "RideFragment.onCreate()"); //setRetainInstance(true); mRideManager = RideManager.get(getActivity()); Log.d(Constants.APP.TAG, "mRideManager set = RideManager.get(" + getActivity() + ")"); setHasOptionsMenu(true);/* w w w.java 2s . co m*/ // check for a Ride ID as an argument, and find the run Bundle args = getArguments(); if (args != null) { long runId = args.getLong(ARG_RUN_ID, -1); Log.d(Constants.APP.TAG, "RideFragment.onCreate() runId=" + runId); if (runId != -1) { LoaderManager lm = getLoaderManager(); lm.initLoader(LOAD_RUN, args, new RunLoaderCallbacks()); lm.initLoader(LOAD_LOCATION, args, new LocationLoaderCallbacks()); } } // Initialize the TextToSpeech Engine... // TODO this engine may not exist. Provide the ability to run without it. Intent checkTTSIntent = new Intent(); checkTTSIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); if (checkTTSIntent.resolveActivity(mRideManager.mAppContext.getPackageManager()) != null) { startActivityForResult(checkTTSIntent, MY_DATA_CHECK_CODE_REQUEST); } else { Log.d(Constants.APP.TAG, "Could not find TTS Intent"); MyToast.Show(getActivity(), "Could not find Text To Speech Service", Color.RED); AlertDialog ad1 = new AlertDialog.Builder(getActivity()).create(); ad1.setCancelable(false); ad1.setTitle("Text To Speech Engine Not Found"); ad1.setMessage( "There was a problem finding the Text To Speech Engine. Make sure it's install properly under Language and Input Settings."); ad1.setButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); ad1.show(); } if (mRideManager.mLoadLastGPXFile) { Log.d(Constants.APP.TAG, "mLoadLastGPXFile=" + mRideManager.mLoadLastGPXFile); Log.d(Constants.APP.TAG, "mCurrentGPXPath=" + mRideManager.mCurrentGPXPath); OpenGPXFileOnNewThreadWithDialog(mRideManager.mCurrentGPXPath); } if (!mRideManager.IsGPSEnabled()) { ShowAlertMessageNoGps(); } // keep the screen on so it doesn't time out and turn dark getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }
From source file:com.dwdesign.tweetings.fragment.UserListDetailsFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { mService = getApplication().getServiceInterface(); mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE); super.onActivityCreated(savedInstanceState); final Bundle args = getArguments(); long account_id = -1, user_id = -1; int list_id = -1; String screen_name = null, list_name = null; if (args != null) { account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1); user_id = args.getLong(INTENT_KEY_USER_ID, -1); list_id = args.getInt(INTENT_KEY_LIST_ID, -1); list_name = args.getString(INTENT_KEY_LIST_NAME); screen_name = args.getString(INTENT_KEY_SCREEN_NAME); }/* ww w . j av a 2s. c o m*/ mProfileImageLoader = getApplication().getImageLoaderWrapper(); mAdapter = new ListActionAdapter(getActivity()); mAdapter.add(new ListTimelineAction()); mAdapter.add(new ListMembersAction()); mAdapter.add(new ListSubscribersAction()); mProfileImageContainer.setOnClickListener(this); mProfileImageContainer.setOnLongClickListener(this); mNameContainer.setOnClickListener(this); mNameContainer.setOnLongClickListener(this); mFollowMoreButton.setOnClickListener(this); mRetryButton.setOnClickListener(this); setListAdapter(null); mListView = getListView(); mListView.addHeaderView(mHeaderView, null, false); mListView.setOnItemClickListener(this); mListView.setOnItemLongClickListener(this); setListAdapter(mAdapter); getUserListInfo(true, account_id, list_id, list_name, user_id, screen_name); }
From source file:com.abcvoipsip.ui.account.AccountsEditListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); //getListView().setSelector(R.drawable.transparent); getListView().setCacheColorHint(Color.TRANSPARENT); // View management View detailsFrame = getActivity().findViewById(R.id.details); dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; if (savedInstanceState != null) { // Restore last state for checked position. curCheckPosition = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID); //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD); }// www .j a va2s . c om AccountsEditListAdapter adapter = new AccountsEditListAdapter(getActivity(), null); adapter.setOnCheckedRowListener(this); //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container)); //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE); setListAdapter(adapter); registerForContextMenu(getListView()); // Prepare the loader. Either re-connect with an existing one, // or start a new one. getLoaderManager().initLoader(0, null, this); getListView().setVerticalFadingEdgeEnabled(true); if (dualPane) { // In dual-pane mode, the list view highlights the selected item. Log.d("lp", "dual pane mode"); getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); //getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT); getListView().setVerticalScrollBarEnabled(false); getListView().setFadingEdgeLength(50); updateCheckedItem(); // Make sure our UI is in the correct state. //showDetails(curCheckPosition, curCheckWizard); } else { //getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT); getListView().setVerticalScrollBarEnabled(true); getListView().setFadingEdgeLength(100); } }
From source file:cz.maresmar.sfm.view.guide.WelcomeActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); //noinspection WrongConstant mMaxFragmentId = savedInstanceState.getInt(MAX_FRAGMENT_ID, WELCOME_FRAGMENT_ID); mViewPager.setCurrentItem(savedInstanceState.getInt(PAGE_ID, WELCOME_FRAGMENT_ID), false); mAdvSettings = savedInstanceState.getBoolean(ADVANCED_SETTINGS, false); mUserUri = savedInstanceState.getParcelable(USER_URI); mValidatedCredentialId = savedInstanceState.getLong(VALIDATED_CREDENTIAL_ID, -1); mSwipeRefreshLayout.setRefreshing(savedInstanceState.getBoolean(REFRESHING)); }
From source file:cz.maresmar.sfm.service.plugin.sync.SyncHandler.java
/** * Start the sync with given actions/*from w w w. j av a2s. c om*/ * * @param action Action to be done * @param extras Action's parameters * @return {@code true} if the action was successful, {@code false} otherwise */ boolean startAction(@Action int action, @NonNull Bundle extras) { broadcastStart(); boolean successful; try { switch (action) { case ACTION_FULL_SYNC: startPlugins(ALL_TASKS, null, null); break; case ACTION_CHANGES_SYNC: startPlugins(TASKS_FOR_CHANGES_SYNC, null, null); break; case ACTION_REMAINING_SYNC: { final long userId = extras.getLong(EXTRA_USER_ID, UNKNOWN_ID); startRemainingSync(userId); break; } default: { Timber.e("Unknown action %d", action); // As there cold be more important don't lost other tasks in queue, crash only in debug if (BuildConfig.DEBUG) { throw new IllegalArgumentException("Unknown action " + action); } } } // Give plugins some time to make it done try { int pluginsTimeout = Integer.valueOf(mPrefs.getString(SettingsContract.PLUGINS_TIMEOUT, SettingsContract.PLUGINS_TIMEOUT_DEFAULT)); boolean doneInTime = mRemainingResultsLatch.await(pluginsTimeout, java.util.concurrent.TimeUnit.SECONDS); if (!doneInTime) { mWorstResult = RESULT_PLUGIN_TIMEOUT; } } catch (InterruptedException e) { Timber.e("Waiting to plugins was interrupted"); } // Updates portals for next start if (mPrefs.getBoolean(SettingsContract.UPDATE_PORTALS_AUTOMATICALLY, SettingsContract.UPDATE_PORTALS_AUTOMATICALLY_DEFAULT)) { PortalsUpdateService.handleActionUpdate(mContext); } } finally { // Check actions only if I had an connection if (mWorstResult != BroadcastContract.RESULT_IO_EXCEPTION && mWorstResult != BroadcastContract.RESULT_PORTAL_TEMPORALLY_INACCESSIBLE) { // Check actions ActionUtils.deleteConflictFailedActions(mContext); ActionUtils.checkActionResults(mContext); // Save time to settings mPrefs.edit().putLong(SettingsContract.LAST_DONE_SYNC, System.currentTimeMillis()).apply(); successful = true; } else { successful = false; } // Send broadcast broadcastResults(mWorstResult); } return successful; }
From source file:com.csipsimple.ui.account.AccountsEditListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView lv = getListView();//from w w w . j a v a2 s.co m //getListView().setSelector(R.drawable.transparent); lv.setCacheColorHint(Color.TRANSPARENT); // View management View detailsFrame = getActivity().findViewById(R.id.details); dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; if (savedInstanceState != null) { // Restore last state for checked position. curCheckPosition = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID); //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD); } setListShown(false); if (mAdapter == null) { if (mHeaderView != null) { lv.addHeaderView(mHeaderView, null, true); } mAdapter = new AccountsEditListAdapter(getActivity(), null); mAdapter.setOnCheckedRowListener(this); //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container)); //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE); setListAdapter(mAdapter); registerForContextMenu(lv); // Prepare the loader. Either re-connect with an existing one, // or start a new one. getLoaderManager().initLoader(0, null, this); lv.setVerticalFadingEdgeEnabled(true); } if (dualPane) { // In dual-pane mode, the list view highlights the selected item. Log.d("lp", "dual pane mode"); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); //lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT); lv.setVerticalScrollBarEnabled(false); lv.setFadingEdgeLength(50); updateCheckedItem(); // Make sure our UI is in the correct state. //showDetails(curCheckPosition, curCheckWizard); } else { //getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT); lv.setVerticalScrollBarEnabled(true); lv.setFadingEdgeLength(100); } }
From source file:com.fututel.ui.account.AccountsEditListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView lv = getListView();/*from w w w. j a va 2 s. c o m*/ //getListView().setSelector(R.drawable.transparent); lv.setCacheColorHint(Color.TRANSPARENT); // View management View detailsFrame = getActivity().findViewById(R.id.details); dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; if (savedInstanceState != null) { // Restore last state for checked position. curCheckPosition = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID); //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD); } setListShown(false); if (mAdapter == null) { if (mHeaderView != null) { // lv.addHeaderView(mHeaderView , null, true);//rangdong } mAdapter = new AccountsEditListAdapter(getActivity(), null); mAdapter.setOnCheckedRowListener(this); //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container)); //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE); setListAdapter(mAdapter); registerForContextMenu(lv); // Prepare the loader. Either re-connect with an existing one, // or start a new one. getLoaderManager().initLoader(0, null, this); lv.setVerticalFadingEdgeEnabled(true); } if (dualPane) { // In dual-pane mode, the list view highlights the selected item. Log.d("lp", "dual pane mode"); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); //lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT); lv.setVerticalScrollBarEnabled(false); lv.setFadingEdgeLength(50); updateCheckedItem(); // Make sure our UI is in the correct state. //showDetails(curCheckPosition, curCheckWizard); } else { //getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT); lv.setVerticalScrollBarEnabled(true); lv.setFadingEdgeLength(100); } }
From source file:com.digitalarx.android.ui.activity.FileActivity.java
/** * Loads the ownCloud {@link Account} and main {@link OCFile} to be handled by the instance of * the {@link FileActivity}.//from w w w.ja v a 2s . c o m * * Grants that a valid ownCloud {@link Account} is associated to the instance, or that the user * is requested to create a new one. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = new Handler(); mFileOperationsHelper = new FileOperationsHelper(this); Account account; if (savedInstanceState != null) { account = savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT); mFile = savedInstanceState.getParcelable(FileActivity.EXTRA_FILE); mFromNotification = savedInstanceState.getBoolean(FileActivity.EXTRA_FROM_NOTIFICATION); mFileOperationsHelper .setOpIdWaitingFor(savedInstanceState.getLong(KEY_WAITING_FOR_OP_ID, Long.MAX_VALUE)); } else { account = getIntent().getParcelableExtra(FileActivity.EXTRA_ACCOUNT); mFile = getIntent().getParcelableExtra(FileActivity.EXTRA_FILE); mFromNotification = getIntent().getBooleanExtra(FileActivity.EXTRA_FROM_NOTIFICATION, false); } setAccount(account, savedInstanceState != null); mOperationsServiceConnection = new OperationsServiceConnection(); bindService(new Intent(this, OperationsService.class), mOperationsServiceConnection, Context.BIND_AUTO_CREATE); mDownloadServiceConnection = newTransferenceServiceConnection(); if (mDownloadServiceConnection != null) { bindService(new Intent(this, FileDownloader.class), mDownloadServiceConnection, Context.BIND_AUTO_CREATE); } mUploadServiceConnection = newTransferenceServiceConnection(); if (mUploadServiceConnection != null) { bindService(new Intent(this, FileUploader.class), mUploadServiceConnection, Context.BIND_AUTO_CREATE); } }
From source file:cz.maresmar.sfm.view.MainActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mSelectedUserId = savedInstanceState.getLong(ARG_USER_ID, SettingsContract.LAST_USER_UNKNOWN); mSelectedFragmentId = savedInstanceState.getLong(ARG_FRAGMENT_ID, SettingsContract.LAST_FRAGMENT_UNKNOWN); setTitle(savedInstanceState.getCharSequence(ARG_TITLE)); mIsRefreshing = savedInstanceState.getBoolean(ARG_REFRESHING); mSwipeRefreshLayout.setRefreshing(mIsRefreshing); }