Exemplo n.º 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var rootView = inflater.Inflate(Resource.Layout.frag_kusina, container, false);

            _viewPager    = rootView.FindViewById <ViewPager>(Resource.Id.vp_slide);
            _sliderLayout = rootView.FindViewById <LinearLayout>(Resource.Id.slider);
            var context          = Activity.ApplicationContext;
            var viewPagerAdapter = new ViewPagerAdapter(context);

            _viewPager.Adapter = viewPagerAdapter;
            _dotsCount         = viewPagerAdapter.Count;
            _dotsImage         = new ImageView[_dotsCount];
            for (var i = 0; i < _dotsCount; i++)
            {
                _dotsImage[i] = new ImageView(context);
                _dotsImage[i].SetImageDrawable(ContextCompat.GetDrawable(context, NonActd));
                var param = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                          ViewGroup.LayoutParams.WrapContent);
                param.SetMargins(left: 8, top: 0, right: 8, bottom: 0);
                _sliderLayout.AddView(_dotsImage[i], param);
            }
            _dotsImage[0].SetImageDrawable(ContextCompat.GetDrawable(context, ActiveD));
            _viewPager.AddOnPageChangeListener(this);
            return(rootView);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.layout_bottomnavigation);

            mToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            if (null != mToolbar)
            {
                SetSupportActionBar(mToolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(false);
                SupportActionBar.SetHomeButtonEnabled(false);
            }

            mBottomNav = FindViewById <BottomNavigationView>(Resource.Id.bottom_navigation);
            mBottomNav.NavigationItemSelected += OnNavigationItemSelected;
            BottomNavigationViewUtils.SetShiftMode(mBottomNav, false, false);

            mViewPager = FindViewById <ViewPager>(Resource.Id.viewpager);
            var adapter = new ViewPagerAdapter(this.SupportFragmentManager);
            var random  = new Random();

            adapter.AddFragment(new BottomNavFragment(random.Next(10, 20)));
            adapter.AddFragment(new BottomNavFragment(random.Next(10, 30)));
            adapter.AddFragment(new BottomNavFragment(random.Next(10, 40)));
            adapter.AddFragment(new BottomNavFragment(random.Next(10, 50)));
            mViewPager.Adapter = adapter;

            mViewPager.PageSelected += OnViewPagerChanged;

            mBottomNav.SelectedItemId = Resource.Id.one;
            mToolbar.Title            = GetText(Resource.String.one);
            mViewPager.CurrentItem    = 0;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.AdminDashboardLayout);
            findAllElements();

            _mainPagerAdapter      = new ViewPagerAdapter(this);
            _mainViewPager.Adapter = _mainPagerAdapter;
            _circlePageIndicator.SetViewPager(_mainViewPager);
            _circlePageIndicator.SetPageColor(Color.White);
            _circlePageIndicator.SetFillColor(CoreColorConverter.GetColor(ColorConstants.CirclePageIndicatorColor));

            _adminDashboardContentInstance = new AdminDashboardContentView(this);
            _adminDashboardContentView     = _adminDashboardContentInstance.GetView();
            _allocateButton = _adminDashboardContentInstance.GetAllocateButton();

            _allocationPageInstance = new AllocationPageView(this);
            _allocationPageView     = _allocationPageInstance.GetView();

            _mainPagerAdapter.AddView(_adminDashboardContentView);
            _mainPagerAdapter.AddView(_allocationPageView);
            _mainPagerAdapter.NotifyDataSetChanged();

            var timer = new Timer();

            _dashbardGradientTask = new DashboardGradientTimerHelper(this);
            timer.Schedule(_dashbardGradientTask, 0, NumberConstants.DashboardGradientTransition.DashboardGradientTransitionLengthInMilliseconds);
        }
