Exemplo n.º 1
0
        private void showfunsold()
        {
            ICollection <string> oldlist = mSharedPreference.GetStringSet("funslist", new Collection <string>());

            if (oldlist.Count > 0)
            {
                int i = 0;
                if (fixGridLayout != null)
                {
                    fixGridLayout.RemoveAllViews();
                }
                else
                {
                    fixGridLayout = new FixGridLayout(this);
                    fixGridLayout.setmCellHeight(200);
                    fixGridLayout.setmCellWidth(150);
                    linearLayout1.AddView(fixGridLayout);
                }
                foreach (string fun in oldlist)
                {
                    string[] result = fun.Split('|');
                    string   title  = result[0];
                    string   tourl  = result[1];

                    if (Android.OS.Environment.MediaMounted.Equals(Android.OS.Environment.ExternalStorageState))
                    {
                        string imgsavepath = Android.OS.Environment.ExternalStorageDirectory +
                                             File.Separator + "CommFramework" + File.Separator;
                        string savepath = imgsavepath + "funimg" + i.ToString() + ".png";
                        Bitmap bm       = Loading.getLoacalBitmap(savepath);
                        if (bm != null)
                        {
                            MyImageButton oldfun = new MyImageButton(this, bm, title, tourl, "");


                            fixGridLayout.AddView(oldfun);
                        }
                    }
                    i++;
                }
                //linearLayout1.AddView(fixGridLayout);
            }
        }
Exemplo n.º 2
0
        private void Addmyfuns()
        {
            if (fixGridLayout != null)
            {
                fixGridLayout.RemoveAllViews();
            }
            else
            {
                fixGridLayout = new FixGridLayout(this);
                fixGridLayout.setmCellHeight(200);
                fixGridLayout.setmCellWidth(150);
                linearLayout1.AddView(fixGridLayout);
            }
            int i = 0;

            foreach (MyImageButton mbtn in myfunslist)
            {
                fixGridLayout.AddView(mbtn);
                if (mbtn.mbadgeurl != "")
                {
                    string pngpath = Android.OS.Environment.ExternalStorageDirectory +
                                     File.Separator + "CommFramework" +
                                     File.Separator +
                                     "funicoimg" + i.ToString() + ".png";
                    Bitmap icobm = Loading.getLoacalBitmap(pngpath);
                    {
                        if (icobm != null)
                        {
                            BadgeView badge5 = new BadgeView(this, mbtn, fixGridLayout);
                            badge5.Text = (i.ToString());
                            // badge5.SetBackgroundDrawable(new BitmapDrawable(icobm));
                            badge5.SetBackgroundResource(Resource.Drawable.badge_ifaux);
                            badge5.TextSize = (16);
                            badge5.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);
                            badge5.show();
                        }
                    }
                }
                i++;
            }
        }