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:gravity="center_vertical"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:lineSpacingExtra="@dimen/titleLineSpacingExtra"
android:maxLines="1"
android:text="@string/select_segments"
android:textColor="?android:textColorPrimary"
@ -37,10 +37,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/list_header_settings_top_margin"
android:letterSpacing="@dimen/description_letter_spacing"
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier"
android:lineSpacingExtra="@dimen/descriptionLineSpacingExtra"
android:text="@string/select_segments_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
android:textSize="@dimen/default_desc_text_size"
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_video" type="id"/>
<item name="av_notes_widget_state_photo" type="id"/>
<item type="id" name="icon1" />
<item type="id" name="icon2" />
</resources>

View file

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

View file

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