public async void OnRefresh() { _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); pageIndex = 1; var result = await UserInfoService.GetMyBlogPosts(UserTokenUtil.GetToken(this), blogApp, pageIndex); if (result.Success) { articleList = result.Data; initRecycler(); if (articleList.Count != 0) { articleList.ForEach(f => f.MySelf = true); await SQLiteUtil.UpdateArticleList(articleList); } _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = false; }); } else { AlertUtil.ToastShort(this, result.Message); _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = false; }); } }
public async void OnRefresh() { try { pageIndex = 1; _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); var result = new ApiResult <List <StatusModel> >(); if (isMy) { result = await StatusService.ListStatus(userToken, position, pageIndex, true); } else { if (position != 0) { result = await StatusService.ListStatus(UserTokenUtil.GetToken(Activity), position, pageIndex, false); } else { result = await StatusService.ListStatus(accessToken, position, pageIndex, false); } } if (result.Success) { statusList = result.Data; if (statusList.Count != 0) { if (isMy) { statusList.ForEach(f => f.MySelf = true); } initRecycler(); await SQLiteUtil.UpdateStatusList(statusList); } _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = false; }); } else { AlertUtil.ToastShort(Activity, result.Message); _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = false; }); } } catch (Exception ex) { AlertUtil.ToastShort(Activity, ex.Message); _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = false; }); } }
private async void LoadMore() { if (_swipeRefreshLayout.Refreshing) { _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = false; }); } pageIndex++; var result = new ApiResult <List <QuestionModel> >(); if (isMy) { result = await QuestionService.ListQuestion(userToken, position, pageIndex, true, userInfo.SpaceUserId); } else { result = await QuestionService.ListQuestion(accessToken, position, pageIndex, false, 0); } if (result.Success) { var tempList = result.Data; listQuestion.AddRange(tempList); adapter.SetNewData(listQuestion); } else { AlertUtil.ToastShort(Activity, result.Message); } }
public void OnRefresh() { swipeRefreshLayout.Post(() => { swipeRefreshLayout.Refreshing = true; }); GetKbArticleContent(() => { swipeRefreshLayout.Post(() => { swipeRefreshLayout.Refreshing = false; }); }); }
/// <summary> /// Forces a refresh layout to refresh /// </summary> /// <param name="refresher">The refresher</param> /// <param name="view">The recycler view</param> public static void ForceRefreshLayout(SwipeRefreshLayout refresher, RecyclerView view) { refresher.Post(() => { refresher.Refreshing = true; view.Clickable = false; }); Thread.Sleep(200); refresher.Post(() => { refresher.Refreshing = false; view.Clickable = true; }); }
public override async void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); _swipeRefreshLayout = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); _swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); _swipeRefreshLayout.SetOnRefreshListener(this); _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); _swipeRefreshLayout.PostDelayed(() => { System.Diagnostics.Debug.Write("PostDelayed方法已经完成"); _swipeRefreshLayout.Refreshing = false; }, 3000); _recyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView); _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this.Activity)); kbArticlesList = await listKbArticleLocal(); if (kbArticlesList.Count > 0) { initRecycler(); } else { kbArticlesList = await listKbArticlesServer(); if (kbArticlesList.Count > 0) { initRecycler(); } } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); answerId = Intent.GetIntExtra("answerId", 0); questionId = Intent.GetIntExtra("questionId", 0); SetToolBarNavBack(); StatusBarUtil.SetColorStatusBars(this); SetToolBarTitle("»Ø´ðÆÀÂÛ"); //ÏÔʾͼƬÅäÖà options = new DisplayImageOptions.Builder() .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou) .ShowImageOnFail(Resource.Drawable.icon_yuanyou) .ShowImageOnLoading(Resource.Drawable.icon_user) .CacheInMemory(true) .BitmapConfig(Bitmap.Config.Rgb565) .CacheOnDisk(true) // .Displayer(new DisplayerImageCircle(20)) .Build(); edit_content = FindViewById <EditText>(Resource.Id.edit_content); btn_submit = FindViewById <Button>(Resource.Id.btn_submit); userToken = UserTokenUtil.GetToken(this); //btn_submit.enabvle btn_submit.Click += (s, e) => { Add(); }; edit_content.TextChanged += (s, e) => { string temp = edit_content.Text.TrimStart().TrimEnd(); if (!string.IsNullOrEmpty(temp)) { btn_submit.Enabled = true; if (atUserName != null && atUserName.Length > 0 && temp.Contains(atUserName)) { isAt = true; } else { isAt = false; } } else { btn_submit.Enabled = false; } }; _swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); _swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); _swipeRefreshLayout.SetOnRefreshListener(this); _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this)); _recyclerView.AddItemDecoration(new RecyclerViewDecoration(this, (int)Orientation.Vertical)); initRecyclerView(); userInfo = UserInfoShared.GetUserInfo(this); }
/// <summary> /// Snapshot listener that is trigger by DB changes (added, modified, deleted) /// </summary> /// <param name="value">New Snapshot</param> /// <param name="error">Firebase exception object</param> public void OnEvent(Java.Lang.Object value, FirebaseFirestoreException error) { if (error != null) { //Log.w("TAG", "listen:error", error); return; } int count = 1; var snapshots = (QuerySnapshot)value; foreach (DocumentChange dc in snapshots.DocumentChanges) { var dictionary = dc.Document.Data; dictionary.Add("Id", dc.Document.Id); var vendor = ToObject(dictionary); switch (dc.GetType().ToString()) { case "ADDED": //Log.d("TAG", "New Msg: " + dc.getDocument().toObject(Message.class)); vendors.Add(vendor); break; case "MODIFIED": //find modified item and replace with new document int index = vendors.FindIndex(x => x.Id == vendor.Id); vendors.RemoveAt(index); vendors.Insert(index, vendor); break; case "REMOVED": //delete vendor break; } } swipeRefreshLayout.Post(() => { swipeRefreshLayout.Refreshing = false; recyclerView.Clickable = true; }); if (reload) { vendorAdapter.NotifyDataSetChanged(); //for updating adapter reload = false; } else { //make toast Toast toast = Toast.MakeText(this, "new vendors added", ToastLength.Long); toast.SetGravity(GravityFlags.Center, 0, 0); toast.Show(); } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here StatusBarUtil.SetColorStatusBars(this); ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this).WriteDebugLogs().Build();//³õʼ»¯Í¼Æ¬¼ÓÔØ¿ò¼Ü ImageLoader.Instance.Init(configuration); //ÏÔʾͼƬÅäÖà options = new DisplayImageOptions.Builder() .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou) .ShowImageOnFail(Resource.Drawable.icon_yuanyou) .ShowImageOnLoading(Resource.Drawable.icon_user) .CacheInMemory(true) .BitmapConfig(Bitmap.Config.Rgb565) .CacheOnDisk(true) // .Displayer(new DisplayerImageCircle(20)) .Build(); SetToolBarNavBack(); _swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); _swipeRefreshLayout.SetColorScheme(Resource.Color.primary); tv_dateAdded = FindViewById <TextView>(Resource.Id.tv_dateAdded); tv_userDisplayName = FindViewById <TextView>(Resource.Id.tv_userDisplayName); iv_userIcon = FindViewById <ImageView>(Resource.Id.iv_userIcon); tv_content = FindViewById <TextView>(Resource.Id.tv_content); edit_content = FindViewById <EditText>(Resource.Id.edit_content); btn_submit = FindViewById <Button>(Resource.Id.btn_submit); btn_submit.Click += AddCommentClick; statusId = Intent.GetIntExtra("id", 0); GetClientStatus(statusId); shareWidget = new UMengShareWidget(this); _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); _recyclerView.SetLayoutManager(new LinearLayoutManager(this)); _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); _swipeRefreshLayout.Refresh += async(s, e) => { await StatusService.ListStatusComment(AccessTokenUtil.GetToken(this), statusId, callBackSuccess, callBackError); }; edit_content.TextChanged += (s, e) => { if (string.IsNullOrEmpty(edit_content.Text.Trim())) { btn_submit.Enabled = false; } else { btn_submit.Enabled = true; } }; AlertUtil.ToastShort(this, "Ïß³ÌID" + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString()); await StatusService.ListStatusComment(AccessTokenUtil.GetToken(this), statusId, callBackSuccess, callBackError); _recyclerView.AddItemDecoration(new RecyclerViewDecoration(this, (int)Orientation.Vertical)); }
public async void OnRefresh() { _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); pageIndex = 1; if (position == 3) { var result = await KbArticlesService.ListKbArticle(AccessTokenUtil.GetToken(this.Activity), pageIndex); if (result.Success) { //var tempList = result.Data; kbArticlesList = result.Data; adapterKbArticles.SetNewData(kbArticlesList); if (kbArticlesList != null && kbArticlesList.Count != 0) { await SQLiteUtil.UpdateKbArticlesList(result.Data); } _swipeRefreshLayout.Refreshing = false; } else { AlertUtil.ToastShort(Activity, result.Message); _swipeRefreshLayout.Refreshing = false; } } else { var result = await NewsService.ListNews(AccessTokenUtil.GetToken(this.Activity), pageIndex, position); if (result.Success) { newsList = result.Data; if (position == 1) { newsList.ForEach(f => f.IsHot = true); } if (position == 2) { newsList.ForEach(f => f.IsRecommend = true); } adapter.SetNewData(newsList); if (newsList != null && newsList.Count != 0) { await SQLiteUtil.UpdateNewsList(newsList); } _swipeRefreshLayout.Refreshing = false; } else { AlertUtil.ToastShort(Activity, result.Message); _swipeRefreshLayout.Refreshing = false; } } }
protected override void OnResume() { base.OnResume(); refreshCancellationTokenSource?.Cancel(); refreshCancellationTokenSource = new CancellationTokenSource(); Task.Run(async() => { CancellationTokenSource cancellationTokenSource = refreshCancellationTokenSource; while (!cancellationTokenSource.IsCancellationRequested) { Refresh(); await Task.Delay(TramUrWayApplication.GlobalUpdateDelay * 1000); } }); swipeRefresh.Post(() => swipeRefresh.Refreshing = true); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Id = Intent.GetIntExtra("id", 0); articlePresenter = new ArticlePresenter(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); toolbar.SetOnMenuItemClickListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); scrollView = FindViewById <NestedScrollView>(Resource.Id.scrollView); txtTitle = FindViewById <TextView>(Resource.Id.txtTitle); imgAvatar = FindViewById <ImageView>(Resource.Id.llAvatar); txtAuthor = FindViewById <TextView>(Resource.Id.txtAuthor); txtPostdate = FindViewById <TextView>(Resource.Id.txtPostdate); txtBody = FindViewById <WebView>(Resource.Id.txtBody); txtBody.Settings.JavaScriptEnabled = true; txtBody.Settings.DomStorageEnabled = true; txtBody.Settings.LoadsImagesAutomatically = true; txtBody.Settings.DefaultTextEncodingName = "utf-8"; txtBody.SetWebViewClient(BodyWebViewClient.With(this)); txtBody.ScrollBarStyle = ScrollbarStyles.InsideOverlay; txtBody.Settings.SetSupportZoom(false); txtBody.Settings.BuiltInZoomControls = false; txtBody.Settings.CacheMode = CacheModes.CacheElseNetwork; txtBody.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn); var jsInterface = new WebViewJSInterface(this); txtBody.AddJavascriptInterface(jsInterface, "openlistner"); jsInterface.CallFromPageReceived += delegate(object sender, WebViewJSInterface.CallFromPageReceivedEventArgs e) { PhotoActivity.Start(this, e.Result.Split(','), e.Index); }; txtDigg = FindViewById <TextView>(Resource.Id.txtDigg); txtRead = FindViewById <TextView>(Resource.Id.txtRead); txtComments = FindViewById <TextView>(Resource.Id.txtComments); txtBookmark = FindViewById <TextView>(Resource.Id.txtBookmark); swipeRefreshLayout.Post(async() => { await articlePresenter.GetClientArticle(Id); }); shareAction = new ShareAction(this).SetDisplayList(SHARE_MEDIA.Weixin, SHARE_MEDIA.WeixinCircle, SHARE_MEDIA.WeixinFavorite, SHARE_MEDIA.Sina).SetShareboardclickCallback(this); }
public async void OnRefresh() { pageIndex = 1; _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); var result = await NewsService.ListNewsComment(accessToken, POSTID, pageIndex); if (result.Success) { var tempList = result.Data; if (FIRSTREFRESH) { commentList = tempList; initRecycler(); } else { if (tempList != null && tempList.Count != 0) { commentList = tempList; adapter.SetNewData(tempList); } } FIRSTREFRESH = false; _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = false; }); } else { AlertUtil.ToastShort(this, result.Message); _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = false; }); } }
// This override is called only once during the activity's lifecycle, when it is created. protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); HockeyApp.MetricsManager.TrackEvent("AcquaintanceListActivity.OnCreate"); // instantiate adapter _Adapter = new AcquaintanceCollectionAdapter(); // instantiate the layout manager var layoutManager = new LinearLayoutManager(this); // set the content view SetContentView(Resource.Layout.AcquaintanceList); // setup the action bar SetSupportActionBar(FindViewById <Toolbar>(Resource.Id.toolbar)); // ensure that the system bar color gets drawn Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); // set the title of both the activity and the action bar Title = SupportActionBar.Title = "Acquaintances"; _SwipeRefreshLayout = (SwipeRefreshLayout)FindViewById(Resource.Id.acquaintanceListSwipeRefreshContainer); _SwipeRefreshLayout.Refresh += async(sender, e) => { await LoadAcquaintances(); }; _SwipeRefreshLayout.Post(() => _SwipeRefreshLayout.Refreshing = true); // instantiate/inflate the RecyclerView var recyclerView = (RecyclerView)FindViewById(Resource.Id.acquaintanceRecyclerView); // set RecyclerView's layout manager recyclerView.SetLayoutManager(layoutManager); // set RecyclerView's adapter recyclerView.SetAdapter(_Adapter); var addButton = (FloatingActionButton)FindViewById(Resource.Id.acquaintanceListFloatingActionButton); FeedbackManager.Register(this, Settings.HockeyAppId); addButton.Click += (sender, e) => { //StartActivity(new Intent(this, typeof(AquaintanceEditActivity))); FeedbackManager.ShowFeedbackActivity(ApplicationContext); }; CheckForUpdates(); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetToolBarNavBack(); StatusBarUtil.SetColorStatusBars(this); SetToolBarTitle(Resources.GetString(Resource.String.bookmark_my)); _swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); _swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); _swipeRefreshLayout.SetOnRefreshListener(this); _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); _swipeRefreshLayout.PostDelayed(() => { System.Diagnostics.Debug.Write("PostDelayed方法已经完成"); _swipeRefreshLayout.Refreshing = false; }, 3000); ly_expire = FindViewById <LinearLayout>(Resource.Id.ly_expire); tv_startLogin = FindViewById <TextView>(Resource.Id.tv_startLogin); _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this)); token = UserTokenUtil.GetToken(this); if (token.IsExpire) { ly_expire.Visibility = ViewStates.Visible; _swipeRefreshLayout.Visibility = ViewStates.Gone; tv_startLogin.Click += (s, e) => { StartActivity(new Intent(this, typeof(loginactivity))); }; return; } else { ly_expire.Visibility = ViewStates.Gone; _swipeRefreshLayout.Visibility = ViewStates.Visible; } bookMarkList = await listBookmarkServer(); if (bookMarkList != null && bookMarkList.Count > 0) { initRecycler(); } }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.MainPage); SetSupportActionBar(FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar)); SupportActionBar.Title = "OneEchan"; _recyclerView = FindViewById <ExRecyclerView>(Resource.Id.MainPageRecyclerView); _layoutManager = new LinearLayoutManager(this); _recyclerView.ViewLayoutManager = _layoutManager; _recyclerView.LoadMore += (sender, e) => LoadMore(); _refresher = FindViewById <ScrollChildSwipeRefreshLayout>(Resource.Id.MainPageRefresher); _refresher.SetColorSchemeResources(Resource.Color.MediumVioletRed); _refresher.Refresh += async delegate { await Refresh(); }; _refresher.Post(() => _refresher.Refreshing = true); await Refresh(); }
/// <summary> /// Updates SwipeRefreshLayout animation status depending on the IsRefreshing Element /// property. /// </summary> protected void UpdateIsRefreshing() { // I'm afraid this method can be called after the ListViewRenderer is disposed // So let's create a new reference to the SwipeRefreshLayout instance SwipeRefreshLayout refreshLayoutInstance = _refreshLayout; if (refreshLayoutInstance == null) { return; } bool isRefreshing = Element.IsRefreshing; refreshLayoutInstance.Post(() => { refreshLayoutInstance.Refreshing = isRefreshing; }); }
public void OnRefresh() { swipeRefreshLayout.Post(() => { swipeRefreshLayout.Refreshing = true; }); UpdateViewStatus(() => { swipeRefreshLayout.PostDelayed(() => { swipeRefreshLayout.Refreshing = false; }, 1000); }, () => { swipeRefreshLayout.PostDelayed(() => { swipeRefreshLayout.Refreshing = false; }, 1000); }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); _swipeRefresh = FindViewById <SwipeRefreshLayout>(Resource.Id.swipe_main); _swipeRefresh.SetColorScheme(Resource.Color.colorPrimary, Android.Resource.Color.HoloGreenDark, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloOrangeDark); _swipeRefresh.SetOnRefreshListener(this); _swipeRefresh.Post(() => { SeedData(); }); _recyclerView = FindViewById <RecyclerView>(Resource.Id.recycler_waifu); _recyclerView.HasFixedSize = true; gridLayoutManager = new GridLayoutManager(this, 2); _recyclerView.SetLayoutManager(gridLayoutManager); _recyclerView.AddOnScrollListener(new LoadMoreListener(this)); }
public async void OnRefresh() { _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); pageIndex = 1; var result = await ArticleService.ListArticle(accessToken, pageIndex, position); if (result.Success) { var tempList = result.Data; if (tempList != null && tempList.Count > 0) { articleList = tempList; if (isFirstRefresh) { initRecycler(); } else { adapter.SetNewData(tempList); isFirstRefresh = false; } await SQLiteUtil.UpdateArticleList(tempList); } else { AlertUtil.ToastShort(Activity, "ÍøÂ粻̫ºÃŶ"); } _swipeRefreshLayout.PostDelayed(() => { _swipeRefreshLayout.Refreshing = false; }, 800); } else { AlertUtil.ToastShort(Activity, result.Message); _swipeRefreshLayout.PostDelayed(() => { _swipeRefreshLayout.Refreshing = false; }, 800); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); slug = Intent.GetStringExtra("slug"); //slug = "22921645"; handler = new Handler(); postPresenter = new PostPresenter(this); SetContentView(Resource.Layout.post); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetBackgroundColor(Color.Transparent); toolbar.SetTitleTextColor(Color.White); toolbar.SetNavigationIcon(Resource.Drawable.ic_arrow_back_white_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.main_content); collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsingtoolbar); appbar = FindViewById <AppBarLayout>(Resource.Id.appbar); appbar.AddOnOffsetChangedListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetOnRefreshListener(this); scrollView = FindViewById <NestedScrollView>(Resource.Id.scrollView); scrollView.ViewTreeObserver.AddOnScrollChangedListener(this); toolbarTitle = FindViewById <TextView>(Resource.Id.toolbarTitle); titleImage = FindViewById <ImageView>(Resource.Id.titleImage); imgAvatar = FindViewById <ImageView>(Resource.Id.llAvatar); org = FindViewById <ImageView>(Resource.Id.org); txtColumnName = FindViewById <TextView>(Resource.Id.txtColumnName); txtAuthor = FindViewById <TextView>(Resource.Id.txtAuthor); txtTitle = FindViewById <TextView>(Resource.Id.txtTitle); txtBio = FindViewById <TextView>(Resource.Id.txtBio); postContent = FindViewById <PostWebView>(Resource.Id.postContent); txtTime = FindViewById <TextView>(Resource.Id.txtTime); swipeRefreshLayout.Post(() => { swipeRefreshLayout.Refreshing = true; OnRefresh(); }); }
public override async void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); ly_expire = view.FindViewById <LinearLayout>(Resource.Id.ly_expire); tv_startLogin = view.FindViewById <TextView>(Resource.Id.tv_startLogin); _swipeRefreshLayout = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); _swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); _swipeRefreshLayout.SetOnRefreshListener(this); _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); _swipeRefreshLayout.PostDelayed(() => { System.Diagnostics.Debug.Write("PostDelayed刷新已经完成"); _swipeRefreshLayout.Refreshing = false; }, 4000); _recyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView); _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this.Activity)); //_recyclerView.AddItemDecoration(new RecyclerViewDecoration(this.Activity, (int)Orientation.Vertical)); Token token = UserTokenUtil.GetToken(Activity); if (position == 3) { //kbArticlesList = await listKbArticleLocal(); kbArticlesList = await SQLiteUtil.SelectKbArticleList(Constact.PageSize); if (kbArticlesList != null) { initRecyclerKbArticles(); } } else { newsList = await listNewsLocal(); if (newsList != null) { initRecycler(); } } OnRefresh(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); slug = Intent.GetIntExtra("slug", 0); handler = new Handler(); articlePresenter = new ArticlePresenter(this); toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.SetNavigationIcon(Resource.Drawable.back_24dp); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); toolbar.SetNavigationOnClickListener(this); toolbar.SetOnMenuItemClickListener(this); coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.main_content); collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsingtoolbar); appbar = FindViewById <AppBarLayout>(Resource.Id.appbar); appbar.AddOnOffsetChangedListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); scrollView = FindViewById <NestedScrollView>(Resource.Id.scrollView); scrollView.ViewTreeObserver.AddOnScrollChangedListener(this); toolbarTitle = FindViewById <TextView>(Resource.Id.toolbarTitle); titleImage = FindViewById <ImageView>(Resource.Id.titleImage); imgAvatar = FindViewById <ImageViewAsync>(Resource.Id.llAvatar); org = FindViewById <ImageView>(Resource.Id.org); txtAuthor = FindViewById <TextView>(Resource.Id.txtAuthor); txtTitle = FindViewById <TextView>(Resource.Id.txtTitle); txtBio = FindViewById <TextView>(Resource.Id.txtBio); articleContent = FindViewById <ArticleWebView>(Resource.Id.postContent); txtTime = FindViewById <TextView>(Resource.Id.txtTime); txtGood = FindViewById <TextView>(Resource.Id.txtGood); txtComments = FindViewById <TextView>(Resource.Id.txtComments); swipeRefreshLayout.Post(async() => { await articlePresenter.GetClientArticle(slug); }); }
public void GetServiceQuestionSuccess(List <QuestionModel> list) { refreshTime = DateTime.Now; recyclerview_blog.Post(() => { if (!srlBlog.Enabled) { srlBlog.Enabled = true; } if (srlBlog.Refreshing) { srlBlog.Refreshing = false; } if (pageIndex == 1) { if (srlBlog.Refreshing) { srlBlog.Post(() => { srlBlog.Refreshing = false; }); } adapter.SetNewData(list); loadMoreWrapper.NotifyAddData(); pageIndex++; } else { if (list.Count > 0) { adapter.AddData(list); loadMoreWrapper.LoadMoreComplete(); pageIndex++; } else { loadMoreWrapper.LoadMoreEndEmpty(); } } }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.activity_main_grid); Intent intent = Intent; Title = intent.GetStringExtra("Name"); app = FirebaseApp.Instance; db = FirebaseFirestore.GetInstance(app); string category = intent.GetStringExtra("category"); //Setup Views swipeRefreshLayout = (SwipeRefreshLayout)FindViewById(Resource.Id.refreshView); swipeRefreshLayout.Refresh += delegate(object sender, System.EventArgs e) { reload = true; FetchCollection(category); }; swipeRefreshLayout.Post(() => { swipeRefreshLayout.Refreshing = true; recyclerView.Clickable = false; }); reload = true; vendors = new List <Vendor>(); FetchCollection(category); vendorAdapter = new VendorAdapter(vendors); vendorAdapter.ItemClick += OnItemClick; recyclerView = FindViewById <RecyclerView>(Resource.Id.activity_mgrid_rv); recyclerView.SetLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.Vertical)); recyclerView.SetAdapter(vendorAdapter); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = null; try { view = inflater.Inflate(Resource.Layout.fragmentListTrajets, null); m_refresher = view.FindViewById <SwipeRefreshLayout>(Resource.Id.fragmentParameters_refresher); m_recyclerView = view.FindViewById <RecyclerView>(Resource.Id.fragmentParameters_recyclerView); m_textviewEmptyList = view.FindViewById <TextView>(Resource.Id.fragmentParameters_textview_emptyList); //trajets list m_recyclerView.SetLayoutManager(new LinearLayoutManager(Activity)); m_adapter = new RecyclerviewAdapter_Display_trajets(Activity, this); m_recyclerView.SetAdapter(m_adapter); m_refresher.Refresh += M_refresher_Refresh; m_refresher.Post(async() => { m_refresher.Refreshing = true; await RefreshtrajetList(); }); } catch (System.Exception e) { MobileCenter_Helper.ReportError(new FileAccessManager(), e, GetType().Name, MethodBase.GetCurrentMethod().Name); if (view != null) { DynamicUIBuild_Utils.ShowSnackBar(Activity, view, Resource.String.snackbar_errorHappened, Snackbar.LengthLong); } } return(view); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); createDatabase(); SetContentView(Resource.Layout.Main); ListView listView = FindViewById <ListView>(Resource.Id.listview); swipeToRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipe_refresh_layout); bindedList = new List <ElementModel>() { newElementModel(), newElementModel(), newElementModel(), }; adapter = new SwipeListAdapter(this, bindedList); listView.Adapter = adapter; swipeToRefreshLayout.SetOnRefreshListener(this); swipeToRefreshLayout.Post(refreshFromDatabase); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); blogApp = Intent.GetStringExtra("blogApp"); postId = Intent.GetIntExtra("postId", 0); SetToolBarNavBack(); StatusBarUtil.SetColorStatusBars(this); SetToolBarTitle(Resources.GetString(Resource.String.comment)); //显示图片配置 options = new DisplayImageOptions.Builder() .ShowImageForEmptyUri(Resource.Drawable.icon_yuanyou) .ShowImageOnFail(Resource.Drawable.icon_yuanyou) .ShowImageOnLoading(Resource.Drawable.icon_user) .CacheInMemory(true) .BitmapConfig(Bitmap.Config.Rgb565) .CacheOnDisk(true) // .Displayer(new DisplayerImageCircle(20)) .Build(); edit_content = FindViewById <EditText>(Resource.Id.edit_content); btn_submit = FindViewById <Button>(Resource.Id.btn_submit); //btn_submit.enabvle btn_submit.Click += (s, e) => { Add(); }; edit_content.TextChanged += (s, e) => { string temp = edit_content.Text.TrimStart().TrimEnd(); if (!string.IsNullOrEmpty(temp)) { btn_submit.Enabled = true; if (atUserName != null && atUserName.Length > 0 && temp.Contains(atUserName)) { isAt = true; } else { isAt = false; } } else { btn_submit.Enabled = false; } }; _swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); _swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); _swipeRefreshLayout.SetOnRefreshListener(this); _swipeRefreshLayout.Post(() => { _swipeRefreshLayout.Refreshing = true; }); _swipeRefreshLayout.PostDelayed(() => { System.Diagnostics.Debug.Write("PostDelayed方法已经完成"); _swipeRefreshLayout.Refreshing = false; }, 3000); _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); _recyclerView.SetLayoutManager(new Android.Support.V7.Widget.LinearLayoutManager(this)); _recyclerView.AddItemDecoration(new RecyclerViewDecoration(this, (int)Orientation.Vertical)); try { commentList = await listArticleCommentServer(); if (commentList != null) { initRecycler(); } } catch (Exception ex) { MobclickAgent.ReportError(this, ex.ToString()); System.Diagnostics.Debug.Write(ex.ToString()); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); //Prevent app going into sleep mode Window.AddFlags(WindowManagerFlags.KeepScreenOn); MobileCenter_Helper.InitAndroidAnalytics(); if (Settings.NightMode) { SetTheme(Resource.Style.TrajetTramTheme_actionBar_nightMode); } else { SetTheme(Resource.Style.TrajetTramTheme_actionBar_dayMode); } //Set our view from the "main" layout resource SetContentView(Resource.Layout.activitytrajetDetails); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); //Get the trajet's local ID m_itrajetLocalID = Intent.Extras.GetInt("itrajetLocalID"); if (m_itrajetLocalID == 0) { Finish(); } //Get the mode (preparation or conduite) m_bIsModeConduite = Intent.Extras.GetBoolean("IsModeConduite"); m_layoutRoot = FindViewById <RelativeLayout>(Resource.Id.activitytrajetDetails_layout_root); m_refresher = FindViewById <SwipeRefreshLayout>(Resource.Id.activitytrajetDetails_refresher); m_listview = FindViewById <ListView>(Resource.Id.activitytrajetDetails_listview); m_textviewEhouatRefNumber = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_ehouatRefNumber); m_textviewTrain = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_train); m_textviewLocoType = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_locoType); m_textviewTonnage = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_tonnage); m_textviewRadio = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_radio); m_textviewLocationStart = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_locationStart); m_textviewTimeStart = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_timeStart); m_textviewLocationEnd = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_locationEnd); m_textviewTimeEnd = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_timeEnd); m_textviewMinutesBeforeStart = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_minutesBeforeStart); m_textviewAltimeter = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_altimeter); m_imageviewAltimeter = FindViewById <ImageView>(Resource.Id.activitytrajetDetails_imageview_altimeter); m_layoutAltimeter = FindViewById <LinearLayout>(Resource.Id.activitytrajetDetails_layout_altimeter); m_layoutGoToNextStep = FindViewById <LinearLayout>(Resource.Id.activitytrajetDetails_layout_GoToNextStep); m_layoutGPS = FindViewById <LinearLayout>(Resource.Id.activitytrajetDetails_layout_GPS); m_layoutGPSlevel = FindViewById <LinearLayout>(Resource.Id.activitytrajetDetails_layout_GPSlevel); m_imageviewGPSStatus = FindViewById <ImageView>(Resource.Id.activitytrajetDetails_imageview_GPSStatus); m_layoutTimeBeforeStart = FindViewById <LinearLayout>(Resource.Id.activitytrajetDetails_layout_minutesBeforeStart); m_layoutNextStop = FindViewById <RelativeLayout>(Resource.Id.activitytrajetDetails_layout_nextStop); m_textviewNextStopTitle = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_nextStop_title); m_textviewNextStopHour = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_nextStop_hour); m_textviewNextStopMinuteAvanceRetard = FindViewById <TextView>(Resource.Id.activitytrajetDetails_textview_nextStop_miuntesAvanceRetard); m_btnValidPreparation = FindViewById <Button>(Resource.Id.activitytrajetDetails_btn_validePreparation); //Current Stop mode conduite m_layoutCurrentStop = FindViewById <LinearLayout>(Resource.Id.activitytrajetDetails_modeConduite_layout_currentStop); m_layoutCurrentStopInfos = FindViewById <LinearLayout>(Resource.Id.activitytrajetDetails_modeConduite_layout_currentStopInfos); m_textviewCurrentStopName = FindViewById <TextView>(Resource.Id.activitytrajetDetails_arret_textview_name); m_textviewCurrentStopHorairePassage = FindViewById <TextView>(Resource.Id.activitytrajetDetails_arret_textview_horairePassage); m_layoutGoToNextStep.Click += M_layoutGoToNextStep_Click; m_layoutGPS.Click += M_layoutGPS_Click; m_btnValidPreparation.Click += M_btnValidPreparation_Click; m_listview.Scroll += M_listview_Scroll; m_adapter = new ListviewAdapter_Display_arret(this); m_listview.Adapter = m_adapter; m_listview.Divider = null; m_listview.DividerHeight = 0; m_refresher.Refresh += M_refresher_Refresh; m_refresher.Post(async() => { await InitUI(); //Show Security Message if needed ShowSecurityMessageIfNeeded(); //Start GPS tracking if needed if (m_bIsModeConduite && !m_bIsSimulatorActivated) { await GpsHelper.StartListening(OnPositionChanged); m_bHasGPSBeenInit = true; } }); //Init Light Sensor Manager DynamicUIBuild_Utils.InitLightSensorManagers(this, out m_sensorManager, out m_sensorListener); } catch (Exception e) { MobileCenter_Helper.ReportError(new FileAccessManager(), e, GetType().Name, MethodBase.GetCurrentMethod().Name); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Id = Intent.GetIntExtra("id", 0); questionPresenter = new QuestionPresenter(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); toolbar.SetOnMenuItemClickListener(this); swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout); swipeRefreshLayout.SetColorSchemeResources(Resource.Color.primary); swipeRefreshLayout.SetOnRefreshListener(this); txtTitle = FindViewById <TextView>(Resource.Id.txtTitle); imgIconName = FindViewById <ImageView>(Resource.Id.imgIconName); txtUserName = FindViewById <TextView>(Resource.Id.txtUserName); txtScore = FindViewById <TextView>(Resource.Id.txtScore); txtDateAdded = FindViewById <TextView>(Resource.Id.txtDateAdded); txtGold = FindViewById <TextView>(Resource.Id.txtGold); txtDealFlag = FindViewById <TextView>(Resource.Id.txtDealFlag); txtTag = FindViewById <TextView>(Resource.Id.txtTag); this.txtDealFlag.Selected = true; txtBody = FindViewById <WebView>(Resource.Id.txtBody); txtBody.Settings.JavaScriptEnabled = true; txtBody.Settings.DomStorageEnabled = true; txtBody.Settings.LoadsImagesAutomatically = true; txtBody.Settings.DefaultTextEncodingName = "utf-8"; txtBody.SetWebViewClient(BodyWebViewClient.With(this)); txtBody.ScrollBarStyle = ScrollbarStyles.InsideOverlay; txtBody.Settings.SetSupportZoom(false); txtBody.Settings.BuiltInZoomControls = false; txtBody.Settings.CacheMode = CacheModes.CacheElseNetwork; txtBody.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.SingleColumn); var jsInterface = new WebViewJSInterface(this); txtBody.AddJavascriptInterface(jsInterface, "openlistner"); jsInterface.CallFromPageReceived += delegate(object sender, WebViewJSInterface.CallFromPageReceivedEventArgs e) { PhotoActivity.Start(this, e.Result.Split(','), e.Index); }; txtDigg = FindViewById <TextView>(Resource.Id.txtDigg); txtRead = FindViewById <TextView>(Resource.Id.txtRead); txtBookmark = FindViewById <TextView>(Resource.Id.txtBookmark); txtComments = FindViewById <TextView>(Resource.Id.txtComments); txtComments.Text = Resources.GetString(Resource.String.answer); (txtComments.Parent as FrameLayout).Click += delegate { if (question != null && question.Qid > 0) { QuestionAnswersActivity.Start(this, question.Qid); } }; (txtBookmark.Parent as FrameLayout).Click += delegate { if (question != null && question.Qid > 0) { var linkurl = "https://q.cnblogs.com/q/" + question.Qid + "/"; var title = question.Title + "_²©ÎÊ_²©¿ÍÔ°"; BookmarkAddActivity.Start(this, linkurl, title, true); } }; swipeRefreshLayout.Post(async() => { await questionPresenter.GetClientQuestion(Id); }); shareAction = new ShareAction(this).SetDisplayList(SHARE_MEDIA.Weixin, SHARE_MEDIA.WeixinCircle, SHARE_MEDIA.WeixinFavorite, SHARE_MEDIA.Sina).SetShareboardclickCallback(this); }