コード例 #1
0
ファイル: MainActivity.cs プロジェクト: tamifist/KinderChat
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            adapter = new MyPagerAdapter(this, SupportFragmentManager);
            pager   = FindViewById <ViewPager>(Resource.Id.pager);
            tabs    = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
            tabs.SetBackgroundResource(Settings.AppTheme == AppTheme.Red ? Resource.Drawable.red_gradient : Resource.Drawable.blue_gradient);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);
            tabs.OnPageChangeListener = this;
            var pageMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics);

            pager.PageMargin         = pageMargin;
            pager.OffscreenPageLimit = 4;
            if (Settings.FirstRun)
            {
                pager.CurrentItem = 2;
                App.MessageDialog.SendMessage(Resources.GetString(Resource.String.get_started_welcome),
                                              Resources.GetString(Resource.String.welcome_to_kinderchat));
            }
            else
            {
                pager.CurrentItem = 0;
            }

            //IntentFilter connectivityIntentFilter = new IntentFilter();
            //connectivityIntentFilter.AddAction(Android.Net.ConnectivityManager.ConnectivityAction);
            //RegisterReceiver(new NetworkChangeReceiver(), connectivityIntentFilter);

            // Register for GCM
            KinderGcmService.Register(this);

            App.ConnectionManager.TryKeepConnectionAsync();
        }
コード例 #2
0
ファイル: MainActivity.cs プロジェクト: fitzhex/testrepo
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            adapter         = new MyPagerAdapter(SupportFragmentManager);
            pager           = FindViewById <ViewPager> (Resource.Id.pager);
            tabs            = FindViewById <PagerSlidingTabStrip> (Resource.Id.tabs);
            pager.Adapter   = adapter;
            tabs.Visibility = ViewStates.Invisible;
            tabs.SetViewPager(pager);

            var pageMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics);

            pager.PageMargin          = pageMargin;
            tabs.OnPageChangeListener = this;

            PageIndicator mIndicator = FindViewById <CirclePageIndicator> (Resource.Id.indicator);

            mIndicator.SetViewPager(pager);

            mIndicator.SetOnPageChangeListener(new MyPageChangeListener(this));


//			timer.Elapsed+=timer_Elapsed;
//			timer.Start();


            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(false);
        }
コード例 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            adapter       = new MyPagerAdapter(this, SupportFragmentManager);
            pager         = FindViewById <ViewPager> (Resource.Id.pager);
            tabs          = FindViewById <PagerSlidingTabStrip> (Resource.Id.tabs);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);
            tabs.OnPageChangeListener = this;
            var pageMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics);

            pager.PageMargin         = pageMargin;
            pager.OffscreenPageLimit = 4;
            if (Settings.FirstRun)
            {
                pager.CurrentItem = 2;
                App.MessageDialog.SendMessage(Resources.GetString(Resource.String.get_started_welcome), Resources.GetString(Resource.String.welcome_to_kinderchat));
            }
            else
            {
                pager.CurrentItem = 0;
            }

            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(false);


            // Register for GCM
            KinderGcmService.Register(this);
        }
コード例 #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);

            //Android.Support.V7.Widget.Toolbar myToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.my_toolbar);
            //SetSupportActionBar(myToolbar);

            _pager = FindViewById <ViewPager>(Resource.Id.pager);
            _tabs  = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);

            _pager.PageMargin  = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 5, Resources.DisplayMetrics);
            _pager.CurrentItem = 0;

            string[] titles = new string[]
            {
                "SHOP",
                "TASTE",
                "EXPLORE"
            };

            var adapter = new PagerAdapter(SupportFragmentManager, titles);

            _pager.Adapter            = adapter;
            _pager.OffscreenPageLimit = titles.Length;

            _tabs.SetViewPager(_pager);
        }
コード例 #5
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.Main);
     adapter       = new MyAdapter(SupportFragmentManager);
     pager         = FindViewById <ViewPager>(Resource.Id.pager);
     tabs          = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
     pager.Adapter = adapter;
     tabs.SetViewPager(pager);
     tabs.SetBackgroundColor(Android.Graphics.Color.Argb(255, 47, 59, 162));
 }
コード例 #6
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.Menu);
     Window.SetStatusBarColor(Color.Rgb(0, 12, 155));
     TabsPrincipales            = FindViewById <PagerSlidingTabStrip>(Resource.Id.TabsPrincipales);
     ViewPagerPrincipal         = FindViewById <ViewPager>(Resource.Id.ViewPagerPrincipal);
     ViewPagerPrincipal.Adapter = new AdaptadorTabsPrincipales(SupportFragmentManager, this);
     TabsPrincipales.SetViewPager(ViewPagerPrincipal);
     TabsPrincipales.GetChildAt(0).SetMinimumWidth(10);
 }
