Skip to content

Commit 3e4ca60

Browse files
Added open streetmap attribution in nearby
1 parent 4126fce commit 3e4ca60

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
import android.content.res.Configuration;
1818
import android.graphics.Bitmap;
1919
import android.graphics.drawable.VectorDrawable;
20+
import android.net.Uri;
2021
import android.os.Bundle;
2122
import android.provider.Settings;
2223
import android.util.Log;
2324
import android.view.Gravity;
2425
import android.view.LayoutInflater;
2526
import android.view.View;
27+
import android.view.View.OnClickListener;
2628
import android.view.ViewGroup;
2729
import android.view.animation.Animation;
2830
import android.view.animation.AnimationUtils;
@@ -38,6 +40,7 @@
3840
import androidx.annotation.NonNull;
3941
import androidx.annotation.Nullable;
4042
import androidx.appcompat.app.AlertDialog;
43+
import androidx.appcompat.widget.AppCompatTextView;
4144
import androidx.fragment.app.Fragment;
4245
import androidx.recyclerview.widget.DividerItemDecoration;
4346
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -154,6 +157,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
154157
@BindView(R.id.rv_nearby_list)
155158
RecyclerView rvNearbyList;
156159
@BindView(R.id.no_results_message) TextView noResultsView;
160+
@BindView(R.id.tv_attribution)
161+
AppCompatTextView tvOpenStreetAttribution;
157162

158163
@Inject LocationServiceManager locationManager;
159164
@Inject NearbyController nearbyController;
@@ -259,6 +264,11 @@ public void onViewCreated(@NonNull final View view, @Nullable final Bundle saved
259264
scaleBarPlugin.create(scaleBarOptions);
260265
});
261266
});
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+
});
262272
}
263273

264274
/**

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_alignParentBottom="true"
47+
android:layout_alignParentRight="true"
48+
android:text="&#169; OPENSTREETMAP"
49+
android:textColor="@android:color/darker_gray"
50+
android:textStyle="bold"
51+
android:layout_marginRight="4dp"
52+
android:textAlignment="center"
53+
android:layout_height="wrap_content"/>
54+
55+
</RelativeLayout>
4456

4557

4658
<Button

0 commit comments

Comments
 (0)