android.support.v4.util.ArrayMap Java Examples
The following examples show how to use
android.support.v4.util.ArrayMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WXScrollerDomObject.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@Override protected Map<String, String> getDefaultStyle() { Map<String, String> map = new ArrayMap<>(); boolean isVertical = true; if (parent != null) { String direction = (String) parent.getAttrs().get(Constants.Name.SCROLL_DIRECTION); if (direction != null && direction.equals("horizontal")) { isVertical = false; } } String prop = isVertical?Constants.Name.HEIGHT:Constants.Name.WIDTH; if (getStyles().get(prop) == null && getStyles().get(Constants.Name.FLEX) == null) { map.put(Constants.Name.FLEX, "1"); } return map; }
Example #2
Source File: ParticleCloud.java From spark-sdk-android with Apache License 2.0 | 6 votes |
private DeviceState fromSimpleDeviceModel(Models.SimpleDevice offlineDevice) { Set<String> functions = new HashSet<>(); Map<String, VariableType> variables = new ArrayMap<>(); return new DeviceState.DeviceStateBuilder(offlineDevice.id, functions, variables) .name(offlineDevice.name) .cellular(offlineDevice.cellular) .connected(offlineDevice.isConnected) .version("") .deviceType(ParticleDeviceType.fromInt(offlineDevice.productId)) .platformId(offlineDevice.platformId) .productId(offlineDevice.productId) .imei(offlineDevice.imei) .iccid(offlineDevice.lastIccid) .currentBuild(offlineDevice.currentBuild) .defaultBuild(offlineDevice.defaultBuild) .ipAddress(offlineDevice.ipAddress) .lastAppName("") .status(offlineDevice.status) .requiresUpdate(false) .lastHeard(offlineDevice.lastHeard) .build(); }
Example #3
Source File: WXListDomObject.java From weex-uikit with MIT License | 6 votes |
@Override protected Map<String, String> getDefaultStyle() { Map<String,String> map = new ArrayMap<>(); boolean isVertical = true; if (parent != null) { if (parent.getType() != null) { if (parent.getType().equals(WXBasicComponentType.HLIST)) { isVertical = false; } } } String prop = isVertical ? Constants.Name.HEIGHT : Constants.Name.WIDTH; if (getStyles().get(prop) == null && getStyles().get(Constants.Name.FLEX) == null) { map.put(Constants.Name.FLEX, "1"); } return map; }
Example #4
Source File: SharedElementUtils.java From scene with Apache License 2.0 | 6 votes |
/** * Guarantee order: Parent -> Child * Make sure that Parent will not overwrite Child when adding Overlay */ public static List<NonNullPair<String, View>> sortSharedElementList(ArrayMap<String, View> sharedElements) { List<NonNullPair<String, View>> list = new ArrayList<>(); boolean isFirstRun = true; while (!sharedElements.isEmpty()) { final int numSharedElements = sharedElements.size(); for (int i = numSharedElements - 1; i >= 0; i--) { final View view = sharedElements.valueAt(i); final String name = sharedElements.keyAt(i); if (isFirstRun && (view == null || !view.isAttachedToWindow() || name == null)) { sharedElements.removeAt(i); } else if (!isNested(view, sharedElements)) { list.add(NonNullPair.create(name, view)); sharedElements.removeAt(i); } } isFirstRun = false; } return list; }
Example #5
Source File: Transition.java From Transitions-Everywhere with Apache License 2.0 | 6 votes |
/** * Match start/end values by Adapter view ID. Adds matched values to mStartValuesList * and mEndValuesList and removes them from unmatchedStart and unmatchedEnd, using * startIds and endIds as a guide for which Views have unique IDs. */ private void matchIds(@NonNull ArrayMap<View, TransitionValues> unmatchedStart, @NonNull ArrayMap<View, TransitionValues> unmatchedEnd, @NonNull SparseArray<View> startIds, @NonNull SparseArray<View> endIds) { int numStartIds = startIds.size(); for (int i = 0; i < numStartIds; i++) { View startView = startIds.valueAt(i); if (startView != null && isValidTarget(startView)) { View endView = endIds.get(startIds.keyAt(i)); if (endView != null && isValidTarget(endView)) { TransitionValues startValues = unmatchedStart.get(startView); TransitionValues endValues = unmatchedEnd.get(endView); if (startValues != null && endValues != null) { mStartValuesList.add(startValues); mEndValuesList.add(endValues); unmatchedStart.remove(startView); unmatchedEnd.remove(endView); } } } } }
Example #6
Source File: Transition.java From Transitions-Everywhere with Apache License 2.0 | 6 votes |
/** * Match start/end values by Adapter transitionName. Adds matched values to mStartValuesList * and mEndValuesList and removes them from unmatchedStart and unmatchedEnd, using * startNames and endNames as a guide for which Views have unique transitionNames. */ private void matchNames(@NonNull ArrayMap<View, TransitionValues> unmatchedStart, @NonNull ArrayMap<View, TransitionValues> unmatchedEnd, @NonNull ArrayMap<String, View> startNames, @NonNull ArrayMap<String, View> endNames) { int numStartNames = startNames.size(); for (int i = 0; i < numStartNames; i++) { View startView = startNames.valueAt(i); if (startView != null && isValidTarget(startView)) { View endView = endNames.get(startNames.keyAt(i)); if (endView != null && isValidTarget(endView)) { TransitionValues startValues = unmatchedStart.get(startView); TransitionValues endValues = unmatchedEnd.get(endView); if (startValues != null && endValues != null) { mStartValuesList.add(startValues); mEndValuesList.add(endValues); unmatchedStart.remove(startView); unmatchedEnd.remove(endView); } } } } }
Example #7
Source File: BackStackRecord.java From adt-leanback-support with Apache License 2.0 | 6 votes |
/** * Maps shared elements to views in the entering fragment. * * @param state The transition State as returned from {@link #beginTransition( * android.util.SparseArray, android.util.SparseArray, boolean)}. * @param inFragment The last fragment to be added. * @param isBack true if this is popping the back stack or false if this is a * forward operation. */ private ArrayMap<String, View> mapEnteringSharedElements(TransitionState state, Fragment inFragment, boolean isBack) { ArrayMap<String, View> namedViews = new ArrayMap<String, View>(); View root = inFragment.getView(); if (root != null) { if (mSharedElementSourceNames != null) { FragmentTransitionCompat21.findNamedViews(namedViews, root); if (isBack) { namedViews = remapNames(mSharedElementSourceNames, mSharedElementTargetNames, namedViews); } else { namedViews.retainAll(mSharedElementTargetNames); } } } return namedViews; }
Example #8
Source File: CastMessageHandler.java From 365browser with Apache License 2.0 | 6 votes |
/** * Initializes a new {@link CastMessageHandler} instance. * @param session The {@link CastSession} for communicating with the Cast SDK. * @param provider The {@link CastMediaRouteProvider} for communicating with the page. */ public CastMessageHandler(CastMediaRouteProvider provider) { mRouteProvider = provider; mRequests = new SparseArray<RequestRecord>(); mStopRequests = new ArrayMap<String, Queue<Integer>>(); mVolumeRequests = new ArrayDeque<RequestRecord>(); mHandler = new Handler(); synchronized (INIT_LOCK) { if (sMediaOverloadedMessageTypes == null) { sMediaOverloadedMessageTypes = new HashMap<String, String>(); sMediaOverloadedMessageTypes.put("STOP_MEDIA", "STOP"); sMediaOverloadedMessageTypes.put("MEDIA_SET_VOLUME", "SET_VOLUME"); sMediaOverloadedMessageTypes.put("MEDIA_GET_STATUS", "GET_STATUS"); } } }
Example #9
Source File: Transition.java From Transitions-Everywhere with Apache License 2.0 | 6 votes |
/** * This is called internally once all animations have been set up by the * transition hierarchy. * * @hide */ protected void runAnimators() { if (DBG) { Log.d(LOG_TAG, "runAnimators() on " + this); } start(); ArrayMap<Animator, AnimationInfo> runningAnimators = getRunningAnimators(); // Now start every Animator that was previously created for this transition for (Animator anim : mAnimators) { if (DBG) { Log.d(LOG_TAG, " anim: " + anim); } if (runningAnimators.containsKey(anim)) { start(); runAnimator(anim, runningAnimators); } } mAnimators.clear(); end(); }
Example #10
Source File: JsInterfaceHolderImpl.java From AgentWebX5 with Apache License 2.0 | 6 votes |
@Override public JsInterfaceHolder addJavaObjects(ArrayMap<String, Object> maps) { if(!checkSecurity()){ return this; } Set<Map.Entry<String, Object>> sets = maps.entrySet(); for (Map.Entry<String, Object> mEntry : sets) { Object v = mEntry.getValue(); boolean t = checkObject(v); if (!t) throw new JsInterfaceObjectException("this object has not offer method javascript to call ,please check addJavascriptInterface annotation was be added"); else addJavaObjectDirect(mEntry.getKey(), v); } return this; }
Example #11
Source File: PaymentRequestImpl.java From AndroidChromium with Apache License 2.0 | 6 votes |
private static Map<String, PaymentMethodData> getValidatedMethodData( PaymentMethodData[] methodData, CardEditor paymentMethodsCollector) { // Payment methodData are required. if (methodData == null || methodData.length == 0) return null; Map<String, PaymentMethodData> result = new ArrayMap<>(); for (int i = 0; i < methodData.length; i++) { String[] methods = methodData[i].supportedMethods; // Payment methods are required. if (methods == null || methods.length == 0) return null; for (int j = 0; j < methods.length; j++) { // Payment methods should be non-empty. if (TextUtils.isEmpty(methods[j])) return null; result.put(methods[j], methodData[i]); } paymentMethodsCollector.addAcceptedPaymentMethodsIfRecognized(methods); } return result; }
Example #12
Source File: CastMessageHandler.java From delion with Apache License 2.0 | 6 votes |
/** * Initializes a new {@link CastMessageHandler} instance. * @param session The {@link CastSession} for communicating with the Cast SDK. * @param provider The {@link CastMediaRouteProvider} for communicating with the page. */ public CastMessageHandler(CastMediaRouteProvider provider) { mRouteProvider = provider; mRequests = new SparseArray<RequestRecord>(); mStopRequests = new ArrayMap<String, Queue<Integer>>(); mVolumeRequests = new ArrayDeque<RequestRecord>(); mHandler = new Handler(); synchronized (INIT_LOCK) { if (sMediaOverloadedMessageTypes == null) { sMediaOverloadedMessageTypes = new HashMap<String, String>(); sMediaOverloadedMessageTypes.put("STOP_MEDIA", "STOP"); sMediaOverloadedMessageTypes.put("MEDIA_SET_VOLUME", "SET_VOLUME"); sMediaOverloadedMessageTypes.put("MEDIA_GET_STATUS", "GET_STATUS"); } } }
Example #13
Source File: RegisteredContactsFragment.java From iGap-Android with GNU Affero General Public License v3.0 | 6 votes |
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()) { case R.id.action_delete: new MaterialDialog.Builder(G.fragmentActivity).title(R.string.to_delete_contact).content(R.string.delete_text).positiveText(R.string.B_ok).onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { for (ArrayMap.Entry<Long, Boolean> entry : selectedList.entrySet()) { new RequestUserContactsDelete().contactsDelete("" + entry.getKey()); } mActionMode.finish(); refreshAdapter(0, true); } }).negativeText(R.string.B_cancel).show(); return true; default: return false; } }
Example #14
Source File: ReactNativeTabActivity.java From native-navigation with MIT License | 6 votes |
private void traverseTabs() { Stack<ViewGroup> stack = new Stack<>(); stack.push(tabConfigContainer); prevTabBarConfig = renderedTabBarConfig; renderedTabBarConfig = ConversionUtil.EMPTY_MAP; tabViews = new ArrayMap<>(); while (!stack.empty()) { ViewGroup view = stack.pop(); int childCount = view.getChildCount(); for (int i = 0; i < childCount; ++i) { View child = view.getChildAt(i); if (child instanceof TabView) { tabViews.put(child.getId(), (TabView) child); } else if (child instanceof TabBarView) { TabBarView tabBarView = (TabBarView) child; renderedTabBarConfig = ConversionUtil.combine(renderedTabBarConfig, tabBarView.getConfig()); stack.push(tabBarView); } else if (child instanceof ViewGroup) { stack.push((ViewGroup) child); } } } }
Example #15
Source File: BackStackRecord.java From adt-leanback-support with Apache License 2.0 | 6 votes |
/** * Remaps a name-to-View map, substituting different names for keys. * * @param inMap A list of keys found in the map, in the order in toGoInMap * @param toGoInMap A list of keys to use for the new map, in the order of inMap * @param namedViews The current mapping * @return A copy of namedViews with the keys coming from toGoInMap. */ private static ArrayMap<String, View> remapNames(ArrayList<String> inMap, ArrayList<String> toGoInMap, ArrayMap<String, View> namedViews) { if (namedViews.isEmpty()) { return namedViews; } ArrayMap<String, View> remappedViews = new ArrayMap<String, View>(); int numKeys = inMap.size(); for (int i = 0; i < numKeys; i++) { View view = namedViews.get(inMap.get(i)); if (view != null) { remappedViews.put(toGoInMap.get(i), view); } } return remappedViews; }
Example #16
Source File: CastMessageHandler.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Initializes a new {@link CastMessageHandler} instance. * @param session The {@link CastSession} for communicating with the Cast SDK. * @param provider The {@link CastMediaRouteProvider} for communicating with the page. */ public CastMessageHandler(CastMediaRouteProvider provider) { mRouteProvider = provider; mRequests = new SparseArray<RequestRecord>(); mStopRequests = new ArrayMap<String, Queue<Integer>>(); mVolumeRequests = new ArrayDeque<RequestRecord>(); mHandler = new Handler(); synchronized (INIT_LOCK) { if (sMediaOverloadedMessageTypes == null) { sMediaOverloadedMessageTypes = new HashMap<String, String>(); sMediaOverloadedMessageTypes.put("STOP_MEDIA", "STOP"); sMediaOverloadedMessageTypes.put("MEDIA_SET_VOLUME", "SET_VOLUME"); sMediaOverloadedMessageTypes.put("MEDIA_GET_STATUS", "GET_STATUS"); } } }
Example #17
Source File: WXListDomObject.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@Override protected Map<String, String> getDefaultStyle() { Map<String,String> map = new ArrayMap<>(); boolean isVertical = true; if (parent != null) { if (parent.getType() != null) { if (parent.getType().equals(WXBasicComponentType.HLIST)) { isVertical = false; } } } String prop = isVertical ? Constants.Name.HEIGHT : Constants.Name.WIDTH; if (getStyles().get(prop) == null && getStyles().get(Constants.Name.FLEX) == null) { map.put(Constants.Name.FLEX, "1"); } return map; }
Example #18
Source File: MultiMap.java From FireFiles with Apache License 2.0 | 6 votes |
/** * Construct a new map, that contains a unique String key for each value. * <p> * Current algorithm will construct unique key by appending a unique position number to * key's toString() value * * @return a {@link Map} */ public ArrayMap<String, V> getUniqueMap() { ArrayMap<String, V> uniqueMap = new ArrayMap<>(); for (Map.Entry<K, List<V>> entry : mInternalMap.entrySet()) { int count = 1; for (V value : entry.getValue()) { if (count == 1) { addUniqueEntry(uniqueMap, entry.getKey().toString(), value); } else { // append unique number to key for each value addUniqueEntry(uniqueMap, String.format("%s%d", entry.getKey(), count), value); } count++; } } return uniqueMap; }
Example #19
Source File: BackStackRecord.java From adt-leanback-support with Apache License 2.0 | 5 votes |
private void setEpicenterIn(ArrayMap<String, View> namedViews, TransitionState state) { if (mSharedElementTargetNames != null && !namedViews.isEmpty()) { // now we know the epicenter of the entering transition. View epicenter = namedViews .get(mSharedElementTargetNames.get(0)); if (epicenter != null) { state.enteringEpicenterView.epicenter = epicenter; } } }
Example #20
Source File: AbsElement.java From android-databinding with Apache License 2.0 | 5 votes |
protected void writeAttrs(XmlWriter writer) { try { final ArrayMap<String, String> attrMap = getAttributeMap(); for(int i=0,size=attrMap.size() ; i< size ;i++){ writer.attribute(attrMap.keyAt(i),attrMap.valueAt(i)); } } catch (IOException e) { throw new RuntimeException(e); } }
Example #21
Source File: Parcelables.java From spark-sdk-android with Apache License 2.0 | 5 votes |
public static <T extends Serializable> Map<String, T> readSerializableMap(Parcel parcel) { Map<String, T> map = new ArrayMap<>(); Bundle bundle = parcel.readBundle(Parcelables.class.getClassLoader()); for (String key : bundle.keySet()) { @SuppressWarnings("unchecked") T serializable = (T) bundle.getSerializable(key); map.put(key, serializable); } return map; }
Example #22
Source File: WXStyle.java From ucar-weex-core with Apache License 2.0 | 5 votes |
@Override protected WXStyle clone(){ WXStyle style = new WXStyle(); style.mStyles.putAll(this.mStyles); for(Entry<String,Map<String,Object>> entry:this.mPesudoStyleMap.entrySet()){ Map<String,Object> valueClone = new ArrayMap<>(); valueClone.putAll(entry.getValue()); style.mPesudoStyleMap.put(entry.getKey(),valueClone); } style.mPesudoResetStyleMap.putAll(this.mPesudoResetStyleMap); return style; }
Example #23
Source File: BackStackRecord.java From adt-leanback-support with Apache License 2.0 | 5 votes |
private ArrayMap<String, View> remapSharedElements(TransitionState state, Fragment outFragment, boolean isBack) { ArrayMap<String, View> namedViews = new ArrayMap<String, View>(); if (mSharedElementSourceNames != null) { FragmentTransitionCompat21.findNamedViews(namedViews, outFragment.getView()); if (isBack) { namedViews.retainAll(mSharedElementTargetNames); } else { namedViews = remapNames(mSharedElementSourceNames, mSharedElementTargetNames, namedViews); } } if (isBack) { if (outFragment.mEnterTransitionCallback != null) { outFragment.mEnterTransitionCallback.onMapSharedElements( mSharedElementTargetNames, namedViews); } setBackNameOverrides(state, namedViews, false); } else { if (outFragment.mExitTransitionCallback != null) { outFragment.mExitTransitionCallback.onMapSharedElements( mSharedElementTargetNames, namedViews); } setNameOverrides(state, namedViews, false); } return namedViews; }
Example #24
Source File: VideoListAdapter.java From VCL-Android with Apache License 2.0 | 5 votes |
public void setTimes(ArrayMap<String, Long> times) { boolean notify = false; // update times for (int i = 0; i < getCount(); ++i) { MediaWrapper media = getItem(i); Long time = times.get(media.getLocation()); if (time != null) { media.setTime(time); notify = true; } } if (notify) notifyDataSetChanged(); }
Example #25
Source File: AudioBrowserListAdapter.java From VCL-Android with Apache License 2.0 | 5 votes |
public AudioBrowserListAdapter(Activity context, int itemType) { mMediaItemMap = new ArrayMap<String, ListItem>(); mSeparatorItemMap = new ArrayMap<String, ListItem>(); mItems = new ArrayList<ListItem>(); mSections = new SparseArray<String>(); mContext = context; if (itemType != ITEM_WITHOUT_COVER && itemType != ITEM_WITH_COVER) throw new IllegalArgumentException(); mItemType = itemType; SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); mAlignMode = Integer.valueOf(preferences.getString("audio_title_alignment", "0")); }
Example #26
Source File: WXStyle.java From weex-uikit with MIT License | 5 votes |
<T extends String, V> void processPesudoClasses(Map<T, V> styles) { Iterator<Map.Entry<T, V>> iterator = styles.entrySet().iterator(); Map<String, Map<String, Object>> pesudoStyleMap = mPesudoStyleMap; while (iterator.hasNext()) { Map.Entry<T, V> entry = iterator.next(); //Key Format: "style-prop:pesudo_clz1:pesudo_clz2" String key = entry.getKey(); int i; if ((i = key.indexOf(":")) > 0) { String clzName = key.substring(i); if (clzName.equals(Constants.PESUDO.ENABLED)) { //enabled, use as regular style this.mPesudoResetStyleMap.put(key.substring(0, i), entry.getValue()); continue; } else { clzName = clzName.replace(Constants.PESUDO.ENABLED, "");//remove ':enabled' which is ignored } Map<String, Object> stylesMap = pesudoStyleMap.get(clzName); if (stylesMap == null) { stylesMap = new ArrayMap<>(); pesudoStyleMap.put(clzName, stylesMap); } stylesMap.put(key.substring(0, i), entry.getValue()); } } }
Example #27
Source File: ExposureManager.java From android_viewtracker with Apache License 2.0 | 5 votes |
/** * for the exposure event * * @param view * @return */ public void triggerViewCalculate(int triggerType, View view, HashMap<String, Object> commonInfo, Map<String, ExposureModel> lastVisibleViewMap) { if (!GlobalsContext.trackerExposureOpen) { return; } long triggerTime = System.currentTimeMillis(); if (triggerTime - traverseTime < 100) { TrackerLog.d("triggerTime interval is too close to 100ms"); return; } traverseTime = triggerTime; if (view == null) { TrackerLog.d("view is null"); return; } // Sample not hit if (isSampleHit == null) { isSampleHit = CommonHelper.isSamplingHit(GlobalsContext.exposureSampling); } if (!isSampleHit) { TrackerLog.d("exposure isSampleHit is false"); return; } Map<String, ExposureModel> currentVisibleViewMap = new ArrayMap<String, ExposureModel>(); traverseViewTree(view, lastVisibleViewMap, currentVisibleViewMap); commitExposure(triggerType, commonInfo, lastVisibleViewMap, currentVisibleViewMap); TrackerLog.d("triggerViewCalculate"); }
Example #28
Source File: PluginManager.java From Phantom with Apache License 2.0 | 5 votes |
@NonNull private ArrayMap<String, String> parseDependencyRequirements(List<String> lines) { ArrayMap<String, String> dependencies = new ArrayMap<>(); // lib -> requirement for (String line : lines) { final String[] parts = line.split(":"); if (parts.length == 3) { final String lib = parts[0] + ":" + parts[1]; // groupId:artifactId final String requirement = parts[2]; dependencies.put(lib, requirement); } } return dependencies; }
Example #29
Source File: FabSpeedDial.java From FireFiles with Apache License 2.0 | 5 votes |
private void init(Context context, AttributeSet attrs) { TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FabSpeedDial, 0, 0); resolveCompulsoryAttributes(typedArray); resolveOptionalAttributes(typedArray); typedArray.recycle(); if (isGravityBottom()) { LayoutInflater.from(context).inflate(R.layout.fab_speed_dial_bottom, this, true); } else { LayoutInflater.from(context).inflate(R.layout.fab_speed_dial_top, this, true); } if (isGravityEnd()) { setGravity(Gravity.END); } menuItemsLayout = (LinearLayout) findViewById(R.id.menu_items_layout); setOrientation(VERTICAL); newNavigationMenu(); int menuItemCount = navigationMenu.size(); fabMenuItemMap = new ArrayMap<>(menuItemCount); cardViewMenuItemMap = new ArrayMap<>(menuItemCount); setupFab(); }
Example #30
Source File: BackStackRecord.java From adt-leanback-support with Apache License 2.0 | 5 votes |
private void setNameOverrides(TransitionState state, ArrayMap<String, View> namedViews, boolean isEnd) { int count = namedViews.size(); for (int i = 0; i < count; i++) { String source = namedViews.keyAt(i); String target = FragmentTransitionCompat21.getTransitionName(namedViews.valueAt(i)); if (isEnd) { setNameOverride(state.nameOverrides, source, target); } else { setNameOverride(state.nameOverrides, target, source); } } }