From 2d5e43a42bbc0a29c44e118d069b2b42fd3cfb60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Przyby=C5=82a?= Date: Mon, 11 Jan 2021 14:05:50 +0100 Subject: [PATCH] =?UTF-8?q?POS-40=20Doko=C5=84czono=20erkan=20z=20linkami?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Klient/Klient/Klient.Android/MainActivity.cs | 12 ++++++++--- .../Klient.Android/Modules/SearchResult.cs | 20 +++++++++++++++++++ .../Klient/Klient.Android/Poszukiwacz.csproj | 2 +- 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 Klient/Klient/Klient.Android/Modules/SearchResult.cs diff --git a/Klient/Klient/Klient.Android/MainActivity.cs b/Klient/Klient/Klient.Android/MainActivity.cs index e245848..b4c925b 100644 --- a/Klient/Klient/Klient.Android/MainActivity.cs +++ b/Klient/Klient/Klient.Android/MainActivity.cs @@ -14,6 +14,7 @@ using System.Net; using System.Linq; using System.IO; using Newtonsoft.Json; +using Klient.Droid.Modules; namespace Klient.Droid { @@ -240,13 +241,18 @@ namespace Klient.Droid var second_jsonString = await response.Content.ReadAsStringAsync(); dynamic second_jsonObject = JsonConvert.DeserializeObject(second_jsonString); - List> fullLink = JsonConvert.DeserializeObject>>(second_jsonObject); + List fullLink = JsonConvert.DeserializeObject>(second_jsonObject); - // FindViewById(Resource.Id.links).Text = fullLink[0].title + int end = 10; + if (fullLink.Count < 10) end = fullLink.Count; + for (int i = 0; i < end; i++) + { + FindViewById(Resource.Id.links).Text = FindViewById(Resource.Id.links).Text + fullLink[i].Title + ": " + fullLink[i].Link + "\n\n"; + } } else { - + FindViewById(Resource.Id.links).Text = "Coś poszło nie tak!"; } diff --git a/Klient/Klient/Klient.Android/Modules/SearchResult.cs b/Klient/Klient/Klient.Android/Modules/SearchResult.cs new file mode 100644 index 0000000..fc435d5 --- /dev/null +++ b/Klient/Klient/Klient.Android/Modules/SearchResult.cs @@ -0,0 +1,20 @@ +using Android.App; +using Android.Content; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Klient.Droid.Modules +{ + public class SearchResult + { + public string Title { get; set; } + public string Link { get; set; } + public string Snippet { get; set; } + } +} \ No newline at end of file diff --git a/Klient/Klient/Klient.Android/Poszukiwacz.csproj b/Klient/Klient/Klient.Android/Poszukiwacz.csproj index 9571410..703b9a2 100644 --- a/Klient/Klient/Klient.Android/Poszukiwacz.csproj +++ b/Klient/Klient/Klient.Android/Poszukiwacz.csproj @@ -73,6 +73,7 @@ + @@ -98,7 +99,6 @@ -