コード例 #1
0
        public AnnListAdapter(AnnotationActivity context, IList <List <object> > items, RecyclerView recyclerView, WordPopup popup)
        {
            this.context = context;
            wPopup       = popup;
            mLines       = items;

            LinearLayoutManager linearLayoutManager = (LinearLayoutManager)recyclerView.GetLayoutManager();
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            System.Console.WriteLine("AnnotationActivity >> OnCreate");

            app = this;

            try
            {
                if (FindViewById(Resource.Id.lines) != null)
                {
                    AnnTask.UpdateVars(this);
                    CheckIsShared();

                    return;
                }

                curFilePath           = "";
                isFirstAnnotation     = true;
                isFirstFileAnnotation = true;

                PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences, false);
                sharedPrefs = PreferenceManager.GetDefaultSharedPreferences(this);

                SetContentView(Resource.Layout.MainActivity);
                mToolbar = (Toolbar)FindViewById(Resource.Id.toolbar); // Attaching the layout to the toolbar object
                SetSupportActionBar(mToolbar);
                SupportActionBar.SetDisplayShowHomeEnabled(true);
                SupportActionBar.SetIcon(Resource.Drawable.logo_toolbar);

                wPopup   = new WordPopup(this);
                testView = new LineView(this);
                testView.UpdateVars();

                lines             = new List <List <object> >();
                linesRecyclerView = (CustomRecyclerView)FindViewById(Resource.Id.lines);
                linesRecyclerView.mMainActivity = this;
                linesLayoutManager = new LinearLayoutManager(this);
                linesRecyclerView.SetLayoutManager(linesLayoutManager);
                linesAdapter = new AnnListAdapter(this, this.lines, linesRecyclerView, wPopup);
                linesRecyclerView.SetAdapter(linesAdapter);
                defaultItemAnimator = linesRecyclerView.GetItemAnimator();

                linesRecyclerView.AddOnScrollListener(new RecyclerViewOnScrollListener(this));

                mBookmarks      = new List <Bookmark>();
                mFoundBookmarks = new List <Bookmark>();
            }
            catch (Exception e)
            {
                Toast.MakeText(this, "Error: " + e.Message, ToastLength.Long).Show();
            }
        }
コード例 #3
0
        private void SplitButton_Click(object sender, EventArgs e)
        {
            WordPopup view = sender as WordPopup;

            view.dismiss();

            List <object> subWords  = BreakWord(Dict.GetCh(entry));
            int           lineIndex = mContext.lines.IndexOf(line);

            mContext.linesAdapter.NotifyDataSetChanged();

            object firstWord = subWords[0];

            if (mContext.annoMode == AnnotationActivity.ANNOTATE_FILE)
            {
                mContext.curPos = 0;
                mContext.endPos = mContext.GetPosition(mContext.lines, lineIndex + 1, wordIndex, true) + (firstWord is int?Dict.GetLength((int)firstWord) : ((string)firstWord).Length) * 3;
            }
            else
            {
                mContext.endPos = (int)mContext.GetPosition(mContext.lines, lineIndex + 1, wordIndex, false) + (firstWord is int?Dict.GetLength((int)firstWord) : ((string)firstWord).Length);
            }

            List <object> curLine  = (List <object>)line;
            int           toRemove = curLine.Count - wordIndex;

            while (toRemove-- > 0)
            {
                curLine.RemoveAt(wordIndex);
            }
            curLine.Add(subWords[0]);

            int curWidth = 5;

            foreach (object word in curLine)
            {
                curWidth += mContext.testView.GetWordWidth((string)word);
            }

            mContext.SplitAnnotation(lineIndex, curWidth, curLine);
        }
コード例 #4
0
 public CopySpan(WordPopup outerInstance)
 {
     this.outerInstance = outerInstance;
 }