protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); id = Intent.GetStringExtra("id"); handler = new Handler(); commentPresenter = new DailyCommentPresenter(this); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); recyclerView.SetLayoutManager(new LinearLayoutManager(this)); adapter = new DailyCommentsAdapter(); adapter.OnLoadMoreListener = this; recyclerView.SetAdapter(adapter); recyclerView.Post(() => { swipeRefreshLayout.Refreshing = true; OnRefresh(); }); }
public ShellToolbarTracker(IShellContext shellContext, Toolbar toolbar, DrawerLayout drawerLayout) { _shellContext = shellContext ?? throw new ArgumentNullException(nameof(shellContext)); _toolbar = toolbar ?? throw new ArgumentNullException(nameof(toolbar)); _drawerLayout = drawerLayout ?? throw new ArgumentNullException(nameof(drawerLayout)); _toolbar.SetNavigationOnClickListener(this); ((IShellController)_shellContext.Shell).AddFlyoutBehaviorObserver(this); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Id = Intent.GetIntExtra("id", 0); statusPresenter = new StatusPresenter(this); commentPresenter = new StatusCommentsPresenter(this); handler = new Handler(); StatusBarCompat.SetOrdinaryToolBar(this); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); userName = FindViewById <TextView>(Resource.Id.txtUserName); imgUserUrl = FindViewById <ImageView>(Resource.Id.imgUserUrl); imgPrivate = FindViewById <ImageView>(Resource.Id.imgPrivate); imgDelete = FindViewById <ImageButton>(Resource.Id.imgDelete); txtPostdate = FindViewById <TextView>(Resource.Id.txtPostdate); txtBody = FindViewById <TextView>(Resource.Id.txtBody); commentCount = FindViewById <TextView>(Resource.Id.txtCommentCount); txtContent = FindViewById <TextView>(Resource.Id.txtContent); proLoading = FindViewById <ProgressBar>(Resource.Id.proLoading); btnComment = FindViewById <TextView>(Resource.Id.btnComment); btnComment.SetOnClickListener(this); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); recyclerView.SetLayoutManager(new LinearLayoutManager(this)); recyclerView.NestedScrollingEnabled = false; adapter = new StatusCommentsAdapter(); adapter.OnDeleteClickListener = this; adapter.User = await SQLiteUtils.Instance().QueryUser(); recyclerView.SetAdapter(adapter); notDataView = this.LayoutInflater.Inflate(Resource.Layout.empty_view, (ViewGroup)recyclerView.Parent, false); notDataView.Click += delegate(object sender, EventArgs e) { OnRefresh(); }; errorView = this.LayoutInflater.Inflate(Resource.Layout.error_view, (ViewGroup)recyclerView.Parent, false); errorView.Click += delegate(object sender, EventArgs e) { OnRefresh(); }; recyclerView.Post(async() => { await statusPresenter.GetClientStatus(Id); OnRefresh(); }); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); blogApp = Intent.GetStringExtra("blogApp"); blogPresenter = new BlogPresenter(this); handler = new Handler(); coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.coordinatorLayout); appBarLayout = FindViewById <AppBarLayout>(Resource.Id.appbar); linearLayout = FindViewById <LinearLayout>(Resource.Id.linearLayout); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); StatusBarCompat.SetCollapsingToolbar(this, coordinatorLayout, appBarLayout, linearLayout, toolbar); imgAvatar = FindViewById <ImageView>(Resource.Id.avatar); txtTitle = FindViewById <TextView>(Resource.Id.txtTitle); txtSubTitle = FindViewById <TextView>(Resource.Id.txtSubTitle); user = await SQLiteUtils.Instance().QueryUser(); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); var manager = new LinearLayoutManager(this); recyclerView.SetLayoutManager(manager); adapter = new ArticlesAdapter(); adapter.SetOnLoadMoreListener(this); recyclerView.SetAdapter(adapter); notDataView = this.LayoutInflater.Inflate(Resource.Layout.empty_view, (ViewGroup)recyclerView.Parent, false); notDataView.Click += delegate(object sender, EventArgs e) { OnRefresh(); }; errorView = this.LayoutInflater.Inflate(Resource.Layout.error_view, (ViewGroup)recyclerView.Parent, false); errorView.Click += delegate(object sender, EventArgs e) { OnRefresh(); }; recyclerView.Post(async() => { await blogPresenter.GetClientBlog(blogApp); OnRefresh(); }); }
public ShellToolbarTracker(IShellContext shellContext, Toolbar toolbar, DrawerLayout drawerLayout) { _shellContext = shellContext ?? throw new ArgumentNullException(nameof(shellContext)); _toolbar = toolbar ?? throw new ArgumentNullException(nameof(toolbar)); _drawerLayout = drawerLayout ?? throw new ArgumentNullException(nameof(drawerLayout)); _appBar = _toolbar.Parent.GetParentOfType <AppBarLayout>(); _globalLayoutListener = new GenericGlobalLayoutListener(() => UpdateNavBarHasShadow(Page)); _appBar.ViewTreeObserver.AddOnGlobalLayoutListener(_globalLayoutListener); _toolbar.SetNavigationOnClickListener(this); ((IShellController)_shellContext.Shell).AddFlyoutBehaviorObserver(this); }
public override void SetContentView(int layoutResID) { var contentView = (ViewGroup) LayoutInflater.From(this).Inflate( Resource.Layout.Settings, new LinearLayout(this), false); actionbar = contentView.FindViewById<Toolbar>(Resource.Id.toolbar); actionbar.SetNavigationOnClickListener(this); ViewGroup contentWrapper = (ViewGroup) contentView.FindViewById(Resource.Id.content_wrapper); LayoutInflater.From(this).Inflate(layoutResID, contentWrapper, true); Window.SetContentView(contentView); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); View view = inflater.Inflate(Resource.Layout.PhoneVerification, container, true); Toolbar toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar); TextView textTimer = view.FindViewById <TextView>(Resource.Id.countdownTimer); textTimer.Text = "00:" + verificationTimeout.ToString(); toolbar.SetNavigationOnClickListener(this); Timer = new VerificationCountDownTimer(textTimer, verificationTimeout, 1000); return(view); }
public override void SetContentView(int layoutResID) { var contentView = (ViewGroup)LayoutInflater.From(this).Inflate( Resource.Layout.Settings, new LinearLayout(this), false); actionbar = contentView.FindViewById <Toolbar>(Resource.Id.toolbar); actionbar.SetNavigationOnClickListener(this); ViewGroup contentWrapper = (ViewGroup)contentView.FindViewById(Resource.Id.content_wrapper); LayoutInflater.From(this).Inflate(layoutResID, contentWrapper, true); Window.SetContentView(contentView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); blogApp = Intent.GetStringExtra("blogApp"); Id = Intent.GetIntExtra("id", 0); handler = new Handler(); commentPresenter = new ArticleCommentsPresenter(this); StatusBarCompat.SetOrdinaryToolBar(this); dialog = new ProgressDialog(this); dialog.SetCancelable(false); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); txtContent = FindViewById <TextView>(Resource.Id.txtContent); proLoading = FindViewById <ProgressBar>(Resource.Id.proLoading); btnComment = FindViewById <TextView>(Resource.Id.btnComment); btnComment.SetOnClickListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); recyclerView.SetLayoutManager(new LinearLayoutManager(this)); adapter = new ArticleCommentsAdapter(); adapter.SetOnLoadMoreListener(this); notDataView = this.LayoutInflater.Inflate(Resource.Layout.empty_view, (ViewGroup)recyclerView.Parent, false); notDataView.Click += delegate(object sender, EventArgs e) { OnRefresh(); }; errorView = this.LayoutInflater.Inflate(Resource.Layout.error_view, (ViewGroup)recyclerView.Parent, false); errorView.Click += delegate(object sender, EventArgs e) { OnRefresh(); }; recyclerView.SetAdapter(adapter); recyclerView.Post(() => { swipeRefreshLayout.Refreshing = true; OnRefresh(); }); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Id = Intent.GetIntExtra("id", 0); handler = new Handler(); answersPresenter = new QuestionAnswersPresenter(this); StatusBarCompat.SetOrdinaryToolBar(this); dialog = new ProgressDialog(this); dialog.SetCancelable(false); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); toolbar.SetOnMenuItemClickListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); recyclerView.SetLayoutManager(new LinearLayoutManager(this)); adapter = new QuestionAnswersAdapter(); adapter.SetOnLoadMoreListener(this); adapter.User = await SQLiteUtils.Instance().QueryUser(); adapter.OnDeleteClickListener = this; notDataView = this.LayoutInflater.Inflate(Resource.Layout.empty_view, (ViewGroup)recyclerView.Parent, false); notDataView.Click += delegate(object sender, EventArgs e) { OnRefresh(); }; errorView = this.LayoutInflater.Inflate(Resource.Layout.error_view, (ViewGroup)recyclerView.Parent, false); errorView.Click += delegate(object sender, EventArgs e) { OnRefresh(); }; recyclerView.SetAdapter(adapter); recyclerView.Post(() => { swipeRefreshLayout.Refreshing = true; OnRefresh(); }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); slug = Intent.GetStringExtra("slug"); handler = new Handler(); columnPresenter = new ColumnPresenter(this); SetContentView(Resource.Layout.column); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetOnRefreshListener(this); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); LinearLayoutManager layoutManager = new LinearLayoutManager(this); layoutManager.SmoothScrollbarEnabled = true; layoutManager.AutoMeasureEnabled = true; recyclerView.SetLayoutManager(layoutManager); recyclerView.HasFixedSize = true; recyclerView.NestedScrollingEnabled = false; llAvatar = FindViewById <ImageView>(Resource.Id.llAvatar); txtName = FindViewById <TextView>(Resource.Id.txtName); txtDescription = FindViewById <TextView>(Resource.Id.txtDescription); txtFollowersCount = FindViewById <TextView>(Resource.Id.txtFollowersCount); txtPostsCount = FindViewById <TextView>(Resource.Id.txtPostsCount); txtEmpty = FindViewById <TextView>(Resource.Id.txtEmpty); adapter = new PostsAdapter(); adapter.OnLoadMoreListener = this; recyclerView.SetAdapter(adapter); recyclerView.Post(() => { swipeRefreshLayout.Refreshing = true; OnRefresh(); }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); handler = new Handler(); StatusBarCompat.SetOrdinaryToolBar(this); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); var packageInfo = this.PackageManager.GetPackageInfo(this.PackageName, 0); var txtVersion = FindViewById <TextView>(Resource.Id.txtVersion); txtVersion.Text = packageInfo.VersionName; FindViewById <LinearLayout>(Resource.Id.layoutSurvey).Click += (object sender, EventArgs e) => { Intent intent = new Intent(Intent.ActionSendto); intent.AddFlags(ActivityFlags.NewTask); intent.SetData(Android.Net.Uri.Parse("mailto:" + Resources.GetString(Resource.String.survey_email))); if (intent.ResolveActivity(this.PackageManager) != null) { intent.PutExtra(Intent.ExtraSubject, "来自 " + packageInfo.PackageName + " - " + packageInfo.VersionName + " 的反馈意见"); intent.PutExtra(Intent.ExtraText, "设备信息:Android " + Build.VERSION.Release + " - " + Build.Manufacturer + " - " + Build.Model + "\n(如果涉及隐私请手动删除这个内容)\n\n"); StartActivity(intent); } else { Toast.MakeText(this, "系统中没有安装邮件客户端", ToastLength.Short).Show(); } }; FindViewById <LinearLayout>(Resource.Id.layoutQQ).Click += (object sender, EventArgs e) => { sharesWidget.Open("http://shang.qq.com/wpa/qunwpa?idkey=5c281d37638467fb0f411484dcd513b89ba82b58decb8518cc2523b95232dd9b", "博客园第三方APP开发交流群"); }; FindViewById <LinearLayout>(Resource.Id.layoutOpenSourceUrl).Click += (object sender, EventArgs e) => { sharesWidget.Open(Resources.GetString(Resource.String.open_source_url), "博客园第三方Android客户端,Xamarin App,Material Design风格"); }; sharesWidget = new UMengSharesWidget(this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); handler = new Handler(); StatusBarCompat.SetOrdinaryToolBar(this); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); var packageInfo = this.PackageManager.GetPackageInfo(this.PackageName, 0); var txtVersion = FindViewById <TextView>(Resource.Id.txtVersion); txtVersion.Text = packageInfo.VersionName; FindViewById <LinearLayout>(Resource.Id.layoutSurvey).Click += (object sender, EventArgs e) => { Intent intent = new Intent(Intent.ActionSendto); intent.AddFlags(ActivityFlags.NewTask); intent.SetData(Android.Net.Uri.Parse("mailto:" + Resources.GetString(Resource.String.survey_email))); if (intent.ResolveActivity(this.PackageManager) != null) { intent.PutExtra(Intent.ExtraSubject, "来自 " + packageInfo.PackageName + " - " + packageInfo.VersionName + " 的反馈意见"); intent.PutExtra(Intent.ExtraText, "设备信息:Android " + Build.VERSION.Release + " - " + Build.Manufacturer + " - " + Build.Model + "\n(如果涉及隐私请手动删除这个内容)\n\n"); StartActivity(intent); } else { Toast.MakeText(this, "系统中没有安装邮件客户端", ToastLength.Short).Show(); } }; FindViewById <LinearLayout>(Resource.Id.layoutOpenSourceUrl).Click += (object sender, EventArgs e) => { Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(Resources.GetString(Resource.String.open_source_url))); intent.SetClassName("com.android.browser", "com.android.browser.BrowserActivity"); intent.AddFlags(ActivityFlags.NewTask); StartActivity(intent); }; }
protected override void OnAttachedToWindow() { base.OnAttachedToWindow(); Element page = Element.Parent; MasterDetailPage masterDetailPage = null; while (page != null) { if (page is App) { var app = page as App; if (app == null) { return; } var navPage = app.MainPage as NavigationPage; if (navPage == null) { return; } masterDetailPage = navPage.Navigation.NavigationStack.FirstOrDefault() as MasterDetailPage; break; } page = page.Parent; } if (masterDetailPage == null) { return; } var renderer = Platform.GetRenderer(masterDetailPage) as MasterDetailPageRenderer; if (renderer == null) { return; } var drawerLayout = (DrawerLayout)renderer; //V4 nie działało Android.Support.V7.Widget.Toolbar toolbar = null; for (int i = 0; i < ChildCount; i++) { var child = GetChildAt(i); toolbar = child as Android.Support.V7.Widget.Toolbar; if (toolbar != null) { break; } } toolbar?.SetNavigationOnClickListener(new MenuClickListener(Element, drawerLayout)); }
private void UIClickEvent() { _toolbar.SetNavigationOnClickListener(this); }