public override void Autofill(SparseArray values)
 {
     // User has just selected a Dataset from the list of autofill suggestions.
     // The Dataset is comprised of a list of AutofillValues, with each AutofillValue meant
     // to fill a specific autofillable view. Now we have to update the UI based on the
     // AutofillValues in the list.
     Log.Debug(LogTag, "autoFill(): " + values);
     for (int i = 0; i < values.Size(); i++)
     {
         var  id    = values.KeyAt(i);
         var  value = (AutofillValue)values.ValueAt(i);
         Item item  = VirtualViews.Get(id);
         if (item != null && item.Editable)
         {
             // Set the item's text to the text wrapped in the AutofillValue.
             item.Text = value.TextValue;
         }
         else if (item == null)
         {
             Log.Warn(LogTag, "No item for id " + id);
         }
         else
         {
             Log.Warn(LogTag, "Item for id " + id + " is not editable: " + item);
         }
     }
     PostInvalidate();
 }
Beispiel #2
0
        public virtual void ShowAllHiddenRows()
        {
            for (int i = 0; i < mHideRowList.Size(); i++)
            {
                int row = mHideRowList.KeyAt(i);
                ShowRow(row, false);
            }

            ClearHideRowList();
        }
Beispiel #3
0
        public virtual void ShowAllHiddenColumns()
        {
            for (int i = 0; i < mHideColumnList.Size(); i++)
            {
                int column = mHideColumnList.KeyAt(i);
                ShowColumn(column, false);
            }

            ClearHideColumnList();
        }
Beispiel #4
0
        public override void onReceiveData(int id, int requestCode, Bundle data, Type fromCls, int fromId)
        {
            switch (requestCode)
            {
            case APP_SELECTOR_CODE:
                if (APP_SELECTOR_ID == id)
                {
                    // app selector receives data
                    Window window2 = show(APP_SELECTOR_ID);
                    window2.data.PutInt("fromId", fromId);
                }
                break;

            case APP_SELECTOR_FINISHED_CODE:
                //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
                //ORIGINAL LINE: final Android.Content.pm.ActivityInfo app = data.getParcelable("app");
                ActivityInfo app = (ActivityInfo)data.GetParcelable("app");
                Log.Debug("FloatingFolder", "Received app: " + app);

                Window window = getWindow(id);
                if (window == null)
                {
                    return;
                }

                ViewGroup flow = (ViewGroup)window.FindViewById(Resource.Id.flow);

                AddAppToFolder(id, app, flow);

                OnUserAddApp(id, app);
                break;

            case STARTUP_CODE:
                LoadAllFolders();
                if (MFolders.Size() == 0)
                {
                    MFolders.Put(DEFAULT_ID, new FolderModel());
                    show(DEFAULT_ID);
                }
                else
                {
                    for (int i = 0; i < MFolders.Size(); i++)
                    {
                        FolderModel folder = MFolders.Get(MFolders.KeyAt(i));
                        if (folder.Shown)
                        {
                            show(folder.Id);
                        }
                    }
                }
                break;
            }
        }
Beispiel #5
0
 /**
  * Call this method to reset animation status on all views.
  */
 public void reset()
 {
     for (int i = 0; i < mAnimators.Size(); i++)
     {
         mAnimators.Get(mAnimators.KeyAt(i)).Cancel();
     }
     mAnimators.Clear();
     mFirstAnimatedPosition = -1;
     mLastAnimatedPosition  = -1;
     mAnimationStartMillis  = -1;
     mShouldAnimate         = true;
 }
        /// <summary>
        /// Returns the ids in the <seealso cref="#sWindows"/> cache.
        /// </summary>
        /// <param name="cls">
        ///            The class of the implementation of the window. </param>
        /// <returns> The ids representing the cached windows. </returns>
        public virtual ISet <int?> GetCacheIds(Type cls)
        {
            SparseArray <Window> l2 = SWindows.GetValueOrNull(cls);

            if (l2 == null)
            {
                return(new HashSet <int?>());
            }

            ISet <int?> keys = new HashSet <int?>();

            for (int i = 0; i < l2.Size(); i++)
            {
                keys.Add(l2.KeyAt(i));
            }
            return(keys);
        }
