示例#1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            MainActivity.LoadTheme(this);
            SetContentView(Resource.Layout.EditMetaData);
            Window.SetStatusBarColor(Color.Argb(70, 00, 00, 00));

            instance      = this;
            song          = (Song)Intent.GetStringExtra("Song");
            queuePosition = Intent.GetIntExtra("Position", -1);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.backToolbar);
            DisplayMetrics metrics = new DisplayMetrics();

            WindowManager.DefaultDisplay.GetMetrics(metrics);
            ((View)toolbar.Parent.Parent).LayoutParameters.Height = metrics.WidthPixels;
            toolbar.Parent.RequestLayout();
            toolbar.LayoutParameters.Height = metrics.WidthPixels / 3;
            toolbar.RequestLayout();
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayShowTitleEnabled(false);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            title     = FindViewById <TextView>(Resource.Id.metadataTitle);
            artist    = FindViewById <TextView>(Resource.Id.metadataArtist);
            album     = FindViewById <TextView>(Resource.Id.metadataAlbum);
            youtubeID = FindViewById <TextView>(Resource.Id.metadataYID);
            albumArt  = FindViewById <ImageView>(Resource.Id.metadataArt);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.metadataFAB);

            fab.Click += async(sender, e) => { await ValidateChanges(); };

            title.Text      = song.Title;
            artist.Text     = song.Artist;
            album.Text      = song.Album;
            youtubeID.Text  = song.YoutubeID;
            albumArt.Click += AlbumArt_Click;

            var songCover       = Android.Net.Uri.Parse("content://media/external/audio/albumart");
            var songAlbumArtUri = ContentUris.WithAppendedId(songCover, song.AlbumArt);

            Picasso.With(Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Drawable.noAlbum).Into(albumArt);
        }
示例#2
0
 protected override void OnResume()
 {
     base.OnResume();
     instance = this;
 }