Updated solution for map modes does not fit in drawer

This commit is contained in:
Denis 2014-11-12 10:43:42 +02:00
parent a5046bf2d6
commit 2b918acf91
2 changed files with 5 additions and 5 deletions

View file

@ -28,7 +28,7 @@ public class AppModeDialog {
if (showDefault || settings.getApplicationMode() != ApplicationMode.DEFAULT) { if (showDefault || settings.getApplicationMode() != ApplicationMode.DEFAULT) {
selected.add(settings.getApplicationMode()); selected.add(settings.getApplicationMode());
} }
return prepareAppModeView(a, values, selected, parent, singleSelection, onClickListener); return prepareAppModeView(a, values, selected, parent, singleSelection, false, onClickListener);
} }
//special method for drawer menu //special method for drawer menu
@ -41,7 +41,7 @@ public class AppModeDialog {
if (values.size() > 4) { if (values.size() > 4) {
return createDrawerView(a, visible, values, selected, allModes, onClickListener); return createDrawerView(a, visible, values, selected, allModes, onClickListener);
} else { } else {
return prepareAppModeView(a, values, selected, null, true, onClickListener); return prepareAppModeView(a, values, selected, null, true, true, onClickListener);
} }
} }
@ -168,9 +168,9 @@ public class AppModeDialog {
} }
public static View prepareAppModeView(Activity a, final List<ApplicationMode> values , final Set<ApplicationMode> selected, public static View prepareAppModeView(Activity a, final List<ApplicationMode> values , final Set<ApplicationMode> selected,
ViewGroup parent, final boolean singleSelection, final View.OnClickListener onClickListener) { ViewGroup parent, final boolean singleSelection,boolean drawer, final View.OnClickListener onClickListener) {
LinearLayout ll = (LinearLayout) a.getLayoutInflater().inflate(R.layout.mode_toggles, parent); LinearLayout ll = (LinearLayout) a.getLayoutInflater().inflate(R.layout.mode_toggles, parent);
final ToggleButton[] buttons = createToggles(values, ll, a, false); final ToggleButton[] buttons = createToggles(values, ll, a, drawer);
for (int i = 0; i < buttons.length; i++) { for (int i = 0; i < buttons.length; i++) {
setButtonListener(values, selected, onClickListener, buttons, i, singleSelection); setButtonListener(values, selected, onClickListener, buttons, i, singleSelection);
} }

View file

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