public void AttachToScrollView(ObservableScrollView scrollView, IScrollDirectorListener scrollDirectionListener = null, IOnScrollChangedListener onScrollChangedListener = null) { var scrollDetector = new ScrollViewScrollDetectorImpl(this); scrollDetector.ScrollDirectionListener = scrollDirectionListener; scrollDetector.OnScrollChangedListener = onScrollChangedListener; scrollDetector.ScrollThreshold = scrollThreshold; scrollView.OnScrollChangedListener = scrollDetector; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); MyLog.Log(this, nameof(OnCreate) + "..."); SetContentView(Resource.Layout.artical); ActionBar?.Hide(); articalOverview = null; Bundle extras = Intent.Extras; Website currentWebsite = null; MyLog.Log(this, "Loading bundle data" + "..."); if (extras != null && extras.ContainsKey(PassArticalOverviewObj)) { articalOverview = new ArticalOverview(extras.GetBundle(PassArticalOverviewObj)); } else { Finish(); return; } if (extras != null || extras.ContainsKey(PassWebsiteKey)) { currentWebsiteKey = extras.GetString(PassWebsiteKey); } else { Finish(); return; } if (extras != null || extras.ContainsKey(PassIsOffline)) { isOffline = extras.GetBoolean(PassIsOffline); } else { Finish(); return; } MyLog.Log(this, "Loading bundle data" + "...Done"); if (!isOffline) { MyLog.Log(this, $"Request artical data online url {articalOverview.LinkOfActualArtical}" + "..."); analysisModule.ReadArtical(UidGenerator(), currentWebsiteKey, articalOverview, this); //make the request MyLog.Log(this, $"Request artical data online url {articalOverview.LinkOfActualArtical}" + "...Done"); } else { MyLog.Log(this, $"Requesting artical data offline url{articalOverview.LinkOfActualArtical}" + "..."); database.GetArtical(UidGenerator(), articalOverview, this); MyLog.Log(this, $"Requesting artical data offline url{articalOverview.LinkOfActualArtical}" + "...Done"); } currentWebsite = Config.GetWebsite(currentWebsiteKey); MyLog.Log(this, "Loading webview" + "..."); articalContentWebview = FindViewById <WebView>(Resource.Id.articalContentWebView); articalContentWebview.Settings.DefaultFontSize = 20; articalContentWebview.Settings.BuiltInZoomControls = true; articalContentWebview.Settings.JavaScriptEnabled = true; articalContentWebview.Settings.AllowFileAccessFromFileURLs = true; articalContentWebview.Settings.AllowUniversalAccessFromFileURLs = true; articalContentWebview.Visibility = ViewStates.Gone; MyLog.Log(this, "Loading webview" + "...Done"); ChangeStatusBarColor(Window, currentWebsite.Color); gridview = FindViewById <GridView>(Resource.Id.relatedPostGridView); adapter = new GridviewAdapter() { parent = this }; gridview.Adapter = adapter; gridview.ItemClick += Gridview_ItemClick; articalContentTextview = FindViewById <TextView>(Resource.Id.articalContentTextView); headerLayout = FindViewById <LinearLayout>(Resource.Id.articalHeaderLinearLayout); articalTitleTextview = FindViewById <TextView>(Resource.Id.articalTitleTextView); articalDateTextview = FindViewById <TextView>(Resource.Id.articalDateTextView); articalWebsiteComicTextview = FindViewById <TextView>(Resource.Id.articalWebsiteComicTextView); scrollView = FindViewById <other.ObservableScrollView>(Resource.Id.articalScrollView); floatingButton = FindViewById <other.FloatingActionButton>(Resource.Id.articalFab); navDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.articalDrawerLayout); headerLayout.SetBackgroundColor(Android.Graphics.Color.ParseColor(currentWebsite.Color)); articalTitleTextview.Text = articalOverview.Title ?? ""; articalDateTextview.Text = GetHumanReadableDate(articalOverview.Date) ?? ""; articalWebsiteComicTextview.Text = currentWebsite.ComicText ?? ""; articalContentTextview.Text = "Loading..."; articalContentTextview.Gravity = GravityFlags.CenterHorizontal; floatingButton.AttachToScrollView(scrollView); floatingButton.Visibility = !isOffline ? ViewStates.Visible : ViewStates.Gone; optionOpenInBrowser = FindViewById <TextView>(Resource.Id.articalOptionOpenInBrowserTextView); optionOpenInBrowser.Click += OptionOpenInBrowser_Click; floatingButton.Click += FloatingButton_Click; MyLog.Log(this, nameof(OnCreate) + "...Done"); }
public void AttachToScrollView (ObservableScrollView scrollView, IScrollDirectorListener scrollDirectionListener = null, IOnScrollChangedListener onScrollChangedListener = null) { var scrollDetector = new ScrollViewScrollDetectorImpl (this); scrollDetector.ScrollDirectionListener = scrollDirectionListener; scrollDetector.OnScrollChangedListener = onScrollChangedListener; scrollDetector.ScrollThreshold = scrollThreshold; scrollView.OnScrollChangedListener = scrollDetector; }