Ejemplo n.º 1
0
 public static void CreateInstance(Context ctx, int mainVersion, int patchVersion)
 {
     if (Env.UseOBB)
     {
         instance = new OBBAssetHelper(ctx, mainVersion, patchVersion);
     }
     else
     {
         instance = new FSAssetHelper(ctx);
     }
 }
Ejemplo n.º 2
0
        public override View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
        {
            var view = convertView;

            if (view != null)
            {
                ((BitmapDrawable)view.FindViewById <ImageView>(Resource.Id.ivMeidaElementImage).Drawable).Bitmap.Recycle();
            }
            else
            {
                view = layoutInflater.Inflate(Resource.Layout.MediaElement, null);
            }

            var imageView = view.FindViewById <ImageView>(Resource.Id.ivMeidaElementImage);

            imageView.SetImageBitmap(AssetHelper.GetBitmap(Context, GetItem(position).Media.ImagePath));
            return(view);
        }
        public override View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
        {
            View view = convertView;

            if (view == null)
            {
                view = LayoutInflater.From(Context).Inflate(Resource.Layout.AbcRankSolutionItems, null);
            }
            else
            {
                ((BitmapDrawable)view.FindViewById <ImageView>(Resource.Id.ivAbcRankSolutionItem).Drawable).Bitmap.Recycle();
            }


            var item = items.ElementAt(position);

            if (item.Name == null)
            {
                // if there is no item as solution show the placeholder question mark without text
                prepareUiElementsForImage(BitmapFactory.DecodeResource(Context.Resources, Resource.Drawable.ic_help_black_24dp), view.FindViewById <ImageView>(Resource.Id.ivAbcRankSolutionItem), view.FindViewById <TextView>(Resource.Id.abcRankSolutionElementName));
            }
            else
            {
                // if there is an item at this position of the solution
                if (item.Media != null)
                {
                    // if there is an item with media element
                    prepareUiElementsForImage(AssetHelper.GetBitmap(Context, item.Media.ImagePath), view.FindViewById <ImageView>(Resource.Id.ivAbcRankSolutionItem), view.FindViewById <TextView>(Resource.Id.abcRankSolutionElementName));
                }
                else
                {
                    // if there is an item with image and contains only text
                    view.FindViewById <TextView>(Resource.Id.abcRankSolutionElementName).Text     = items.ElementAt(position).Name;
                    view.FindViewById <TextView>(Resource.Id.abcRankSolutionElementName).TextSize = 40.0f;
                }
            }

            return(view);
        }