List of usage examples for android.support.v4.util SimpleArrayMap containsKey
public boolean containsKey(Object obj)
From source file:com.facebook.litho.ComponentsStethoManagerImpl.java
private static void storeDrawable(StyleAccumulator accumulator, SimpleArrayMap<String, String> overrides, String key) {/* w ww . j a v a2s . c o m*/ if (overrides.containsKey(key)) { accumulator.store(key, overrides.get(key), false); } else { accumulator.store(key, "<drawable>", false); } }
From source file:com.facebook.litho.ComponentsStethoManagerImpl.java
private static void storeFloat(StyleAccumulator accumulator, SimpleArrayMap<String, String> overrides, String key, float value) { if (overrides.containsKey(key)) { accumulator.store(key, overrides.get(key), false); } else {// w w w. j a v a 2 s . c om accumulator.store(key, Float.toString(value), false); } }
From source file:com.facebook.litho.ComponentsStethoManagerImpl.java
private static void storeEnum(StyleAccumulator accumulator, SimpleArrayMap<String, String> overrides, String key, Object value) { if (overrides.containsKey(key)) { accumulator.store(key, overrides.get(key), false); } else {//from w w w. j a va 2s . c o m accumulator.store(key, toCSSString(value), false); } }
From source file:com.facebook.litho.ComponentsStethoManagerImpl.java
private static void storeYogaValue(StyleAccumulator accumulator, SimpleArrayMap<String, String> overrides, String key, YogaValue value) { if (overrides.containsKey(key)) { accumulator.store(key, overrides.get(key), false); } else {// w w w.j a v a2 s . c o m final String valueString; switch (value.unit) { case UNDEFINED: valueString = "undefined"; break; case POINT: valueString = Float.toString(value.value); break; case PERCENT: valueString = value.value + "%"; break; case AUTO: valueString = "auto"; break; default: throw new IllegalStateException(); } accumulator.store(key, valueString, false); } }
From source file:com.appsimobile.appsii.SimpleJson.java
@Nullable static SimpleJson getChild(@NonNull SimpleJson parent, String segment) { JSONObject object = parent.mJsonObject; SimpleArrayMap<String, SimpleJson> map = parent.mParsedChildren; if (map == null) { JSONObject obj = object.optJSONObject(segment); if (obj == null) return null; parent.mParsedChildren = new SimpleArrayMap<>(); map = parent.mParsedChildren;/*from w w w. j a v a2 s .c om*/ map.put(segment, new SimpleJson(obj)); } SimpleJson result; if (map.containsKey(segment)) { result = map.get(segment); } else { JSONObject obj = object.optJSONObject(segment); if (obj == null) return null; result = new SimpleJson(obj); map.put(segment, result); } return result; }
From source file:com.novoda.downloadmanager.notifications.SynchronisedDownloadNotifier.java
private void addBatchToCluster(String tag, SimpleArrayMap<String, Collection<DownloadBatch>> cluster, DownloadBatch batch) {//from w w w.j a v a 2 s .c o m if (tag == null) { return; } Collection<DownloadBatch> batches; if (cluster.containsKey(tag)) { batches = cluster.get(tag); } else { batches = new ArrayList<>(); cluster.put(tag, batches); } batches.add(batch); }
From source file:com.novoda.downloadmanager.notifications.SynchronisedDownloadNotifier.java
private List<Integer> getStaleTagsThatWereNotRenewed( SimpleArrayMap<String, Collection<DownloadBatch>> clustered) { List<Integer> staleTags = new ArrayList<>(); for (int i = activeNotifications.size() - 1; i >= 0; i--) { String tag = activeNotifications.keyAt(i); if (!clustered.containsKey(tag)) { staleTags.add(tag.hashCode()); activeNotifications.removeAt(i); }//from w w w .j a v a 2 s . c om } return staleTags; }
From source file:com.appsimobile.appsii.module.appsiagenda.MonthView.java
/** * Sets all the parameters for displaying this week. The only required * parameter is the week number. Other parameters have a default value and * will only update if a new value is included, except for focus month, * which will always default to no focus month if no value is passed in. See * {@link #VIEW_PARAMS_HEIGHT} for more info on parameters. * * @param params A map of the new parameters, see * {@link #VIEW_PARAMS_HEIGHT}/* www. j a v a 2 s.co m*/ */ public void setMonthParams(SimpleArrayMap<String, Integer> params) { if (!params.containsKey(VIEW_PARAMS_MONTH) && !params.containsKey(VIEW_PARAMS_YEAR)) { throw new InvalidParameterException("You must specify month and year for this view"); } setTag(params); // We keep the current value for any params not present if (params.containsKey(VIEW_PARAMS_HEIGHT)) { mRowHeight = params.get(VIEW_PARAMS_HEIGHT); if (mRowHeight < MIN_HEIGHT) { mRowHeight = MIN_HEIGHT; } } if (params.containsKey(VIEW_PARAMS_SELECTED_DAY)) { mSelectedDay = params.get(VIEW_PARAMS_SELECTED_DAY); } mStartJulianDay = params.get(VIEW_PARAMS_START_JULIAN_DAY); // Allocate space for caching the day numbers and focus values mMonth = params.get(VIEW_PARAMS_MONTH); mYear = params.get(VIEW_PARAMS_YEAR); // Figure out what day today is final Time today = new Time(Time.getCurrentTimezone()); today.setToNow(); mHasToday = false; mToday = -1; mCalendar.set(Calendar.MONTH, mMonth); mCalendar.set(Calendar.YEAR, mYear); mCalendar.set(Calendar.DAY_OF_MONTH, 1); mDayOfWeekStart = mCalendar.get(Calendar.DAY_OF_WEEK); if (params.containsKey(VIEW_PARAMS_WEEK_START)) { mWeekStart = params.get(VIEW_PARAMS_WEEK_START); } else { mWeekStart = mCalendar.getFirstDayOfWeek(); } mNumCells = Utils.getDaysInMonth(mMonth, mYear); for (int i = 0; i < mNumCells; i++) { final int day = i + 1; if (sameDay(day, today)) { mHasToday = true; mToday = day; } } mNumRows = calculateNumRows(); // Invalidate cached accessibility information. mTouchHelper.invalidateRoot(); }
From source file:com.appsimobile.appsii.module.calls.CallLogLoader.java
private SimpleArrayMap<String, BaseContactInfo> loadContactsByNumber(Context context) { SimpleArrayMap<String, BaseContactInfo> result = new SimpleArrayMap<>(); Cursor c = context.getContentResolver().query(CommonDataKinds.Phone.CONTENT_URI, ContactsByNumberQuery.PROJECTION, null, null, null); while (c.moveToNext()) { String normalizedNumber = c.getString(ContactsByNumberQuery.NORMALIZED_NUMBER); String plainNumber = c.getString(ContactsByNumberQuery.NUMBER); if (normalizedNumber == null && plainNumber == null) continue; if (normalizedNumber != null && result.containsKey(normalizedNumber)) continue; if (plainNumber != null && result.containsKey(plainNumber)) continue; BaseContactInfo info = new BaseContactInfo(); info.mContactId = c.getLong(ContactsByNumberQuery.CONTACT_ID); info.mLookupKey = c.getString(ContactsByNumberQuery.LOOKUP_KEY); info.mContactLookupUri = ContactsContract.Contacts.getLookupUri(info.mContactId, info.mLookupKey); info.mDisplayName = c.getString(ContactsByNumberQuery.DISPLAY_NAME); info.mDisplayNameSource = c.getInt(ContactsByNumberQuery.DISPLAY_NAME_SOURCE); info.mPhotoUri = c.getString(ContactsByNumberQuery.PHOTO_URI); info.mStarred = c.getInt(ContactsByNumberQuery.STARRED) == 1; result.put(normalizedNumber, info); if (!TextUtils.equals(plainNumber, normalizedNumber)) { result.put(plainNumber, info); }//from w w w . ja v a2 s. c o m } c.close(); return result; }
From source file:com.appsimobile.appsii.module.weather.WeatherLoadingService.java
private String[] addFallbackWoeid(String[] woeids, SimpleArrayMap<String, String> woeidTimezones) { PreferenceHelper preferenceHelper = mPreferenceHelper; String woeid = preferenceHelper.getDefaultLocationWoeId(); if (woeid != null) { String[] tmp = new String[woeids.length + 1]; System.arraycopy(woeids, 0, tmp, 1, woeids.length); tmp[0] = woeid;// ww w . j a v a 2 s . c om woeids = tmp; String woeidTimezone = preferenceHelper.getDefaultLocationTimezone(); if (!woeidTimezones.containsKey(woeid)) { woeidTimezones.put(woeid, woeidTimezone); } } return woeids; }