コード例 #7
0
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetDisplayShowHomeEnabled(true);

            adapter       = new MyPagerAdapter(FragmentManager, this.LayoutInflater, true);
            pager         = FindViewById <ViewPager>(Resource.Id.pager);
            tabs          = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);
        }
コード例 #8
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.pagerSlidingTabStripUi);
     // Create your application here
     _myAdapter     = new MyAdapter(SupportFragmentManager);
     _pager         = FindViewById <ViewPager>(Resource.Id.pager);
     _tabs          = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
     _pager.Adapter = _myAdapter;
     _tabs.SetViewPager(_pager);
     _tabs.SetBackgroundColor(Android.Graphics.Color.Argb(255, 0, 149, 164));
 }
コード例 #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_sample);
            SupportActionBar.Hide();
            ViewPager pager = FindViewById <ViewPager>(Resource.Id.pager);

            pager.Adapter = new PagerAdapter(SupportFragmentManager);
            PagerSlidingTabStrip tabStrip = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);

            tabStrip.SetViewPager(pager);
        }
コード例 #10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            pager = FindViewById <Android.Support.V4.View.ViewPager>(Resource.Id.pager);
            tabs  = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);

            adapter       = new MyAdapter(SupportFragmentManager);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);
            tabs.SetBackgroundColor(Android.Graphics.Color.Argb(255, 0, 149, 164));
        }
コード例 #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            db = new DataBase();

            adapter = new MyAdapter(SupportFragmentManager);
            pager   = FindViewById <ViewPager>(Resource.Id.pager);
            PagerSlidingTabStrip tabs = (PagerSlidingTabStrip)FindViewById(Resource.Id.tabs);

            pager.Adapter = adapter;

            tabs.SetViewPager(pager);
            tabs.SetBackgroundColor(Android.Graphics.Color.Rgb(75, 121, 187));
        }
コード例 #12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            adapter       = new MyPagerAdapter(SupportFragmentManager);
            pager         = FindViewById <ViewPager> (Resource.Id.pager);
            tabs          = FindViewById <PagerSlidingTabStrip> (Resource.Id.tabs);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);

            var pageMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics);

            pager.PageMargin             = pageMargin;
            tabs.OnTabReselectedListener = this;

            ChangeColor(Resources.GetColor(Resource.Color.green));
        }
コード例 #13
0
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            AuthenticationHelper.PlatformParameters = new PlatformParameters(this);


            adapter       = new TabAdapter(this, SupportFragmentManager);
            pager         = FindViewById <ViewPager>(Resource.Id.pager);
            tabs          = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);
            pager.OffscreenPageLimit = 2;


            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(false);
        }
コード例 #14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);

            var toolbar = FindViewById <global::Android.Support.V7.Widget.Toolbar>(Resource.Id.Toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            var menuDrawable = GetDrawable(Resource.Drawable.ic_menu_white_24dp);

            Helper.TintDrawable(Resources, menuDrawable);
            SupportActionBar.SetHomeAsUpIndicator(menuDrawable);

            var titles  = new[] { "Activities", "Groups" };
            var adapter = new TabsFragmentPagerAdapter(SupportFragmentManager, titles);

            viewPager         = FindViewById <ViewPager>(Resource.Id.ViewPager);
            viewPager.Adapter = adapter;

            viewPager.OffscreenPageLimit = titles.Length;
            viewPager.CurrentItem        = 0;

            tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.Tabs);
            tabs.SetViewPager(viewPager);

            tabs.OnPageChangeListener = this;

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

            fab.Click += (sender, e) =>
            {
                Snackbar
                .Make(fab, "Here's a snackbar!", Snackbar.LengthLong)
                .SetAction("Action", v => Console.WriteLine("Action handler"))
                .Show();
            };

            TurnsRepository = new TurnsRepository();
            TurnsRepository.InitializeMockData();
        }
コード例 #15
0
ファイル: GameFragment.cs プロジェクト: davevr/PhabrikClient
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);

            var view = inflater.Inflate(Resource.Layout.GameLayout, container, false);

            pager         = view.FindViewById <LockableViewPager>(Resource.Id.post_pager);
            pager.Adapter = new LeaderboardPageAdapter(MainPage.SupportFragmentManager, MainPage);
            pager.AddOnPageChangeListener(this);
            pager.OffscreenPageLimit = 2;
            pager.SwipeLocked        = true;
            tabs = view.FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
            tabs.SetViewPager(pager);
            tabs.IndicatorHeight      = Resources.GetDimensionPixelSize(Resource.Dimension.tab_indicator_height);
            tabs.TabPaddingLeftRight  = Resources.GetDimensionPixelSize(Resource.Dimension.tab_padding);
            tabs.OnPageChangeListener = this;
            pager.CurrentItem         = 0;
            return(view);
        }
