Merge pull request #5366 from osmandapp/ChumvaIssuesFixes

Fix StartEditingTravelCard
This commit is contained in:
Alexander Sytnyk 2018-05-08 18:25:10 +03:00 committed by GitHub
commit 22187c820a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -133,7 +133,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn
}
}
}
items.add(new StartEditingTravelCard(app, nightMode));
items.add(new StartEditingTravelCard(app, getMyActivity(), nightMode));
adapter.setItems(items);
final DownloadIndexesThread downloadThread = app.getDownloadThread();

View file

@ -1,5 +1,7 @@
package net.osmand.plus.wikivoyage.explore.travelcards;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.customtabs.CustomTabsIntent;
@ -16,8 +18,11 @@ public class StartEditingTravelCard extends BaseTravelCard {
public static final int TYPE = 1;
public StartEditingTravelCard(OsmandApplication app, boolean nightMode) {
private Context context;
public StartEditingTravelCard(OsmandApplication app, Activity context, boolean nightMode) {
super(app, nightMode);
this.context = context;
}
@Override
@ -35,7 +40,7 @@ public class StartEditingTravelCard extends BaseTravelCard {
.setToolbarColor(ContextCompat.getColor(app, nightMode ? R.color.actionbar_dark_color : R.color.actionbar_light_color))
.build();
String text = "https://" + app.getLanguage().toLowerCase() + ".m.wikivoyage.org";
customTabsIntent.launchUrl(app, Uri.parse(text));
customTabsIntent.launchUrl(context, Uri.parse(text));
}
});
}