Exemple #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();
        }
Exemple #2
0
        private static void CopyFile(Context context, string fileName)
        {
            try
            {
                System.IO.Stream fos = context.OpenFileOutput(fileName, FileCreationMode.Private);
                System.IO.Stream fis = context.Assets.Open(fileName);

                AnnotationActivity.CopyFile(fis, fos);

                fos.Flush();
                fos.Close();
                fis.Close();

                System.Console.WriteLine(fileName + " successfuly copied!!!!!");
            }
            catch (Exception e)
            {
                System.Console.WriteLine("Dict CopyFile ERROR => " + e.Message);
            }
        }
        public WordPopup(AnnotationActivity activity)
        {
            mContext = activity;
            mWindow  = new PopupWindow(mContext);
            if (Build.VERSION.SdkInt >= BuildVersionCodes.Honeycomb)
            {
                mWindow.SoftInputMode = SoftInput.AdjustNothing;
            }
            mWindowManager = activity.GetSystemService(Context.WindowService).JavaCast <IWindowManager>();
            history        = new List <int>();

            LayoutInflater inflater = (LayoutInflater)mContext.GetSystemService(Context.LayoutInflaterService);

            mRootView               = inflater.Inflate(Resource.Layout.Popup, null);
            mBubble                 = (LinearLayout)mRootView.FindViewById(Resource.Id.bubble);
            mScroll                 = (ScrollView)mRootView.FindViewById(Resource.Id.scroller);
            mArrowDown              = (ImageView)mRootView.FindViewById(Resource.Id.arrow_down);
            mArrowUp                = (ImageView)mRootView.FindViewById(Resource.Id.arrow_up);
            mChars                  = (TextView)mRootView.FindViewById(Resource.Id.charsText);
            mChars.LinksClickable   = true;
            mChars.MovementMethod   = LinkMovementMethod.Instance;
            mContent                = (TextView)mRootView.FindViewById(Resource.Id.content);
            mContent.LinksClickable = true;
            mContent.MovementMethod = LinkMovementMethod.Instance;
            mBookmark               = (TextView)mRootView.FindViewById(Resource.Id.bookmarkTitle);

            this.Configure(mContext);

            mWindow.SetBackgroundDrawable(new BitmapDrawable());
            mWindow.Width            = ViewGroup.LayoutParams.WrapContent;
            mWindow.Height           = ViewGroup.LayoutParams.WrapContent;
            mWindow.Touchable        = true;
            mWindow.Focusable        = false;
            mWindow.OutsideTouchable = false;
            mWindow.ContentView      = mRootView;

            Button copyButton = (Button)mRootView.FindViewById(Resource.Id.charsCopy);

            copyButton.Touch += Button_Touch;
            copyButton.Click += CopyButton_Click;

            splitButton        = (Button)mRootView.FindViewById(Resource.Id.button_split);
            splitButton.Touch += Button_Touch;
            splitButton.Click += SplitButton_Click;

            Button starButton = (Button)mRootView.FindViewById(Resource.Id.button_star);

            starButton.Touch += Button_Touch;
            starButton.Click += StarButton_Click;

            bookmarkButton        = (Button)mRootView.FindViewById(Resource.Id.button_bookmark);
            bookmarkButton.Touch += Button_Touch;
            bookmarkButton.Click += BookmarkButton_Click;

            Button shareButton = (Button)mRootView.FindViewById(Resource.Id.button_share);

            shareButton.Touch += Button_Touch;
            shareButton.Click += ShareButton_Click;

            LinearLayout popupButtons = (LinearLayout)mRootView.FindViewById(Resource.Id.popupButtons);

            Dictionaries.DictInfo[] dicts = Dictionaries.DictList;
            PackageManager          pm    = mContext.PackageManager;

            foreach (Dictionaries.DictInfo dict in dicts)
            {
                bool installed = Dictionaries.IsPackageInstalled(pm, dict.packageName);
                if (installed)
                {
                    Button dictBtn = new Button(mContext);
                    dictBtn.Text     = dict.id;
                    dictBtn.TextSize = 20;
                    dictBtn.SetTextColor(Color.ParseColor("#99333333"));
                    //dictBtn.Tag = dict;
                    dictBtn.SetPadding((int)(10 * scale), (int)(2 * scale), 0, (int)(2 * scale));
                    dictBtn.SetBackgroundColor(Color.Transparent);
                    dictBtn.SetMinimumWidth(0);
                    dictBtn.SetMinWidth(0);
                    dictBtn.SetMinimumHeight(0);
                    dictBtn.SetMinHeight(0);
                    dictBtn.SetSingleLine(true);
                    dictBtn.Touch += Button_Touch;
                    popupButtons.AddView(dictBtn);
                    dictBtn.Click += DictBtn_Click;
                }
            }
        }
Exemple #4
0
 public DumpBothAnnTask(AnnotationActivity activity)
 {
     Activity = activity;
 }
Exemple #5
0
 public DumpPinyinAnnTask(AnnotationActivity activity)
 {
     Activity = activity;
 }
Exemple #6
0
 public UpdateLinesAnnTask(AnnotationActivity activity)
 {
     Activity = activity;
 }
Exemple #7
0
 public RecyclerViewOnScrollListener(AnnotationActivity activity)
 {
     this.Activity = activity;
 }