Add new app mode

This commit is contained in:
vshcherb 2013-11-27 16:58:12 +01:00
parent 83ccbe0eff
commit db3fdf5817
24 changed files with 13 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -18,8 +18,8 @@ public class ApplicationMode {
public static final ApplicationMode CAR = reg(R.string.app_mode_car, R.drawable.ic_car, "car", null);
public static final ApplicationMode BICYCLE = reg(R.string.app_mode_bicycle, R.drawable.ic_bicycle, "bicycle", null);
public static final ApplicationMode PEDESTRIAN = reg(R.string.app_mode_pedestrian, R.drawable.ic_pedestrian, "pedestrian", null);
public static final ApplicationMode AIRCRAFT = reg(R.string.app_mode_aircraft, R.drawable.ic_browse_map, "aircraft", null);
public static final ApplicationMode BOAT = reg(R.string.app_mode_boat, R.drawable.ic_browse_map, "boat", null);
public static final ApplicationMode AIRCRAFT = reg(R.string.app_mode_aircraft, R.drawable.ic_aircraft, "aircraft", null);
public static final ApplicationMode BOAT = reg(R.string.app_mode_boat, R.drawable.ic_sail_boat, "boat", null);
private static ApplicationMode reg(int key, int iconId, String stringKey, ApplicationMode parent) {
@ -74,6 +74,10 @@ public class ApplicationMode {
return nightMode? R.drawable.ic_action_bicycle_dark : R.drawable.ic_action_bicycle_light;
} else if(this == ApplicationMode.PEDESTRIAN){
return nightMode? R.drawable.ic_action_pedestrian_dark : R.drawable.ic_action_pedestrian_light;
} else if(this == ApplicationMode.BOAT){
return nightMode? R.drawable.ic_action_sail_boat_dark : R.drawable.ic_action_sail_boat_light;
} else if(this == ApplicationMode.AIRCRAFT){
return nightMode? R.drawable.ic_action_aircraft_dark : R.drawable.ic_action_aircraft_light;
} else {
return nightMode? R.drawable.app_mode_globus_dark : R.drawable.app_mode_globus_light;
}

View file

@ -31,8 +31,9 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
@ -281,6 +282,9 @@ public class NavigateAction {
private static ToggleButton[] createToggles(final List<ApplicationMode> values, LinearLayout topLayout, Context ctx) {
final ToggleButton[] buttons = new ToggleButton[values.size()];
HorizontalScrollView scroll = new HorizontalScrollView(ctx);
topLayout.addView(scroll);
int k = 0;
int left = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, ctx.getResources().getDisplayMetrics());
@ -292,9 +296,9 @@ public class NavigateAction {
tb.setTextOff("");
tb.setContentDescription(ma.toHumanString(ctx));
tb.setButtonDrawable(ma.getIconId());
LayoutParams lp = new LinearLayout.LayoutParams(metrics, metrics);
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(metrics, metrics);
lp.setMargins(left, 0, 0, 0);
topLayout.addView(tb, lp);
scroll.addView(tb, lp);
}
return buttons;