List of usage examples for android.os Bundle getInt
public int getInt(String key)
From source file:com.mohamnag.inappbilling.InAppBillingPlugin.java
/** * Loads the product details from play store and puts them in inventory, * will reload the product if they have been already loaded before. * * @param querySkus//from ww w. j av a2 s . co m * @param itemType * @param callbackContext * @throws RemoteException */ private Error querySkuDetails(Bundle querySkus, String itemType) { Error ret = null; try { Bundle skuDetailsInapp = iabService.getSkuDetails(3, cordova.getActivity().getPackageName(), itemType, querySkus); int response = skuDetailsInapp.getInt("RESPONSE_CODE"); if (response == BILLING_RESPONSE_RESULT_OK) { ArrayList<String> responseList = skuDetailsInapp.getStringArrayList("DETAILS_LIST"); for (String thisResponse : responseList) { try { SkuDetails d = new SkuDetails(itemType, thisResponse); jsLog("Got sku details: " + d); myInventory.addSkuDetails(d); } catch (JSONException ex) { jsLog("JSONException: " + ex.getMessage()); } } } else { ret = new Error(ERR_LOAD_INVENTORY, "Cant load product details. Responce code: " + response); } } catch (RemoteException ex) { Logger.getLogger(InAppBillingPlugin.class.getName()).log(Level.SEVERE, null, ex); ret = new Error(ERR_LOAD_INVENTORY, ex.getMessage()); } return ret; }
From source file:com.futurologeek.smartcrossing.crop.CropImageActivity.java
private void loadInput() { Intent intent = getIntent();//from w w w.j ava 2 s .co m Bundle extras = intent.getExtras(); if (extras != null) { aspectX = extras.getInt(Crop.Extra.ASPECT_X); aspectY = extras.getInt(Crop.Extra.ASPECT_Y); maxX = extras.getInt(Crop.Extra.MAX_X); maxY = extras.getInt(Crop.Extra.MAX_Y); saveUri = extras.getParcelable(MediaStore.EXTRA_OUTPUT); } sourceUri = intent.getData(); if (sourceUri != null) { exifRotation = CropUtil .getExifRotation(CropUtil.getFromMediaUri(this, getContentResolver(), sourceUri)); InputStream is = null; try { sampleSize = calculateBitmapSampleSize(sourceUri); is = getContentResolver().openInputStream(sourceUri); BitmapFactory.Options option = new BitmapFactory.Options(); option.inSampleSize = sampleSize; rotateBitmap = new RotateBitmap(BitmapFactory.decodeStream(is, null, option), exifRotation); } catch (IOException e) { Log.e("Error reading image: " + e.getMessage(), e); setResultException(e); } catch (OutOfMemoryError e) { Log.e("OOM reading image: " + e.getMessage(), e); setResultException(e); } finally { CropUtil.closeSilently(is); } } }
From source file:com.andybotting.tramhunter.activity.StopDetailsActivity.java
/** * On create of this class/*from w w w . j av a 2s .c o m*/ */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.stop_details); // Home title button findViewById(R.id.title_btn_home).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { UIUtils.goHome(StopDetailsActivity.this); } }); // Refresh title button findViewById(R.id.title_btn_refresh).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mShowDialog = true; new GetNextTramTimes().execute(); } }); // Map title button findViewById(R.id.title_btn_map).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Bundle bundle = new Bundle(); StopsList mStopList = new StopsList(); mStopList.add(mStop); bundle.putParcelable("stopslist", mStopList); Intent intent = new Intent(StopDetailsActivity.this, StopMapActivity.class); intent.putExtras(bundle); startActivityForResult(intent, 1); } }); // Set up our list mListAdapter = new NextTramsListAdapter(); mListView = getListView(); mListView.setVisibility(View.GONE); // Preferences mPreferenceHelper = new PreferenceHelper(); // Get bundle data int routeId = -1; Bundle extras = getIntent().getExtras(); if (extras != null) { mTramTrackerId = extras.getInt("tramTrackerId"); routeId = extras.getInt("routeId", -1); } // Get our favourite stops list mFavouriteList = new FavouriteList(); // Create out DB instance mDB = new TramHunterDB(); mStop = mDB.getStop(mTramTrackerId); if (routeId > -1) mRoute = mDB.getRoute(routeId); // Set the title String title = mStop.getStopName(); ((TextView) findViewById(R.id.title_text)).setText(title); // Display stop data displayStop(mStop); // Star button mStarButton = (CompoundButton) findViewById(R.id.stopStar); mStarButton.setChecked(mFavouriteList.isFavourite(new Favourite(mStop, mRoute))); mStarButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mFavouriteList.setFavourite(new Favourite(mStop, mRoute), mStarButton.isChecked()); } }); // Get our TramTracker service, either SOAP (def) or JSON // if (mPreferenceHelper.isJSONAPIEnabled()) // ttService = new TramTrackerServiceJSON(); // else ttService = new TramTrackerServiceSOAP(); // Our thread for updating the stops every 60 secs mRefreshThread = new Thread(new CountDown()); mRefreshThread.setDaemon(true); mRefreshThread.start(); }
From source file:androidx.navigation.NavController.java
/** * Restores all navigation controller state from a bundle. * * <p>State may be saved to a bundle by calling {@link #saveState()}. * Restoring controller state is the responsibility of a {@link NavHost}.</p> * * @param navState state bundle to restore *//*from ww w. j av a 2 s. co m*/ public void restoreState(@Nullable Bundle navState) { if (navState == null) { return; } mGraphId = navState.getInt(KEY_GRAPH_ID); mNavigatorStateToRestore = navState.getBundle(KEY_NAVIGATOR_STATE); mBackStackToRestore = navState.getIntArray(KEY_BACK_STACK_IDS); if (mGraphId != 0) { // Set the graph right away, onGraphCreated will handle restoring the // rest of the saved state setGraph(mGraphId); } }
From source file:org.anhonesteffort.flock.SubscriptionGoogleFragment.java
private void handleLoadSkuList(final String productType) { if (asyncTask != null) return;/*w w w . j a v a 2 s. c o m*/ asyncTask = new AsyncTask<Void, Void, Bundle>() { @Override protected void onPreExecute() { Log.d(TAG, "handleLoadSkuList"); subscriptionActivity.setProgressBarIndeterminateVisibility(true); subscriptionActivity.setProgressBarVisibility(true); } private ArrayList<String> getSkuDetails(ArrayList<String> skuList, Bundle result) throws RemoteException { Bundle skuBundle = new Bundle(); skuBundle.putStringArrayList("ITEM_ID_LIST", skuList); Bundle skuDetails = subscriptionActivity.billingService.getSkuDetails(3, SubscriptionGoogleFragment.class.getPackage().getName(), productType, skuBundle); if (skuDetails.getInt("RESPONSE_CODE") == 0) return skuDetails.getStringArrayList("DETAILS_LIST"); else { Log.e(TAG, "sku details response code is != 0"); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR); return new ArrayList<String>(0); } } @Override protected Bundle doInBackground(Void... params) { Bundle result = new Bundle(); if (subscriptionActivity.billingService == null) { Log.e(TAG, "billing service is null"); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR); return result; } ArrayList<String> skuQueryList = new ArrayList<String>(2); skuQueryList.add(SKU_YEARLY_SUBSCRIPTION); try { List<String> skuDetails = getSkuDetails(skuQueryList, result); ArrayList<String> skuList = new ArrayList<String>(); if (result.getInt(ErrorToaster.KEY_STATUS_CODE, -1) != -1) return result; for (String thisResponse : skuDetails) { JSONObject productObject = new JSONObject(thisResponse); skuList.add(productObject.getString("productId")); } result.putStringArrayList("SKU_LIST", skuList); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); } catch (JSONException e) { Log.e(TAG, "error parsing sku details", e); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR); } catch (RemoteException e) { Log.e(TAG, "error parsing sku details", e); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR); } return result; } @Override protected void onPostExecute(Bundle result) { asyncTask = null; subscriptionActivity.setProgressBarIndeterminateVisibility(false); subscriptionActivity.setProgressBarVisibility(false); if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) handleSkuListLoaded(result.getStringArrayList("SKU_LIST")); else ErrorToaster.handleDisplayToastBundledError(subscriptionActivity, result); } }.execute(); }
From source file:com.example.igorklimov.popularmoviesdemo.fragments.DetailFragment.java
private void setMinSizes(View space) { int fragmentHeight; int fragmentWidth; if (!isTabletPreference(context)) { fragmentHeight = this.getResources().getDisplayMetrics().heightPixels; fragmentWidth = this.getResources().getDisplayMetrics().widthPixels; } else {/*from w w w.j a v a 2 s . co m*/ Bundle arguments = getArguments(); fragmentHeight = arguments.getInt("fragmentHeight"); fragmentWidth = arguments.getInt("fragmentWidth"); } int minHeight = fragmentHeight / 3; int minWidth = (int) (((double) minHeight / 278) * 185); int backdropHeight = (!Utility.isTabletPreference(context) && Configuration.ORIENTATION_LANDSCAPE == context.getResources().getConfiguration().orientation ? fragmentHeight - fragmentHeight / 3 : (int) (((double) fragmentWidth / 500) * 281)); mPosterView.setMinimumWidth(minWidth); mPosterView.setMinimumHeight(minHeight); mBack.setMinimumHeight(backdropHeight); if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT && space != null) { space.setMinimumHeight(backdropHeight); } }
From source file:com.nextgis.firereporter.SettingsSupport.java
public SettingsSupport(Context context, PreferenceScreen screen) { this.screen = screen; this.context = context; // Load the preferences from an XML resource //addPreferencesFromResource(R.xml.preferences); mSendDataIntervalPref = (ListPreference) screen.findPreference(SettingsActivity.KEY_PREF_INTERVAL); if (mSendDataIntervalPref != null) { int index = mSendDataIntervalPref.findIndexOfValue(mSendDataIntervalPref.getValue()); if (index >= 0) { mSendDataIntervalPref.setSummary(mSendDataIntervalPref.getEntries()[index]); } else {//www . j a v a 2 s .co m mSendDataIntervalPref.setSummary((String) mSendDataIntervalPref.getValue()); } } mSaveBattPref = (CheckBoxPreference) screen.findPreference(SettingsActivity.KEY_PREF_SERVICE_BATT_SAVE); if (mSaveBattPref != null) mSaveBattPref.setSummary(mSaveBattPref.isChecked() ? R.string.stOn : R.string.stOff); mNotifyLEDPref = (CheckBoxPreference) screen.findPreference(SettingsActivity.KEY_PREF_NOTIFY_LED); if (mNotifyLEDPref != null) mNotifyLEDPref.setSummary(mNotifyLEDPref.isChecked() ? R.string.stOn : R.string.stOff); mPlaySoundPref = (CheckBoxPreference) screen.findPreference(SettingsActivity.KEY_PREF_NOTIFY_SOUND); if (mPlaySoundPref != null) mPlaySoundPref.setSummary(mPlaySoundPref.isChecked() ? R.string.stOn : R.string.stOff); mVibroPref = (CheckBoxPreference) screen.findPreference(SettingsActivity.KEY_PREF_NOTIFY_VIBRO); if (mVibroPref != null) mVibroPref.setSummary(mVibroPref.isChecked() ? R.string.stOn : R.string.stOff); mRowCountPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_ROW_COUNT); if (mRowCountPref != null) mRowCountPref.setSummary((String) mRowCountPref.getText()); mFireSearchRadiusPref = (EditTextPreference) screen .findPreference(SettingsActivity.KEY_PREF_FIRE_SEARCH_RADIUS); if (mFireSearchRadiusPref != null) mFireSearchRadiusPref .setSummary((String) mFireSearchRadiusPref.getText() + " " + context.getString(R.string.km)); mDayIntervalPref = (ListPreference) screen.findPreference(SettingsActivity.KEY_PREF_SEARCH_DAY_INTERVAL); if (mDayIntervalPref != null) { int index = mDayIntervalPref.findIndexOfValue(mDayIntervalPref.getValue()); if (index >= 0) { mDayIntervalPref.setSummary(mDayIntervalPref.getEntries()[index]); } else { mDayIntervalPref.setSummary((String) mDayIntervalPref.getValue()); } } mSearchCurrentDatePref = (CheckBoxPreference) screen .findPreference(SettingsActivity.KEY_PREF_SEARCH_CURR_DAY); if (mSearchCurrentDatePref != null) mSearchCurrentDatePref.setSummary(mSearchCurrentDatePref.isChecked() ? R.string.stSearchCurrentDayOn : R.string.stSearchCurrentDayOff); mNasaServerPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_NASA); if (mNasaServerPref != null) mNasaServerPref.setSummary((String) mNasaServerPref.getText()); mNasaServerUserPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_NASA_USER); if (mNasaServerUserPref != null) mNasaServerUserPref.setSummary((String) mNasaServerUserPref.getText()); mUserServerPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_USER); if (mUserServerPref != null) mUserServerPref.setSummary((String) mUserServerPref.getText()); mUserServerUserPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_USER_USER); if (mUserServerUserPref != null) mUserServerUserPref.setSummary((String) mUserServerUserPref.getText()); mScanServerUserPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_SCAN_USER); if (mScanServerUserPref != null) mScanServerUserPref.setSummary((String) mScanServerUserPref.getText()); mNasaServerPassPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_NASA_PASS); mUserServerPassPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_USER_PASS); mScanServerPassPref = (EditTextPreference) screen.findPreference(SettingsActivity.KEY_PREF_SRV_SCAN_PASS); final Preference checkNasaConnPref = (Preference) screen .findPreference(SettingsActivity.KEY_PREF_SRV_NASA_CHECK_CONN); final Preference checkUserConnPref = (Preference) screen .findPreference(SettingsActivity.KEY_PREF_SRV_USER_CHECK_CONN); final Preference checkScanConnPref = (Preference) screen .findPreference(SettingsActivity.KEY_PREF_SRV_SCAN_CHECK_CONN); mReturnHandler = new Handler() { @SuppressLint("NewApi") public void handleMessage(Message msg) { Bundle resultData = msg.getData(); boolean bHaveErr = resultData.getBoolean(GetFiresService.ERROR); int nType = resultData.getInt(GetFiresService.SOURCE); if (bHaveErr) { Toast.makeText(SettingsSupport.this.context, resultData.getString(GetFiresService.ERR_MSG), Toast.LENGTH_LONG).show(); if (nType == 1) {//user checkUserConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkUserConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } else if (nType == 2) {//nasa checkNasaConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkNasaConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } else if (nType == 3) {//scanex checkScanConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkScanConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } } else { String sData = resultData.getString(GetFiresService.JSON); if (nType == 1) {//user JSONObject jsonMainObject; try { jsonMainObject = new JSONObject(sData); if (jsonMainObject.getBoolean("error")) { String sMsg = jsonMainObject.getString("msg"); Toast.makeText(SettingsSupport.this.context, sMsg, Toast.LENGTH_LONG).show(); checkUserConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkUserConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } else { checkUserConnPref.setSummary(R.string.stConnectionSucceeded); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkUserConnPref.setIcon(R.drawable.ic_navigation_accept); } } catch (JSONException e) { Toast.makeText(SettingsSupport.this.context, e.toString(), Toast.LENGTH_LONG).show(); e.printStackTrace(); checkUserConnPref.setSummary(R.string.sCheckDBConnSummary); } } else if (nType == 2) {//nasa JSONObject jsonMainObject; try { jsonMainObject = new JSONObject(sData); if (jsonMainObject.getBoolean("error")) { String sMsg = jsonMainObject.getString("msg"); Toast.makeText(SettingsSupport.this.context, sMsg, Toast.LENGTH_LONG).show(); checkNasaConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkNasaConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } else { checkNasaConnPref.setSummary(R.string.stConnectionSucceeded); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkNasaConnPref.setIcon(R.drawable.ic_navigation_accept); } } catch (JSONException e) { Toast.makeText(SettingsSupport.this.context, e.toString(), Toast.LENGTH_LONG).show(); e.printStackTrace(); checkNasaConnPref.setSummary(R.string.sCheckDBConnSummary); } } else if (nType == 3) {//scanex if (sData.length() == 0) { String sMsg = "Connect failed"; Toast.makeText(SettingsSupport.this.context, sMsg, Toast.LENGTH_LONG).show(); checkScanConnPref.setSummary(R.string.stConnectionFailed); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkScanConnPref.setIcon(R.drawable.ic_alerts_and_states_error); } else { checkScanConnPref.setSummary(R.string.stConnectionSucceeded); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) checkScanConnPref.setIcon(R.drawable.ic_navigation_accept); new HttpGetter(SettingsSupport.this.context, 4, SettingsSupport.this.context.getString(R.string.stChecking), mReturnHandler, true).execute( "http://fires.kosmosnimki.ru/SAPI/Account/Get/?CallBackName=" + GetFiresService.USER_ID, sData); } } else if (nType == 4) {//scanex detailes try { String sSubData = GetFiresService.removeJsonT(sData); JSONObject rootobj = new JSONObject(sSubData); String sStatus = rootobj.getString("Status"); if (sStatus.equals("OK")) { JSONObject resobj = rootobj.getJSONObject("Result"); String sName = ""; if (!resobj.isNull("FullName")) sName = resobj.getString("FullName"); String sPhone = ""; if (!resobj.isNull("Phone")) sPhone = resobj.getString("Phone"); //add properties if (sPhone.length() > 0) { Preference PhonePref = new Preference(SettingsSupport.this.context); PhonePref.setTitle(R.string.stScanexServerUserPhone); PhonePref.setSummary(sPhone); PhonePref.setOrder(2); SettingsSupport.this.screen.addPreference(PhonePref); } if (sName.length() > 0) { Preference NamePref = new Preference(SettingsSupport.this.context); NamePref.setTitle(R.string.stScanexServerUserFullName); NamePref.setSummary(sName); NamePref.setOrder(2); SettingsSupport.this.screen.addPreference(NamePref); } } else { Toast.makeText(SettingsSupport.this.context, rootobj.getString("ErrorInfo"), Toast.LENGTH_LONG).show(); } } catch (JSONException e) { Toast.makeText(SettingsSupport.this.context, e.toString(), Toast.LENGTH_LONG).show(); e.printStackTrace(); } } } }; }; if (checkNasaConnPref != null) checkNasaConnPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { String sURL = mNasaServerPref.getText() + "?function=test_conn_nasa&user=" + mNasaServerUserPref.getText() + "&pass=" + mNasaServerPassPref.getText(); new HttpGetter(SettingsSupport.this.context, 2, SettingsSupport.this.context.getString(R.string.stChecking), mReturnHandler, true) .execute(sURL); return true; } }); if (checkUserConnPref != null) checkUserConnPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { String sURL = mUserServerPref.getText() + "?function=test_conn_user&user=" + mUserServerUserPref.getText() + "&pass=" + mUserServerPassPref.getText(); new HttpGetter(SettingsSupport.this.context, 1, SettingsSupport.this.context.getString(R.string.stChecking), mReturnHandler, true) .execute(sURL); return true; } }); if (checkScanConnPref != null) checkScanConnPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { //String sURL = mUserServerPref.getText() + "?function=test_conn_nasa&user=" + mUserServerUserPref.getText() + "&pass=" + mUserServerPassPref.getText(); new ScanexHttpLogin(SettingsSupport.this.context, 3, SettingsSupport.this.context.getString(R.string.stChecking), mReturnHandler, true) .execute(mScanServerUserPref.getText(), mScanServerPassPref.getText()); return true; } }); }
From source file:net.mEmoZz.PopMovies.frags.DetailFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Bundle bundle = this.getArguments(); helper = new DBHelper(getActivity()); Configuration conf = getActivity().getResources().getConfiguration(); if (conf.smallestScreenWidthDp >= 600) { if (bundle != null) { movie = bundle.getParcelable("movie"); position = bundle.getInt("pos"); if (movie != null) { posterEndPoint = movie.getPoster(); backdropEndPoint = movie.getBackdrop(); overviewEndPoint = movie.getOverview(); dateEndPoint = movie.getDate(); voteEndPoint = movie.getVoteAvr(); titleEndPoint = movie.getTitle(); idEndpoint = movie.getId(); if (dateEndPoint.equals("")) { year = "Unknown"; } else { year = dateEndPoint.substring(0, 4); }//from ww w. ja v a2s . c o m if (titleEndPoint.equals("")) { titleEndPoint = "Not available."; } else { titleEndPoint = movie.getTitle(); } if (overviewEndPoint.equals("")) { overviewEndPoint = "No overview found."; } else { overviewEndPoint = movie.getOverview(); } } } } else { posterEndPoint = getActivity().getIntent().getExtras().getString("poster"); backdropEndPoint = getActivity().getIntent().getExtras().getString("backdrop"); overviewEndPoint = getActivity().getIntent().getExtras().getString("overview"); dateEndPoint = getActivity().getIntent().getExtras().getString("date"); voteEndPoint = getActivity().getIntent().getExtras().getString("vote"); titleEndPoint = getActivity().getIntent().getExtras().getString("title"); idEndpoint = getActivity().getIntent().getExtras().getString("id"); position = getActivity().getIntent().getExtras().getInt("position"); } boolean ifExist = helper.ifExist(idEndpoint); if (ifExist) { detailUnFav.setVisibility(VISIBLE); detailFav.setVisibility(GONE); } else { detailUnFav.setVisibility(GONE); detailFav.setVisibility(VISIBLE); } String posterUrl = Url.POSTERS_URL + "w342" + posterEndPoint; DisplayImageOptions mOptions = new DisplayImageOptions.Builder().cacheOnDisk(true).cacheInMemory(false) .displayer(new FadeInBitmapDisplayer(1500)).showImageOnFail(R.drawable.no_poster) .showImageForEmptyUri(R.drawable.no_poster).build(); ImageLoader.getInstance().displayImage(posterUrl, detailPoster, mOptions, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { Palette p = Palette.from(loadedImage).generate(); detailCard.setCardBackgroundColor(p.getVibrantColor(0)); if (p.getVibrantColor(0) == Color.TRANSPARENT) { detailCard.setCardBackgroundColor(p.getMutedColor(0)); } } }); String backdropUrl = Url.POSTERS_URL + "w780" + backdropEndPoint; if (conf.smallestScreenWidthDp >= 600) { ImageLoader.getInstance().displayImage(backdropUrl, tabBackdrop, mOptions, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { Palette p = Palette.from(loadedImage).generate(); tabBackdrop.setBackgroundColor(p.getVibrantColor(0)); if (p.getVibrantColor(0) == Color.TRANSPARENT) { tabBackdrop.setBackgroundColor(p.getMutedColor(0)); } } }); detailDate.setText(year); detailTitle.setText(titleEndPoint); } else { detailDate.setText(dateEndPoint); } detailVoteAvr.setText(voteEndPoint); detailOverview.setText(overviewEndPoint); final ScaleAnimation animation = new ScaleAnimation(0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(165); detailFav.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { adapter.notifyDataSetChanged(); detailFav.setVisibility(GONE); detailUnFav.startAnimation(animation); detailUnFav.setVisibility(VISIBLE); helper.insertRow(posterEndPoint, backdropEndPoint, idEndpoint, titleEndPoint, dateEndPoint, voteEndPoint, overviewEndPoint); } }); detailUnFav.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { adapter.notifyDataSetChanged(); detailUnFav.setVisibility(GONE); detailFav.startAnimation(animation); detailFav.setVisibility(VISIBLE); helper.deleteRow(idEndpoint); if (fav.isChecked()) { CoreAdapter.movies.remove(position); adapter.notifyItemRemoved(position); adapter.notifyDataSetChanged(); } } }); new DurationTask().execute(); trailsAdapter = new TrailersAdapter(trailers, getActivity()); new TrailersTask().execute(); revsAdapter = new ReviewsAdapter(reviews, getActivity()); new ReviewsTask().execute(); }
From source file:com.irccloud.android.fragment.UsersListFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (tapTimer == null) tapTimer = new Timer("users-tap-timer"); if (savedInstanceState != null && savedInstanceState.containsKey("cid")) { cid = savedInstanceState.getInt("cid"); bid = savedInstanceState.getInt("bid"); channel = savedInstanceState.getString("channel"); }/*from w ww . j av a 2 s .co m*/ }
From source file:com.openerp.addons.note.EditNoteFragment.java
@Override public void onStart() { super.onStart(); Bundle bundle = getArguments(); if (bundle.containsKey("row_id")) { noteMemo = (EditText) rootview.findViewById(R.id.txv_editNote_Description); descriptionHeader = (TextView) rootview.findViewById(R.id.txv_editNote_Description_Heading); webViewpad = (WebView) rootview.findViewById(R.id.txv_editNote_Description_Pad); row_id = bundle.getInt("row_id"); stageid = bundle.getString("stage_id"); tagid = bundle.getString("tag_id"); setNoteTags(tagid);//from w w w . j a v a 2s. com setCurrentNoteStages(scope.context()); originalMemo = bundle.getString("row_details"); // If Pad Installed if (originalMemo == null) { padAdded = true; noteMemo.setVisibility(View.GONE); descriptionHeader.setVisibility(View.GONE); originalMemo = bundle.getString("padurl"); webViewpad.setVisibility(View.VISIBLE); webViewpad.getSettings().setJavaScriptEnabled(true); webViewpad.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); webViewpad.loadUrl( originalMemo + "?showChat=false&userName=" + OEUser.current(scope.context()).getUsername()); } noteMemo.setText(bundle.getString("row_details")); } }