コード例 #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.account);

            myAdapter     = new MyAdapter(SupportFragmentManager);
            pager         = FindViewById <ViewPager>(Resource.Id.pager);
            tabStrip      = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
            pager.Adapter = myAdapter;
            tabStrip.SetViewPager(pager);
            tabStrip.ShouldExpand = true;
            tabStrip.SetTabTextColor(Resource.Color.lightGray);
            tabStrip.TabTextColorSelected = GetColorStateList(Resource.Color.white);
            tabStrip.SetFitsSystemWindows(true);

            tabStrip.TabPaddingLeftRight = 240;
            tabStrip.SetBackgroundColor(Android.Graphics.Color.ParseColor("#075E54"));
            // Create your application here
        }
コード例 #17
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            adapter       = new MyIconPagerAdapter(SupportFragmentManager);
            pager         = FindViewById <ViewPager>(Resource.Id.pager);
            tabs          = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);

            var pageMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics);

            pager.PageMargin             = pageMargin;
            pager.CurrentItem            = 1;
            tabs.OnTabReselectedListener = this;
            tabs.OnPageChangeListener    = this;

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            ChangeColor(Resources.GetColor(Resource.Color.green));
        }
コード例 #18
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.EmpresaCardLayout);
            EmpresaModel empresa = JsonConvert.DeserializeObject <EmpresaModel>(Intent.GetStringExtra("Empresa"));

            FindViewById <ImageButton>(Resource.Id.ibCerrar).Click += (sender, e) => OnBackPressed();

            FindViewById <TextView>(Resource.Id.lblNombre).Text = empresa.Empresa_Nombre;

            ViewPager _viewPager = FindViewById <ViewPager>(Resource.Id.vpPerfil);

            _viewPager.Adapter = new EmpresaPageAdapter(this, new List <string> {
                Resources.GetString(Resource.String.str_profile_about_me), Resources.GetString(Resource.String.str_profile_social), Resources.GetString(Resource.String.str_profile_work)
            }, empresa);

            PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);

            tabs.SetTextColorResource(Resource.Color.comment_pressed);
            tabs.SetViewPager(_viewPager);
        }
コード例 #19
0
ファイル: homeScreen2.cs プロジェクト: dscarr94/Loup
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.HomeScreen2); // set the view to HomeScreen2.axml
            ActionBar.Hide();                            // hide the actionbar

            // Get user id
            string uid = Intent.GetStringExtra("UserId");

            ViewPager viewpager = FindViewById <ViewPager>(Resource.Id.viewpager); // get viewpager from layout

            // Add Adapter to the ViewPager
            HomeScreenAdapter adapter = new HomeScreenAdapter(SupportFragmentManager); // call homescreenadapter, feed it SupportFragmentManager (internal to FragmentActivity)

            viewpager.Adapter = adapter;                                               // assign the adapter to the viewpager

            // Add Tabs to ViewPager
            PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs); // get tabs from layout

            tabs.SetViewPager(viewpager);                                                      // assign the tabs to the viewpager
        }
コード例 #20
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);

            _pager             = FindViewById <ViewPager>(Resource.Id.pager);
            _tabs              = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);
            _pager.PageMargin  = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics);
            _pager.CurrentItem = 0;

            string[] titles = new string[]
            {
                "Fragment1",
                "Fragment2"
            };

            var adapter = new PagerAdapter(SupportFragmentManager, titles);

            _pager.Adapter            = adapter;
            _pager.OffscreenPageLimit = titles.Length;
            _tabs.SetViewPager(_pager);
        }
コード例 #21
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.SalasJuntasHistorialesLayout);
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            ActionBar.Title = Resources.GetString(Resource.String.SalasJuntas);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ViewPager _viewPager = FindViewById <ViewPager>(Resource.Id.vpHistorial);

            _viewPager.Adapter = new HistorialesAdapter(this, new List <string> {
                Resources.GetString(Resource.String.Recientes),
                Resources.GetString(Resource.String.Historico),
                Resources.GetString(Resource.String.Canceladas)
            });

            PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);

            tabs.SetTextColorResource(Resource.Color.comment_pressed);
            tabs.SetViewPager(_viewPager);
        }
