-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Attribution] Show attribution present in TileJson source in attribution modal sheet #1087
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we try optimizing the UI to make non-html attribution, not clickable? (setting them to disabled so they turn grey?)
bbb3593
to
71a8727
Compare
if (attribution.url.isEmpty()) { | ||
setTextColor(Color.GRAY) | ||
} else { | ||
setTextColor(ContextCompat.getColor(context, R.color.mapbox_blue)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary to set the blue color again? I think the default style defined in mapbox_attribution_list_item
is mapbox_blue
already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, somehow the color GRAY
was set to whole list, so added the condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % nit
attributionParser.createAttributionString(true) | ||
); | ||
} | ||
|
||
@Test | ||
public void testParseAttributionWithCustomStringAttribution() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty unexpected to see test in Java here 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to convert it to kotlin, probably later :D
sdk/src/test/java/com/mapbox/maps/attribution/AttributionParseTest.java
Outdated
Show resolved
Hide resolved
sdk/src/test/java/com/mapbox/maps/attribution/AttributionParseTest.java
Outdated
Show resolved
Hide resolved
val attribution = attributions[position] | ||
view.findViewById<TextView>(android.R.id.text1).apply { | ||
// if attribution url is empty, we show them as disabled. | ||
if (attribution.url.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could put if inside:
setTextColor(if () ... else ...)
/** | ||
* Parse string literal to attribution with empty url. | ||
*/ | ||
private fun parseStringLiteralToAttributions(stringLiteralArray: MutableList<String>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is indeed a mutable list needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additionally naming stringLiteralArray
with word array is not aligned well with actual list type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I will update that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor suggestions however dropping 🟢 in order not to block merging after those will be fixed.
Also missing checkpoint to port this to v10.3 branch - is this intended? I thought we want to have it in v10.3 stable however I don't have strong opinion here, imo it could wait until v10.4-beta.1
…Test.java Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com>
Yes, added the check. this will be included in v10.3 |
76ea168
to
061b830
Compare
…ion modal sheet (#1087) * allow string attribution * Update sdk/src/test/java/com/mapbox/maps/attribution/AttributionParseTest.java Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com> * update attribute parser Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com>
…ion modal sheet (#1087) * allow string attribution * Update sdk/src/test/java/com/mapbox/maps/attribution/AttributionParseTest.java Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com> * update attribute parser Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com>
…ion modal sheet (#1087) (#1129) * allow string attribution * Update sdk/src/test/java/com/mapbox/maps/attribution/AttributionParseTest.java Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com> * update attribute parser Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com> Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com>
Summary of changes
if the user provides the source attribution in string literal (eg.
{attribution: "OpenStreetMap contributors, CC-BY-SA"}
), it doesn't populate in the attribution dialog, which should be shown. this pr fixes the issue.Pull request checklist:
@JvmOverloads
,@file:JvmName
, etc).mapbox-maps-android
changelog:<changelog>Fix an issue where source attribution was not populated in attribution dialog.</changelog>
.v10.3
release branch fix / enhancement, merge it tomain
firstly and then port tov10.3
release branch.Fixes: < Link to related issues that will be fixed by this pull request, if they exist >
PRs must be submitted under the terms of our Contributor License Agreement CLA.