Beispiel #7
0
        public void filter(FaceInfo[] infos, ImageFrame frame)
        {
            currentFrame.Clear();
            if (infos != null)
            {
                foreach (FaceInfo faceInfo in infos)
                {
                    TrackedModel face = getTrackedModel(faceInfo, frame);
                    currentFrame.Add(face);
                    face.setInfo(faceInfo);
                }
            }

            leftFaces.Clear();
            for (int i = 0; i < trackingFaces.Size(); i++)
            {
                int          key  = trackingFaces.KeyAt(i);
                TrackedModel face = trackingFaces.Get(key);
                if (!currentFrame.Contains(face))
                {
                    leftFaces.Add(key);
                }
                else
                {
                    if (onTrackListener != null)
                    {
                        face.setFrame(frame);
                        onTrackListener.onTrack(face);
                    }
                }
            }
            foreach (int?key in leftFaces)
            {
                TrackedModel left = trackingFaces.Get(key.Value);
                Log.Info("xx", " left:" + left);
                left.setEvent(Event.OnLeave);
                trackingFaces.Remove(key.Value);
                if (onTrackListener != null)
                {
                    onTrackListener.onTrack(left);
                }
                // TODO release argb?
            }
        }
Beispiel #8
0
        public override IParcelable SaveState()
        {
            IParcelable p      = base.SaveState();
            Bundle      bundle = new Bundle();

            bundle.PutParcelable(_stateSuperState, p);

            bundle.PutInt(_statePages, _pages.Size());
            if (0 < _pages.Size())
            {
                for (int i = 0; i < _pages.Size(); i++)
                {
                    int position = _pages.KeyAt(i);
                    bundle.PutInt(CreateCacheIndex(i), position);
                    Fragment f = _pages.Get(position);
                    _fm.PutFragment(bundle, CreateCacheKey(position), f);
                }
            }
            return(bundle);
        }
Beispiel #9
0
        public override void Autofill(SparseArray values)
        {
            Context context = Context;

            // User has just selected a Dataset from the list of autofill suggestions.
            // The Dataset is comprised of a list of AutofillValues, with each AutofillValue meant
            // to fill a specific autofillable view. Now we have to update the UI based on the
            // AutofillValues in the list, but first we make sure all autofilled values belong to the
            // same partition
            if (DEBUG)
            {
                Log.Debug(TAG, "autofill(): " + values);
            }

            // First get the name of all partitions in the values
            ArraySet partitions = new ArraySet();

            for (int i = 0; i < values.Size(); i++)
            {
                int id        = values.KeyAt(i);
                var partition = mPartitionsByAutofillId.Get(id);
                if (partition == null)
                {
                    ShowError(context.GetString(Resource.String.message_autofill_no_partitions, id,
                                                mPartitionsByAutofillId));
                    return;
                }

                partitions.Add(partition.mName);
            }

            // Then make sure they follow the Highlander rule (There can be only one)
            if (partitions.Size() != 1)
            {
                ShowError(context.GetString(Resource.String.message_autofill_blocked, partitions));
                return;
            }

            // Finally, autofill it.
            var df = Android.Text.Format.DateFormat.GetDateFormat(context);

            for (int i = 0; i < values.Size(); i++)
            {
                int id    = values.KeyAt(i);
                var value = (AutofillValue)values.ValueAt(i);
                var item  = mVirtualViews.Get(id);

                if (item == null)
                {
                    Log.Warn(TAG, "No item for id " + id);
                    continue;
                }

                if (!item.editable)
                {
                    ShowError(context.GetString(Resource.String.message_autofill_readonly, item.text.ToString()));
                    continue;
                }

                // Check if the type was properly set by the autofill service
                if (DEBUG)
                {
                    Log.Debug(TAG, "Validating " + i
                              + ": expectedType=" + CommonUtil.GetTypeAsString(item.type)
                              + "(" + item.type + "), value=" + value);
                }

                bool valid = false;
                if (value.IsText && item.type == AutofillType.Text)
                {
                    item.text = value.TextValue;
                    valid     = true;
                }
                else if (value.IsDate && item.type == AutofillType.Date)
                {
                    item.text = df.Format(new Date(value.DateValue));
                    valid     = true;
                }
                else
                {
                    Log.Warn(TAG, "Unsupported type: " + value);
                }

                if (!valid)
                {
                    item.text = context.GetString(Resource.String.message_autofill_invalid);
                }
            }

            PostInvalidate();
            ShowMessage(context.GetString(Resource.String.message_autofill_ok, partitions.ValueAt(0)));
        }