List of usage examples for android.os Bundle putParcelable
public void putParcelable(@Nullable String key, @Nullable Parcelable value)
From source file:cc.wulian.smarthomev5.fragment.singin.handler.DecodeHandler.java
/** * Decode the data within the viewfinder rectangle, and time how long it took. For efficiency, reuse the same reader objects from one decode to the next. * /*from ww w . java 2 s . c o m*/ * @param data * The YUV preview frame. * @param width * The width of the preview frame. * @param height * The height of the preview frame. */ private void decode(byte[] data, int width, int height) { long start = System.currentTimeMillis(); Result rawResult = null; // /start rotate 90 2013.02.04/// if (!CameraManager.get().isLandscape()) { byte[] rotatedData = new byte[data.length]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int index1 = (x * height + height - y - 1); int index2 = (x + y * width); if (index1 < rotatedData.length && index2 < data.length) { rotatedData[index1] = data[index2]; } } } int tmp = width; // Here we are swapping, that's the difference to #11 width = height; height = tmp; data = rotatedData; } // //end rotate//// PlanarYUVLuminanceSource source = CameraManager.get().buildLuminanceSource(data, width, height); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); if (bitmap != null) { Log.d(TAG, "decode: bitmap is exists"); } else { Log.d(TAG, "decode: bitmap is null"); } try { rawResult = multiFormatReader.decodeWithState(bitmap); } catch (ReaderException re) { Log.d(TAG, "decode: ", re); } finally { multiFormatReader.reset(); } if (rawResult != null) { long end = System.currentTimeMillis(); Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message = Message.obtain(scanHandlerResult.getHandler(), R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle(); bundle.putParcelable(DecodeThread.BARCODE_BITMAP, source.renderCroppedGreyscaleBitmap()); message.setData(bundle); // Log.d(TAG, "Sending decode succeeded message..."); message.sendToTarget(); } else { Message message = Message.obtain(scanHandlerResult.getHandler(), R.id.decode_failed); message.sendToTarget(); } }
From source file:com.adkdevelopment.rssreader.ui.MainActivity.java
@Override public void onFragmentInteraction(Integer position, View view, List<NewsObject> item) { if (!mTwoPane) { Intent intent = new Intent(this, DetailActivity.class); intent.putExtra(NewsRealm.NEWS_POSITION, position); intent.putExtra(NewsRealm.NEWS_EXTRA, (ArrayList) item); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { @SuppressWarnings("unchecked") Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(this).toBundle(); startActivity(intent, bundle); } else {/*from w w w. ja v a 2 s . c om*/ startActivity(intent); } } else { Bundle args = new Bundle(); args.putParcelable(NewsRealm.NEWS_EXTRA, item.get(position)); DetailFragment fragment = DetailFragment.newInstance(item.get(position)); fragment.setArguments(args); getSupportFragmentManager().beginTransaction().replace(R.id.item_detail_container, fragment).commit(); } }
From source file:com.acomminos.morlunk.MorlunkHomeActivity.java
@Override public void onBlogPostSelected(MorlunkBlogPost post) { Bundle arguments = new Bundle(); arguments.putParcelable("post", post); MorlunkBlogPostFragment postFragment = new MorlunkBlogPostFragment(); postFragment.setArguments(arguments); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(R.id.container, postFragment); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE); transaction.addToBackStack(null);//from ww w .j av a 2s . c o m transaction.commit(); }
From source file:com.btmura.android.reddit.app.ControlFragment.java
public ControlFragment withThingBundle(ThingBundle thingBundle) { Bundle args = new Bundle(getArguments()); args.putParcelable(ARG_THING_BUNDLE, thingBundle); return newFragment(args); }
From source file:pt.up.mobile.authenticator.Authenticator.java
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) { Log.v(TAG, "addAccount()"); final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:com.manning.androidhacks.hack023.authenticator.Authenticator.java
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:com.hyrt.cnp.account.AccountAuthenticator.java
/** * The user has requested to add a new account to the system. We return an * intent that will launch our login screen if the user has not logged in * yet, otherwise our activity will just pass the user's credentials on to * the account manager./*w w w . ja v a2s.co m*/ */ @Override public Bundle addAccount(final AccountAuthenticatorResponse response, final String accountType, final String authTokenType, final String[] requiredFeatures, final Bundle options) throws NetworkErrorException { final Intent intent = new Intent(context, LoginActivity.class); intent.putExtra(PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(KEY_INTENT, intent); return bundle; }
From source file:com.hyrt.cnp.account.AccountAuthenticator.java
@Override public Bundle updateCredentials(final AccountAuthenticatorResponse response, final Account account, final String authTokenType, final Bundle options) { final Intent intent = new Intent(context, LoginActivity.class); intent.putExtra(PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); if (!TextUtils.isEmpty(account.name)) intent.putExtra(PARAM_USERNAME, account.name); final Bundle bundle = new Bundle(); bundle.putParcelable(KEY_INTENT, intent); return bundle; }
From source file:com.rukman.emde.smsgroups.authenticator.GMSAuthenticator.java
@Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { Log.d(TAG, "Get Auth Token"); // If the caller requested an authToken type we don't support, then // return an error if (!authTokenType.equals(GMSApplication.AUTHTOKEN_TYPE)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ERROR_MESSAGE, "invalid authTokenType"); return result; }//from w ww . j a v a2s . c o m // Extract the username and password from the Account Manager, and ask // the server for an appropriate AuthToken. final String password = AccountManager.get(mContext).getPassword(account); if (!TextUtils.isEmpty(password)) { try { final String authToken = NetworkUtilities.authenticate(account.name, password); if (!TextUtils.isEmpty(authToken)) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, GMSApplication.ACCOUNT_TYPE); result.putString(AccountManager.KEY_AUTHTOKEN, authToken); return result; } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } // If we get here, then we couldn't access the user's password - so we // need to re-prompt them for their credentials. We do that by creating // an intent to display our AuthenticatorActivity panel. final Intent intent = new Intent(mContext, GMSAuthenticatorActivity.class); intent.putExtra(GMSAuthenticatorActivity.PARAM_USERNAME, account.name); intent.putExtra(GMSAuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:com.afg.MngProductContentProvider.Fragments.MultiSelectList_Fragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mList = getListView();//ww w. ja v a 2 s . co m mList.setAdapter(mAdapter); mList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); //final MultiChoiceListener mcl = new MultiChoiceListener(getContext(), mChoicePresenteR); mList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int i, long l) { Bundle potatoe = new Bundle(); potatoe.putParcelable(PRODUCT_KEY, (Product) parent.getItemAtPosition(i)); mCallback.showManageProduct(potatoe); } }); mList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) { //getListView().setItemChecked(i, mcl.isPosition(i)); return true; } }); }