Intermediate commit

This commit is contained in:
Victor Shcherb 2011-12-22 21:20:49 +01:00
parent 741fe4089e
commit 6e66378cd4
33 changed files with 82 additions and 45 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 945 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/box_expand_trans_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_expand_trans_pressed" />
<item android:drawable="@drawable/box_expand_trans_normal" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/box_top_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_top_pressed" />
<item android:drawable="@drawable/box_top_simple" />
<item android:state_pressed="true" android:drawable="@drawable/box_top_l_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_top_l_pressed" />
<item android:drawable="@drawable/box_top_l_normal" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/box_top_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_top_pressed" />
<item android:state_pressed="true" android:drawable="@drawable/box_top_l_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_top_l_pressed" />
<item android:drawable="@drawable/box_top_trans_l" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 925 B

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/box_top_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_top_pressed" />
<item android:drawable="@drawable/box_top_simple" />
<item android:state_pressed="true" android:drawable="@drawable/box_top_r_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_top_r_pressed" />
<item android:drawable="@drawable/box_top_r_normal" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/box_top_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_top_pressed" />
<item android:state_pressed="true" android:drawable="@drawable/box_top_r_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_top_r_pressed" />
<item android:drawable="@drawable/box_top_trans_r" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 945 B

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/box_top_stack_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_top_stack_pressed" />
<item android:drawable="@drawable/box_top_stack_normal" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/box_top_stack_pressed" />
<item android:state_focused="true" android:drawable="@drawable/box_top_stack_pressed" />
<item android:drawable="@drawable/box_top_trans" />
</selector>

View file

