List of usage examples for android.os Bundle remove
public void remove(String key)
From source file:com.eleybourn.bookcatalogue.goodreads.api.ListReviewsApiHandler.java
void date2Sql(Bundle b, String key) { if (b.containsKey(key)) { String date = b.getString(key); try {// w ww . j a v a2 s .co m Date d = mUpdateDateFmt.parse(date); date = Utils.toSqlDateTime(d); b.putString(key, date); } catch (Exception e) { b.remove(key); } } }
From source file:com.farmerbb.taskbar.service.DashboardService.java
private void removeWidget(int cellId, boolean tempRemove) { widgets.remove(cellId);//from w w w . ja v a 2 s .c om DashboardCell cellLayout = cells.get(cellId); Bundle bundle = (Bundle) cellLayout.getTag(); mAppWidgetHost.deleteAppWidgetId(bundle.getInt("appWidgetId")); bundle.remove("appWidgetId"); LinearLayout linearLayout = (LinearLayout) cellLayout.findViewById(R.id.dashboard); linearLayout.removeAllViews(); cellLayout.setTag(bundle); cellLayout.setOnClickListener(cellOcl); cellLayout.setOnHoverListener(cellOhl); cellLayout.setOnLongClickListener(null); cellLayout.setOnGenericMotionListener(null); cellLayout.setOnInterceptedLongPressListener(null); SharedPreferences pref = U.getSharedPreferences(this); SharedPreferences.Editor editor = pref.edit(); editor.remove("dashboard_widget_" + Integer.toString(cellId)); if (tempRemove) { editor.putBoolean("dashboard_widget_" + Integer.toString(cellId) + "_placeholder", true); addPlaceholder(cellId); } else editor.remove("dashboard_widget_" + Integer.toString(cellId) + "_provider"); editor.apply(); }
From source file:org.mariotaku.twidere.fragment.AbsStatusesFragment.java
@Override public final Loader<List<ParcelableStatus>> onCreateLoader(int id, Bundle args) { final boolean fromUser = args.getBoolean(EXTRA_FROM_USER); args.remove(EXTRA_FROM_USER); return onCreateStatusesLoader(getActivity(), args, fromUser); }
From source file:com.karura.framework.PluginManager.java
/** * Called when the webview attached with the plugin manager is being restored with instance data * /*from w ww . j a v a 2 s . c o m*/ * Lets try to recreate all plugins with instance data * * @param savedInstance * the memory block which contains information about each of the plugins which were persisted in call to onSaveInstanceState */ public void onRestoreInstanceState(Bundle savedInstance) { // See if there is a valid instance to restore state from if (savedInstance == null || !savedInstance.containsKey(PLUGIN_MGR_INSTANCE_DATA_KEY)) return; Bundle pluginMgrInstanceData = savedInstance.getBundle(PLUGIN_MGR_INSTANCE_DATA_KEY); _nextPluginId = 0; for (String pluginDataKey : pluginMgrInstanceData.keySet()) { // only process those data keys which were created by us if (!pluginDataKey.startsWith(PLUGIN_INSTANCE_DATA_KEY_PREFIX)) { continue; } // try and retrieve plugin specific instance data Bundle pluginInstanceData = pluginMgrInstanceData.getBundle(pluginDataKey); if (pluginInstanceData == null) continue; String clazz = pluginInstanceData.getString(PLUGIN_CLASS_NAME_KEY); pluginInstanceData.remove(PLUGIN_CLASS_NAME_KEY); Integer pluginId = Integer.valueOf(pluginInstanceData.getString(PLUGIN_ID_KEY)); // manage the plugin id counter for subsequent allocation of plugins if (_nextPluginId < pluginId) { _nextPluginId = pluginId; } pluginInstanceData.remove(PLUGIN_ID_KEY); // Since we are passing the instance data for the plugin in this call, we are hoping it // will be able to restore its state allocateAndCachePlugin(clazz, pluginId, pluginInstanceData); } // safe increment _nextPluginId++; // TODO create a list of pluginIds and pass them back to the javascript layer just in case }
From source file:org.mariotaku.twidere.fragment.AbsActivitiesFragment.java
@Override public final Loader<List<ParcelableActivity>> onCreateLoader(int id, Bundle args) { final boolean fromUser = args.getBoolean(EXTRA_FROM_USER); args.remove(EXTRA_FROM_USER); return onCreateActivitiesLoader(getActivity(), args, fromUser); }
From source file:com.grouzen.android.serenity.HttpConnection.java
private HttpResponse post(String url, Bundle params) throws ClientProtocolException, IOException { HttpPost method = new HttpPost(url); if (params != null) { try {/*from w ww .j ava 2 s . c o m*/ if (mMultipartKey != null && mMultipartFileName != null) { ByteArrayBody byteArrayBody = new ByteArrayBody(params.getByteArray(mMultipartKey), mMultipartFileName); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); Charset charset = Charset.forName(CHARSET); entity.addPart(mMultipartKey, byteArrayBody); params.remove(mMultipartKey); for (String k : params.keySet()) { entity.addPart(new FormBodyPart(k, new StringBody(params.getString(k), charset))); } method.setEntity(entity); } else { ArrayList<NameValuePair> entity = convertParams(params); method.setEntity(new UrlEncodedFormEntity(entity, CHARSET)); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return execute(method); }
From source file:uk.co.ashtonbrsc.intentexplode.Explode.java
private void rememberIntent(Intent original) { this.originalIntent = getUri(original); Intent copy = cloneIntent(this.originalIntent); final Bundle originalExtras = original.getExtras(); if (originalExtras != null) { // bugfix #14: collect extras that are lost in the intent <-> string conversion Bundle additionalExtrasBundle = new Bundle(originalExtras); for (String key : originalExtras.keySet()) { if (copy.hasExtra(key)) { additionalExtrasBundle.remove(key); }/*from w ww .j a v a 2 s . c om*/ } if (!additionalExtrasBundle.isEmpty()) { additionalExtras = additionalExtrasBundle; } } }
From source file:uk.org.rivernile.edinburghbustracker.android.fragments.general.BusStopMapFragment.java
/** * Move the camera to the initial location. The initial location is * determined by the following order;//from w w w . j a v a2 s . c o m * * - If the args contains a stopCode, go there. * - If the args contains a latitude AND a longitude, go there. * - If the SharedPreferences have mappings for a previous location, then * go there. * - Otherwise, go to the default map location, as defined by * {@link #DEFAULT_LAT} and {@link #DEFAULT_LONG) at * {@link #DEFAULT_ZOOM}. */ private void moveCameraToInitialLocation() { final Bundle args = getArguments(); if (args != null && args.containsKey(ARG_STOPCODE)) { moveCameraToBusStop(args.getString(ARG_STOPCODE)); args.remove(ARG_STOPCODE); } else if (args != null && args.containsKey(ARG_LATITUDE) && args.containsKey(ARG_LONGITUDE)) { moveCameraToLocation(new LatLng(args.getDouble(ARG_LATITUDE), args.getDouble(ARG_LONGITUDE)), DEFAULT_SEARCH_ZOOM, false); args.remove(ARG_LATITUDE); args.remove(ARG_LONGITUDE); } else if (map != null) { // The Lat/Lons have to be treated as Strings because // SharedPreferences has no support for doubles. final String latitude = sp.getString(PreferencesActivity.PREF_MAP_LAST_LATITUDE, String.valueOf(DEFAULT_LAT)); final String longitude = sp.getString(PreferencesActivity.PREF_MAP_LAST_LONGITUDE, String.valueOf(DEFAULT_LONG)); final float zoom = sp.getFloat(PreferencesActivity.PREF_MAP_LAST_ZOOM, DEFAULT_ZOOM); try { moveCameraToLocation(new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude)), zoom, false); } catch (NumberFormatException e) { moveCameraToLocation(new LatLng(DEFAULT_LAT, DEFAULT_LONG), DEFAULT_ZOOM, false); } } }
From source file:uk.org.rivernile.edinburghbustracker.android.fragments.general.BusStopMapFragment.java
/** * {@inheritDoc}/* w ww . j a v a 2s .c om*/ */ @Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (map == null) { map = getMap(); if (map != null) { getActivity().supportInvalidateOptionsMenu(); final UiSettings uiSettings = map.getUiSettings(); uiSettings.setRotateGesturesEnabled(false); uiSettings.setCompassEnabled(false); uiSettings.setMyLocationButtonEnabled(true); map.setInfoWindowAdapter(new MapInfoWindow(getActivity())); map.setOnCameraChangeListener(this); map.setOnMarkerClickListener(this); map.setOnInfoWindowClickListener(this); map.setMapType(sp.getInt(PreferencesActivity.PREF_MAP_LAST_MAP_TYPE, GoogleMap.MAP_TYPE_NORMAL)); map.setPadding(0, actionBarHeight, 0, 0); moveCameraToInitialLocation(); refreshBusStops(null); // Check to see if a search is to be done. final Bundle args = getArguments(); if (args != null && args.containsKey(ARG_SEARCH)) { onSearch(args.getString(ARG_SEARCH)); args.remove(ARG_SEARCH); } } } }
From source file:com.freeme.filemanager.FileExplorerTabActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { //*/ add by xueweili for after Switch the language, file manager stop running on 20160518 if (savedInstanceState != null) { savedInstanceState.remove("android:fragments"); }/* ww w . j a v a2 s .c om*/ //*/ Log.i("liuhaoran", "oncreate"); super.onCreate(savedInstanceState); mContext = this; MobclickAgent.setDebugMode(true); MobclickAgent.openActivityDurationTrack(false); MobclickAgent.startWithConfigure(new UMAnalyticsConfig(mContext, "57dfa18e67e58e7d2b003625", "hwdroi", EScenarioType.E_UM_ANALYTICS_OEM, false)); getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); StorageHelper.getInstance(this).setCurrentMountPoint(Environment.getExternalStorageDirectory().getPath()); setContentView(R.layout.fragment_pager); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(DEFAULT_OFFSCREEN_PAGES); //*/ test if (FileManagerApplication.mIsTest.equals("true")) { final TextView test = (TextView) findViewById(R.id.tv_test); test.setVisibility(View.VISIBLE); test.getBackground().setAlpha(100); new Handler().postDelayed(new Runnable() { @Override public void run() { test.setVisibility(View.GONE); } }, 3000); } //*/ mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(null, FileCategoryContainerFragment.class, null); mTabsAdapter.addTab(null, FileViewFragment.class, null); mTabsAdapter.addTab(null, ServerControlFragment.class, null); mViewPager.setAdapter(mTabsAdapter); //*/ modified by tyd wulianghuan 2013-07-15 for: make the second tab be selected when usbStorge mounted //*/add by droi mingjun for updateself on 20151221 mSharedPref = PreferenceManager.getDefaultSharedPreferences(this); editor = mSharedPref.edit(); //*/end mTabHost = (RadioGroup) findViewById(R.id.home_group); mTabBtnOne = (RadioButton) findViewById(R.id.home_radio_one); mTabBtnTwo = (RadioButton) findViewById(R.id.home_radio_two); mTabBtnThree = (RadioButton) findViewById(R.id.home_radio_three); if (FileManagerApplication.mIsHideFTP.equals("false")) { mTabBtnThree.setVisibility(View.GONE); } mTabHost.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup arg0, int arg1) { // TODO Auto-generated method stub switch (arg0.getCheckedRadioButtonId()) { case R.id.home_radio_one: Log.i("home_radio_one", "home_radio_one"); // hometype = 1; if ((FileViewFragment) mTabsAdapter.getItem(1) != null && ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub != null) { ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub.exitActionMode(); //((FileCategoryContainerFragment)mTabsAdapter.getItem(0)).setStorageDeviceInfo(); } mViewPager.setCurrentItem(0, false); break; case R.id.home_radio_two: // hometype = 2; if ((FileCategoryContainerFragment) mTabsAdapter.getItem(0) != null && ((FileCategoryContainerFragment) mTabsAdapter .getItem(0)).mFileViewInteractionHub != null) { ((FileCategoryContainerFragment) mTabsAdapter.getItem(0)).mFileViewInteractionHub .exitActionMode(); } mViewPager.setCurrentItem(1, false); break; case R.id.home_radio_three: // hometype = 3; if ((FileViewFragment) mTabsAdapter.getItem(1) != null && ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub != null) { ((FileViewFragment) mTabsAdapter.getItem(1)).mFileViewInteractionHub.exitActionMode(); } mViewPager.setCurrentItem(2, false); break; default: break; } } }); int tabindex = getIntent().getIntExtra("TAB", Util.CATEGORY_TAB_INDEX); if (tabindex != 2) { int index = getIntent().getIntExtra("tab_index", Util.CATEGORY_TAB_INDEX); } //*/ modify end initButtonReceiver(); UpdateMonitor.Builder //*/ init UpdateMonitor .getInstance(this) //*/ register you Application to obsever .registerApplication(getApplication()) //*/ register you Application is Service or hasEnrtyActivity .setApplicationIsServices(true) //*/ default notify small icon, ifnot set use updateself_ic_notify_small .setDefaultNotifyIcon(R.drawable.updateself_ic_notify_small).complete(); checkSecurityPermissions(); // requestPermissionsMonery(); }