Skip to content

Commit

Permalink
Merge pull request #229 from onaio/223-resize-my-location-button-on-m…
Browse files Browse the repository at this point in the history
…obile

Resize drawable assets
  • Loading branch information
vincent-karuri authored Dec 13, 2018
2 parents 4f619f4 + 53fff2c commit 39ee0dc
Show file tree
Hide file tree
Showing 46 changed files with 28 additions and 17 deletions.
9 changes: 4 additions & 5 deletions library/src/main/java/io/ona/kujaku/views/KujakuMapView.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
import io.ona.kujaku.utils.LogUtil;
import io.ona.kujaku.utils.NetworkUtil;
import io.ona.kujaku.utils.Permissions;
import io.ona.kujaku.utils.Views;

import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleOpacity;
Expand Down Expand Up @@ -724,7 +723,7 @@ public void setOnFeatureClickListener(@NonNull OnFeatureClickListener onFeatureC
public void focusOnUserLocation(boolean focusOnMyLocation) {
if (focusOnMyLocation) {
isMapScrolled = false;
changeTargetIcon(R.drawable.ic_cross_hair_blue);
changeImageButtonResource(currentLocationBtn, R.drawable.ic_cross_hair_blue);

// Enable the listener & show the current user location
updateUserLocationOnMap = true;
Expand All @@ -734,7 +733,7 @@ public void focusOnUserLocation(boolean focusOnMyLocation) {

} else {
updateUserLocationOnMap = false;
changeTargetIcon(R.drawable.ic_cross_hair);
changeImageButtonResource(currentLocationBtn, R.drawable.ic_cross_hair);
}
}

Expand All @@ -745,8 +744,8 @@ public void setBoundsChangeListener(@Nullable BoundsChangeListener boundsChangeL
callBoundsChangedListeners();
}

private void changeTargetIcon(int drawableIcon) {
Views.changeDrawable(currentLocationBtn, drawableIcon);
private void changeImageButtonResource(ImageButton imageButton, int resourceId) {
imageButton.setImageResource(resourceId);
}

private void checkPermissions() {
Expand Down
Binary file modified library/src/main/res/drawable-hdpi/ic_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-hdpi/ic_cross_hair.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-hdpi/ic_cross_hair_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-hdpi/ic_hamburger_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-mdpi/ic_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-mdpi/ic_cross_hair.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-mdpi/ic_cross_hair_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-mdpi/ic_hamburger_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-xhdpi/ic_cross_hair.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-xhdpi/ic_cross_hair_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-xxhdpi/ic_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-xxhdpi/ic_cross_hair.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-xxhdpi/ic_cross_hair_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-xxhdpi/ic_hamburger_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-xxxhdpi/ic_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified library/src/main/res/drawable-xxxhdpi/ic_cross_hair.png
Binary file modified library/src/main/res/drawable-xxxhdpi/ic_cross_hair_blue.png
13 changes: 6 additions & 7 deletions library/src/main/res/layout/mapbox_mapview_internal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
<!-- This is the target button shown on the bottom-right -->
<ImageButton
android:id="@+id/ib_mapview_focusOnMyLocationIcon"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_width="@dimen/my_location_button_dimen"
android:layout_height="@dimen/my_location_button_dimen"
android:src="@drawable/ic_cross_hair"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="@dimen/my_location_btn_margin"
android:layout_marginRight="@dimen/my_location_btn_margin"
android:layout_gravity="top|right"
android:padding="10dp"
android:background="@drawable/circle_button"
Expand All @@ -71,8 +71,8 @@
android:orientation="vertical">

<ImageButton
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_width="@dimen/my_location_button_dimen"
android:layout_height="@dimen/my_location_button_dimen"
android:layout_margin="20dp"
android:id="@+id/imgBtn_mapview_locationAdditionBtn"
android:background="@drawable/circle_button_black_border"
Expand All @@ -90,7 +90,6 @@
android:visibility="gone"
android:layout_marginLeft="20dp"
android:layout_marginBottom="20dp">

<TextView
android:id="@+id/feature_info_text"
android:layout_width="match_parent"
Expand Down
4 changes: 4 additions & 0 deletions library/src/main/res/values-sw600dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<resources>
<dimen name="my_location_button_dimen">70dp</dimen>
<dimen name="my_location_btn_margin">32dp</dimen>
</resources>
2 changes: 2 additions & 0 deletions library/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
<dimen name="info_window_nonfocus_text_size">14dp</dimen>
<dimen name="info_window_focus_padding">14dp</dimen>
<dimen name="info_window_nonfocus_padding">10dp</dimen>
<dimen name="my_location_button_dimen">48dp</dimen>
<dimen name="my_location_btn_margin">16dp</dimen>
</resources>
Binary file added sample/src/main/res/drawable-sw600dp-hdpi/ic_add.png
Binary file added sample/src/main/res/drawable-sw600dp-mdpi/ic_add.png
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<solid android:color="#ffffff" />
<corners android:radius="10dp" />
<corners android:radius="@dimen/hamburger_radius"/>
<padding
android:left="10dp"
android:top="10dp"
Expand Down
8 changes: 4 additions & 4 deletions sample/src/main/res/layout/content_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
android:id="@+id/map_view_hamburger_menu"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_width="@dimen/my_location_button_dimen"
android:layout_height="@dimen/my_location_button_dimen"
android:src="@drawable/ic_hamburger_menu"
android:layout_marginTop="28dp"
android:layout_marginLeft="28dp"
android:layout_marginTop="@dimen/hamburger_margin"
android:layout_marginLeft="@dimen/hamburger_margin"
android:background="@drawable/rounded_square_bg"/>

<Button
Expand Down
5 changes: 5 additions & 0 deletions sample/src/main/res/values-sw600dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="hamburger_margin">48dp</dimen>
<dimen name="hamburger_radius">10dp</dimen>
</resources>
2 changes: 2 additions & 0 deletions sample/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
<dimen name="nav_header_vertical_spacing">16dp</dimen>
<dimen name="nav_header_height">160dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="hamburger_margin">24dp</dimen>
<dimen name="hamburger_radius">5dp</dimen>
</resources>

0 comments on commit 39ee0dc

Please sign in to comment.