public virtual int GetItemViewType(T item, int position) { int delegatesCount = delegates.Size(); for (int i = delegatesCount - 1; i >= 0; i--) { Com.Zhy.Adapter.Recyclerview.Base.ItemViewDelegate <T> delegate_ = delegates.ValueAt (i); if (delegate_.IsForViewType(item, position)) { return(delegates.KeyAt(i)); } } throw new System.ArgumentException("No ItemViewDelegate added that matches position=" + position + " in data source"); }
public void ReceiveDetections(Detector.Detections detections) { Android.Util.SparseArray barcodes = detections.DetectedItems; for (int i = 0; i < barcodes.Size(); i++) { Barcode barcode = barcodes.ValueAt(i) as Barcode; string value = barcode.DisplayValue; try { Uri appId = Uri.Parse(value); if (!appId.Scheme.Equals("layer")) { throw new Java.Lang.IllegalArgumentException("URI is not an App ID"); } if (!appId.Authority.Equals("")) { throw new Java.Lang.IllegalArgumentException("URI is not an App ID"); } IList <string> segments = appId.PathSegments; if (segments.Count != 3) { throw new Java.Lang.IllegalArgumentException("URI is not an App ID"); } if (!segments[0].Equals("apps")) { throw new Java.Lang.IllegalArgumentException("URI is not an App ID"); } if (!segments[1].Equals("staging") && !segments[1].Equals("production")) { throw new Java.Lang.IllegalArgumentException("URI is not an App ID"); } UUID uuid = UUID.FromString(segments[2]); if (Util.Log.IsLoggable(Util.Log.VERBOSE)) { Util.Log.v("Captured Layer App ID: " + appId + ", UUID: " + uuid); } if (_appIdScanner.mAppIdCallback == null) { return; } _appIdScanner.mAppIdCallback.OnLayerAppIdScanned(_appIdScanner, appId.ToString()); } catch (System.Exception e) { // Not this barcode... if (Util.Log.IsLoggable(Util.Log.ERROR)) { Util.Log.e("Barcode does not contain an App ID URI: " + value, e); } } } }