Exemplo n.º 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.NonAdminDashboardLayout);

            findAllElements();
            setAllStringConstants();

            _mainPagerAdapter      = new ViewPagerAdapter(this);
            _mainViewPager.Adapter = _mainPagerAdapter;
            _circlePageIndicator.SetViewPager(_mainViewPager);
            _circlePageIndicator.SetPageColor(Color.White);
            _circlePageIndicator.SetFillColor(new Color(255, 255, 255, 64));

            _nonAdminDashboardContentInstance = new NonAdminContentAdapter(this);
            _nonAdminContentView = _nonAdminDashboardContentInstance.GetView();

            _gamificationContentInstance = new GamificationViewAdapter(this);
            _gamificationView            = _gamificationContentInstance.GetView();

            _mainPagerAdapter.AddView(_nonAdminContentView);
            _mainPagerAdapter.AddView(_gamificationView);
            _mainPagerAdapter.NotifyDataSetChanged();

            var timer = new Timer();

            _dashbardGradientTask = new DashboardGradientTimerHelper(this);
            timer.Schedule(_dashbardGradientTask, 0, NumberConstants.DashboardGradientTransition.DashboardGradientTransitionLengthInMilliseconds);
        }
Exemplo n.º 5
0
 public ParseConfiguration(Context context, ProgressBarView progressBarView, Intent data, ViewPager viewPager, ViewPagerAdapter viewPagerAdapter)
 {
     this.context          = context;
     this.progressBarView  = progressBarView;
     this.data             = data;
     this.viewPager        = viewPager;
     this.viewPagerAdapter = viewPagerAdapter;
 }
        private void SetupViewPager(ViewPager viewPager)
        {
            var adapter = new ViewPagerAdapter(SupportFragmentManager);

            adapter.AddFragment(new CategoryListFragment(), Resources.GetText(Resource.String.CoursesPivotItem_Header));
            adapter.AddFragment(new ProfileFragment(), Resources.GetText(Resource.String.ProfilePivotItem_Header));

            viewPager.Adapter = adapter;
        }
 private void InitViewPager()
 {
     if (Context != null)
     {
         _tabLayout.SetupWithViewPager(_viewPager);
         var adapter = new ViewPagerAdapter(Context, ChildFragmentManager);
         _viewPager.Adapter = adapter;
     }
 }
Exemplo n.º 8
0
 private void SetupViewPager()
 {
     adapter = new ViewPagerAdapter(SupportFragmentManager);
     adapter.AddFragment(Fragment.Instantiate(this, Class.FromType(typeof(SearchFragment)).Name), Resources.GetString(Resource.String.FragmentSearch));
     adapter.AddFragment(Fragment.Instantiate(this, Class.FromType(typeof(MatchFragment)).Name), Resources.GetString(Resource.String.FragmentMatch));
     //adapter.AddFragment(Fragment.Instantiate(this, Class.FromType(typeof(DesignFragment)).Name), Resources.GetString(Resource.String.FragmentDesign));
     adapter.AddFragment(Fragment.Instantiate(this, Class.FromType(typeof(MyClothesFragment)).Name), Resources.GetString(Resource.String.FragmentMyClothes));
     viewPager.Adapter = adapter;
 }
        private void SetupViewPager(ViewPager viewPager)
        {
            var adapter = new ViewPagerAdapter(this.SupportFragmentManager);

            adapter.AddFragment(new PresentListFragment(), "Anwesend");
            adapter.AddFragment(new StampFragment(), "Stempeln");
            adapter.AddFragment(new TimeListFragment(), "Zeiten");
            viewPager.Adapter = adapter;
            viewPager.Adapter.NotifyDataSetChanged();
        }
Exemplo n.º 10
0
        private void SetupViewPager()
        {
            ViewPagerAdapter adapter = new ViewPagerAdapter(SupportFragmentManager);

            adapter.AddFragment(_homeFragment, "Home");
            adapter.AddFragment(_earningsFragment, "Earnings");
            adapter.AddFragment(_ratingsFragment, "Rating");
            adapter.AddFragment(_accountFragment, "Account");
            _viewpager.Adapter = adapter;
        }
Exemplo n.º 11
0
        private void SetupViewPager()
        {
            ViewPagerAdapter adapter = new ViewPagerAdapter(SupportFragmentManager);

            adapter.AddFragment(homeFragment, "Home");
            adapter.AddFragment(earningsFragment, "Earnings");
            //adapter.AddFragment(ratingFragment, "Ratings");
            adapter.AddFragment(accountFragment, "Account");
            viewPager.Adapter = adapter;
        }
