This commit is contained in:
Alexander Sytnyk 2018-01-23 16:47:56 +02:00
parent 5ea0cd0359
commit 003e75498c
5 changed files with 12 additions and 7 deletions

View file

@ -49,6 +49,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginTop="@dimen/dashboard_map_toolbar"
android:visibility="gone">
<net.osmand.plus.views.controls.DynamicListView

View file

@ -406,7 +406,7 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
protected void profileDialog() {
AlertDialog.Builder b = new AlertDialog.Builder(this);
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>();
View v = AppModeDialog.prepareAppModeView(this, selected, false, null, true, false,
View v = AppModeDialog.prepareAppModeView(this, selected, false, null, true, true, false,
new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -22,7 +22,7 @@ import java.util.Set;
public class AppModeDialog {
public static View prepareAppModeView(Activity a, final Set<ApplicationMode> selected, boolean showDefault,
ViewGroup parent, final boolean singleSelection, boolean useMapTheme, final View.OnClickListener onClickListener) {
ViewGroup parent, final boolean singleSelection, boolean useListBg, boolean useMapTheme, final View.OnClickListener onClickListener) {
OsmandSettings settings = ((OsmandApplication) a.getApplication()).getSettings();
final List<ApplicationMode> values = new ArrayList<ApplicationMode>(ApplicationMode.values(settings));
if(!showDefault) {
@ -31,7 +31,7 @@ public class AppModeDialog {
if (showDefault || (settings.getApplicationMode() != ApplicationMode.DEFAULT && !singleSelection)) {
selected.add(settings.getApplicationMode());
}
return prepareAppModeView(a, values, selected, parent, singleSelection, false, useMapTheme, onClickListener);
return prepareAppModeView(a, values, selected, parent, singleSelection, useListBg, useMapTheme, onClickListener);
}
//special method for drawer menu
@ -45,10 +45,14 @@ public class AppModeDialog {
}
public static View prepareAppModeView(Activity a, final List<ApplicationMode> values , final Set<ApplicationMode> selected,
ViewGroup parent, final boolean singleSelection, boolean drawer, boolean useMapTheme, final View.OnClickListener onClickListener) {
ViewGroup parent, final boolean singleSelection, boolean useListBg, boolean useMapTheme, final View.OnClickListener onClickListener) {
View ll = a.getLayoutInflater().inflate(R.layout.mode_toggles, parent);
boolean nightMode = isNightMode(((OsmandApplication) a.getApplication()), useMapTheme);
ll.setBackgroundColor(ContextCompat.getColor(a, nightMode ? R.color.route_info_bg_dark : R.color.route_info_bg_light));
if (useListBg) {
AndroidUtils.setListItemBackground(a, ll, nightMode);
} else {
ll.setBackgroundColor(ContextCompat.getColor(a, nightMode ? R.color.route_info_bg_dark : R.color.route_info_bg_light));
}
final View[] buttons = new View[values.size()];
int k = 0;
for(ApplicationMode ma : values) {

View file

@ -225,7 +225,7 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
modes.remove(ApplicationMode.DEFAULT);
final Set<ApplicationMode> selected = new LinkedHashSet<ApplicationMode>(ApplicationMode.values(settings));
selected.remove(ApplicationMode.DEFAULT);
View v = AppModeDialog.prepareAppModeView(this, modes, selected, null, false, false, false,
View v = AppModeDialog.prepareAppModeView(this, modes, selected, null, false, true, false,
new View.OnClickListener() {
@Override

View file

@ -241,7 +241,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
vg.removeAllViews();
AppModeDialog.prepareAppModeView(mapActivity, selected, false,
vg, true, true, new View.OnClickListener() {
vg, true, false,true, new View.OnClickListener() {
@Override
public void onClick(View v) {
if (selected.size() > 0) {