protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.layout_test_tab);//.test.layout.activity_main2); // Create your application here foreach (var item in mTitles) { if (item == "IOS") { VideoIntroductionFragment mVideoIntroductionFragment = VideoIntroductionFragment.newInstance(1); mFragments.Add(mVideoIntroductionFragment); } else { mFragments.Add(SimpleCardFragment.getInstance(item)); } } mSlidingTabLayout = FindViewById <SlidingTabLayout>(Resource.Id.tab_layout); mViewPager = FindViewById <ViewPager>(Resource.Id.view_pager); mAdapter = new MyPagerAdapter(SupportFragmentManager); mViewPager.Adapter = mAdapter;// SetAdapter(mAdapter); //mViewPager.OffscreenPageLimit = 2;// SetOffscreenPageLimit(2); mSlidingTabLayout.SetViewPager(mViewPager); MeasureTabLayoutTextWidth(0); //var vdaonpagechangeListenter = new VDA_OnPageChangeListener(this); mViewPager.AddOnPageChangeListener(this); }
public override void initViews(Bundle savedInstanceState) { mToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); mCollapsingToolbarLayout = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar); mVideoPreview = FindViewById <ImageView>(Resource.Id.video_preview); mSlidingTabLayout = FindViewById <SlidingTabLayout>(Resource.Id.tab_layout); mViewPager = FindViewById <ViewPager>(Resource.Id.view_pager); mFAB = FindViewById <FloatingActionButton>(Resource.Id.fab); mAppBarLayout = FindViewById <AppBarLayout>(Resource.Id.app_bar_layout); mTvPlayer = FindViewById <TextView>(Resource.Id.tv_player); mAvText = FindViewById <TextView>(Resource.Id.tv_av); mPlayerView = FindViewById <VideoPlayerView>(Resource.Id.video_view); mBufferingIndicator = FindViewById <View>(Resource.Id.buffering_indicator); Intent intent = this.Intent;// getIntent(); if (intent != null) { av = intent.GetIntExtra(ConstantUtil.EXTRA_AV, -1); imgUrl = intent.GetStringExtra(ConstantUtil.EXTRA_IMG_URL); } InitMediaPlayer(); LoadData(); mFAB.Clickable = false;// setClickable(false); Color stateColor = new Color(Resource.Color.gray_20); mFAB.BackgroundTintList = ColorStateList.ValueOf(stateColor); // SetBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.gray_20))); mFAB.TranslationY = -Resources.GetDimension(Resource.Dimension.floating_action_button_size_half); // SetTranslationY(-getResources().getDimension(R.dimen.floating_action_button_size_half)); //var mFAB_OnClick = new OnClickListener(this); mFAB.Click += delegate { Intent mIntent = new Intent(this, typeof(VideoPlayerActivity)); mIntent.PutExtra(ConstantUtil.EXTRA_CID, 1);//.getAid()); mIntent.PutExtra(ConstantUtil.EXTRA_TITLE, "From Test"); //mIntent.PutExtra(ConstantUtil.EXTRA_CID, v_detail.mVideoDetailsInfo.getData().getPages()[0].getCid());//.getAid()); //mIntent.PutExtra(ConstantUtil.EXTRA_TITLE, v_detail.mVideoDetailsInfo.getData().getTitle()); StartActivity(mIntent); };// SetOnClickListener(mFAB_OnClick); mAppBarLayout.AddOnOffsetChangedListener(this); //mAppBarLayout.OffsetChanged += delegate { // new OnOffsetChangedListener(this); //}; var mAppBar_OffsetChanged = new OnOffsetChangedListener(this); mAppBarLayout.AddOnOffsetChangedListener(mAppBar_OffsetChanged); //mTvPlayer.Click += delegate //{ // mAppBar_OffsetChanged.mCurrentState = AppBarStateChangeEvent.State.EXPANDED; // mTvPlayer.Visibility = ViewStates.Gone;// .setVisibility(View.GONE); // mAvText.Visibility = ViewStates.Visible;// .setVisibility(View.VISIBLE); // mToolbar.SetContentInsetsRelative(DisplayUtil.dp2px(BaseContext, 15), 0); //}; }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); _pager = this.FindFirstChild <ViewPager>(); _tabStrip = this.FindFirstChild <SlidingTabLayout>(); UpdateForeground(); ResetAdapter(); UpdateItems(); }