Exemplo n.º 12
0
        //creating fragments for the nav bar
        private void SetupViewPager()
        {
            ViewPagerAdapter adapter = new ViewPagerAdapter(SupportFragmentManager);

            adapter.AddFragment(calendarFragment, "Calendar");
            adapter.AddFragment(mapFragment, "Map");
            adapter.AddFragment(dietPlannerFragment, "Diet Planner");
            adapter.AddFragment(helpFragment, "Help & Support");
            viewpager.Adapter = adapter;
        }
Exemplo n.º 13
0
        private void SetupViewpager()
        {
            ViewPagerAdapter adapter = new ViewPagerAdapter(SupportFragmentManager);

            adapter.AddFragemts(HomeFragment, "Home");
            adapter.AddFragemts(EarningsFragment, "Earning");
            adapter.AddFragemts(RatingsFragment, "Rating");
            adapter.AddFragemts(AccountFragment, "Account");
            viewPager.Adapter = adapter;
        }
        void InitViewPager()
        {
            _viewPagerAdapter  = new ViewPagerAdapter(this, ChildFragmentManager);
            _viewPager.Adapter = _viewPagerAdapter;

            // Setting this custom layout for each tab ensures that the tabs will
            // fill all available horizontal space.
            _slidingTabLayout.SetCustomTabView(Resource.Layout.CustomTabLayout, Resource.Id.txtTab);
            _slidingTabLayout.SetViewPager(_viewPager);
        }
Exemplo n.º 15
0
        private void SetupViewPager(ViewPager viewPager)
        {
            var loc     = ServiceLocator.Current.GetInstance <ILocalizedStringProvider>();
            var adapter = new ViewPagerAdapter(SupportFragmentManager);

            adapter.AddFragment(new InformationFragment(), loc.GetLocalizedString(Localized.InformationPivotItem_Header));
            adapter.AddFragment(new DescriptionFragment(), loc.GetLocalizedString(Localized.DescriptionPivotItem_Header));
            adapter.AddFragment(new InstructorFragment(), loc.GetLocalizedString(Localized.InstructorPivotItem_Header));

            viewPager.Adapter = adapter;
        }
        private void SetupViewPager(ViewPager viewPager)
        {
            var loc     = ServiceLocator.Current.GetInstance <ILocalizedStringProvider>();
            var adapter = new ViewPagerAdapter(SupportFragmentManager);

            adapter.AddFragment(new SessionDetailsFragment(), loc.GetLocalizedString(Localized.SchedulePivotItem_Header));
            adapter.AddFragment(new SubscribeFragment(), loc.GetLocalizedString(Localized.SubscribePivotItem_Header));
            adapter.AddFragment(new FeedbackFragment(), loc.GetLocalizedString(Localized.FeedbackPivotItem_Header));
            adapter.AddFragment(new ContactFragment(), loc.GetLocalizedString(Localized.ContactPivotItem_Header));

            viewPager.Adapter = adapter;
        }
Exemplo n.º 17
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            viewPager = FindViewById <ViewPager>(Resource.Id.pager);
            viewPager.SetPageTransformer(true, new ZoomPageTransformer());
            var viewPagerAdapter = new ViewPagerAdapter(SupportFragmentManager);

            viewPager.Adapter = viewPagerAdapter;
        }
Exemplo n.º 18
0
        private void SetupTabs()
        {
            V4ViewPager      viewPager = FindViewById <V4ViewPager>(Resource.Id.pager);
            ViewPagerAdapter adapter   = new ViewPagerAdapter(SupportFragmentManager);

            // Add Fragments to adapter one by one
            adapter.AddFragment(new RotationFragment(), "Map Rotation");
            adapter.AddFragment(new NewsFragment(), "News");

            viewPager.Adapter = adapter;

            TabLayout tabLayout = FindViewById <TabLayout>(Resource.Id.tabs);

            tabLayout.SetupWithViewPager(viewPager);
        }
Exemplo n.º 19
0
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.Main);
        var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

        SetSupportActionBar(toolbar);
        SupportActionBar.Title = "ViewPager Indicator Dots";
        var pager     = new ViewPagerAdapter(SupportFragmentManager);
        var viewPager = FindViewById <ViewPager>(Resource.Id.viewPager);

        viewPager.Adapter       = pager;
        viewPager.PageSelected += ViewPager_PageSelected;
    }
