Created
June 13, 2017 19:53
-
-
Save jamesmontemagno/3c7244d5bc10bc4162995cdddeeb9cf7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:orientation="vertical" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent"> | |
| <include | |
| android:id="@+id/toolbar" | |
| layout="@layout/toolbar" /> | |
| <FrameLayout | |
| android:layout_width="fill_parent" | |
| android:layout_height="0dp" | |
| android:layout_weight="1" | |
| android:id="@+id/fragment_frame_layout"/> | |
| </LinearLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using Android.App; | |
| using Android.Content; | |
| using Android.OS; | |
| using Android.Runtime; | |
| using Android.Views; | |
| using Android.Widget; | |
| using ImageSearch.ViewModel; | |
| using Android.Support.V7.App; | |
| using Toolbar = Android.Support.V7.Widget.Toolbar; | |
| using Xamarin.Forms; | |
| using ImageSearch.Shared.View; | |
| using Xamarin.Forms.Platform.Android.AppCompat; | |
| using Xamarin.Forms.Platform.Android; | |
| namespace ImageSearch.Droid | |
| { | |
| [Activity(Label = "Details", Icon = "@drawable/icon")] | |
| public class DetailsActivity : AppCompatActivity | |
| { | |
| public static ImageSearchViewModel ViewModel { get; set; } | |
| protected override void OnCreate(Bundle bundle) | |
| { | |
| base.OnCreate(bundle); | |
| SetContentView(Resource.Layout.details); | |
| Xamarin.Forms.Forms.Init(this, bundle); | |
| var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar); | |
| SetSupportActionBar(toolbar); | |
| SupportActionBar.Title = ViewModel.SelectedImage.Title; | |
| // #1 Initialize | |
| Forms.Init(this, null); | |
| // #2 Use it | |
| var frag = new DetailsPage(ViewModel.SelectedImage, ViewModel).CreateFragment(this); | |
| var ft = FragmentManager.BeginTransaction(); | |
| ft.Replace(Resource.Id.fragment_frame_layout, frag, "main"); | |
| ft.Commit(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment