Search in sources :

Example 11 with TravelHelper

use of net.osmand.plus.wikivoyage.data.TravelHelper in project Osmand by osmandapp.

the class ExploreTabFragment method downloadHasFinished.

@Override
public void downloadHasFinished() {
    OsmandApplication app = getMyApplication();
    if (app != null) {
        TravelHelper travelHelper = app.getTravelHelper();
        if (travelHelper.isAnyTravelBookPresent()) {
            app.getTravelHelper().initializeDataOnAppStartup();
            WikivoyageExploreActivity exploreActivity = getExploreActivity();
            if (exploreActivity != null) {
                exploreActivity.populateData(true);
            }
        } else {
            removeRedundantCards();
        }
    }
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) TravelHelper(net.osmand.plus.wikivoyage.data.TravelHelper)

Example 12 with TravelHelper

use of net.osmand.plus.wikivoyage.data.TravelHelper in project Osmand by osmandapp.

the class SavedArticlesRvAdapter method updateSaveButton.

private void updateSaveButton(final TravelGpxVH holder, final TravelGpx article) {
    if (article != null) {
        final TravelHelper helper = app.getTravelHelper();
        final boolean saved = helper.getBookmarksHelper().isArticleSaved(article);
        Drawable icon = getActiveIcon(saved ? R.drawable.ic_action_read_later_fill : R.drawable.ic_action_read_later);
        holder.rightButton.setText(saved ? R.string.shared_string_remove : R.string.shared_string_save);
        holder.rightButton.setCompoundDrawablesWithIntrinsicBounds(null, null, icon, null);
        holder.rightButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                helper.saveOrRemoveArticle(article, !saved);
                updateSaveButton(holder, article);
            }
        });
    }
}
Also used : Drawable(android.graphics.drawable.Drawable) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) TravelHelper(net.osmand.plus.wikivoyage.data.TravelHelper)

Aggregations

TravelHelper (net.osmand.plus.wikivoyage.data.TravelHelper)12 View (android.view.View)4 TextView (android.widget.TextView)4 OsmandApplication (net.osmand.plus.OsmandApplication)4 TravelArticle (net.osmand.plus.wikivoyage.data.TravelArticle)4 Drawable (android.graphics.drawable.Drawable)3 File (java.io.File)3 GPXFile (net.osmand.GPXUtilities.GPXFile)3 SelectedGpxFile (net.osmand.plus.track.helpers.GpxSelectionHelper.SelectedGpxFile)3 WebView (android.webkit.WebView)2 ImageView (android.widget.ImageView)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 ArrayList (java.util.ArrayList)2 MapActivity (net.osmand.plus.activities.MapActivity)2 MapMarkersHelper (net.osmand.plus.mapmarkers.MapMarkersHelper)2 TravelGpx (net.osmand.plus.wikivoyage.data.TravelGpx)2 SuppressLint (android.annotation.SuppressLint)1 Intent (android.content.Intent)1 ColorStateList (android.content.res.ColorStateList)1 Bundle (android.os.Bundle)1