コード例 #22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.DirectoriosLayout);
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            ActionBar.Title = Resources.GetString(Resource.String.Directorio);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            _viewPager = FindViewById <ViewPager>(Resource.Id.vpSucursal);
            List <UsuarioModel> usuarios  = new UsuariosController().GetDirectorioUsuarios();
            List <EmpresaModel> empresas  = new EmpresaController().GetDirectorioEmpresas();
            SimpleStorage       storage   = SimpleStorage.EditGroup("Login");
            List <UsuarioModel> favoritos = new UsuariosController().GetMiembrosFavoritos(storage.Get("Usuario_Id"), storage.Get("Usuario_Tipo"));

            _viewPager.Adapter = new DirectorioAdapter(this, new List <string> {
                "Miembros", "Empresas", "Favoritos"
            }, usuarios, empresas, favoritos);

            PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);

            tabs.SetTextColorResource(Resource.Color.comment_pressed);
            tabs.SetViewPager(_viewPager);
            SearchView busqueda = FindViewById <SearchView>(Resource.Id.svBuscar);

            busqueda.SetQueryHint("Buscar...");
            busqueda.QueryTextChange += (sender, e) =>
            {
                _viewPager.Adapter = new DirectorioAdapter(this, new List <string> {
                    "Miembros", "Empresas", "Favoritos"
                },
                                                           usuarios.Where(usuario => usuario.Usuario_Nombre.IndexOf(((SearchView)sender).Query, StringComparison.OrdinalIgnoreCase) >= 0).ToList(),
                                                           empresas.Where(empresa => empresa.Empresa_Nombre.IndexOf(((SearchView)sender).Query, StringComparison.OrdinalIgnoreCase) >= 0).ToList(),
                                                           favoritos.Where(miembro => miembro.Usuario_Nombre.IndexOf(((SearchView)sender).Query, StringComparison.OrdinalIgnoreCase) >= 0).ToList());
            };
        }
コード例 #23
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Viaje);

            _btnRegresarInicio = FindViewById <Button>(Resource.Id.BtnRegresarInicio);
            _pager             = FindViewById <ViewPager>(Resource.Id.pager);
            _tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);

            _tabs.SetBackgroundColor(Colores.DarkPrimary);
            _tabs.SetTabTextColor(Colores.Icons);
            _btnRegresarInicio.Visibility = Android.Views.ViewStates.Gone;
            _btnRegresarInicio.SetBackgroundColor(Colores.LightPrimary);
            _btnRegresarInicio.SetTextColor(Colores.PrimaryText);

            var idViaje = Intent.GetIntExtra("IdViaje", -1);

            if (idViaje == -1)
            {
                AlertMessage.Show(this, "Ha ocurrido un error: No se seleccionó un viaje", ToastLength.Long);
                RegresarInicio();
                return;
            }

            await ObtenerDetalleViajeSeleccionado(idViaje);

            _adapter = new ViajeAdapter(SupportFragmentManager, _viaje);

            _pager.Adapter = _adapter;
            _tabs.SetViewPager(_pager);

            _btnRegresarInicio.Click += (sender, e) =>
            {
                RegresarInicio();
            };
        }
コード例 #24
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var v = inflater.Inflate(Resource.Layout.fragment_tabstrip, container, false);

            loadingView = inflater.Inflate(Resource.Layout.loading_view, null, false);

            refreshViews         = new List <Android.Support.V4.Widget.SwipeRefreshLayout> ();
            leaderboardAdapters  = new List <LeaderboardAdapter> ();
            leaderboardListViews = new List <ListView> ();

            if (profile.teams.Count > 0)
            {
                foreach (var team in profile.teams)
                {
                    var leaderboardRefreshView = new Android.Support.V4.Widget.SwipeRefreshLayout(Activity);
                    var leaderboardListView    = new ListView(Activity);
                    var leaderboardAdapter     = new LeaderboardAdapter(Activity);
                    leaderboardListView.Adapter = leaderboardAdapter;
                    leaderboardRefreshView.AddView(leaderboardListView);
                    TeamHolder th = new TeamHolder();
                    th.id   = team.id;
                    th.name = team.name;
                    leaderboardRefreshView.Tag = th;
                    refreshViews.Add(leaderboardRefreshView);
                    leaderboardListViews.Add(leaderboardListView);
                    leaderboardAdapters.Add(leaderboardAdapter);
                }
            }

            var lrv = new Android.Support.V4.Widget.SwipeRefreshLayout(Activity);
            var llv = new ListView(Activity);
            var lda = new LeaderboardAdapter(Activity);

            llv.Adapter = lda;
            lrv.AddView(llv);
            TeamHolder wth = new TeamHolder();

            wth.id   = -1;
            wth.name = "World";
            lrv.Tag  = wth;
            refreshViews.Add(lrv);
            leaderboardListViews.Add(llv);
            leaderboardAdapters.Add(lda);

            SetCurrentItems(0);

            adapter = new MyPagerAdapter(refreshViews);

            pager         = v.FindViewById <ViewPager> (Resource.Id.pager);
            tabs          = v.FindViewById <PagerSlidingTabStrip> (Resource.Id.tabs);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);
            tabs.OnPageChangeListener = this;