Exemplo n.º 20
0
 // <summary>
 /// Method Name     : SetUpViewPager
 /// Author          : Sanket Prajapati
 /// Creation Date   : 15 Dec 2017
 /// Purpose         : Set fragment for wizard
 /// Revision        :
 /// </summary>
 private void SetUpViewPagerWithDeposit(NonSwipeableViewPager nonSwipeableViewPager)
 {
     viewPagerAdapter = new ViewPagerAdapter(SupportFragmentManager);
     viewPagerAdapter.addFrag(new FragmentEstimatedReview());
     viewPagerAdapter.addFrag(new FragmentServices());
     viewPagerAdapter.addFrag(new FragmentServiceDates());
     viewPagerAdapter.addFrag(new FragmentAddresses());
     viewPagerAdapter.addFrag(new FragmentWhatMattersMost());
     viewPagerAdapter.addFrag(new FragmentValuation());
     viewPagerAdapter.addFrag(new FragmentVitalInformation());
     viewPagerAdapter.addFrag(new FragmentAcknowledgement());
     viewPagerAdapter.addFrag(new FragmentDeposit());
     // viewPagerAdapter.addFrag(new FragmentMoveConfirmed());
     nonSwipeableViewPager.Adapter = viewPagerAdapter;
 }
Exemplo n.º 21
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            viewPagerAdapter  = new ViewPagerAdapter(this.SupportFragmentManager, this);
            viewPager         = FindViewById <ViewPager>(Resource.Id.view_pager);
            viewPager.Adapter = viewPagerAdapter;
            tabs = FindViewById <TabLayout>(Resource.Id.tabs);
            tabs.SetupWithViewPager(viewPager);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            view = Window.DecorView;
        }
Exemplo n.º 22
0
        private void InitViews()
        {
            LayoutInflater inflater = LayoutInflater.From(this);

            //初始化引导图片列表
            views = new List <View>();
            views.Add(inflater.Inflate(Resource.Layout.Guider_One, null));
            views.Add(inflater.Inflate(Resource.Layout.Guider_Two, null));
            views.Add(inflater.Inflate(Resource.Layout.Guider_Three, null));
            views.Add(inflater.Inflate(Resource.Layout.Guider_Four, null));

            vpAdapter               = new  ViewPagerAdapter(views, this);
            guiderViewpager         = FindViewById <ViewPager> (Resource.Id.guiderviewpager);
            guiderViewpager.Adapter = vpAdapter;
            //绑定回调

            guiderViewpager.AddOnPageChangeListener(this);
        }
Exemplo n.º 23
0
        private void SetUpViewPager(ViewPager viewPager)
        {
            ViewPagerAdapter adapter = new ViewPagerAdapter(SupportFragmentManager);

            homeFragment     = new HomeFragment();
            libraryFragment  = new LibraryFragment();
            accountFragment  = new AccountFragment();
            userLandFragment = new AddNewLandFragment();

            adapter.AddFragment(homeFragment);               //0
            adapter.AddFragment(libraryFragment);            //1
            adapter.AddFragment(accountFragment);            //2
            adapter.AddFragment(userLandFragment);           //3
            adapter.AddFragment(new EditUserLandFragment()); //4
            adapter.AddFragment(new UserLandFragment());     //5

            viewPager.Adapter = adapter;
        }
Exemplo n.º 24
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            InitializeFragments();
            ViewPagerAdapter adapter = new ViewPagerAdapter(SupportFragmentManager, _fragments);

            _viewPager         = (ViewPager)FindViewById(Resource.Id.viewPager1);
            _viewPager.Adapter = adapter;

            //Views
            _bottomNavigation = (BottomNavigationView)FindViewById(Resource.Id.bottom_navigation);

            _bottomNavigation.NavigationItemSelected += NavigationView_NavigationItemSelected;
            _viewPager.PageSelected += ViewPager_PageSelected;
        }
