private void InitDrawer() { if (_rightDrawer != null) { return; } var builder = new DrawerBuilder().WithActivity(Activity); builder.WithSliderBackgroundColorRes(ResourceExtension.BrushHamburgerBackgroundRes); builder.WithStickyFooterShadow(true); builder.WithDisplayBelowStatusBar(true); builder.WithDrawerGravity((int)GravityFlags.Right); builder.WithStickyHeaderShadow(true); builder.WithStickyHeader(Resource.Layout.AnimeListPageDrawerHeader); _rightDrawer = builder.Build(); _rightDrawer.DrawerLayout.SetDrawerLockMode(DrawerLayout.LockModeLockedClosed); _rightDrawer.StickyHeader.SetBackgroundColor(new Color(ResourceExtension.BrushAppBars)); _rightDrawer.DrawerLayout.AddDrawerListener(new DrawerListener(() => { ViewModelLocator.NavMgr.ResetOneTimeOverride(); OnCloseDrawer(); }, null)); }
private void InitDrawer() { if (RightDrawer != null) { return; } var builder = new DrawerBuilder().WithActivity(Activity); builder.WithSliderBackgroundColorRes(ResourceExtension.BrushHamburgerBackgroundRes); builder.WithStickyFooterShadow(true); builder.WithDisplayBelowStatusBar(true); builder.WithDrawerGravity((int)GravityFlags.Right); builder.WithStickyHeaderShadow(true); builder.WithStickyHeader(Resource.Layout.AnimeListPageDrawerHeader); RightDrawer = builder.Build(); RightDrawer.DrawerLayout.SetDrawerLockMode(DrawerLayout.LockModeUnlocked); RightDrawer.StickyHeader.SetBackgroundColor(new Color(ResourceExtension.BrushAppBars)); RightDrawer.DrawerLayout.AddDrawerListener(new DrawerListener( onClose: () => { OpenFiltersDrawer(false); ViewModelLocator.NavMgr.ResetOneTimeOverride(); }, onOpen: () => { ViewModelLocator.NavMgr.RegisterOneTimeMainOverride(new RelayCommand(CloseDrawer)); _actionMenu.Close(true); })); OpenFiltersDrawer(false); }
/// <summary> /// 获取标签生成器 /// </summary> protected override TagBuilder GetTagBuilder() { var builder = new DrawerBuilder(); Config(builder); return(builder); }
//===================================================================== // CICLO DE VIDA DA ATIVIDADE //===================================================================== protected override void OnCreate(Bundle estadoGravado) { base.OnCreate(estadoGravado); SetContentView(Resource.Layout.Main); aGravar = false; InicializarTitulo(); InicializarBotaoPesquisa(); // Se o dispositivo tem microfone, associa um "click handler" ao botão de voz, se não, desativa-o. InicializarBotaoVoz(); string email = Intent.GetStringExtra("utilizador_email") ?? ""; InicializarCabecalho(email, estadoGravado); InicializarDefinicoesESobre(); InicializarItemsUtilizador(); drawerBuilder = new DrawerBuilder() .WithActivity(this) .WithAccountHeader(cabecalhoDrawer); // Adicionar o cabeçalho inicializado. if (email.Equals("")) // Utilizador não autenticado { InicializarItemsLoginRegisto(); } else // TODO: Testar se o utilizador é um proprietário ou um cliente e criar items diferentes para cada caso! { InicializarItemsCliente(); } drawer = drawerBuilder.WithOnDrawerItemClickListener(this) .WithSavedInstance(estadoGravado) .WithShowDrawerOnFirstLaunch(true) .Build(); // Havendo vários tipos de DrawerItems, pode-se fazer caching desses items para se obter um melhor desempenho // ao fazer scroll. A cache deve ser inicializada depois do DrawerBuilder ser construido. RecyclerViewCacheUtil.Instance.WithCacheSize(2).Init(drawer); // Só se ativa a seleção quando não se está a recriar a "activity" if (estadoGravado == null) { // Definir a seleção como tendo identificador -1 drawer.SetSelection(-1, false); // Definir o perfil ativo cabecalhoDrawer.SetActiveProfile(itemUtilizador, false); } utilitarioApiGoogle = MnhamMnhamApp.ObterUtilitarioApiGoogle(); primeiraExecucao = true; }
private void InitDrawer() { if (_rightDrawer != null) { return; } var builder = new DrawerBuilder().WithActivity(Activity); builder.WithSliderBackgroundColorRes(ResourceExtension.BrushHamburgerBackgroundRes); builder.WithStickyFooterShadow(true); builder.WithDisplayBelowStatusBar(true); builder.WithDrawerGravity((int)GravityFlags.Right); builder.WithStickyHeaderShadow(true); builder.WithStickyHeader(Resource.Layout.AnimeListPageDrawerHeader); _rightDrawer = builder.Build(); _rightDrawer.StickyHeader.SetBackgroundColor(new Color(ResourceExtension.BrushAppBars)); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); receiver = new NetworkBroadcastReceiver(this); receiver.SetListener(this); intentFilter = new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"); RegisterReceiver(receiver, intentFilter); tvNetworkNotification = (TextView)FindViewById(Resource.Id.network_notification); ConnectivityManager cm = (ConnectivityManager)this.GetSystemService(Context.ConnectivityService); if (cm.ActiveNetworkInfo == null) { var ad = new Android.Support.V7.App.AlertDialog.Builder(this); ad.SetTitle("No Connection"); ad.SetMessage("Looks like there's a problem with your network connection. Try again later."); ad.SetCancelable(false); ad.SetPositiveButton("OK", this); Android.Support.V7.App.AlertDialog dialog = ad.Create(); dialog.Show(); } else { MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.googlemap); mapFragment.GetMapAsync(this); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); // Deserialize the member object ISharedPreferences pref = GetSharedPreferences(GetString(Resource.String.PreferenceFileName), FileCreationMode.Private); var member = pref.GetString(GetString(Resource.String.PreferenceSavedMember), ""); user = JsonConvert.DeserializeObject <Member>(member); var profile = new ProfileDrawerItem(); profile.WithName(user.username); profile.WithIdentifier(100); headerResult = new AccountHeaderBuilder() .WithActivity(this) .WithHeaderBackground(Resource.Drawable.profilebackground) .WithSelectionListEnabledForSingleProfile(false) .AddProfiles(profile) .WithOnAccountHeaderListener(this) .WithSavedInstance(bundle) .Build(); var header = new PrimaryDrawerItem(); header.WithName(Resource.String.Drawer_Item_Trips); header.WithIcon(GoogleMaterial.Icon.GmdDirectionsCar); header.WithIdentifier(1); var logoutDrawer = new SecondaryDrawerItem(); logoutDrawer.WithName(Resource.String.Drawer_Item_Logout); logoutDrawer.WithIcon(GoogleMaterial.Icon.GmdSettingsPower); logoutDrawer.WithIdentifier(4); //create the drawer and remember the `Drawer` result object Drawer result = new DrawerBuilder() .WithActivity(this) .WithToolbar(toolbar) .WithAccountHeader(headerResult) .AddDrawerItems( header, new DividerDrawerItem(), logoutDrawer ) .WithOnDrawerItemClickListener(this) .Build(); originAutocompleteFragment = (PlaceAutocompleteFragment) FragmentManager.FindFragmentById(Resource.Id.place_autocomplete_origin_fragment); originAutocompleteFragment.SetHint("Enter the origin"); originAutocompleteFragment.PlaceSelected += OnOriginSelected; destAutocompleteFragment = (PlaceAutocompleteFragment) FragmentManager.FindFragmentById(Resource.Id.place_autocomplete_destination_fragment); destAutocompleteFragment.SetHint("Enter the destination"); destAutocompleteFragment.PlaceSelected += OnDestinationSelected; progress = new ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(ProgressDialogStyle.Spinner); progress.SetMessage("Getting location..."); progress.SetCancelable(false); RunOnUiThread(() => { progress.Show(); }); // Request Update request locationManager = (LocationManager)GetSystemService(Context.LocationService); IList <string> providers = locationManager.AllProviders; Criteria criteria = new Criteria(); string bestProvider = locationManager.GetBestProvider(criteria, true); locationManager.RequestLocationUpdates(bestProvider, MIN_TIME, MIN_DISTANCE, this); } }
private void BuildDrawer() { var builder = new DrawerBuilder().WithActivity(this); builder.WithSliderBackgroundColorRes(ResourceExtension.BrushHamburgerBackgroundRes); builder.WithStickyFooterShadow(true); builder.WithDisplayBelowStatusBar(true); var animeButton = GetBasePrimaryItem(OnAnimeListMore); animeButton.WithName("Anime list"); animeButton.WithIdentifier((int)PageIndex.PageAnimeList); animeButton.WithIcon(Resource.Drawable.icon_list); var searchButton = GetBasePrimaryItem(); searchButton.WithName("Search"); searchButton.WithIdentifier((int)PageIndex.PageSearch); searchButton.WithIcon(Resource.Drawable.icon_search); var seasonalButton = GetBasePrimaryItem(); seasonalButton.WithName("Seasonal anime"); seasonalButton.WithIdentifier((int)PageIndex.PageSeasonal); seasonalButton.WithIcon(Resource.Drawable.icon_seasonal); var recomButton = GetBasePrimaryItem(); recomButton.WithName("Recommendations"); recomButton.WithIdentifier((int)PageIndex.PageRecomendations); recomButton.WithIcon(Resource.Drawable.icon_recom); var topAnimeButton = GetBasePrimaryItem(OnTopAnimeMore); topAnimeButton.WithName("Top anime"); topAnimeButton.WithIdentifier((int)PageIndex.PageTopAnime); topAnimeButton.WithIcon(Resource.Drawable.icon_fav_outline); var calendarButton = GetBasePrimaryItem(); calendarButton.WithName("Calendar"); calendarButton.WithIdentifier((int)PageIndex.PageCalendar); calendarButton.WithIcon(Resource.Drawable.icon_calendar); // var articlesButton = GetBaseSecondaryItem(); articlesButton.WithName("Articles & News"); articlesButton.WithIdentifier((int)PageIndex.PageArticles); articlesButton.WithIcon(Resource.Drawable.icon_newspaper); var videoButton = GetBaseSecondaryItem(); videoButton.WithName("Promotional Videos"); videoButton.WithIdentifier((int)PageIndex.PagePopularVideos); videoButton.WithIcon(Resource.Drawable.icon_video); var feedsButton = GetBaseSecondaryItem(); feedsButton.WithName("Friends Feeds"); feedsButton.WithIdentifier((int)PageIndex.PageFeeds); feedsButton.WithIcon(Resource.Drawable.icon_feeds); var forumsButton = GetBaseSecondaryItem(); forumsButton.WithName("Forums"); forumsButton.WithIdentifier((int)PageIndex.PageForumIndex); forumsButton.WithIcon(Resource.Drawable.icon_forum); //var messagingButton = GetBaseSecondaryItem(); //messagingButton.WithName("Messaging"); //messagingButton.WithIdentifier((int) PageIndex.PageMessanging); //messagingButton.WithIcon(Resource.Drawable.icon_message_alt); var historyButton = GetBaseSecondaryItem(); historyButton.WithName("History"); historyButton.WithIdentifier((int)PageIndex.PageHistory); historyButton.WithIcon(Resource.Drawable.icon_clock); //var notificationHubButton = GetBaseSecondaryItem(); //notificationHubButton.WithName("Notification Hub"); //notificationHubButton.WithIdentifier((int) PageIndex.PageNotificationHub); //notificationHubButton.WithIcon(Resource.Drawable.icon_notification); var wallpapersButton = GetBaseSecondaryItem(); wallpapersButton.WithName("Images"); wallpapersButton.WithIdentifier((int)PageIndex.PageWallpapers); wallpapersButton.WithIcon(Resource.Drawable.icon_image_alt); var clubsButton = GetBaseSecondaryItem(); clubsButton.WithName("Clubs"); clubsButton.WithIdentifier((int)PageIndex.PageClubIndex); clubsButton.WithIcon(Resource.Drawable.icon_club); // var othersSubHeader = new SectionDrawerItem(); othersSubHeader.WithName("Other"); othersSubHeader.WithDivider(true); othersSubHeader.WithTextColorRes(ResourceExtension.BrushTextRes); if (!Settings.HamburgerHideMangaSection) { var mangaSubHeader = new SectionDrawerItem(); mangaSubHeader.WithName("Manga"); mangaSubHeader.WithDivider(true); mangaSubHeader.WithIdentifier(55779988); mangaSubHeader.WithTextColorRes(ResourceExtension.BrushTextRes); var mangaListButton = GetBaseSecondaryItem(OnMangaMore); mangaListButton.WithName("Manga list"); mangaListButton.WithIdentifier((int)PageIndex.PageMangaList); mangaListButton.WithIcon(Resource.Drawable.icon_list); var topMangaButton = GetBaseSecondaryItem(); topMangaButton.WithName("Top manga"); topMangaButton.WithIdentifier((int)PageIndex.PageTopManga); topMangaButton.WithIcon(Resource.Drawable.icon_fav_outline); builder.WithDrawerItems(new List <IDrawerItem>() { animeButton, seasonalButton, topAnimeButton, searchButton, recomButton, calendarButton, mangaSubHeader,// mangaListButton, topMangaButton, othersSubHeader,// articlesButton, videoButton, feedsButton, forumsButton, // messagingButton, historyButton, clubsButton, // notificationHubButton, wallpapersButton }); } else { builder.WithDrawerItems(new List <IDrawerItem>() { animeButton, seasonalButton, topAnimeButton, searchButton, recomButton, calendarButton, othersSubHeader,// articlesButton, videoButton, feedsButton, forumsButton, // messagingButton, historyButton, // notificationHubButton, wallpapersButton }); } _drawer = builder.Build(); UpdateLogInLabel(); _drawer.StickyFooter.SetBackgroundColor(new Color(Settings.SelectedTheme == 1 ? ResourceExtension.BrushAnimeItemInnerBackground : ResourceExtension.BrushAnimeItemBackground)); _drawer.DrawerLayout.AddDrawerListener(new DrawerListener(OnClose, OnOpen)); }
private async void BuildDrawer() { var builder = new DrawerBuilder().WithActivity(this); builder.WithSliderBackgroundColorRes(Resource.Color.BrushHamburgerBackground); builder.WithStickyFooterShadow(true); var animeButton = GetBasePrimaryItem(); animeButton.WithName("Anime list"); animeButton.WithIdentifier((int)PageIndex.PageAnimeList); animeButton.WithIcon(Resource.Drawable.icon_list); var searchButton = GetBasePrimaryItem(); searchButton.WithName("Anime search"); searchButton.WithIdentifier((int)PageIndex.PageSearch); searchButton.WithIcon(Resource.Drawable.icon_search); var seasonalButton = GetBasePrimaryItem(); seasonalButton.WithName("Seasonal anime"); seasonalButton.WithIdentifier((int)PageIndex.PageSeasonal); seasonalButton.WithIcon(Resource.Drawable.icon_seasonal); var recomButton = GetBasePrimaryItem(); recomButton.WithName("Recommendations"); recomButton.WithIdentifier((int)PageIndex.PageRecomendations); recomButton.WithIcon(Resource.Drawable.icon_recom); var topAnimeButton = GetBasePrimaryItem(); topAnimeButton.WithName("Top anime"); topAnimeButton.WithIdentifier((int)PageIndex.PageTopAnime); topAnimeButton.WithIcon(Resource.Drawable.icon_fav_outline); var calendarButton = GetBasePrimaryItem(); calendarButton.WithName("Calendar"); calendarButton.WithIdentifier((int)PageIndex.PageCalendar); calendarButton.WithIcon(Resource.Drawable.icon_calendar); // var mangaListButton = GetBaseSecondaryItem(); mangaListButton.WithName("Manga list"); mangaListButton.WithIdentifier((int)PageIndex.PageMangaList); mangaListButton.WithIcon(Resource.Drawable.icon_books); var mangaSearchButton = GetBaseSecondaryItem(); mangaSearchButton.WithName("Manga search"); mangaSearchButton.WithIdentifier((int)PageIndex.PageMangaSearch); mangaSearchButton.WithIcon(Resource.Drawable.icon_search); var topMangaButton = GetBaseSecondaryItem(); topMangaButton.WithName("Top manga"); topMangaButton.WithIdentifier((int)PageIndex.PageTopManga); topMangaButton.WithIcon(Resource.Drawable.icon_fav_outline); // IDrawerItem accountButton; if (Credentials.Authenticated) { var btn = new ProfileDrawerItem(); btn.WithName("Account"); btn.WithTextColorRes(Resource.Color.BrushText); btn.WithSelectedColorRes(Resource.Color.BrushAnimeItemBackground); btn.WithSelectedTextColorRes(Resource.Color.AccentColour); btn.WithIdentifier((int)PageIndex.PageProfile); btn.WithIcon(Resource.Drawable.icon_account); accountButton = btn; } else { var btn = GetBaseSecondaryItem(); btn.WithName("Sign in"); btn.WithIdentifier((int)PageIndex.PageLogIn); btn.WithIcon(Resource.Drawable.icon_login); accountButton = btn; } var settingsButton = GetBaseSecondaryItem(); settingsButton.WithName("Settings & more"); settingsButton.WithIdentifier((int)PageIndex.PageSettings); settingsButton.WithIcon(Resource.Drawable.icon_settings); builder.AddStickyDrawerItems(accountButton, settingsButton); // var mangaSubHeader = new SectionDrawerItem(); mangaSubHeader.WithName("Manga"); mangaSubHeader.WithDivider(true); mangaSubHeader.WithTextColorRes(Resource.Color.BrushText); builder.WithDrawerItems(new List<IDrawerItem>() { animeButton, searchButton, seasonalButton, recomButton, topAnimeButton, calendarButton, mangaSubHeader,// mangaListButton, mangaSearchButton, topMangaButton, }); _drawer = builder.Build(); _drawer.StickyFooter.SetBackgroundColor(new Color(ResourceExtension.BrushAnimeItemInnerBackground)); if (Credentials.Authenticated) { var bmp = await ImageService.Instance.LoadUrl( $"https://myanimelist.cdn-dena.com/images/userimages/4952914.jpg") .AsBitmapDrawableAsync(); var btn = accountButton as ProfileDrawerItem; btn.WithIcon(bmp); _drawer.UpdateStickyFooterItem(btn); } }
private async void BuildDrawer() { var builder = new DrawerBuilder().WithActivity(this); builder.WithSliderBackgroundColorRes(ResourceExtension.BrushHamburgerBackgroundRes); builder.WithStickyFooterShadow(true); builder.WithDisplayBelowStatusBar(true); var animeButton = GetBasePrimaryItem(); animeButton.WithName("Anime list"); animeButton.WithIdentifier((int)PageIndex.PageAnimeList); animeButton.WithIcon(Resource.Drawable.icon_list); var searchButton = GetBasePrimaryItem(); searchButton.WithName("Anime search"); searchButton.WithIdentifier((int)PageIndex.PageSearch); searchButton.WithIcon(Resource.Drawable.icon_search); var seasonalButton = GetBasePrimaryItem(); seasonalButton.WithName("Seasonal anime"); seasonalButton.WithIdentifier((int)PageIndex.PageSeasonal); seasonalButton.WithIcon(Resource.Drawable.icon_seasonal); var recomButton = GetBasePrimaryItem(); recomButton.WithName("Recommendations"); recomButton.WithIdentifier((int)PageIndex.PageRecomendations); recomButton.WithIcon(Resource.Drawable.icon_recom); var topAnimeButton = GetBasePrimaryItem(); topAnimeButton.WithName("Top anime"); topAnimeButton.WithIdentifier((int)PageIndex.PageTopAnime); topAnimeButton.WithIcon(Resource.Drawable.icon_fav_outline); var calendarButton = GetBasePrimaryItem(); calendarButton.WithName("Calendar"); calendarButton.WithIdentifier((int)PageIndex.PageCalendar); calendarButton.WithIcon(Resource.Drawable.icon_calendar); // var mangaListButton = GetBaseSecondaryItem(); mangaListButton.WithName("Manga list"); mangaListButton.WithIdentifier((int)PageIndex.PageMangaList); mangaListButton.WithIcon(Resource.Drawable.icon_books); var topMangaButton = GetBaseSecondaryItem(); topMangaButton.WithName("Top manga"); topMangaButton.WithIdentifier((int)PageIndex.PageTopManga); topMangaButton.WithIcon(Resource.Drawable.icon_fav_outline); var articlesButton = GetBaseSecondaryItem(); articlesButton.WithName("Articles & News"); articlesButton.WithIdentifier((int)PageIndex.PageArticles); articlesButton.WithIcon(Resource.Drawable.icon_newspaper); var videoButton = GetBaseSecondaryItem(); videoButton.WithName("Promotional Videos"); videoButton.WithIdentifier((int)PageIndex.PagePopularVideos); videoButton.WithIcon(Resource.Drawable.icon_video); var feedsButton = GetBaseSecondaryItem(); feedsButton.WithName("Friends Feeds"); feedsButton.WithIdentifier((int)PageIndex.PageFeeds); feedsButton.WithIcon(Resource.Drawable.icon_feeds); var forumsButton = GetBaseSecondaryItem(); forumsButton.WithName("Friends Feeds"); forumsButton.WithIdentifier((int)PageIndex.PageForumIndex); forumsButton.WithIcon(Resource.Drawable.icon_feeds); // IDrawerItem accountButton; if (Credentials.Authenticated) { var btn = new ProfileDrawerItem(); btn.WithName("Account"); btn.WithTextColorRes(ResourceExtension.BrushTextRes); btn.WithSelectedColorRes(ResourceExtension.BrushAnimeItemBackgroundRes); btn.WithSelectedTextColorRes(Resource.Color.AccentColour); btn.WithIdentifier((int)PageIndex.PageProfile); btn.WithIcon(Resource.Drawable.icon_account); accountButton = btn; } else { var btn = GetBaseSecondaryItem(); btn.WithName("Sign in"); btn.WithIdentifier((int)PageIndex.PageLogIn); btn.WithIcon(Resource.Drawable.icon_login); accountButton = btn; } var settingsButton = GetBaseSecondaryItem(); settingsButton.WithName("Settings & more"); settingsButton.WithIdentifier((int)PageIndex.PageSettings); settingsButton.WithIcon(Resource.Drawable.icon_settings); builder.AddStickyDrawerItems(accountButton, settingsButton); // var mangaSubHeader = new SectionDrawerItem(); mangaSubHeader.WithName("Manga"); mangaSubHeader.WithDivider(true); mangaSubHeader.WithTextColorRes(ResourceExtension.BrushTextRes); var othersSubHeader = new SectionDrawerItem(); othersSubHeader.WithName("Other"); othersSubHeader.WithDivider(true); othersSubHeader.WithTextColorRes(ResourceExtension.BrushTextRes); builder.WithDrawerItems(new List <IDrawerItem>() { animeButton, searchButton, seasonalButton, recomButton, topAnimeButton, calendarButton, mangaSubHeader,// mangaListButton, topMangaButton, othersSubHeader,// articlesButton, videoButton, feedsButton, forumsButton }); _drawer = builder.Build(); _drawer.StickyFooter.SetBackgroundColor(new Color(ResourceExtension.BrushAnimeItemInnerBackground)); if (Credentials.Authenticated) { var bmp = await ImageService.Instance.LoadUrl( $"https://myanimelist.cdn-dena.com/images/userimages/{Credentials.Id}.jpg") .AsBitmapDrawableAsync(); var btn = accountButton as ProfileDrawerItem; btn.WithIcon(bmp); _drawer.UpdateStickyFooterItem(btn); } }