//			refreshView = v.FindViewById<Android.Support.V4.Widget.SwipeRefreshLayout> (Resource.Id.refreshView);
//
//			refreshView.Refresh += async delegate {
//				var resp = await client.ExecuteGetTaskAsync(request);
//				var content = resp.Content;
//				var serializerSettings = new JsonSerializerSettings() {
//					NullValueHandling = NullValueHandling.Ignore,
//					DateParseHandling = DateParseHandling.None
//				};
//				adapter.Leaderboard = JsonConvert.DeserializeObject<Core.Leaderboard.Leaderboard>(content, serializerSettings);
//
//				refreshView.Refreshing = false;
//				UpdateView();
//			};
//			UpdateView ();

            return(v);
        }
コード例 #25
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var v = inflater.Inflate(Resource.Layout.fragment_tabstrip, container, false);

            loadingView        = inflater.Inflate(Resource.Layout.loading_view, null, false);
            reflections        = new List <Android.Support.V4.Widget.SwipeRefreshLayout>();
            reflectionsList    = new List <ListView> ();
            reflectionsAdapter = new List <ReflectionAdapter> ();
            if (profile.teams.Count > 0)
            {
                foreach (var team in profile.teams)
                {
                    var rv  = new Android.Support.V4.Widget.SwipeRefreshLayout(Activity);
                    var lv  = new ListView(Activity);
                    var adp = new ReflectionAdapter(Activity);
                    lv.Adapter = adp;
                    rv.AddView(lv);
                    TeamHolder th = new TeamHolder();
                    th.id   = team.id;
                    th.name = team.name;
                    Console.WriteLine(team.slug);
                    rv.Tag = th;
                    reflections.Add(rv);
                    reflectionsList.Add(lv);
                    reflectionsAdapter.Add(adp);
                }
            }

            var uv  = new Android.Support.V4.Widget.SwipeRefreshLayout(Activity);
            var ulv = new ListView(Activity);
            var ula = new ReflectionAdapter(Activity);

            ulv.Adapter = ula;
            uv.AddView(ulv);
            TeamHolder userTeam = new TeamHolder();

            userTeam.id   = -1;
            userTeam.name = "Me";
            uv.Tag        = userTeam;
            reflections.Add(uv);
            reflectionsList.Add(ulv);
            reflectionsAdapter.Add(ula);

            var wv  = new Android.Support.V4.Widget.SwipeRefreshLayout(Activity);
            var wlv = new ListView(Activity);
            var wla = new ReflectionAdapter(Activity);

            wlv.Adapter = wla;
            wv.AddView(wlv);
            TeamHolder worldTeam = new TeamHolder();

            worldTeam.id   = -2;
            worldTeam.name = "World";
            wv.Tag         = worldTeam;
            reflections.Add(wv);
            reflectionsList.Add(wlv);
            reflectionsAdapter.Add(wla);


            currentLayout          = reflections [0];
            currentList            = reflectionsList [0];
            currentAdapter         = reflectionsAdapter [0];
            currentList.Scroll    += HandleScroll;
            currentLayout.Refresh += HandleRefresh;
            adapter = new MyPagerAdapter(reflections);

            pager = v.FindViewById <ViewPager> (Resource.Id.pager);

            tabs          = v.FindViewById <PagerSlidingTabStrip> (Resource.Id.tabs);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);
            tabs.OnPageChangeListener = this;


            return(v);
        }