Exemplo n.º 25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            //Referencing the views, populating the adapter with fragments, calling a method to populate the bottom menu
            mTabLayout = FindViewById <TabLayout>(Resource.Id.maintablayout);
            mViewPager = FindViewById <ViewPager>(Resource.Id.mainviewpager);
            ViewPagerAdapter adapter = new ViewPagerAdapter(SupportFragmentManager);

            adapter.AddFragment(HomeFragment);
            adapter.AddFragment(ExploreFragment);

            mViewPager.Adapter = adapter;
            ////Populating the TabLayout with icons
            PopulateMainTabIcons();
        }
Exemplo n.º 26
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Principal);

            //Android.Widget.Toolbar toolbar = FindViewById<Android.Widget.Toolbar>(Resource.Id.toolbar);
            //SetActionBar(toolbar);

            tabLayout         = FindViewById <Android.Support.Design.Widget.TabLayout>(Resource.Id.tabs);
            viewPager         = FindViewById <ViewPager>(Resource.Id.pager);
            viewPagerAdapter  = new ViewPagerAdapter(SupportFragmentManager);
            viewPager.Adapter = viewPagerAdapter;
            tabLayout.SetupWithViewPager(viewPager);

            await IniciaProcessos();

            salasFragment = new SalasFragment();
            viewPagerAdapter.AddFragment(salasFragment, GetString(Resource.String.salas_proximas));
            viewPagerAdapter.AddFragment(new Android.Support.V4.App.Fragment(), GetString(Resource.String.conversas));
            viewPagerAdapter.AddFragment(new Android.Support.V4.App.Fragment(), GetString(Resource.String.notificacoes));
            viewPagerAdapter.NotifyDataSetChanged();
        }
