Fix NPE
This commit is contained in:
parent
2843126682
commit
e8ccd4eb45
3 changed files with 10 additions and 7 deletions
|
@ -811,7 +811,7 @@ public class GPXUtilities {
|
|||
return points.isEmpty();
|
||||
}
|
||||
|
||||
int getPointsSize() {
|
||||
public int getPointsSize() {
|
||||
return points.size();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,10 +97,12 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
|||
private String selectedLang;
|
||||
private WikivoyageArticle article;
|
||||
|
||||
private TextView trackButton;
|
||||
private TextView selectedLangTv;
|
||||
private TextView saveBtn;
|
||||
private WebView contentWebView;
|
||||
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -158,9 +160,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
|||
});
|
||||
|
||||
|
||||
final GPXFile gpx = article.getGpxFile();
|
||||
TextView trackButton = (TextView) mainView.findViewById(R.id.gpx_button);
|
||||
trackButton.setText(trackButton.getText() + " (" + gpx.getPoints().size() +")");
|
||||
trackButton = (TextView) mainView.findViewById(R.id.gpx_button);
|
||||
trackButton.setCompoundDrawablesWithIntrinsicBounds(
|
||||
getActiveIcon(R.drawable.ic_action_track_16), null, null, null
|
||||
);
|
||||
|
@ -171,6 +171,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
|||
if (article == null || fm == null) {
|
||||
return;
|
||||
}
|
||||
final GPXFile gpx = article.getGpxFile();
|
||||
WikivoyageDbHelper dbHelper = getMyApplication().getWikivoyageDbHelper();
|
||||
File file = getMyApplication().getAppPath(IndexConstants.GPX_TRAVEL_DIR + dbHelper.getGPXName(article));
|
||||
|
||||
|
@ -179,7 +180,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
|||
args.putString(WikivoyageArticleContentsFragment.CONTENTS_JSON_KEY, article.getContentsJson());
|
||||
Intent newIntent = new Intent(getActivity(), getMyApplication().getAppCustomization().getTrackActivity());
|
||||
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, gpx.path);
|
||||
newIntent.putExtra(TrackActivity.OPEN_POINTS_TAB, true);
|
||||
// newIntent.putExtra(TrackActivity.OPEN_POINTS_TAB, true);
|
||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(newIntent);
|
||||
}
|
||||
|
@ -299,6 +300,9 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
|||
if (article == null) {
|
||||
return;
|
||||
}
|
||||
if(article.getGpxFile() != null) {
|
||||
trackButton.setText(trackButton.getText() + " (" + article.getGpxFile().getPointsSize() +")");
|
||||
}
|
||||
|
||||
WikivoyageLocalDataHelper ldh = getMyApplication().getWikivoyageDbHelper().getLocalDataHelper();
|
||||
ldh.addToHistory(article);
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||
|
||||
public class SavedArticlesTabFragment extends BaseOsmAndFragment implements WikivoyageLocalDataHelper.Listener {
|
||||
|
||||
private static final Log LOG = PlatformUtil.getLog(SavedArticlesTabFragment.class);
|
||||
protected static final Log LOG = PlatformUtil.getLog(SavedArticlesTabFragment.class);
|
||||
|
||||
private WikivoyageLocalDataHelper dataHelper;
|
||||
|
||||
|
@ -38,7 +38,6 @@ public class SavedArticlesTabFragment extends BaseOsmAndFragment implements Wiki
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
dataHelper = app.getWikivoyageDbHelper().getLocalDataHelper();
|
||||
LOG.debug("Data helper null:" + (dataHelper != null));
|
||||
|
||||
final View mainView = inflater.inflate(R.layout.fragment_saved_articles_tab, container, false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue