mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
5191: Fix UI elements not conforming to dark mode (#5193)
* feedback dialog: fix black font in dark mode * LocationPickerActivity: fix light map in dark mode * Fix #5182 Switch From Mapbox to MapLibre (#5184) * Fix #5182 Switch From Mapbox to MapLibre * Fix #5182 Switch From Mapbox to MapLibre - Resolved requestFeature() issue * Fix #5182 Switch From Mapbox to MapLibre - Resolved dark mode issue on two screens * Fix #5182 Switch From Mapbox to MapLibre - Resolved dark mode issue on additional screens * Fix #5182 Switch From Mapbox to MapLibre - Resolved dark mode issue on notification screen * Fix #5182 Switch From Mapbox to MapLibre - Test errors * fix issue #5015 - custom image selector not identifying photo location (#5190) Co-authored-by: Siva <doodsiva@gmail.com> * feedback dialog: fix black font in dark mode * LocationPickerActivity: fix light map in dark mode * LocationPicker: use predefined style based on device theme * LocationPickerActivityTest: add additional target exception in catch block * LocationPickerConstants: remove extra newline introduced --------- Co-authored-by: Kartikay Kaushik <93285364+kartikaykaushik14@users.noreply.github.com> Co-authored-by: Siva Subramaniam <112970189+siva-subramaniam-v@users.noreply.github.com> Co-authored-by: Siva <doodsiva@gmail.com>
This commit is contained in:
parent
0f1e526326
commit
a5a65fc1ee
4 changed files with 31 additions and 9 deletions
|
|
@ -57,6 +57,7 @@ import fr.free.nrw.commons.R;
|
|||
import fr.free.nrw.commons.Utils;
|
||||
import fr.free.nrw.commons.kvstore.JsonKvStore;
|
||||
import fr.free.nrw.commons.theme.BaseActivity;
|
||||
import fr.free.nrw.commons.utils.SystemThemeUtils;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
|
@ -139,12 +140,21 @@ public class LocationPickerActivity extends BaseActivity implements OnMapReadyCa
|
|||
@Named("default_preferences")
|
||||
public
|
||||
JsonKvStore applicationKvStore;
|
||||
/**
|
||||
* isDarkTheme: for keeping a track of the device theme and modifying the map theme accordingly
|
||||
*/
|
||||
@Inject
|
||||
SystemThemeUtils systemThemeUtils;
|
||||
private boolean isDarkTheme;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
||||
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
isDarkTheme = systemThemeUtils.isDeviceInNightMode();
|
||||
|
||||
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.hide();
|
||||
|
|
@ -238,7 +248,8 @@ public class LocationPickerActivity extends BaseActivity implements OnMapReadyCa
|
|||
@Override
|
||||
public void onMapReady(final MapboxMap mapboxMap) {
|
||||
this.mapboxMap = mapboxMap;
|
||||
mapboxMap.setStyle(Style.getPredefinedStyle("Streets"), this::onStyleLoaded);
|
||||
mapboxMap.setStyle(isDarkTheme ? LocationPickerConstants.DARK_MAP_STYLE :
|
||||
LocationPickerConstants.STREETS_MAP_STYLE, this::onStyleLoaded);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package fr.free.nrw.commons.LocationPicker;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.Style;
|
||||
|
||||
/**
|
||||
* Constants need for location picking
|
||||
*/
|
||||
|
|
@ -11,6 +13,12 @@ public final class LocationPickerConstants {
|
|||
public static final String MAP_CAMERA_POSITION
|
||||
= "location.picker.cameraPosition";
|
||||
|
||||
public static final String DARK_MAP_STYLE
|
||||
= Style.getPredefinedStyle("Dark");
|
||||
|
||||
public static final String STREETS_MAP_STYLE
|
||||
= Style.getPredefinedStyle("Streets");
|
||||
|
||||
|
||||
private LocationPickerConstants() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
android:layout_margin="@dimen/dimen_6"
|
||||
android:padding="@dimen/tiny_gap"
|
||||
android:textSize="24sp"
|
||||
android:textColor="@color/black"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:text="@string/navigation_item_feedback"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
android:layout_margin="@dimen/dimen_6"
|
||||
android:padding="4dp"
|
||||
android:textSize="21sp"
|
||||
android:textColor="@color/black"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:text="@string/select_feedback_data_choice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
|
|
|||
|
|
@ -143,12 +143,15 @@ class LocationPickerActivityUnitTests {
|
|||
method.invoke(activity, mapboxMap)
|
||||
fail("Expected an exception to be thrown")
|
||||
} catch (e: InvocationTargetException) {
|
||||
assertTrue(e.targetException is MapboxConfigurationException)
|
||||
assertEquals(
|
||||
"\nUsing MapView requires calling Mapbox.getInstance(Context context, String apiKey,"
|
||||
+ " WellKnownTileServer wellKnownTileServer) before inflating or creating the view.",
|
||||
e.targetException.message
|
||||
)
|
||||
assertTrue((e.targetException is MapboxConfigurationException) ||
|
||||
(e.targetException is ExceptionInInitializerError))
|
||||
if (e.targetException is MapboxConfigurationException) {
|
||||
assertEquals(
|
||||
"\nUsing MapView requires calling Mapbox.getInstance(Context context, String apiKey,"
|
||||
+ " WellKnownTileServer wellKnownTileServer) before inflating or creating the view.",
|
||||
e.targetException.message
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue