Skip to content

Commit

Permalink
Merge pull request #98 from TetsuOtter/92-show-destination
Browse files Browse the repository at this point in the history
  • Loading branch information
TetsuOtter authored Nov 11, 2023
2 parents 7ee4b17 + 7911dba commit c9b9e08
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 9 deletions.
5 changes: 3 additions & 2 deletions TRViS/DTAC/DTACElementStyles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static AppThemeColorBindingExtension genColor(byte defaultColorValue, byte darkC
new(0x44, 0x99, 0xFF)
);
public static readonly AppThemeColorBindingExtension HeaderBackgroundColor = genColor(0xDD, baseDarkColor + 0x18);
public static readonly AppThemeColorBindingExtension SeparatorLineColor = genColor(0xDD, baseDarkColor + 0x33);
public static readonly AppThemeColorBindingExtension SeparatorLineColor = genColor(0xAA, baseDarkColor + 0x33);
public static readonly AppThemeColorBindingExtension DefaultBGColor = genColor(0xFF, baseDarkColor);
public static readonly AppThemeColorBindingExtension CarCountBGColor = genColor(0xFE, baseDarkColor + 0x11);
public static readonly AppThemeColorBindingExtension TabAreaBGColor = genColor(0xEE, baseDarkColor - 0x20);
Expand Down Expand Up @@ -93,7 +93,7 @@ public static readonly AppThemeGenericsBindingExtension<Brush> MarkerMarkButtonB
DefaultTextColor.Apply(v, Label.TextColorProperty);
v.FontSize = DefaultTextSize;
v.FontFamily = DefaultFontFamily;
v.Margin = new(4);
v.Margin = new(4,0);
v.LineBreakMode = LineBreakMode.CharacterWrap;

v.LineHeight = DeviceInfo.Platform == DevicePlatform.Android ? 0.9 : 1.1;
Expand All @@ -106,6 +106,7 @@ public static readonly AppThemeGenericsBindingExtension<Brush> MarkerMarkButtonB
T v = LabelStyle<T>();

HeaderTextColor.Apply(v, Label.TextColorProperty);
v.Margin = new(1);

return v;
}
Expand Down
5 changes: 3 additions & 2 deletions TRViS/DTAC/Style_VerticalView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@
<Setter Property="TextColor" Value="{x:Static dtac:DTACElementStyles.DefaultTextColor}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="Hiragino Sans"/>
<Setter Property="Margin" Value="1"/>
<Setter Property="Margin" Value="4,0"/>
<Setter Property="LineBreakMode" Value="CharacterWrap"/>
<Setter Property="LineHeight" Value="{OnPlatform Android=0.9, Default=1}"/>
<Setter Property="LineHeight" Value="{OnPlatform Android=0.9, Default=1.1}"/>
</Style>
<Style TargetType="Label" BasedOn="{StaticResource LabelStyle}">
<Setter Property="Margin" Value="4"/>
</Style>
<Style x:Key="HeaderLabel" TargetType="Label" BasedOn="{StaticResource LabelStyle}">
<Setter Property="TextColor" Value="{x:Static dtac:DTACElementStyles.HeaderTextColor}"/>
<Setter Property="Margin" Value="1"/>
</Style>
<Style x:Key="TimetableLabel" TargetType="Label" BasedOn="{StaticResource LabelStyle}">
<Setter Property="TextColor" Value="{x:Static dtac:DTACElementStyles.TimetableTextColor}"/>
Expand Down
11 changes: 10 additions & 1 deletion TRViS/DTAC/VerticalStylePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
Style="{StaticResource LabelStyle}"
Text="{Binding TrainNumber, Converter={StaticResource TrainNumberConverter}}"
TextColor="{x:Static dtac:DTACElementStyles.TrainNumNextDayTextColor}"
FontSize="28"
FontSize="24"
FontAttributes="Bold"
Grid.Column="0"/>
<Line
Expand Down Expand Up @@ -180,6 +180,15 @@
HorizontalOptions="Start"
VerticalOptions="Center"
Text="{Binding BeginRemarks}"/>

<Label
x:Name="DestinationLabel"
Style="{StaticResource LabelStyle}"
Margin="0,8"
HorizontalOptions="Start"
VerticalOptions="Start"
Grid.Column="6"
Grid.ColumnSpan="2"/>
</Grid>

<dtac:TimetableHeader
Expand Down
35 changes: 33 additions & 2 deletions TRViS/DTAC/VerticalStylePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public partial class VerticalStylePage : ContentView
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public const double DATE_AND_START_BUTTON_ROW_HEIGHT = 60;
const double TRAIN_INFO_HEADER_ROW_HEIGHT = 54;
const double TRAIN_INFO_ROW_HEIGHT = 60;
const double TRAIN_INFO_ROW_HEIGHT = 54;
const double TRAIN_INFO_BEFORE_DEPARTURE_ROW_HEIGHT = DTACElementStyles.BeforeDeparture_AfterArrive_Height * 2;
const double CAR_COUNT_AND_BEFORE_REMARKS_ROW_HEIGHT = 60;
const double CAR_COUNT_AND_BEFORE_REMARKS_ROW_HEIGHT = 54;
const double TIMETABLE_HEADER_ROW_HEIGHT = 60;

RowDefinition TrainInfo_BeforeDepature_RowDefinition { get; } = new(0);
Expand Down Expand Up @@ -160,6 +160,8 @@ partial void OnSelectedTrainDataChanged(TrainData? newValue)
TrainInfo_BeforeDepartureArea.BeforeDepartureText = newValue?.BeforeDeparture ?? "";
TrainInfo_BeforeDepartureArea.BeforeDepartureText_OnStationTrackColumn = newValue?.BeforeDepartureOnStationTrackCol ?? "";

SetDestinationString(newValue?.Destination);

int dayCount = newValue?.DayCount ?? 0;
this.IsNextDayLabel.IsVisible = dayCount > 0;
}
Expand Down Expand Up @@ -233,4 +235,33 @@ void BeforeRemarks_TrainInfo_OpenCloseChanged(object sender, ValueChangedEventAr
);
logger.Debug("Animation started");
}

string? _DestinationString = null;
void SetDestinationString(string? value)
{
if (_DestinationString == value)
return;

_DestinationString = value;
if (string.IsNullOrEmpty(value))
{
DestinationLabel.IsVisible = false;
DestinationLabel.Text = null;
return;
}

string dstStr = value;
switch (value.Length)
{
case 1:
dstStr = $"{Utils.SPACE_CHAR}{value}{Utils.SPACE_CHAR}";
break;
case 2:
dstStr = $"{value[0]}{Utils.SPACE_CHAR}{value[1]}";
break;
}

DestinationLabel.Text = $"({dstStr}行)";
DestinationLabel.IsVisible = true;
}
}
2 changes: 1 addition & 1 deletion TRViS/DTAC/ViewHost.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
IgnoreSafeArea="True">
<Grid.RowDefinitions>
<RowDefinition Height="{x:Static local:ViewHost.TitleViewHeight}"/>
<RowDefinition Height="64"/>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

Expand Down
2 changes: 1 addition & 1 deletion TRViS/Utils/SampleDataLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public class SampleDataLoader : TRViS.IO.ILoader
SpeedType: null,
NominalTractiveCapacity: null,
CarCount: null,
Destination: null,
Destination: "長い駅名",
BeginRemarks: null,
AfterRemarks: "(入換)",
Remarks: null,
Expand Down

0 comments on commit c9b9e08

Please sign in to comment.