private static string BuildTrackIdString(MediaFormat format)
 {
     return(format.TrackId == null
                         ? ""
                         : String.Format(Locale.Us, " (%d)", format.TrackId));
 }
Esempio n. 2
0
        private static void loadEmoji(int page)
        {
            try
            {
                float scale       = 1.0f;
                int   imageResize = 1;
                if (AndroidUtilities.density <= 1.0f)
                {
                    scale       = 2.0f;
                    imageResize = 2;
                }
                else if (AndroidUtilities.density <= 1.5f)
                {
                    scale       = 3.0f;
                    imageResize = 2;
                }
                else if (AndroidUtilities.density <= 2.0f)
                {
                    scale = 2.0f;
                }
                else
                {
                    scale = 3.0f;
                }

                var imageName = String.Format("emoji%.01fx_%d.jpg", scale, page);
                var imageFile = Application.Context.ApplicationContext.GetFileStreamPath(imageName);
                if (!imageFile.Exists())
                {
                    var iss = Application.Context.ApplicationContext.Assets.Open("emoji/" + imageName);
                    AndroidUtilities.copyFile(iss, imageFile);
                    iss.Close();
                }

                BitmapFactory.Options opts = new BitmapFactory.Options();
                opts.InJustDecodeBounds = true;
                BitmapFactory.DecodeFile(imageFile.AbsolutePath, opts);

                int width  = opts.OutWidth / imageResize;
                int height = opts.OutHeight / imageResize;
                int stride = width * 4;

                var bitmap = Bitmap.CreateBitmap(width, height, Bitmap.Config.Argb8888);
                AndroidUtilities.loadBitmap(imageFile.AbsolutePath, bitmap, imageResize, width, height, stride);

                imageName = String.Format("emoji%.01fx_a_%d.jpg", scale, page);
                imageFile = Application.Context.ApplicationContext.GetFileStreamPath(imageName);
                if (!imageFile.Exists())
                {
                    var iss = Start.getInstance().Assets.Open("emoji/" + imageName);
                    AndroidUtilities.copyFile(iss, imageFile);
                    iss.Close();
                }

                AndroidUtilities.loadBitmap(imageFile.AbsolutePath, bitmap, imageResize, width, height, stride);



                AndroidUtilities.runOnUIThread(new Runnable(() =>
                {
                    emojiBmp[page] = bitmap;
                    //NotificationCenter.getInstance().postNotificationName(NotificationCenter.emojiDidLoaded);
                }));
            }
            catch (Java.Lang.Exception ex)
            {
                var erro = ex;
            }
        }
 private static string BuildBitrateString(MediaFormat format)
 {
     return(format.Bitrate == MediaFormat.NoValue
                         ? ""
                         : String.Format(Locale.Us, "%.2fMbit", format.Bitrate / 1000000f));
 }