Skip to content

Commit 1f0fcdb

Browse files
* Added OPENSTREET attribution in nearby
1 parent aa1d6fe commit 1f0fcdb

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import android.content.pm.PackageManager;
1010
import android.content.res.Configuration;
1111
import android.graphics.Bitmap;
12+
import android.net.Uri;
1213
import android.os.Bundle;
1314
import android.provider.Settings;
1415
import android.util.Log;
@@ -29,6 +30,7 @@
2930

3031
import androidx.annotation.NonNull;
3132
import androidx.annotation.Nullable;
33+
import androidx.appcompat.widget.AppCompatTextView;
3234
import androidx.recyclerview.widget.DividerItemDecoration;
3335
import androidx.recyclerview.widget.LinearLayoutManager;
3436
import androidx.recyclerview.widget.RecyclerView;
@@ -154,6 +156,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
154156
MapView mapView;
155157
@BindView(R.id.rv_nearby_list)
156158
RecyclerView rvNearbyList;
159+
@BindView(R.id.tv_attribution)
160+
AppCompatTextView tvOpenStreetAttribution;
157161

158162
@Inject LocationServiceManager locationManager;
159163
@Inject NearbyController nearbyController;
@@ -260,6 +264,11 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
260264
scaleBarPlugin.create(scaleBarOptions);
261265
});
262266
});
267+
tvOpenStreetAttribution.setOnClickListener(v -> {
268+
Intent intent = new Intent(Intent.ACTION_VIEW);
269+
intent.setData(Uri.parse("https://www.openstreetmap.org/copyright"));
270+
startActivity(intent);
271+
});
263272
}
264273

265274
/**

app/src/main/res/layout/fragment_nearby_parent.xml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<!-- I have done this intentionally, the mapview because of some elevation or something,
2727
sometimes hangs over the drawer layout and sometimes draws its onPaused state over the contributions, this seems to be the probable fix -->
28-
<FrameLayout
28+
<RelativeLayout
2929
android:layout_width="match_parent"
3030
android:layout_height="match_parent"
3131
android:layout_below="@id/nearby_filter">
@@ -40,7 +40,19 @@
4040
android:layout_height="match_parent"
4141
android:background="@android:color/transparent" />
4242

43-
</FrameLayout>
43+
<androidx.appcompat.widget.AppCompatTextView
44+
android:id="@+id/tv_attribution"
45+
android:layout_width="wrap_content"
46+
android:layout_height="wrap_content"
47+
android:layout_alignParentRight="true"
48+
android:layout_alignParentBottom="true"
49+
android:layout_margin="4dp"
50+
android:text="&#169; OPENSTREETMAP \n contributors"
51+
android:textAlignment="center"
52+
android:textColor="@android:color/darker_gray"
53+
android:textStyle="bold" />
54+
55+
</RelativeLayout>
4456

4557

4658
<Button

0 commit comments

Comments
 (0)