Exemplo n.º 27
0
        private void TabIndex()
        {
            Advp = FindViewById <ViewPager>(Resource.Id.viewpager);

            Scan           = FindViewById <ImageView>(Resource.Id.TabIndeximScan);
            Search         = FindViewById <ImageView>(Resource.Id.TabIndeximSearch);
            Type1          = FindViewById <ImageView>(Resource.Id.type1);
            Type2          = FindViewById <ImageView>(Resource.Id.type2);
            Type3          = FindViewById <ImageView>(Resource.Id.type3);
            Type4          = FindViewById <ImageView>(Resource.Id.type4);
            Type5          = FindViewById <ImageView>(Resource.Id.type5);
            Type6          = FindViewById <ImageView>(Resource.Id.type6);
            Type7          = FindViewById <ImageView>(Resource.Id.type7);
            Type8          = FindViewById <ImageView>(Resource.Id.type8);
            Type9          = FindViewById <ImageView>(Resource.Id.type9);
            TabIndexLayout = FindViewById <LinearLayout>(Resource.Id.TabIndexLayout);
            searchEdit     = FindViewById <EditText>(Resource.Id.TabIndexEditSearch);

            Scan.SetImageResource(Resource.Drawable.IconScan);
            Search.SetImageResource(Resource.Drawable.IconSearch);

            Type1.SetImageResource(Resource.Drawable.IndexIcon_1);
            Type2.SetImageResource(Resource.Drawable.IndexIcon_8);
            Type3.SetImageResource(Resource.Drawable.IndexIcon_7);
            Type4.SetImageResource(Resource.Drawable.IndexIcon_5);
            Type5.SetImageResource(Resource.Drawable.IndexIcon_9);
            Type6.SetImageResource(Resource.Drawable.IndexIcon_2);
            Type7.SetImageResource(Resource.Drawable.IndexIcon_4);
            Type8.SetImageResource(Resource.Drawable.IndexIcon_3);
            Type9.SetImageResource(Resource.Drawable.IndexIcon_6);

            View             v1, v2, v3;
            List <View>      viewList;
            ViewPagerAdapter AdvpAdapter;
            var li = LayoutInflater.From(this);

            v1       = li.Inflate(Resource.Layout.ViewPager_1, null);
            v2       = li.Inflate(Resource.Layout.ViewPager_2, null);
            v3       = li.Inflate(Resource.Layout.ViewPager_3, null);
            viewList = new List <View>();
            viewList.Add(v1);
            viewList.Add(v2);
            viewList.Add(v3);
            ad1 = v1.FindViewById <ImageView>(Resource.Id.Vpimage_1);
            ad2 = v2.FindViewById <ImageView>(Resource.Id.Vpimage_2);
            ad3 = v3.FindViewById <ImageView>(Resource.Id.Vpimage_3);
            Picasso.With(this).Load("http://115.159.145.115/ads/ad1.png").Into(ad1);
            Picasso.With(this).Load("http://115.159.145.115/ads/ad2.png").Into(ad2);
            Picasso.With(this).Load("http://115.159.145.115/ads/ad3.png").Into(ad3);
            AdvpAdapter  = new ViewPagerAdapter(viewList);
            Advp.Adapter = AdvpAdapter;

            MobileBarcodeScanner.Initialize(Application);
            scanner = new MobileBarcodeScanner();

            Button flashButton;
            View   zxingOverlay;

            Scan.Click += async delegate {
                scanner.UseCustomOverlay = true;

                //Inflate our custom overlay from a resource layout
                zxingOverlay = LayoutInflater.FromContext(this).Inflate(Resource.Layout.Scanning, null);

                //Find the button from our resource layout and wire up the click event
                flashButton        = zxingOverlay.FindViewById <Button>(Resource.Id.buttonZxingFlash);
                flashButton.Click += (sender, e) => scanner.ToggleTorch();

                //Set our custom overlay
                scanner.CustomOverlay = zxingOverlay;

                //Start scanning!
                var result = await scanner.Scan();

                HandleScanResult(result);
            };
            Search.Click += delegate
            {
                if (searchEdit.Text != "")
                {
                    Intent ActBookList = new Intent(this, typeof(BookListView));
                    Bundle bundle      = new Bundle();
                    ActBookList.PutExtra("SearchInfo", searchEdit.Text);
                    ActBookList.PutExtras(bundle);
                    StartActivity(ActBookList);
                }
            };

            Type1.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "计算机");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type2.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "文学");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type3.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "社会科学");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type4.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "历史");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type5.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "文化");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type6.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "教材");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type7.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "科普");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type8.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "经济");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };
            Type9.Click += delegate
            {
                Intent ActList = new Intent(this, typeof(BookListView_type));
                Bundle bundle  = new Bundle();
                ActList.PutExtra("SearchType", "其他");
                ActList.PutExtra("SearchInfo", "");
                ActList.PutExtras(bundle);
                StartActivity(ActList);
            };

            TabIndexLayout.Click += delegate
            {
                Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(searchEdit.WindowToken, 0);
            };
        }
		void InitViewPager()
		{
			_viewPagerAdapter = new ViewPagerAdapter(this,ChildFragmentManager);
			_viewPager.Adapter=_viewPagerAdapter;

			// Setting this custom layout for each tab ensures that the tabs will
			// fill all available horizontal space.
			_slidingTabLayout.SetCustomTabView(Resource.Layout.CustomTabLayout, Resource.Id.txtTab);
			_slidingTabLayout.SetViewPager(_viewPager);
		}
        private void InitViewPager()
        {
            mViewPagerAdapter = new ViewPagerAdapter (ChildFragmentManager, this);
            mViewPager.Adapter = mViewPagerAdapter;

            mSlidingTabLayout.SetCustomTabView (Resource.Layout.Custom_Tab, Resource.Id.tabText);
            mSlidingTabLayout.SetViewPager (mViewPager);
        }
