Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locale setup #37

Merged
merged 4 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,62 +104,66 @@ private void DrawCapabilities() {
return;
}

String unknown = getString(R.string.unknown);
String supported = getString(R.string.supported);
String unsupported = getString(R.string.unsupported);

// Navigation messages

// API 34 Data
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
int support = Capabilities.hasAccumulatedDeltaRange();
String adrText = "Unknown";
String adrText = unknown;
switch (support) {
case GnssCapabilities.CAPABILITY_UNKNOWN -> adrText = "Unknown";
case GnssCapabilities.CAPABILITY_SUPPORTED -> adrText = "Supported";
case GnssCapabilities.CAPABILITY_UNSUPPORTED -> adrText = "Unsupported";
case GnssCapabilities.CAPABILITY_UNKNOWN -> adrText = unknown;
case GnssCapabilities.CAPABILITY_SUPPORTED -> adrText = supported;
case GnssCapabilities.CAPABILITY_UNSUPPORTED -> adrText = unsupported;
}

if (hasADR != null) {
hasADR.setText(adrText);
}
if (hasMsa != null) {
hasMsa.setText(Capabilities.hasMsa() ? "Supported" : "Unsupported");
hasMsa.setText(Capabilities.hasMsa() ? supported : unsupported);
}
if (supportsSatellitePvt != null) {
supportsSatellitePvt.setText(Capabilities.hasSatellitePvt() ? "Supported" : "Unsupported");
supportsSatellitePvt.setText(Capabilities.hasSatellitePvt() ? supported : unsupported);
}
} else {
if (hasADR != null) {
hasADR.setText("Unknown");
hasADR.setText(unknown);
}
if (hasMsa != null) {
hasMsa.setText("Unknown");
hasMsa.setText(unknown);
}
if (supportsSatellitePvt != null) {
supportsSatellitePvt.setText("Unknown");
supportsSatellitePvt.setText(unknown);
}
}

// API 31 data
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (supportsNavigationMessages != null) {
supportsNavigationMessages.setText(Capabilities.hasNavigationMessages() ? "Supported" : "Unsupported");
supportsNavigationMessages.setText(Capabilities.hasNavigationMessages() ? supported : unsupported);
}
if (supportsMeasurements != null) {
supportsMeasurements.setText(Capabilities.hasMeasurements() ? "Supported" : "Unsupported");
supportsMeasurements.setText(Capabilities.hasMeasurements() ? supported : unsupported);
}
} else {
if (supportsNavigationMessages != null) {
supportsNavigationMessages.setText("Unknown");
supportsNavigationMessages.setText(unknown);
}
if (supportsMeasurements != null) {
supportsMeasurements.setText("Unknown");
supportsMeasurements.setText(unknown);
}
}

// < API 30 data (supported by minimum)
if (hardwareYear != null) {
hardwareYear.setText(GnssModelYear != 0 ? String.format(Locale.US, "%d", GnssModelYear) : "Unknown (before 2016)");
hardwareYear.setText(GnssModelYear != 0 ? String.format(Locale.US, "%d", GnssModelYear) : getString(R.string.unknown_before_2016));
}
if( hardwareName != null) {
hardwareName.setText(GnssModelName == null ? "Unknown" : GnssModelName);
hardwareName.setText(GnssModelName == null ? unknown : GnssModelName);
}
if (deviceLatitude != null) {
deviceLatitude.setText(String.valueOf(Latitude));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class SatelliteFiltersModalPane extends BottomSheetDialogFragment {

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return this.getLayoutInflater().inflate(
R.layout.fragment_satellite_filters_modal_pane_list_dialog,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ private void PrintEventDataToLayout() {
if (lastEvent != null) {
activity.runOnUiThread(() ->
{
TimerTextView.setText("Last updated: " + LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern("HH:mm:ss")));
String lastUpdatedString = getString(R.string.last_updated);
TimerTextView.setText(lastUpdatedString + LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern("HH:mm:ss")));
TimerProgressBar.setVisibility(View.VISIBLE);
LoadingIndicator.setVisibility(View.INVISIBLE);
CurrentSatelliteData.clear();
Expand Down
104 changes: 60 additions & 44 deletions GalileoFront/app/src/main/res/layout/fragment_general_stats_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
tools:ignore="UselessParent">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:text="GNSS Chipset:"
android:textStyle="bold" />
android:text="@string/gnss_chipset"
android:textStyle="bold"
tools:ignore="RtlSymmetry" />

<LinearLayout
android:layout_width="wrap_content"
Expand All @@ -26,14 +28,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Model name: " />
android:paddingStart="16dp"
android:text="@string/model_name"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/gnssHardwareName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />

</LinearLayout>

Expand All @@ -45,14 +48,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Model year: " />
android:paddingStart="16dp"
android:text="@string/model_year"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/gnssHardwareYear"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown (before 2016)" />
android:text="@string/unknown_before_2016" />

</LinearLayout>

Expand All @@ -64,14 +68,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Navigation Messages: " />
android:paddingStart="16dp"
android:text="@string/navigation_messages"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/supportsNavigationMessages"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />

</LinearLayout>

Expand All @@ -83,14 +88,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Measurements: " />
android:paddingStart="16dp"
android:text="@string/measurements"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/supportsMeasurements"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />

</LinearLayout>

Expand All @@ -102,14 +108,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="ADR: " />
android:paddingStart="16dp"
android:text="@string/adr"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/hasADR"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />

</LinearLayout>

Expand All @@ -121,14 +128,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Msa: " />
android:paddingStart="16dp"
android:text="@string/msa"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/hasMsa"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />

</LinearLayout>

Expand All @@ -140,14 +148,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Satellite PVT: " />
android:paddingStart="16dp"
android:text="@string/satellite_pvt"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/supportsSatellitePvt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />

</LinearLayout>

Expand All @@ -156,8 +165,9 @@
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:text="Location:"
android:textStyle="bold" />
android:text="@string/location"
android:textStyle="bold"
tools:ignore="RtlSymmetry" />

<LinearLayout
android:layout_width="wrap_content"
Expand All @@ -167,14 +177,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Latitude: " />
android:paddingStart="16dp"
android:text="@string/latitude"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/deviceLatitude"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />

</LinearLayout>

Expand All @@ -186,14 +197,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Longitude: " />
android:paddingStart="16dp"
android:text="@string/longitude"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/deviceLongitude"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />
</LinearLayout>

<LinearLayout
Expand All @@ -204,14 +216,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Altitude: " />
android:paddingStart="16dp"
android:text="@string/altitude"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/deviceAltitude"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />
</LinearLayout>

<LinearLayout
Expand All @@ -222,14 +235,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Accuracy: " />
android:paddingStart="16dp"
android:text="@string/accuracy"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/deviceAccuracy"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />
</LinearLayout>

<LinearLayout
Expand All @@ -240,14 +254,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Bearing: " />
android:paddingStart="16dp"
android:text="@string/bearing"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/deviceBearing"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />
</LinearLayout>

<LinearLayout
Expand All @@ -258,14 +273,15 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:text="Bearing Accuracy: " />
android:paddingStart="16dp"
android:text="@string/bearing_accuracy"
tools:ignore="RtlSymmetry" />

<TextView
android:id="@+id/deviceBearingAccuracy"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Unknown" />
android:text="@string/unknown" />
</LinearLayout>

</LinearLayout>
Expand Down
Loading