コード例 #26
0
        void InitTabs()
        {
            adapter = new MyPagerAdapter(SupportFragmentManager);


            pager = new CustomPager(this);


            pager.Id = 0x1000;
            tabs     = FindViewById <PagerSlidingTabStrip>(stops.Resource.Id.tabs);
            var pagerWrapper = FindViewById <FrameLayout>(stops.Resource.Id.viewPagerWrapper);

            pagerWrapper.AddView(pager);
            pager.Adapter = adapter;
            tabs.SetViewPager(pager);

            var pageMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics);

            pager.PageMargin             = pageMargin;
            tabs.OnTabReselectedListener = this;

            // pager.SetCurrentItem(2, true);

            pager.OffscreenPageLimit = 55;


            FavoriteBridge.Instance.OnEvent += (source, e) => {
                var evt = (EventClassArgs)e;
                if (evt.Name == "FavoriteSelected")
                {
                    var data = (Favorite)evt.Data;

                    if (data.fromName != null && data.toName != null)
                    {
                        pager.SetCurrentItem(1, true);
                    }
                    else if (data.fromName != null)
                    {
                        pager.SetCurrentItem(0, true);
                    }
                }
            };


            pager.PageSelected += (object sender, ViewPager.PageSelectedEventArgs e) => {
                var pos = e.Position;

                if (prevFrag == null)
                {
                    prevFrag = ((LazyLoadFragment)adapter.Frags[0]);
                }

                var currentFrag = ((LazyLoadFragment)adapter.Frags[pos]);

                /*
                 * Animate frag slide in on viewpager change. So we avoid the
                 */
                if (currentFrag.Loaded)
                {
                    currentFrag.Frag.SlideAnimateIn();
                }

                /*
                 * Makes the prev layout ready for slide in animation
                 */
                if (prevFrag != null && prevFrag.Loaded)
                {
                    prevFrag.Frag.RestoreViewPosition();
                }

                ((LazyLoadFragment)adapter.Frags[pos]).Create();
                if (prevFrag != null)
                {
                    prevFrag.ClearFocus();
                }
                if (((LazyLoadFragment)adapter.Frags[pos]).Loaded)
                {
                    ((LazyLoadFragment)adapter.Frags[pos]).SetFocus();
                }
                prevFrag = ((LazyLoadFragment)adapter.Frags[pos]);
            };
        }