Exemplo n.º 30
0
        protected override void OnCreate(Bundle b)
        {
            base.OnCreate(b);
            CrashManager.Register(this, Constants.KEY_HOCKEY);
            try
            {
                SetContentView(Resource.Layout.layout_home);

                Inject();


                int intentTab = Intent.GetIntExtra(Constants.INTENT_HOME_TAB, 0);
                if (intentTab > 0)
                {
                    SetCurrentTab(intentTab);
                }

                bnMain.NavigationItemSelected +=
                    delegate(object sender, BottomNavigationView.NavigationItemSelectedEventArgs e)
                {
                    e.Handled = true;
                    SetCurrentTab(e.Item.Order);
                };

                ViewHelper.DisableShiftMode(bnMain);

                ViewPagerAdapter vpAdapter = new ViewPagerAdapter(SupportFragmentManager);
                vpAdapter.AddFragment(new ControlFragment());
                vpAdapter.AddFragment(new RemoteFragment());
                vpAdapter.AddFragment(new ExtraFragment());
                vpAdapter.AddFragment(new AppSettingsFragment());
                vpMain.Adapter            = vpAdapter;
                vpMain.OffscreenPageLimit = 3;


                SetSupportActionBar(tbMain);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);

                abDrawerToggle = new ActionBarDrawerToggle(this, dlMain, tbMain, Resource.String.app_name,
                                                           Resource.String.app_name)
                {
                    DrawerIndicatorEnabled = true
                };

                dlMain.AddDrawerListener(abDrawerToggle);
                abDrawerToggle.SyncState();

                Window.AddFlags(WindowManagerFlags.TranslucentStatus);
                Window.ClearFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                Window.SetStatusBarColor(Color.Transparent);


                smDrawerDevices = nvDrawer.Menu.AddSubMenu(0, 0, 0, "Saved receiver");
                smDrawerOther   = nvDrawer.Menu.AddSubMenu("Other");
                smDrawerDevices.SetGroupCheckable(0, true, false);

                int i = 0;
                foreach (var device in deviceHelper.liDevices)
                {
                    AddDrawerItem(
                        smDrawerDevices,
                        i,
                        device.scanDevice.Model,
                        Resource.Drawable.av_receiver_100_black,
                        true,
                        0,
                        Resource.Layout.layout_home_drawer_item_action, device.id.ToString());

                    if (device.conFlag > 0)
                    {
                        ConnectWithDevice(i);
                    }
                    i++;
                }

                AddDrawerItem(
                    smDrawerOther, 0, "Add device",
                    Resource.Drawable.add_100_white,
                    true, 1, null, null);
                AddDrawerItem(
                    smDrawerOther, 1, "Sleep timer",
                    Resource.Drawable.sleep_timer_100_black,
                    true, 1, null, null);
                AddDrawerItem(
                    smDrawerOther, 2, "Buy key",
                    Resource.Drawable.key_100_black,
                    true, 1, null, null);
                AddDrawerItem(
                    smDrawerOther, 3, "Help",
                    Resource.Drawable.help_100_black,
                    true, 1, null, null);

                nvDrawer.NavigationItemSelected += OnNavDrawerItemSelected;
                nvDrawer.BringToFront();

                if (prefs.IsFirstAppStart())
                {
                    ShowWelcomeDialog();
                }

                RegisterMedia();

                OpenBroadcast();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Toast.MakeText(this, e.Message, ToastLength.Long).Show();
            }
        }
Exemplo n.º 31
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.content_main, container, false);

            try
            {
                layouts = new int[]
                {
                    Resource.Layout.LayoutStart,
                    Resource.Layout.LayoutSlide0,
                    Resource.Layout.LayoutSlide1,
                    Resource.Layout.LayoutSlide2,
                    Resource.Layout.LayoutSlide3,
                    Resource.Layout.LayoutSlide4,
                    Resource.Layout.LayoutSlide5
                };

                viewPager  = view.FindViewById <ViewPager>(Resource.Id.viewPager);
                dotsLayout = view.FindViewById <LinearLayout>(Resource.Id.layoutPanel);
                btnNext    = view.FindViewById <Button>(Resource.Id.btn_next);
                btnSkip    = view.FindViewById <Button>(Resource.Id.btn_skip);


                addDots(0);
                Android.App.FragmentTransaction transaction = this.FragmentManager.BeginTransaction();
                ViewPagerAdapter adapter = new ViewPagerAdapter(layouts, ref transaction);
                viewPager.Adapter = adapter;

                viewPager.PageSelected += ViewPager_PageSelected;
                //viewPager.AddOnPageChangeListener(new ViewPager.IOnPageChangeListener());

                btnNext.Click += (sender, e) =>
                {
                    //int current = GetItem(+1);
                    //if (current < layouts.Length)
                    //    //move to next screen
                    //    viewPager.CurrentItem = current;
                    //else
                    //{

                    //}
                    Android.App.FragmentTransaction transaction2 = this.FragmentManager.BeginTransaction();
                    //lauch main screen here
                    MainPageActivity content = new MainPageActivity();
                    transaction2.Replace(Resource.Id.framelayout, content).AddToBackStack(null).Commit();
                };

                btnSkip.Click += (sender, e) =>
                {
                    Android.App.FragmentTransaction transaction2 = this.FragmentManager.BeginTransaction();
                    //lauch main screen here
                    ContentMainActivity content = new ContentMainActivity();
                    transaction2.Replace(Resource.Id.framelayout, content).AddToBackStack(null).Commit();
                    //Android.App.FragmentTransaction transaction1 = this.FragmentManager.BeginTransaction();
                    //ContentMainActivity content4 = new ContentMainActivity();
                    //transaction1.Replace(Resource.Id.framelayout, content4).AddToBackStack(null).Commit();
                };
            }
            catch (Exception ex)
            {
                Toast.MakeText(Activity, "" + ex.Message, ToastLength.Long).Show();
            }
            return(view);
        }
