Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
LocationPickerActivity: fix light map in dark mode
  • Loading branch information
RitikaPahwa4444 committed Mar 31, 2023
commit fbbd837e3789b28490e52c463a30c1fd7487ae0c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
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;
Expand Down Expand Up @@ -139,12 +140,24 @@ 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);

<<<<<<< HEAD
=======
isDarkTheme = systemThemeUtils.isDeviceInNightMode();

getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
>>>>>>> LocationPickerActivity: fix light map in dark mode
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.hide();
Expand Down Expand Up @@ -238,7 +251,11 @@ private void getToolbarUI() {
@Override
public void onMapReady(final MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
<<<<<<< HEAD
mapboxMap.setStyle(Style.getPredefinedStyle("Streets"), this::onStyleLoaded);
=======
mapboxMap.setStyle(isDarkTheme ? Style.DARK : Style.MAPBOX_STREETS, this::onStyleLoaded);
>>>>>>> LocationPickerActivity: fix light map in dark mode
}

/**
Expand Down