protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Repo); TextView repoName = FindViewById <TextView>(Resource.Id.RepoName); TextView readMeView = FindViewById <TextView>(Resource.Id.Readme); SwipeRefreshLayout swipe = FindViewById <SwipeRefreshLayout>(Resource.Id.RepoListSwipe); commitList = FindViewById <ListView>(Resource.Id.CommitList); repoName.Text = $"{MainActivity.repo.Owner.Name} - {MainActivity.repo.Name}"; readMeView.MovementMethod = new Android.Text.Method.ScrollingMovementMethod(); //Gets the readme and binds to the TextView var readme = await _fetch.GetJson(_url.Readme(MainActivity.repo), MainActivity.token, true); readMeView.TextFormatted = Html.FromHtml(readme); await GetCommits(); swipe.Refresh += async(sender, e) => { await GetCommits(); swipe.Refreshing = false; }; }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); Button signIn = FindViewById <Button>(Resource.Id.SignIn); ImageView userAvatar = FindViewById <ImageView>(Resource.Id.UserAvatar); Button getStarred = FindViewById <Button>(Resource.Id.GetStarred); TextView greeting = FindViewById <TextView>(Resource.Id.Greeting); pageInfo = FindViewById <TextView>(Resource.Id.PageInfo); navigation = FindViewById <LinearLayout>(Resource.Id.Navigation); previousPage = FindViewById <Button>(Resource.Id.PreviousPage); nextPage = FindViewById <Button>(Resource.Id.NextPage); listView = FindViewById <ListView>(Resource.Id.RepoList); token = await GetLocalStorage.GetLocalAccessToken(); signIn.Click += async(sender, e) => { var json = await _fetch.GetJson(_url.User, token); user = await ParseManager.Parse <User>(json); if (user != null) { greeting.Text = $"Welcome {user.UserName}"; var bitmap = GetImageHelper.GetImageBitmapFromUrl(user.avatarUrl); userAvatar.SetImageBitmap(bitmap); getStarred.Enabled = true; signIn.Visibility = ViewStates.Gone; } }; getStarred.Click += async(sender, e) => { var json = await _fetch.GetJson(_url.Starred(user), token); repos = await ParseManager.Parse <List <Repo> >(json); foreach (Repo repo in repos) { repo.IsStarred = true; } ; navigation.Visibility = ViewStates.Gone; listView.Adapter = new RepoListAdapter(this, token, user, repos); }; listView.ItemClick += (sender, e) => { var listView = sender as ListView; repo = repos[e.Position]; var intent = new Intent(this, typeof(RepoActivity)); StartActivity(intent); }; previousPage.Click += (sender1, e1) => { page--; Search(); }; nextPage.Click += (sender2, e2) => { page++; Search(); }; }