コード例 #27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.PerfilCardEditarLayout);
            miembro = JsonConvert.DeserializeObject <UsuarioModel>(Intent.GetStringExtra("Miembro"));
            FindViewById <ImageButton>(Resource.Id.ibCerrar).Click += (sender, e) => OnBackPressed();

            imgPerfil = FindViewById <ImageView>(Resource.Id.ivPerfil);
            if (!string.IsNullOrEmpty(miembro.Usuario_Fotografia))
            {
                miembro.Usuario_Fotografia_Perfil = new UploadImages().DownloadFileFTP(miembro.Usuario_Fotografia, usuario_imagen_path);
                photo = BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_Perfil, 0, miembro.Usuario_Fotografia_Perfil.Length);
                imgPerfil.SetImageBitmap(ImagesHelper.GetRoundedShape(BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_Perfil, 0, miembro.Usuario_Fotografia_Perfil.Length)));
            }
            else
            {
                imgPerfil.SetImageResource(Resource.Mipmap.ic_profile_empty);
            }
            imgFondo = FindViewById <ImageView>(Resource.Id.imgFondo);
            if (!string.IsNullOrEmpty(miembro.Usuario_Fotografia_Fondo))
            {
                miembro.Usuario_Fotografia_FondoPerfil = new UploadImages().DownloadFileFTP(miembro.Usuario_Fotografia_Fondo, usuario_imagen_path);
                background = BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_FondoPerfil, 0, miembro.Usuario_Fotografia_FondoPerfil.Length);
                imgFondo.SetImageBitmap(background);
            }

            FindViewById <Button>(Resource.Id.btnGuardar).Click += delegate
            {
                System.IO.MemoryStream stream = new System.IO.MemoryStream();
                photo?.Compress(Bitmap.CompressFormat.Jpeg, 0, stream);
                miembro.Usuario_Fotografia_Perfil = stream?.ToArray();
                stream = new System.IO.MemoryStream();
                background?.Compress(Bitmap.CompressFormat.Jpeg, 0, stream);
                miembro.Usuario_Fotografia_FondoPerfil = stream?.ToArray();
                if (new UsuariosController().UpdateDataMiembros(miembro.Usuario_Id, FindViewById <EditText>(Resource.Id.txtNombre).Text,
                                                                FindViewById <EditText>(Resource.Id.txtApellidos).Text, miembro.Usuario_Correo_Electronico, miembro.Usuario_Telefono,
                                                                miembro.Usuario_Celular, miembro.Usuario_Descripcion, DateTime.Parse(miembro.Usuario_Fecha_Nacimiento), miembro.Usuario_Fotografia_Perfil, miembro.Usuario_Fotografia_FondoPerfil))
                {
                    miembro.Redes_Sociales.AsParallel().ToList().ForEach(red =>
                    {
                        if (!string.IsNullOrEmpty(red.Usuario_Red_Social_Id) || !string.IsNullOrEmpty(red.Red_Social_Enlace))
                        {
                            new RedesSocialesController().SetRedSocial(miembro.Usuario_Id, miembro.Usuario_Tipo, red.Red_Social_Id, red.Red_Social_Enlace, red.Usuario_Red_Social_Id);
                        }
                    });
                    new EmpresaController().UpdateUsuarioEmpresaPerfil(miembro.Empresa_Actual.Empresa_Id, miembro.Usuario_Id, "",
                                                                       miembro.Empresa_Actual.Empresa_Nombre, miembro.Empresa_Actual.Empresa_Correo_Electronico,
                                                                       miembro.Empresa_Actual.Empresa_Pagina_Web, miembro.Usuario_Puesto, miembro.Empresa_Actual.Empresa_Logotipo_Perfil);
                    Toast.MakeText(this, Resource.String.str_general_save, ToastLength.Short).Show();
                    Intent intent = new Intent(this, typeof(PerfilCardActivity));
                    intent.PutExtra("Miembro", JsonConvert.SerializeObject(new UsuariosController().GetMemberData(miembro.Usuario_Id, miembro.Usuario_Tipo)));
                    StartActivity(intent);
                    Finish();
                }
                else
                {
                    Toast.MakeText(this, Resource.String.str_general_save_error, ToastLength.Short).Show();
                }
            };

            FindViewById <ImageView>(Resource.Id.btnCamara).Click += delegate
            {
                Width = Height = 400;
                CreateDirectoryForPictures();
                IsThereAnAppToTakePictures();
                Intent intent = new Intent(MediaStore.ActionImageCapture);
                _file = new File(_dir, String.Format("{0}.jpg", Guid.NewGuid()));
                intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(_file));
                StartActivityForResult(intent, TakePicture);
                flag = true;
            };

            FindViewById <ImageView>(Resource.Id.btnCamaraFondo).Click += delegate
            {
                Width  = 1500;
                Height = 500;
                CreateDirectoryForPictures();
                IsThereAnAppToTakePictures();
                Intent intent = new Intent(MediaStore.ActionImageCapture);
                _file = new File(_dir, String.Format("{0}.jpg", Guid.NewGuid()));
                intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(_file));
                StartActivityForResult(intent, TakePicture);
                flag = false;
            };

            FindViewById <EditText>(Resource.Id.txtNombre).Text    = miembro.Usuario_Nombre;
            FindViewById <EditText>(Resource.Id.txtApellidos).Text = miembro.Usuario_Apellidos;
            FindViewById <TextView>(Resource.Id.lblEmpresa).Text   = miembro.Usuario_Empresa_Nombre;

            ViewPager _viewPager = FindViewById <ViewPager>(Resource.Id.vpPerfil);

            _viewPager.Adapter = new PerfilEditarPageAdapter(this, new List <string> {
                Resources.GetString(Resource.String.str_profile_about_me), Resources.GetString(Resource.String.str_profile_social), Resources.GetString(Resource.String.str_profile_work)
            }, ref miembro);

            PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);

            tabs.SetTextColorResource(Resource.Color.comment_pressed);
            tabs.SetViewPager(_viewPager);
        }