Exemplo n.º 32
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            System.Console.WriteLine("&Pager view created");

            View view = inflater.Inflate(Resource.Layout.ViewPager, container, false);
            TabLayout tabs = Activity.FindViewById<TabLayout>(Resource.Id.tabs);
            ViewPager pager = view.FindViewById<ViewPager>(Resource.Id.pager);

            ((AppBarLayout.LayoutParams)Activity.FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsingToolbar).LayoutParameters).ScrollFlags = AppBarLayout.LayoutParams.ScrollFlagScroll | AppBarLayout.LayoutParams.ScrollFlagEnterAlways | AppBarLayout.LayoutParams.ScrollFlagSnap;
            tabs.Visibility = ViewStates.Visible;
            tabs.RemoveAllTabs();

            if (type == 0)
            {
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.songs)));
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.folders)));

                adapter = new ViewPagerAdapter(ChildFragmentManager);
                adapter.AddFragment(Browse.NewInstance(), Resources.GetString(Resource.String.songs));
                adapter.AddFragment(FolderBrowse.NewInstance(), Resources.GetString(Resource.String.folders));

                pager.Adapter = adapter;
                pager.AddOnPageChangeListener(this);
                pager.AddOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabs));

                tabs.SetupWithViewPager(pager);
                tabs.TabReselected += OnTabReselected;

                pager.CurrentItem = pos;
                tabs.TabMode = TabLayout.ModeFixed;
                tabs.SetScrollPosition(pos, 0f, true);
            }
            else if (type == 1)
            {
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.all)));
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.songs)));
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.playlists)));
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.lives)));
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.channels)));

                ViewPagerAdapter adapter = new ViewPagerAdapter(ChildFragmentManager);
                Fragment[] fragment = YoutubeSearch.NewInstances(query);
                adapter.AddFragment(fragment[0], Resources.GetString(Resource.String.all));
                adapter.AddFragment(fragment[1], Resources.GetString(Resource.String.songs));
                adapter.AddFragment(fragment[2], Resources.GetString(Resource.String.playlists));
                adapter.AddFragment(fragment[3], Resources.GetString(Resource.String.lives));
                adapter.AddFragment(fragment[4], Resources.GetString(Resource.String.channels));

                pager.Adapter = adapter;
                pager.AddOnPageChangeListener(this);
                pager.AddOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabs));
                tabs.SetupWithViewPager(pager);
                tabs.TabReselected += OnTabReselected;

                pager.CurrentItem = pos;
                tabs.TabMode = TabLayout.ModeScrollable;
                tabs.SetScrollPosition(pos, 0f, true);

                YoutubeSearch.instances[pos].IsFocused = true;
                YoutubeSearch.instances[pos].OnFocus();
                MainActivity.instance.FindViewById<TabLayout>(Resource.Id.tabs).Visibility = ViewStates.Visible;

                IMenuItem searchItem = MainActivity.instance.menu.FindItem(Resource.Id.search);
                SearchView searchView = (SearchView)searchItem.ActionView;
                searchView.Focusable = false;
                searchItem.ExpandActionView();
                searchView.SetQuery(query, false);
                searchView.ClearFocus();
                searchView.Focusable = true;
            }
            return view;
        }