protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.tv_episode_detail); toolbar = FindViewById<Toolbar>(Resource.Id.image_toolbar_main_toolbar); appBarLayout = FindViewById<AppBarLayout>(Resource.Id.image_toolbar_appbar_layout); collapseToolbar = FindViewById<CollapsingToolbarLayout>(Resource.Id.image_toolbar_collapsing_layout); collapseToolbar.TitleEnabled = true; titleContainer = FindViewById<Android.Widget.LinearLayout>(Resource.Id.image_toolbar_collapsing_root); dataRV = FindViewById<RecyclerView>(Resource.Id.tv_episode_detail_rv); dataRV.SetLayoutManager(new CachingLayoutManager(this)); loadingView = FindViewById<ContentLoadingProgressBar>(Resource.Id.image_toolbar_loading); AppView.SetActionBarForActivity(toolbar, this); appBarLayout.OffsetChanged += AppLayout_OffsetChanged; callBack = new JavaValueCallback(); callBack.ValueReceived += JavaCallBack_ValueReceived; canGoBackToSeriesHome = Intent.GetBooleanExtra("canGoBackToSeriesHome", false); var link = Intent.GetStringExtra("itemLink"); LoadEpisodeData(link); }
/// <summary> /// Sets the orientation property of the given LinearLayout by the given Orientation option. /// </summary> /// <param name="layout"> /// The linear layout to update orientation. /// </param> /// <param name="orientation"> /// The orientation to update with. /// </param> public static void SetOrientation( this Android.Widget.LinearLayout layout, XPlat.UI.Controls.Orientation orientation) { if (layout == null) { return; } layout.Orientation = orientation == XPlat.UI.Controls.Orientation.Vertical ? Android.Widget.Orientation.Vertical : Android.Widget.Orientation.Horizontal; layout.Invalidate(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.tv_show_detail); appBarLayout = FindViewById <AppBarLayout>(Resource.Id.image_toolbar_appbar_layout); collapseToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.image_toolbar_collapsing_layout); collapseToolbar.TitleEnabled = true; detailToolbar = FindViewById <Toolbar>(Resource.Id.image_toolbar_main_toolbar); seasonsHeader = FindViewById <TabLayout>(Resource.Id.main_tabs_header); seasonEpisodesPager = FindViewById <ViewPager>(Resource.Id.main_tabs_viewpager); seasonsHeader.Visibility = ViewStates.Gone; seasonEpisodesPager.Visibility = ViewStates.Gone; detailImage = FindViewById <AppCompatImageView>(Resource.Id.image_toolbar_main_image); titleText = FindViewById <AppCompatTextView>(Resource.Id.image_toolbar_main_title); descriptionText = FindViewById <AppCompatTextView>(Resource.Id.image_toolbar_main_description); releaseText = FindViewById <AppCompatTextView>(Resource.Id.image_toolbar_main_release); genreText = FindViewById <AppCompatTextView>(Resource.Id.image_toolbar_main_genre); titleContainer = FindViewById <Android.Widget.LinearLayout>(Resource.Id.image_toolbar_collapsing_root); loadingView = FindViewById <ContentLoadingProgressBar>(Resource.Id.image_toolbar_loading); AppView.SetActionBarForActivity(detailToolbar, this); appBarLayout.OffsetChanged += AppLayout_OffsetChanged; // load data from link if (savedInstanceState is null) { var link = Intent.Extras.GetString("itemLink"); LoadData(link); } else { // get saved show data var show = Newtonsoft.Json.JsonConvert.DeserializeObject <SeriesDetails>(savedInstanceState.GetString(ShowDetailSaveInstanceName)); LoadData(null, show); } }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.View> e) { base.OnElementChanged(e); if (Control == null) { Android.Widget.LinearLayout v = new Android.Widget.LinearLayout(Context); v.Clickable = true; SetNativeControl(v); } Control.Click += new EventHandler((o, ee) => { if (((ClickableStackLayout)Element).Enabled) { ((ClickableStackLayout)Element).OnClicked(); } }); Control.Touch += new EventHandler <TouchEventArgs>((o, ee) => { if (!((ClickableStackLayout)Element).Enabled) { ee.Handled = false; return; } if (ee.Event.Action == MotionEventActions.Down) { int[] attrs = { Resource.Attribute.colorAccent }; Control.SetBackgroundColor(Context.Theme.ObtainStyledAttributes(Resource.Style.MainTheme, attrs).GetColor(0, Android.Graphics.Color.Black)); } else if (ee.Event.Action == MotionEventActions.Up) { Control.SetBackgroundColor(Android.Graphics.Color.Transparent); } ee.Handled = false; }); }