POS-40 Początek ekranu z linkami

This commit is contained in:
Wojciech Przybyła 2021-01-11 01:59:23 +01:00
parent b3732fc11d
commit fc00e94f6a
4 changed files with 459 additions and 371 deletions

View File

@ -230,7 +230,26 @@ namespace Klient.Droid
var response = await client.PostAsync("http://10.0.2.2:5001/api/Image/Process", formDataContent);
if(response.StatusCode == HttpStatusCode.OK)
{
var jsonString = await response.Content.ReadAsStringAsync();
dynamic jsonObject = JsonConvert.DeserializeObject(jsonString);
FindViewById<TextView>(Resource.Id.ErrorPhoto).Text = "Przesłano zdjęcie!";
SetContentView(Resource.Layout.ekranZLinkami);
var second_response = await client.GetAsync("http://10.0.2.2:5001/api/Search", jsonObject.response);
if(second_response.StatusCode == HttpStatusCode.OK)
{
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);
// FindViewById<TextView>(Resource.Id.links).Text = fullLink[0].title
}
else
{
}
}
else
{
@ -307,9 +326,10 @@ namespace Klient.Droid
var jsonString = await response.Content.ReadAsStringAsync();
dynamic jsonObject = JsonConvert.DeserializeObject(jsonString);
List<string> history = JsonConvert.DeserializeObject<List<string>>(jsonObject.history);
int end = 10;
int temp;
for (int i = 0; i < 10; i++)
if (history.Count < 10) end = history.Count;
for (int i = 0; i < end; i++)
{
temp = i + 1;
FindViewById<TextView>(Resource.Id.history).Text = FindViewById<TextView>(Resource.Id.history).Text + "\n" + temp + ". " + history[i];

View File

@ -169,6 +169,11 @@
<SubType>Designer</SubType>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\layout\ekranZLinkami.xml">
<SubType>Designer</SubType>
</AndroidResource>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffbdd7f0">
<TextView
android:text="Proponowane materiały"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="25px"
android:minHeight="25px"
android:id="@+id/linkTitle"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:translationY="5dp"
android:textColor="#ff000000" />
<TextView
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/links"
android:layout_below="@+id/linkTitle"
android:textColor="#ff393939"
android:linksClickable="true"
android:autoLink="web" />
<Button
android:text="Back"
android:layout_width="38.5dp"
android:layout_height="35.0dp"
android:id="@+id/backToSendPhoto"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#ff0b31c8"
android:textColor="#fffcfcfc"
android:gravity="center"
android:onClick="GoToPoLogowaniu" />
<TextView
android:text="Poszukiwacz 2021"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text1"
android:textColor="#ff000000"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>