public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.fragment_animation, container, false); this.toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar); this.instructionsContainer = view.FindViewById <ViewGroup>(Resource.Id.instructions); this.animationContainer = view.FindViewById <ViewGroup>(Resource.Id.animation_container); this.animationView = view.FindViewById <LottieAnimationView>(Resource.Id.animation_view); this.seekBar = view.FindViewById <AppCompatSeekBar>(Resource.Id.seek_bar); this.invertButton = view.FindViewById <ImageButton>(Resource.Id.invert_colors); this.playButton = view.FindViewById <ImageButton>(Resource.Id.play_button); this.scaleSeekBar = view.FindViewById <AppCompatSeekBar>(Resource.Id.scale_seek_bar); this.scaleTextView = view.FindViewById <TextView>(Resource.Id.scale_text); this.loopButton = view.FindViewById <ImageButton>(Resource.Id.loop); this.animationNameView = view.FindViewById <TextView>(Resource.Id.animation_name); ImageButton restartButton = view.FindViewById <ImageButton>(Resource.Id.restart); ImageButton loadAssetButton = view.FindViewById <ImageButton>(Resource.Id.load_asset); ImageButton qrscanButton = view.FindViewById <ImageButton>(Resource.Id.qrscan); ImageButton loadFieButton = view.FindViewById <ImageButton>(Resource.Id.load_file); ImageButton loadUrlButton = view.FindViewById <ImageButton>(Resource.Id.load_url); playButton.Click += PlayButton_Click; restartButton.Click += RestartButton_Click; loopButton.Click += LoopButton_Click; invertButton.Click += InvertButton_Click; loadAssetButton.Click += LoadAssetButton_Click; loadFieButton.Click += LoadFileButton_Click; loadUrlButton.Click += LoadUrlButton_Click; qrscanButton.Click += QRScanButton_Click; (this.Activity as AppCompatActivity).SetSupportActionBar(toolbar); toolbar.SetNavigationIcon(Resource.Drawable.ic_back); toolbar.NavigationClick += (sender, e) => FragmentManager.PopBackStack(); this.HasOptionsMenu = true; PostUpdatePlayButtonText(); LoopButton_Click(null, EventArgs.Empty); this.animationView.AddAnimatorListener(this); this.animationView.AddAnimatorUpdateListener(this); this.seekBar.ProgressChanged += (sender, e) => { if (!animationView.IsAnimating) { animationView.Progress = e.Progress / 100f; } }; this.scaleSeekBar.ProgressChanged += (sender, e) => { this.animationView.Scale = e.Progress / ScaleSliderFactor; this.scaleTextView.Text = String.Format("{0:0.00}", this.animationView.Scale); }; return(view); }
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(); }); }
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(); }); }
protected override void SetToolbar() { _toolbar = View.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.app_basket_delivery_on_address_toolbar); _toolbar.Title = Title; var navigationIcon = new TypedValue(); Context.Theme.ResolveAttribute(Resource.Attribute.app_basket_delivery_on_address_ic_close, navigationIcon, false); _toolbar.SetNavigationIcon(navigationIcon.Data); _toolbar.NavigationClick += (sender, e) => ViewModel.CloseCommand.Execute(null); }
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); 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); }
//private Android.Support.V7.Widget.SearchView searchview; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); toolbar = FindViewById <Android.Support.V7.Widget.Toolbar> (Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.ic_menu); SetSupportActionBar(toolbar); //toolbar.InflateMenu(Resource.Menu.search_menu); drawerLayout = FindViewById <DrawerLayout> (Resource.Id.drawer_layout); navigationView = FindViewById <NavigationView> (Resource.Id.nv_menu); navigationView.NavigationItemSelected += (object sender, NavigationView.NavigationItemSelectedEventArgs e) => { switch (e.MenuItem.ItemId) { case Resource.Id.nav_home: StartActivity(typeof(SwipeRefreshActivity)); break; case Resource.Id.nav_friends: StartActivity(typeof(CollapsingToolbarLayoutActivity)); break; case Resource.Id.coordinator_layout: StartActivity(typeof(CoordinatorLayoutActivity)); break; case Resource.Id.coordinator_behavior: StartActivity(typeof(CoordinatoBehaviorActivity)); break; default: break; } drawerLayout.CloseDrawers(); }; }
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 async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.searchInput); var app = ((InitApp)ApplicationContext); if (app != null) { app.addActivity(this); } StatusBarUtil.SetColorStatusBars(this); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); toolbar.NavigationClick += (s, e) => { //ActivityCompat.FinishAfterTransition(this); ActivityCompat.FinishAfterTransition(this); this.Finish(); }; initSearchHistory(); category = Intent.GetStringExtra("category"); keyword = Intent.GetStringExtra("keyword"); search_keyword = FindViewById <SearchView>(Resource.Id.search_keyword); search_keyword.QueryTextSubmit += (h, _keyword) => { keyword = _keyword.Query.Trim(); if (keyword == null || keyword.Length == 0) { return; } SearchResultActivity.Enter(category, keyword, true, this); }; //search_keyword.SetIconifiedByDefault(false); //设置展开图标的样式 search_keyword.OnActionViewExpanded(); //初始可以点击输入的状态 search_keyword.RequestFocus(); //将控件设置成可获取焦点状态,默认是无法获取焦点的,只有设置成true,才能获取控件的点击事件 search_keyword.Focusable = true; }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.searchResult); var app = ((InitApp)ApplicationContext); if (app != null) { app.addActivity(this); } tv_question = FindViewById <TextView>(Resource.Id.tv_question); tv_news = FindViewById <TextView>(Resource.Id.tv_news); tv_kb = FindViewById <TextView>(Resource.Id.tv_kb); tv_blog = FindViewById <TextView>(Resource.Id.tv_blog); search_keyword = FindViewById <SearchView>(Resource.Id.search_keyword); _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorScheme(Resource.Color.primary); swipeRefreshLayout.Refreshing = false; StatusBarUtil.SetColorStatusBars(this); category = Intent.GetStringExtra("category"); keyword = Intent.GetStringExtra("keyword"); startQuery = Intent.GetBooleanExtra("startquery", false); initCategoryClick(); //初始化category单击事件 initCategoryByCategory(); //初始化category 选中的状态 toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); toolbar.NavigationClick += (s, e) => { ActivityCompat.FinishAfterTransition(this); }; swipeRefreshLayout.Refresh += (s, e) => { swipeRefreshLayout.PostDelayed(() => { swipeRefreshLayout.Refreshing = false; }, 1000); }; _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this)); //search_keyword.SubmitButtonEnabled = true; //默认为false 不显示提交按钮,是否启用提交按钮 search_keyword.OnActionViewExpanded(); //手动展开SearchView输入框,初始可以点击输入的状态 //search_keyword.SetIconifiedByDefault(false); //默认是为true 不显示输入框键盘,默认提交按钮不显示,该属性设置为false,则直接展开输入框弹出键盘 // search_keyword.RequestFocus(); //将控件设置成可获取焦点状态,默认是无法获取焦点的,只有设置成true,才能获取控件的点击事件 //search_keyword.Focusable = true; search_keyword.ClearFocus(); search_keyword.Focusable = true; if (!string.IsNullOrEmpty(keyword)) { search_keyword.QueryHint = keyword; } search_keyword.FocusChange += (s, e) => { System.Diagnostics.Debug.Write(e.HasFocus); if (e.HasFocus) { SearchInputActivity.Enter(category, this); } }; search_keyword.SetOnQueryTextFocusChangeListener(this); search_keyword.QueryTextSubmit += async(s, e) => { keyword = search_keyword.Query.Trim(); if (keyword == null || keyword.Length == 0) { return; } SearchHistoryShared.SetSearchHistory(keyword, this); swipeRefreshLayout.Refreshing = true; await listSearchService((list) => { swipeRefreshLayout.PostDelayed(() => { swipeRefreshLayout.Refreshing = false; }, 1000); searchList = list; initRecycler(); }); }; if (startQuery) { initCategoryByCategory(); SearchHistoryShared.SetSearchHistory(keyword, this); if (!string.IsNullOrEmpty(keyword)) { swipeRefreshLayout.Refreshing = true; await listSearchService((list) => { swipeRefreshLayout.PostDelayed(() => { swipeRefreshLayout.Refreshing = false; }, 1000); searchList = list; initRecycler(); }); } } }