NPE fix, styling text

This commit is contained in:
androiddevkotlin 2021-02-11 23:25:54 +02:00
parent 7890afe582
commit 3d92a46df6
4 changed files with 23 additions and 14 deletions

View file

@ -25,7 +25,7 @@
android:ellipsize="end" android:ellipsize="end"
android:gravity="center_vertical" android:gravity="center_vertical"
android:letterSpacing="@dimen/text_button_letter_spacing" android:letterSpacing="@dimen/text_button_letter_spacing"
android:lineSpacingExtra="@dimen/line_spacing_extra_description" android:lineSpacingExtra="@dimen/titleLineSpacingExtra"
android:maxLines="1" android:maxLines="1"
android:text="@string/select_segments" android:text="@string/select_segments"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
@ -37,10 +37,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/list_header_settings_top_margin" android:layout_marginBottom="@dimen/list_header_settings_top_margin"
android:letterSpacing="@dimen/description_letter_spacing"
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier" android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier"
android:lineSpacingExtra="@dimen/descriptionLineSpacingExtra"
android:text="@string/select_segments_description" android:text="@string/select_segments_description"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" /> osmand:typeface="@string/font_roboto_regular" />

View file

@ -16,7 +16,5 @@
<item name="av_notes_widget_state_audio" type="id"/> <item name="av_notes_widget_state_audio" type="id"/>
<item name="av_notes_widget_state_video" type="id"/> <item name="av_notes_widget_state_video" type="id"/>
<item name="av_notes_widget_state_photo" type="id"/> <item name="av_notes_widget_state_photo" type="id"/>
<item type="id" name="icon1" />
<item type="id" name="icon2" />
</resources> </resources>

View file

@ -413,4 +413,7 @@
<dimen name="radioButtonSize">32dp</dimen> <dimen name="radioButtonSize">32dp</dimen>
<dimen name="checkBoxSize">24dp</dimen> <dimen name="checkBoxSize">24dp</dimen>
<dimen name="titleLineSpacingExtra">5sp</dimen>
<dimen name="descriptionLineSpacingExtra">3sp</dimen>
</resources> </resources>

View file

@ -493,22 +493,28 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
if (mapActivity != null && index < card.getGpxInfoList().size()) { if (mapActivity != null && index < card.getGpxInfoList().size()) {
GPXInfo gpxInfo = card.getGpxInfoList().get(index); GPXInfo gpxInfo = card.getGpxInfoList().get(index);
String fileName = gpxInfo.getFileName(); String fileName = gpxInfo.getFileName();
GPXFile GPXFile = app.getSelectedGpxHelper().getSelectedFileByName(fileName).getGpxFile(); SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByName(fileName);
FragmentManager fragmentManager = getFragmentManager(); if (selectedGpxFile != null) {
if (GPXFile != null && fragmentManager != null) { GPXFile gpxFile = selectedGpxFile.getGpxFile();
boolean isTrackContainsMultiSegment = GPXFile.getNonEmptySegmentsCount() > 1; if (gpxFile.getNonEmptySegmentsCount() > 1) {
if (!isTrackContainsMultiSegment) { TrackSelectSegmentBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), gpxFile);
selectTrackToFollow(GPXFile);
updateSelectionMode(false);
} else { } else {
TrackSelectSegmentBottomSheet.showInstance(fragmentManager, GPXFile); updateSelectionMode(false);
selectTrackToFollow(gpxFile);
} }
} else { } else {
CallbackWithObject<GPXFile[]> callback = new CallbackWithObject<GPXFile[]>() { CallbackWithObject<GPXFile[]> callback = new CallbackWithObject<GPXFile[]>() {
@Override @Override
public boolean processResult(GPXFile[] result) { public boolean processResult(GPXFile[] result) {
selectTrackToFollow(result[0]); MapActivity mapActivity = getMapActivity();
updateSelectionMode(false); if (mapActivity != null) {
if (result[0].getNonEmptySegmentsCount() > 1) {
TrackSelectSegmentBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), result[0]);
} else {
updateSelectionMode(false);
selectTrackToFollow(result[0]);
}
}
return true; return true;
} }
}; };