POS_Sprint_5 #7
@ -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<Dictionary<string, string>> fullLink = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(second_jsonObject);
|
||||
List<SearchResult> fullLink = JsonConvert.DeserializeObject<List<SearchResult>>(second_jsonObject);
|
||||
|
||||
// FindViewById<TextView>(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<TextView>(Resource.Id.links).Text = FindViewById<TextView>(Resource.Id.links).Text + fullLink[i].Title + ": " + fullLink[i].Link + "\n\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
FindViewById<TextView>(Resource.Id.links).Text = "Coś poszło nie tak!";
|
||||
}
|
||||
|
||||
|
||||
|
20
Klient/Klient/Klient.Android/Modules/SearchResult.cs
Normal file
20
Klient/Klient/Klient.Android/Modules/SearchResult.cs
Normal file
@ -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; }
|
||||
}
|
||||
}
|
@ -73,6 +73,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Modules\SearchResult.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
@ -98,7 +99,6 @@
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Modules\" />
|
||||
<Folder Include="Resources\drawable-hdpi\" />
|
||||
<Folder Include="Resources\drawable-xhdpi\" />
|
||||
<Folder Include="Resources\drawable-xxhdpi\" />
|
||||
|
Loading…
Reference in New Issue
Block a user