This commit is contained in:
Victor Shcherb 2018-04-15 16:40:21 +02:00
parent 2843126682
commit e8ccd4eb45
3 changed files with 10 additions and 7 deletions

View file

@ -811,7 +811,7 @@ public class GPXUtilities {
return points.isEmpty(); return points.isEmpty();
} }
int getPointsSize() { public int getPointsSize() {
return points.size(); return points.size();
} }

View file

@ -97,10 +97,12 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
private String selectedLang; private String selectedLang;
private WikivoyageArticle article; private WikivoyageArticle article;
private TextView trackButton;
private TextView selectedLangTv; private TextView selectedLangTv;
private TextView saveBtn; private TextView saveBtn;
private WebView contentWebView; private WebView contentWebView;
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
@Nullable @Nullable
@Override @Override
@ -158,9 +160,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
}); });
final GPXFile gpx = article.getGpxFile(); trackButton = (TextView) mainView.findViewById(R.id.gpx_button);
TextView trackButton = (TextView) mainView.findViewById(R.id.gpx_button);
trackButton.setText(trackButton.getText() + " (" + gpx.getPoints().size() +")");
trackButton.setCompoundDrawablesWithIntrinsicBounds( trackButton.setCompoundDrawablesWithIntrinsicBounds(
getActiveIcon(R.drawable.ic_action_track_16), null, null, null getActiveIcon(R.drawable.ic_action_track_16), null, null, null
); );
@ -171,6 +171,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
if (article == null || fm == null) { if (article == null || fm == null) {
return; return;
} }
final GPXFile gpx = article.getGpxFile();
WikivoyageDbHelper dbHelper = getMyApplication().getWikivoyageDbHelper(); WikivoyageDbHelper dbHelper = getMyApplication().getWikivoyageDbHelper();
File file = getMyApplication().getAppPath(IndexConstants.GPX_TRAVEL_DIR + dbHelper.getGPXName(article)); 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()); args.putString(WikivoyageArticleContentsFragment.CONTENTS_JSON_KEY, article.getContentsJson());
Intent newIntent = new Intent(getActivity(), getMyApplication().getAppCustomization().getTrackActivity()); Intent newIntent = new Intent(getActivity(), getMyApplication().getAppCustomization().getTrackActivity());
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, gpx.path); 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); newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(newIntent); startActivity(newIntent);
} }
@ -299,6 +300,9 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
if (article == null) { if (article == null) {
return; return;
} }
if(article.getGpxFile() != null) {
trackButton.setText(trackButton.getText() + " (" + article.getGpxFile().getPointsSize() +")");
}
WikivoyageLocalDataHelper ldh = getMyApplication().getWikivoyageDbHelper().getLocalDataHelper(); WikivoyageLocalDataHelper ldh = getMyApplication().getWikivoyageDbHelper().getLocalDataHelper();
ldh.addToHistory(article); ldh.addToHistory(article);

View file

@ -27,7 +27,7 @@ import java.util.List;
public class SavedArticlesTabFragment extends BaseOsmAndFragment implements WikivoyageLocalDataHelper.Listener { 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; 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) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final OsmandApplication app = getMyApplication(); final OsmandApplication app = getMyApplication();
dataHelper = app.getWikivoyageDbHelper().getLocalDataHelper(); dataHelper = app.getWikivoyageDbHelper().getLocalDataHelper();
LOG.debug("Data helper null:" + (dataHelper != null));
final View mainView = inflater.inflate(R.layout.fragment_saved_articles_tab, container, false); final View mainView = inflater.inflate(R.layout.fragment_saved_articles_tab, container, false);