コード例 #28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.PerfilCardLayout);
            miembro = JsonConvert.DeserializeObject <UsuarioModel>(Intent.GetStringExtra("Miembro"));
            FindViewById <ImageButton>(Resource.Id.ibCerrar).Click += (sender, e) => OnBackPressed();

            imgPerfil = FindViewById <ImageView>(Resource.Id.ivPerfil);
            if (!string.IsNullOrEmpty(miembro.Usuario_Fotografia))
            {
                miembro.Usuario_Fotografia_Perfil = new UploadImages().DownloadFileFTP(miembro.Usuario_Fotografia, usuario_imagen_path);
                photo = BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_Perfil, 0, miembro.Usuario_Fotografia_Perfil.Length);
                imgPerfil.SetImageBitmap(ImagesHelper.GetRoundedShape(BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_Perfil, 0, miembro.Usuario_Fotografia_Perfil.Length)));
            }
            else
            {
                imgPerfil.SetImageResource(Resource.Mipmap.ic_profile_empty);
            }
            imgFondo = FindViewById <ImageView>(Resource.Id.imgFondo);
            if (!string.IsNullOrEmpty(miembro.Usuario_Fotografia_Fondo))
            {
                miembro.Usuario_Fotografia_FondoPerfil = new UploadImages().DownloadFileFTP(miembro.Usuario_Fotografia_Fondo, usuario_imagen_path);
                background = BitmapFactory.DecodeByteArray(miembro.Usuario_Fotografia_FondoPerfil, 0, miembro.Usuario_Fotografia_FondoPerfil.Length);
                imgFondo.SetImageBitmap(background);
            }

            FindViewById <TextView>(Resource.Id.lblNombre).Text  = miembro.Usuario_Nombre + " " + miembro.Usuario_Apellidos;
            FindViewById <TextView>(Resource.Id.lblEmpresa).Text = miembro.Usuario_Empresa_Nombre;
            Button btnSeguir = FindViewById <Button>(Resource.Id.btnSeguir);

            FindViewById <Button>(Resource.Id.btnSendMessage).Click += delegate
            {
                Intent intent = PackageManager.GetLaunchIntentForPackage("mx.worklabs");
                if (intent == null)
                {
                    intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("https://play.google.com/store/apps/details?id=mx.worklabs"));
                }
                intent.AddFlags(ActivityFlags.NewTask);
                StartActivity(intent);
            };

            if (miembro.Usuario_Id == storage.Get("Usuario_Id") && miembro.Usuario_Tipo == storage.Get("Usuario_Tipo"))
            {
                FindViewById <Button>(Resource.Id.btnSendMessage).Visibility = Android.Views.ViewStates.Gone;
                btnSeguir.Visibility = Android.Views.ViewStates.Gone;
                ImageView editar = FindViewById <ImageView>(Resource.Id.btnEditar);
                editar.Visibility = Android.Views.ViewStates.Visible;
                editar.Click     += delegate
                {
                    Intent intent = new Intent(this, typeof(PerfilCardEditarActivity));
                    intent.PutExtra("Miembro", Intent.GetStringExtra("Miembro"));
                    StartActivity(intent);
                    Finish();
                };
            }
            isFavorite = new UsuariosController().IsMiembroFavorito(storage.Get("Usuario_Id"), storage.Get("Usuario_Tipo"), miembro.Usuario_Id, miembro.Usuario_Tipo);
            if (!isFavorite.Value)
            {
                btnSeguir.Text = Resources.GetString(Resource.String.str_social_network_unfollow);
            }
            FindViewById <Button>(Resource.Id.btnSeguir).Click += delegate
            {
                if (isFavorite.Value)
                {
                    if (new UsuariosController().RemoveMiembroFavorito(isFavorite))
                    {
                        btnSeguir.Text = Resources.GetString(Resource.String.str_social_network_follow);
                    }
                    else
                    {
                        btnSeguir.Text = Resources.GetString(Resource.String.str_social_network_unfollow);
                    }
                }
            };

            ViewPager _viewPager = FindViewById <ViewPager>(Resource.Id.vpPerfil);

            _viewPager.Adapter = new PerfilPageAdapter(this, new List <string> {
                Resources.GetString(Resource.String.str_profile_about_me), Resources.GetString(Resource.String.str_profile_social), Resources.GetString(Resource.String.str_profile_work)
            }, miembro);

            PagerSlidingTabStrip tabs = FindViewById <PagerSlidingTabStrip>(Resource.Id.tabs);

            tabs.SetTextColorResource(Resource.Color.comment_pressed);
            tabs.SetViewPager(_viewPager);
            if (storage.Get("Usuario_Id") == miembro.Usuario_Id && storage.Get("Usuario_Tipo") == miembro.Usuario_Tipo)
            {
                imgPerfil.Click += delegate
                {
                    Width = Height = 400;
                    CreateDirectoryForPictures();
                    IsThereAnAppToTakePictures();
                    Intent intent = new Intent(MediaStore.ActionImageCapture);
                    _file = new File(_dir, String.Format("{0}.jpg", Guid.NewGuid()));
                    intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(_file));
                    StartActivityForResult(intent, TakePicture);
                    flag = true;
                };

                imgFondo.Click += delegate
                {
                    Width  = 1500;
                    Height = 500;
                    CreateDirectoryForPictures();
                    IsThereAnAppToTakePictures();
                    Intent intent = new Intent(MediaStore.ActionImageCapture);
                    _file = new File(_dir, String.Format("{0}.jpg", Guid.NewGuid()));
                    intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(_file));
                    StartActivityForResult(intent, TakePicture);
                    flag = false;
                };
            }
        }
コード例 #29
0
        void SetUpPager()
        {
            _pager.Adapter = new LandingPagerAdapter(SupportFragmentManager, this);

            _tabs.SetViewPager(_pager);
        }