@ -1062,6 +1062,9 @@ public class OsmandSettings {
public final CommonPreference<Boolean> SHOW_ALTITUDE_INFO =
new BooleanPreference("show_altitude_info", false, false, true);
{
SHOW_ALTITUDE_INFO.setModeDefaultValue(ApplicationMode.CAR, false);
}
public final CommonPreference<Boolean> SHOW_ZOOM_LEVEL =
new BooleanPreference("show_zoom_level", false, false, true);

View file

@ -134,7 +134,7 @@ public class MainMenuActivity extends Activity {
SharedPreferences prefs = activity.getApplicationContext().getSharedPreferences("net.osmand.settings", MODE_WORLD_READABLE);
// only one commit should be with contribution version flag
// prefs.edit().putBoolean(CONTRIBUTION_VERSION_FLAG, true).commit();
// prefs.edit().putBoolean(CONTRIBUTION_VERSION_FLAG, true).commit();
if (prefs.contains(CONTRIBUTION_VERSION_FLAG)) {
SpannableString content = new SpannableString(textVersion);
content.setSpan(new ClickableSpan() {

View file

@ -100,27 +100,24 @@ public class MapInfoLayer extends OsmandMapLayer {
}
public void applyTheme() {
int boxTop = R.drawable.box_top;
int boxTop = R.drawable.box_top_stack;
int boxTopR = R.drawable.box_top_r;
int boxTopL = R.drawable.box_top_l;
int expand = R.drawable.box_expand;
if(view.getSettings().TRANSPARENT_MAP_THEME.get()){
boxTop = R.drawable.box_top_t;
boxTop = R.drawable.box_top_t_stack;
boxTopR = R.drawable.box_top_rt;
boxTopL = R.drawable.box_top_lt;
expand = R.drawable.box_expand_t;
}
int i = 0;
for(MapInfoControl m : rightStack.getAllViews()){
m.setBackgroundDrawable(view.getResources().getDrawable(i == 0 ? boxTopR : boxTop));
i++;
}
rightStack.setExpandImageDrawable(view.getResources().getDrawable(expand));
i = 0;
for(MapInfoControl m : leftStack.getAllViews()){
m.setBackgroundDrawable(view.getResources().getDrawable(i < 2 ? boxTopL : boxTop));
i++;
}
rightStack.setTopDrawable(view.getResources().getDrawable(boxTopR));
rightStack.setStackDrawable(view.getResources().getDrawable(boxTop));
leftStack.setTopDrawable(view.getResources().getDrawable(boxTopL));
leftStack.setStackDrawable(view.getResources().getDrawable(boxTop));
leftStack.setExpandImageDrawable(view.getResources().getDrawable(expand));
rightStack.setExpandImageDrawable(view.getResources().getDrawable(expand));
statusBar.setBackgroundDrawable(view.getResources().getDrawable(boxTop));
showAltitude = view.getSettings().SHOW_ALTITUDE_INFO.get();
}
@ -219,14 +216,15 @@ public class MapInfoLayer extends OsmandMapLayer {
private TextInfoControl createSpeedControl(){
final TextInfoControl speedControl = new TextInfoControl(map, 3, paintText, paintSubText) {
private float cachedSpeed = 0;
// TODO
private float cachedSpeed = 5;
@Override
public boolean updateInfo() {
// draw speed
if (map.getLastKnownLocation() != null && map.getLastKnownLocation().hasSpeed()) {
if (Math.abs(map.getLastKnownLocation().getSpeed() - cachedSpeed) > .3f) {
cachedSpeed = map.getLastKnownLocation().getSpeed();
// if (map.getLastKnownLocation() != null && map.getLastKnownLocation().hasSpeed()) {
// if (Math.abs(map.getLastKnownLocation().getSpeed() - cachedSpeed) > .3f) {
// cachedSpeed = map.getLastKnownLocation().getSpeed();
String ds = OsmAndFormatter.getFormattedSpeed(cachedSpeed, map);
int ls = ds.lastIndexOf(' ');
if (ls == -1) {
@ -235,13 +233,13 @@ public class MapInfoLayer extends OsmandMapLayer {
setText(ds.substring(0, ls), ds.substring(ls + 1));
}
return true;
}
} else if (cachedSpeed != 0) {
cachedSpeed = 0;
setText(null, null);
return true;
}
return false;
// }
// } else if (cachedSpeed != 0) {
// cachedSpeed = 0;
// setText(null, null);
// return true;
// }
// return false;
}
};
speedControl.setText(null, null);
@ -290,12 +288,13 @@ public class MapInfoLayer extends OsmandMapLayer {
@Override
public boolean updateInfo() {
int time = 0;
if (routeLayer != null && routeLayer.getHelper().isRouterEnabled()) {
boolean followingMode = routeLayer.getHelper().isFollowingMode();
time = routeLayer.getHelper().getLeftTime();
int time = 1500;
// TODO
// if (routeLayer != null && routeLayer.getHelper().isRouterEnabled()) {
// boolean followingMode = routeLayer.getHelper().isFollowingMode();
// time = routeLayer.getHelper().getLeftTime();
if (time != 0) {
if (followingMode && showArrivalTime) {
if (/*followingMode && */showArrivalTime) {
long toFindTime = time * 1000 + System.currentTimeMillis();
if (Math.abs(toFindTime - cachedLeftTime) > 30000) {
cachedLeftTime = toFindTime;
@ -316,7 +315,7 @@ public class MapInfoLayer extends OsmandMapLayer {
}
}
}
}
// }
if (time == 0 && cachedLeftTime != 0) {
cachedLeftTime = 0;
setText(null, null);
@ -346,6 +345,7 @@ public class MapInfoLayer extends OsmandMapLayer {
private float[] calculations = new float[1];
private int cachedMeters = 0;
@Override
public boolean updateInfo() {
if (map.getPointToNavigate() != null) {

View file

@ -21,6 +21,9 @@ public class MapStackControl extends ViewGroup {
// by default opened
private boolean isCollapsed = false;
private boolean isCollapsible = true;
private Drawable topDrawable;
private Drawable stackDrawable;
public MapStackControl(Context context) {
super(context);
@ -33,12 +36,12 @@ public class MapStackControl extends ViewGroup {
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int cx = (getLeft() + getRight()) / 2 - getLeft();
int t = (int) (getBottom() - getTop() - 12 * MapInfoLayer.scaleCoefficient);
int t = (int) (10 * MapInfoLayer.scaleCoefficient);
if (!isCollapsed) {
canvas.drawBitmap(arrowUp, cx - arrowUp.getWidth() / 2, t - arrowUp.getHeight(), paintImg);
canvas.drawBitmap(arrowUp, cx - arrowUp.getWidth() / 2, t , paintImg);
} else {
canvas.drawBitmap(arrowDown, cx - arrowDown.getWidth() / 2, t - arrowUp.getHeight(), paintImg);
canvas.drawBitmap(arrowDown, cx - arrowDown.getWidth() / 2, t , paintImg);
}
}
};
@ -57,6 +60,14 @@ public class MapStackControl extends ViewGroup {
public void setExpandImageDrawable(Drawable d) {
expandView.setImageDrawable(d);
}
public void setTopDrawable(Drawable topDrawable) {
this.topDrawable = topDrawable;
}
public void setStackDrawable(Drawable stackDrawable) {
this.stackDrawable = stackDrawable;
}
public void updateInfo() {
for (MapInfoControl v : stackViews) {
@ -107,9 +118,12 @@ public class MapStackControl extends ViewGroup {
int w = 0;
int h = 0;
int prevBot = 0;
boolean first = true;
if (stackViews != null) {
for (MapInfoControl c : stackViews) {
if (c.getVisibility() != View.GONE) {
c.setBackgroundDrawable(first ? topDrawable.mutate() : stackDrawable.mutate());
first = false;
c.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
w = Math.max(w, c.getMeasuredWidth());
if (h > 0) {
@ -125,6 +139,8 @@ public class MapStackControl extends ViewGroup {
if (c.getVisibility() != View.GONE) {
isCollapsible = true;
if (!isCollapsed) {
c.setBackgroundDrawable(first ? topDrawable.mutate() : stackDrawable.mutate());
first = false;
c.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
w = Math.max(w, c.getMeasuredWidth());
h -= c.getPaddingBottom();
@ -145,7 +161,7 @@ public class MapStackControl extends ViewGroup {
}
}
if (isCollapsible) {
h -= prevBot;
// h -= prevBot;
h += expandView.getDrawable().getMinimumHeight();
w = Math.max(w, expandView.getDrawable().getMinimumWidth());
}