Skip to content
This repository was archived by the owner on Dec 3, 2021. It is now read-only.

Commit ee4d42f

Browse files
committed
Added new error screen layout
1 parent 5420bd4 commit ee4d42f

File tree

7 files changed

+65
-38
lines changed

7 files changed

+65
-38
lines changed

PTVGlass/NearMeActivity.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public async void NearbyDepartures(Location location)
7070
// show error card
7171
var errorCard = new Card(this);
7272
errorCard.SetText (e.ToString());
73-
errorCard.SetFootnote (Resource.String.error);
7473
SetContentView (errorCard.ToView ());
74+
7575
return;
7676
}
7777

@@ -102,9 +102,11 @@ public async void NearbyDepartures(Location location)
102102
// if there are no stops nearby, show no stops message
103103
if (stopsNearby.Count == 0)
104104
{
105-
var noStopsCard = new Card(this);
106-
noStopsCard.SetText(noStopsNearby);
107-
SetContentView(noStopsCard.ToView());
105+
// Show error screen
106+
SetContentView (Resource.Layout.ErrorScreen);
107+
var errorText = FindViewById<TextView> (Resource.Id.error_text);
108+
errorText.SetText(noStopsNearby); // set error text
109+
108110
return;
109111
}
110112

PTVGlass/PTVGlass.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
<None Include="Assets\AboutAssets.txt" />
8080
<None Include="Properties\AndroidManifest.xml" />
8181
<AndroidResource Include="Resources\layout\BusTramDepartureWithStationRow.axml" />
82+
<AndroidResource Include="Resources\drawable\ic_warning_50.png" />
83+
<AndroidResource Include="Resources\layout\ErrorScreen.axml" />
8284
</ItemGroup>
8385
<ItemGroup />
8486
<ItemGroup>
@@ -107,8 +109,8 @@
107109
<Visible>False</Visible>
108110
</XamarinComponentReference>
109111
<XamarinComponentReference Include="modernhttpclient">
110-
<Visible>False</Visible>
111112
<Version>1.2.1</Version>
113+
<Visible>False</Visible>
112114
</XamarinComponentReference>
113115
</ItemGroup>
114116
<ItemGroup>

PTVGlass/Resources/Resource.designer.cs

Lines changed: 26 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
11 KB
Binary file not shown.
Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:orientation="vertical"
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
43
android:layout_width="fill_parent"
5-
android:layout_height="fill_parent"
6-
>
7-
</LinearLayout>
8-
4+
android:layout_height="fill_parent">
5+
<LinearLayout
6+
android:orientation="vertical"
7+
android:layout_width="fill_parent"
8+
android:layout_height="fill_parent"
9+
android:gravity="center">
10+
<ImageView
11+
android:src="@drawable/ic_warning_50"
12+
android:layout_width="wrap_content"
13+
android:layout_height="wrap_content"
14+
android:id="@+id/error_icon"
15+
android:layout_marginBottom="10dip" />
16+
<TextView
17+
android:layout_width="match_parent"
18+
android:layout_height="wrap_content"
19+
android:id="@+id/error_text"
20+
android:layout_below="@+id/error_icon"
21+
android:gravity="center"
22+
android:textSize="36dip" />
23+
</LinearLayout>
24+
</RelativeLayout>

PTVGlass/Resources/values/Strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<string name="busses_near_me">buses near me</string>
1010
<string name="trams_near_me">trams near me</string>
1111
<string name="no_upcoming_departures">No upcoming departures scheduled</string>
12-
<string name="error">Error</string>
12+
<string name="no_internet_connection">Not connected to the internet</string>
1313
<string name="no_bus_stops_nearby">No bus stops nearby</string>
1414
<string name="no_tram_stops_nearby">No tram stops nearby</string>
1515
<string name="no_train_stops_nearby">No train stops nearby</string>

PTVGlass/TrainDepartureActivity.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ protected override async void OnCreate (Bundle bundle)
2424
{
2525
base.OnCreate (bundle);
2626

27-
// Show loading screen
28-
SetContentView (Resource.Layout.LoadingScreen);
29-
var loadingText = FindViewById<TextView> (Resource.Id.loading_text);
30-
loadingText.SetText(Resource.String.getting_departures); // set loading text
31-
var progressBar = FindViewById<SliderView> (Resource.Id.indeterm_slider);
32-
progressBar.StartIndeterminate (); // start indeterminate progress bar
33-
3427
// get station ID from intent
3528
int intentStationId = int.Parse(Intent.GetStringExtra ("stationId"));
3629

@@ -43,16 +36,18 @@ protected override async void OnCreate (Bundle bundle)
4336
// show error card
4437
var errorCard = new Card(this);
4538
errorCard.SetText (e.ToString());
46-
errorCard.SetFootnote (Resource.String.error);
4739
SetContentView (errorCard.ToView ());
40+
4841
return;
4942
}
5043

5144
// if there are no departures, show no departure message
5245
if (stationDepartures.Count == 0) {
53-
var noDeparturesCard = new Card(this);
54-
noDeparturesCard.SetText (Resource.String.no_upcoming_departures);
55-
SetContentView (noDeparturesCard.ToView ());
46+
// Show error screen
47+
SetContentView (Resource.Layout.ErrorScreen);
48+
var errorText = FindViewById<TextView> (Resource.Id.error_text);
49+
errorText.SetText(Resource.String.no_upcoming_departures); // set error text
50+
5651
return;
5752
}
5853

0 commit comments

Comments
 (0)