List of usage examples for android.content Intent getSerializableExtra
public Serializable getSerializableExtra(String name)
From source file:com.mycelium.wallet.activity.send.SendMainActivity.java
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { if (requestCode == SCAN_RESULT_CODE) { if (resultCode != RESULT_OK) { if (intent != null) { String error = intent.getStringExtra(ScanActivity.RESULT_ERROR); if (error != null) { Toast.makeText(this, error, Toast.LENGTH_LONG).show(); }//from w ww . ja va2 s.com } } else { ScanActivity.ResultType type = (ScanActivity.ResultType) intent .getSerializableExtra(ScanActivity.RESULT_TYPE_KEY); if (type == ScanActivity.ResultType.PRIVATE_KEY) { InMemoryPrivateKey key = ScanActivity.getPrivateKey(intent); _receivingAddress = key.getPublicKey().toAddress(_mbwManager.getNetwork()); } else if (type == ScanActivity.ResultType.ADDRESS) { _receivingAddress = ScanActivity.getAddress(intent); } else if (type == ScanActivity.ResultType.URI) { BitcoinUri uri = ScanActivity.getUri(intent); _receivingAddress = uri.address; _transactionLabel = uri.label; if (uri.amount != null) { //we set the amount to the one contained in the qr code, even if another one was entered previously if (_amountToSend != null && _amountToSend > 0) { Toast.makeText(this, R.string.amount_changed, Toast.LENGTH_LONG).show(); } _amountToSend = uri.amount; } } else { throw new IllegalStateException("Unexpected result type from scan: " + type.toString()); } } } else if (requestCode == ADDRESS_BOOK_RESULT_CODE && resultCode == RESULT_OK) { // Get result from address chooser String s = Preconditions.checkNotNull(intent.getStringExtra(AddressBookFragment.ADDRESS_RESULT_NAME)); String result = s.trim(); // Is it really an address? Address address = Address.fromString(result, _mbwManager.getNetwork()); if (address == null) { return; } _receivingAddress = address; } else if (requestCode == MANUAL_ENTRY_RESULT_CODE && resultCode == RESULT_OK) { Address address = Preconditions .checkNotNull((Address) intent.getSerializableExtra(ManualAddressEntry.ADDRESS_RESULT_NAME)); _receivingAddress = address; } else if (requestCode == GET_AMOUNT_RESULT_CODE && resultCode == RESULT_OK) { // Get result from address chooser _amountToSend = Preconditions.checkNotNull((Long) intent.getSerializableExtra("amountToSend")); } else { // We didn't like what we got, bail } _transactionStatus = tryCreateUnsignedTransaction(); updateUi(); }
From source file:com.retroteam.studio.retrostudio.EditorLandscape.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_editor_landscape); //get display size Display display = getWindowManager().getDefaultDisplay(); display.getSize(displaysize);//from ww w . j av a 2s. c o m //check where we're coming from, if we have an intent if (getIntent().getStringExtra("SourceActivity") != null && getIntent() != null) { Intent intent = getIntent(); if (intent.getStringExtra("SourceActivity").equals("MainActivity")) { ProjectWrapper projwrapper = (ProjectWrapper) intent.getSerializableExtra("project"); if (projwrapper != null) { // We are loading the project from a file. PROJECT_TITLE = projwrapper.title; PROJECT_TEMPO = projwrapper.tempo; TS_BEATS = projwrapper.tSig.beats(); TS_NOTES = projwrapper.tSig.notes(); theproject = projwrapper.project; ArrayList<MeasureTagGroup> mTagList = projwrapper.mTagList; //redraw project redrawMe(theproject); //re-apply measure tags for (int m = 0; m < mTagList.size(); m++) { ImageView measure = (ImageView) findMeasureByCoords(mTagList.get(m).row, mTagList.get(m).column); measure.setTag(R.id.TAG_ROW, mTagList.get(m).row); measure.setTag(R.id.TAG_COLUMN, mTagList.get(m).column); measure.setTag(R.bool.TAG_HASNOTES, mTagList.get(m).hasNotes); measure.setTag(R.id.TAG_GUISNAP, mTagList.get(m).guiSNAP); measure.setTag(R.id.TAG_FILLED_NOTES, mTagList.get(m).filledNotes); if (mTagList.get(m).hasNotes) { measure.setImageResource(R.drawable.measure_new_filled); } } Toast.makeText(this, "Opened project " + PROJECT_TITLE, Toast.LENGTH_SHORT).show(); } else { // We're making a new project or coming from the main menu Toast.makeText(this, "Created new project.", Toast.LENGTH_SHORT).show(); TS_BEATS = intent.getIntExtra("TimeSigBeats", 4); TS_NOTES = intent.getIntExtra("TimeSigNotes", 4); theproject = new Project(new TimeSignature(TS_BEATS, TS_NOTES)); } } } // Put the project title in the actionbar. if (PROJECT_TITLE != "") { setupActionBar("'" + PROJECT_TITLE + "' Project Editor (" + Integer.toString(TS_BEATS) + "/" + Integer.toString(TS_NOTES) + " Time)"); } else { setupActionBar( "Project Editor (" + Integer.toString(TS_BEATS) + "/" + Integer.toString(TS_NOTES) + " Time)"); } //add buttons to the floating action menu FloatingActionsMenu menuAddTrack = (FloatingActionsMenu) findViewById(R.id.add_track_menu); FloatingActionButton addSineTrack = new FloatingActionButton(getBaseContext()); addSineTrack.setTitle("Add Sine Wave Track"); addSineTrack.setIcon(R.drawable.sine_wave); addSineTrack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SineWave wave = new SineWave(); theproject.addTrack(wave); addTrack(R.drawable.sine_wave, false); } }); FloatingActionButton addSquareTrack = new FloatingActionButton(getBaseContext()); addSquareTrack.setTitle("Add Square Wave Track"); addSquareTrack.setIcon(R.drawable.square_wave); addSquareTrack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SquareWave wave = new SquareWave(); theproject.addTrack(wave); addTrack(R.drawable.square_wave, false); } }); FloatingActionButton addNoiseTrack = new FloatingActionButton(getBaseContext()); addNoiseTrack.setTitle("Add Noise Wave Track"); addNoiseTrack.setIcon(R.drawable.noise_wave); addNoiseTrack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { NoiseWave wave = new NoiseWave(); theproject.addTrack(wave); addTrack(R.drawable.noise_wave, false); } }); FloatingActionButton addSawTrack = new FloatingActionButton(getBaseContext()); addSawTrack.setTitle("Add Saw Wave Track"); addSawTrack.setIcon(R.drawable.saw_wave); addSawTrack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SawtoothWave wave = new SawtoothWave(); theproject.addTrack(wave); addTrack(R.drawable.saw_wave, false); } }); FloatingActionButton addInvSawTrack = new FloatingActionButton(getBaseContext()); addInvSawTrack.setTitle("Add Inverse Saw Wave Track"); addInvSawTrack.setIcon(R.drawable.inv_saw_wave); addInvSawTrack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { InverseSawtoothWave wave = new InverseSawtoothWave(); theproject.addTrack(wave); addTrack(R.drawable.inv_saw_wave, false); } }); FloatingActionButton addTriangleTrack = new FloatingActionButton(getBaseContext()); addTriangleTrack.setTitle("Add Triangle Wave Track"); addTriangleTrack.setIcon(R.drawable.triangle_wave); addTriangleTrack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TriangleWave wave = new TriangleWave(); theproject.addTrack(wave); addTrack(R.drawable.triangle_wave, false); } }); menuAddTrack.addButton(addSineTrack); menuAddTrack.addButton(addSquareTrack); menuAddTrack.addButton(addNoiseTrack); menuAddTrack.addButton(addSawTrack); menuAddTrack.addButton(addInvSawTrack); menuAddTrack.addButton(addTriangleTrack); // Set the project tempo. theproject.tempo(PROJECT_TEMPO); }
From source file:com.nextgis.maplibui.service.WalkEditService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { String action = intent.getAction(); if (!TextUtils.isEmpty(action)) { switch (action) { case ACTION_STOP: mGeometry = null;// www . j a va2 s . c o m mLayerId = Constants.NOT_FOUND; stopSelf(); break; case ACTION_START: int layerId = intent.getIntExtra(ConstantsUI.KEY_LAYER_ID, Constants.NOT_FOUND); if (mLayerId == layerId) { // we are already running track record sendGeometryBroadcast(); } else { mLayerId = layerId; mGeometry = (GeoGeometry) intent.getSerializableExtra(ConstantsUI.KEY_GEOMETRY); if (mGeometry instanceof GeoLinearRing) { GeoLinearRing ring = (GeoLinearRing) mGeometry; if (ring.isClosed()) ring.remove(ring.getPointCount() - 1); } mTargetActivity = intent.getStringExtra(ConstantsUI.TARGET_CLASS); startWalkEdit(); SharedPreferences.Editor edit = mSharedPreferencesTemp.edit(); edit.putInt(ConstantsUI.KEY_LAYER_ID, mLayerId); edit.putString(ConstantsUI.KEY_GEOMETRY, mGeometry.toWKT(true)); edit.putString(ConstantsUI.TARGET_CLASS, mTargetActivity); edit.commit(); } break; } } } else { mLayerId = mSharedPreferencesTemp.getInt(ConstantsUI.KEY_LAYER_ID, Constants.NOT_FOUND); mGeometry = GeoGeometryFactory.fromWKT(mSharedPreferencesTemp.getString(ConstantsUI.KEY_GEOMETRY, ""), GeoConstants.CRS_WEB_MERCATOR); mTargetActivity = mSharedPreferencesTemp.getString(ConstantsUI.TARGET_CLASS, ""); startWalkEdit(); } return START_STICKY; }
From source file:com.orangelabs.rcs.ri.messaging.chat.group.GroupChatView.java
@Override public boolean processIntent(Intent intent) { String action = intent.getAction(); if (LogUtils.isActive) { Log.d(LOGTAG, "processIntent: " + action); }// w ww. ja v a 2 s.c o m String oldChatId = mChatId; try { switch ((GroupChatMode) intent.getSerializableExtra(EXTRA_MODE)) { case OUTGOING: /* Initiate a Group Chat: Get subject */ mSubject = intent.getStringExtra(GroupChatView.EXTRA_SUBJECT); updateGroupChatViewTitle(mSubject); /* Get the list of participants */ ContactUtil contactUtil = ContactUtil.getInstance(this); List<String> contacts = intent.getStringArrayListExtra(GroupChatView.EXTRA_PARTICIPANTS); if (contacts == null || contacts.isEmpty()) { showMessageThenExit(R.string.label_invalid_contacts); return false; } for (String contact : contacts) { mParticipants.add(contactUtil.formatContact(contact)); } if (mParticipants.isEmpty()) { showMessageThenExit(R.string.label_invalid_contacts); return false; } return initiateGroupChat(oldChatId == null); case OPEN: /* Open an existing session from the history log */ mChatId = intent.getStringExtra(GroupChatIntent.EXTRA_CHAT_ID); mGroupChat = mChatService.getGroupChat(mChatId); if (mGroupChat == null) { if (LogUtils.isActive) { Log.e(LOGTAG, "Groupchat not found for Id=".concat(mChatId)); } showMessageThenExit(R.string.label_session_not_found); return false; } setCursorLoader(oldChatId == null); sChatIdOnForeground = mChatId; mSubject = mGroupChat.getSubject(); updateGroupChatViewTitle(mSubject); /* Set list of participants */ mParticipants = mGroupChat.getParticipants().keySet(); if (LogUtils.isActive) { Log.i(LOGTAG, "processIntent chatId=" + mChatId + " subject='" + mSubject + "'"); } return true; case INCOMING: String rxChatId = intent.getStringExtra(GroupChatIntent.EXTRA_CHAT_ID); if (GroupChatIntent.ACTION_NEW_GROUP_CHAT_MESSAGE.equals(action)) { String rxMsgId = intent.getStringExtra(GroupChatIntent.EXTRA_MESSAGE_ID); mChatService.markMessageAsRead(rxMsgId); } mChatId = rxChatId; mGroupChat = mChatService.getGroupChat(mChatId); if (mGroupChat == null) { showMessageThenExit(R.string.label_session_not_found); return false; } setCursorLoader(oldChatId == null); sChatIdOnForeground = mChatId; ContactId contact = mGroupChat.getRemoteContact(); mSubject = mGroupChat.getSubject(); updateGroupChatViewTitle(mSubject); mParticipants = mGroupChat.getParticipants().keySet(); /* Display accept/reject dialog */ if (GroupChat.State.INVITED == mGroupChat.getState()) { displayAcceptRejectDialog(contact); } if (LogUtils.isActive) { Log.d(LOGTAG, "New group chat for chatId ".concat(mChatId)); } return true; } } catch (RcsServiceException e) { showExceptionThenExit(e); } return false; }
From source file:org.leopub.mat.service.MessageService.java
@Override protected void onHandleIntent(Intent intent) { Logger.i(TAG, "onHandleIntent entered."); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); UserManager userManager = UserManager.getInstance(); User user = userManager.getCurrentUser(); boolean isAutoSync = pref.getBoolean("auto_sync", true); boolean isUpdateSuccess = false; boolean updated; String hint;/*from w w w.j a v a 2 s.com*/ Result result; try { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (cm.getActiveNetworkInfo() == null) { throw new NetworkException("No connection available"); } if (user == null) { throw new AuthException("No user is loged in"); } Function function = (Function) intent.getSerializableExtra(FUNCTION_TYPE); if (function == Function.Send) { String dst = intent.getStringExtra(SEND_DESTINATION); int type = intent.getIntExtra(SEND_TYPE, 0); String startTime = intent.getStringExtra(SEND_START_TIME); String endTime = intent.getStringExtra(SEND_END_TIME); String place = intent.getStringExtra(SEND_PLACE); String text = intent.getStringExtra(SEND_TEXT); user.sendMessage(dst, type, startTime, endTime, place, text); result = Result.Sent; hint = getString(R.string.send_message_OK); } else if (function == Function.Confirm) { int srcId = intent.getIntExtra(CONFIRM_SRC_ID, -1); int msgId = intent.getIntExtra(CONFIRM_MSG_ID, -1); int status = intent.getIntExtra(CONFIRM_STATUS, -1); user.confirmMessage(srcId, msgId, status); result = Result.Confirmed; hint = getString(R.string.confirm_message_OK); } else { updated = user.sync(null); isUpdateSuccess = true; result = updated ? Result.Updated : Result.Synchronized; hint = getString(R.string.last_update_from) + user.getLastSyncTime().toSimpleString(); } } catch (NetworkException e) { result = Result.NetworkError; hint = getString(R.string.error_network); } catch (NetworkDataException e) { result = Result.NetworkDataError; hint = getString(R.string.error_network_data); } catch (AuthException e) { result = Result.AuthFailed; hint = getString(R.string.error_auth_fail); } catch (HintException e) { result = Result.UnkownError; hint = e.getMessage(); } Intent broadcastIntent = new Intent(Configure.BROADCAST_MESSAGE); broadcastIntent.putExtra(RESULT_CODE, result); broadcastIntent.putExtra(RESULT_HINT, hint); LocalBroadcastManager.getInstance(MyApplication.getAppContext()).sendBroadcast(broadcastIntent); if (!userManager.isMainActivityRunning() && user != null) { List<InboxItem> unconfirmedInboxItems = user.getUnconfirmedInboxItems(); if (unconfirmedInboxItems.size() > 0) { setNotification(unconfirmedInboxItems); } } if (isAutoSync) { int syncPeriod = 0; if (isUpdateSuccess) { syncPeriod = Integer.parseInt(pref.getString("auto_sync_period", "240")); } else { syncPeriod = Integer.parseInt(pref.getString("retry_sync_period", "10")); } setUpdate(syncPeriod, syncPeriod); } }
From source file:cn.com.incito.driver.UI.detailDialog.PCCFragmentActivity.java
@SuppressWarnings("unchecked") @Override/*from w w w .j a va 2s.c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i("test1", "onCreate"); setContentView(R.layout.activity_pcc_main); mContext = this; Intent i = getIntent(); mFlag = i.getIntExtra("selectmodel", FLAG_SINGELSELECTION); totals = i.getIntExtra("totals", -1); totals_error = i.getStringExtra("totals_error"); number = (TextView) findViewById(R.id.number); if (mFlag == FLAG_SINGELSELECTION) { number.setText(String.valueOf(1)); } else { totals = totals != -1 ? totals : 5; number.setText(String.valueOf(totals)); } if (mFlag == FLAG_MULTIPLESELECTION) { selectedCities = (ArrayList<ModelSelectedCity>) i.getSerializableExtra("selectedCities"); } if (selectedCities == null) { selectedCities = new ArrayList<ModelSelectedCity>(); } if (selectedCities.size() > 0) { mCurrentSelected = selectedCities.size() - 1; } tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); pager = (ViewPager) findViewById(R.id.pager); adapter = new MyPagerAdapter(getSupportFragmentManager()); textProvince = (TextView) findViewById(R.id.textProvince); textCity = (TextView) findViewById(R.id.textCity); textCountry = (TextView) findViewById(R.id.textCountry); btn_confirm = (Button) findViewById(R.id.btn_confirm); btn_cancle = (Button) findViewById(R.id.btn_cancle); btn_confirm.setOnClickListener(this); btn_cancle.setOnClickListener(this); setSelectedBtnsListener(); pager.setAdapter(adapter); final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); tabs.setViewPager(pager); provinceFragment = new ProvinceFragment(mContext, handler); cityFragment = new CityFragment(mContext, handler); countryFragment = new CountryFragment(mContext, handler); listFragments.add(provinceFragment); listFragments.add(cityFragment); listFragments.add(countryFragment); notifySelectedCities(); }
From source file:com.juick.android.ThreadActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { JuickAdvancedApplication.maybeEnableAcceleration(this); JuickAdvancedApplication.setupTheme(this); //requestWindowFeature(Window.FEATURE_NO_TITLE); //getSherlock().requestFeature(Window.FEATURE_NO_TITLE); final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); super.onCreate(savedInstanceState); handler = new Handler(); Intent i = getIntent(); mid = (MessageID) i.getSerializableExtra("mid"); if (mid == null) { finish();//from ww w. j a v a 2 s . c o m } messagesSource = (MessagesSource) i.getSerializableExtra("messagesSource"); if (sp.getBoolean("fullScreenThread", false)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } setContentView(R.layout.thread); /* findViewById(R.id.gotoMain).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(ThreadActivity.this, MainActivity.class)); } }); */ final View buttons = findViewById(R.id.buttons); bSend = (ImageButton) findViewById(R.id.buttonSend); bSend.setOnClickListener(this); bAttach = (ImageButton) findViewById(R.id.buttonAttachment); bAttach.setOnClickListener(this); etMessage = (EditText) findViewById(R.id.editMessage); if (sp.getBoolean("helvNueFonts", false)) { etMessage.setTypeface(JuickAdvancedApplication.helvNue); /* TextView oldTitle = (TextView)findViewById(R.id.old_title); oldTitle.setTypeface(JuickAdvancedApplication.helvNue); */ } Button cancel = (Button) findViewById(R.id.buttonCancel); cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doCancel(); } }); tvReplyTo = (TextView) findViewById(R.id.textReplyTo); replyToContainer = (RelativeLayout) findViewById(R.id.replyToContainer); setHeight(replyToContainer, 0); showThread = (Button) findViewById(R.id.showThread); draftsButton = (Button) findViewById(R.id.drafts); etMessage.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { etMessage.setHint(""); setHeight(buttons, ActionBar.LayoutParams.WRAP_CONTENT); InputMethodManager inputMgr = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); inputMgr.toggleSoftInput(0, 0); } else { etMessage.setHint(R.string.ClickToReply); setHeight(buttons, 0); } //To change body of implemented methods use File | Settings | File Templates. } }); draftsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { class Item { String label; long ts; int index; Item(String label, long ts, int index) { this.label = label; this.ts = ts; this.index = index; } } final ArrayList<Item> items = new ArrayList<Item>(); final SharedPreferences drafts = getSharedPreferences("drafts", MODE_PRIVATE); for (int q = 0; q < 1000; q++) { String msg = drafts.getString("message" + q, null); if (msg != null) { if (msg.length() > 50) msg = msg.substring(0, 50); items.add(new Item(msg, drafts.getLong("timestamp" + q, 0), q)); } } Collections.sort(items, new Comparator<Item>() { @Override public int compare(Item item, Item item2) { final long l = item2.ts - item.ts; return l == 0 ? 0 : l > 0 ? 1 : -1; } }); CharSequence[] arr = new CharSequence[items.size()]; for (int i1 = 0; i1 < items.size(); i1++) { Item item = items.get(i1); arr[i1] = item.label; } new AlertDialog.Builder(ThreadActivity.this).setItems(arr, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, final int which) { final Runnable doPull = new Runnable() { @Override public void run() { pullDraft(null, drafts, items.get(which).index); updateDraftsButton(); } }; if (pulledDraft != null && pulledDraft.trim().equals(etMessage.getText().toString().trim())) { // no need to ask, user just looks at the drafts saveDraft(pulledDraftRid, pulledDraftMid, pulledDraftTs, pulledDraft); doPull.run(); } else { if (etMessage.getText().toString().length() > 0) { new AlertDialog.Builder(ThreadActivity.this) .setTitle(getString(R.string.ReplacingText)) .setMessage(getString(R.string.YourTextWillBeReplaced)) .setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { doPull.run(); } }) .setNeutralButton( getString(pulledDraft != null ? R.string.SaveChangedDraft : R.string.SaveDraft), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (pulledDraft != null) { saveDraft(pulledDraftRid, pulledDraftMid, System.currentTimeMillis(), etMessage.getText().toString()); } else { saveDraft(rid, mid.toString(), System.currentTimeMillis(), etMessage.getText().toString()); } doPull.run(); } }) .setPositiveButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .show(); } else { doPull.run(); } } } }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }).show(); } }); enableDrafts = (sp.getBoolean("enableDrafts", false)); if (sp.getBoolean("capitalizeReplies", false)) { etMessage.setInputType(etMessage.getInputType() | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES); } FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); tf = new ThreadFragment(); tf.init(getLastCustomNonConfigurationInstance(), this); Bundle args = new Bundle(); args.putSerializable("mid", mid); args.putSerializable("messagesSource", messagesSource); args.putSerializable("prefetched", i.getSerializableExtra("prefetched")); args.putSerializable("originalMessage", i.getSerializableExtra("originalMessage")); args.putBoolean("scrollToBottom", i.getBooleanExtra("scrollToBottom", false)); tf.setArguments(args); ft.add(R.id.threadfragment, tf); ft.commit(); MainActivity.restyleChildrenOrWidget(getWindow().getDecorView()); detector = new GestureDetector(this, new GestureDetector.OnGestureListener() { @Override public boolean onDown(MotionEvent e) { return false; } @Override public void onShowPress(MotionEvent e) { } @Override public boolean onSingleTapUp(MotionEvent e) { return false; } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return false; } @Override public void onLongPress(MotionEvent e) { } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (velocityX > 0 && Math.abs(velocityX) > 4 * Math.abs(velocityY) && Math.abs(velocityX) > 400) { if (etMessage.getText().toString().trim().length() == 0) { System.out.println("velocityX=" + velocityX + " velocityY" + velocityY); if (sp.getBoolean("swipeToClose", true)) { onBackPressed(); } } } return false; } }); com.actionbarsherlock.app.ActionBar actionBar = getSherlock().getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setHomeButtonEnabled(true); actionBar.setLogo(R.drawable.back_button); }
From source file:com.chatwing.whitelabel.managers.ChatboxModeManager.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (!mIsActive) { return;// ww w.j av a 2s. c o m } switch (requestCode) { case Delegate.REQUEST_SEARCH_CHAT_BOX: if (resultCode == Activity.RESULT_OK) { LightWeightChatBox searchResult = (LightWeightChatBox) data .getSerializableExtra(SearchChatBoxActivity.EXTRA_RESULT_CHAT_BOX); onChatBoxResult(searchResult); } break; case Delegate.REQUEST_CREATE_CHAT_BOX: if (resultCode == Activity.RESULT_OK) { LightWeightChatBox newChatBox = (LightWeightChatBox) data .getSerializableExtra(CreateChatBoxActivity.EXTRA_RESULT_CHAT_BOX); onChatBoxResult(newChatBox); } else if (resultCode == BaseABFragmentActivity.RESULT_EXCEPTION) { Exception exception = (Exception) data .getSerializableExtra(CreateChatBoxActivity.EXTRA_RESULT_EXCEPTION); mActivityDelegate.handle(exception, R.string.error_while_creating_chatbox); } break; case AccountDialogFragment.REQUEST_ADD_NEW_AUTHENTICATION: if (resultCode == Activity.RESULT_OK) { mActivityDelegate.dismissAuthenticationDialog(); User user = (User) data.getSerializableExtra(AuthenticateActivity.INTENT_USER); mActivityDelegate.onAccountSwitch(new AccountSwitchEvent(user)); Toast.makeText(mActivityDelegate.getActivity(), getString(R.string.message_account_added), Toast.LENGTH_LONG).show(); } break; default: super.onActivityResult(requestCode, resultCode, data); } }
From source file:com.justwayward.reader.ui.activity.ReadActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case 1://from w w w .j av a 2 s.co m if (resultCode == RESULT_OK) { BookSource bookSource = (BookSource) data.getSerializableExtra("source"); bookId = bookSource._id; } //mPresenter.getBookMixAToc(bookId, "chapters"); break; default: break; } }
From source file:at.jclehner.rxdroid.DrugListActivity.java
@Override protected void onResume() { super.onResume(); Components.onResumeActivity(this, 0); mIsShowing = true;/*from ww w. j ava 2s .c om*/ final Intent intent = getIntent(); Date date = null; if (intent != null) date = (Date) intent.getSerializableExtra(EXTRA_DATE); if (date == null) date = Settings.getActiveDate(); setDate(date, PAGER_INIT); NotificationReceiver.registerOnDoseTimeChangeListener(mDoseTimeListener); if (Version.BETA) showInfoDialog(OnceIds.BETA_VERSION, R.string._msg_beta_version, getString(R.string.app_name)); if (true) { final String isoLang = Locale.getDefault().getLanguage(); if (!TextUtils.isEmpty(isoLang) && !CollectionUtils.contains(Version.LANGUAGES, isoLang)) { final String language = Locale.getDefault().getDisplayLanguage(Locale.US); showInfoDialog("missing_translation_" + isoLang, R.string._msg_no_translation, language); } } mShowcaseQueue.show(); }