Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-12-22 21:09:07 +01:00
commit 46e0931040
102 changed files with 3493 additions and 1427 deletions

View file

@ -26,6 +26,7 @@ public class Amenity extends MapObject {
public static final String WEBSITE = "website"; public static final String WEBSITE = "website";
public static final String PHONE = "phone"; public static final String PHONE = "phone";
public static final String DESCRIPTION = "description"; public static final String DESCRIPTION = "description";
public static final String ROUTE = "route";
public static final String OPENING_HOURS = "opening_hours"; public static final String OPENING_HOURS = "opening_hours";
public static final String CONTENT = "content"; public static final String CONTENT = "content";
public static final String CUISINE = "cuisine"; public static final String CUISINE = "cuisine";

View file

@ -28,6 +28,10 @@ public class OpeningHoursParser {
private static final String[] monthsStr; private static final String[] monthsStr;
private static final String[] localMothsStr; private static final String[] localMothsStr;
private static final int LOW_TIME_LIMIT = 120;
private static final int HIGH_TIME_LIMIT = 300;
private static final int WITHOUT_TIME_LIMIT = -1;
static { static {
DateFormatSymbols dateFormatSymbols = DateFormatSymbols.getInstance(Locale.US); DateFormatSymbols dateFormatSymbols = DateFormatSymbols.getInstance(Locale.US);
monthsStr = dateFormatSymbols.getShortMonths(); monthsStr = dateFormatSymbols.getShortMonths();
@ -186,6 +190,76 @@ public class OpeningHoursParser {
return isOpenDay || isOpenPrevious; return isOpenDay || isOpenPrevious;
} }
public boolean isOpened24_7() {
boolean opened24_7 = false;
for (OpeningHoursRule r : rules) {
opened24_7 = r.isOpened24_7();
}
return opened24_7;
}
public String getNearToOpeningTime(Calendar cal) {
return getTime(cal, LOW_TIME_LIMIT, true);
}
public String getOpeningTime(Calendar cal) {
return getTime(cal, HIGH_TIME_LIMIT, true);
}
public String getNearToClosingTime(Calendar cal) {
return getTime(cal, LOW_TIME_LIMIT, false);
}
public String getClosingTime(Calendar cal) {
return getTime(cal, WITHOUT_TIME_LIMIT, false);
}
public String getOpeningDay(Calendar calendar) {
Calendar cal = (Calendar) calendar.clone();
String openingTime = "";
for (int i = 0; i < 7; i++) {
cal.add(Calendar.DAY_OF_MONTH, 1);
for (OpeningHoursRule r : rules) {
if (r.containsDay(cal) && r.containsMonth(cal)) {
openingTime = r.getTime(cal, false, WITHOUT_TIME_LIMIT, true);
}
}
if (!Algorithms.isEmpty(openingTime)) {
openingTime += " " + localDaysStr[cal.get(Calendar.DAY_OF_WEEK)];
break;
}
}
return openingTime;
}
private String getTime(Calendar cal, int limit, boolean opening) {
String time = getTimeDay(cal, limit, opening);
if (Algorithms.isEmpty(time)) {
time = getTimeAnotherDay(cal, limit, opening);
}
return time;
}
private String getTimeDay(Calendar cal, int limit, boolean opening) {
String atTime = "";
for (OpeningHoursRule r : rules) {
if (r.containsDay(cal) && r.containsMonth(cal)) {
atTime = r.getTime(cal, false, limit, opening);
}
}
return atTime;
}
private String getTimeAnotherDay(Calendar cal, int limit, boolean opening) {
String atTime = "";
for (OpeningHoursRule r : rules) {
if (((opening && r.containsPreviousDay(cal)) || (!opening && r.containsNextDay(cal))) && r.containsMonth(cal)) {
atTime = r.getTime(cal, true, limit, opening);
}
}
return atTime;
}
public String getCurrentRuleTime(Calendar cal) { public String getCurrentRuleTime(Calendar cal) {
// make exception for overlapping times i.e. // make exception for overlapping times i.e.
// (1) Mo 14:00-16:00; Tu off // (1) Mo 14:00-16:00; Tu off
@ -318,6 +392,14 @@ public class OpeningHoursParser {
*/ */
public boolean containsDay(Calendar cal); public boolean containsDay(Calendar cal);
/**
* Check if the next day after "cal" is part of this rule
*
* @param cal the time to check
* @return true if the next day is part of the rule
*/
boolean containsNextDay(Calendar cal);
/** /**
* Check if the month of "cal" is part of this rule * Check if the month of "cal" is part of this rule
* *
@ -341,6 +423,10 @@ public class OpeningHoursParser {
public String toRuleString(); public String toRuleString();
public String toLocalRuleString(); public String toLocalRuleString();
boolean isOpened24_7();
String getTime(Calendar cal, boolean checkAnotherDay, int limit, boolean opening);
} }
/** /**
@ -558,6 +644,16 @@ public class OpeningHoursParser {
return false; return false;
} }
@Override
public boolean containsNextDay(Calendar cal) {
int i = cal.get(Calendar.DAY_OF_WEEK);
int p = (i + 6) % 7;
if (days[p]) {
return true;
}
return false;
}
/** /**
* Check if the previous weekday of time "cal" is part of this rule * Check if the previous weekday of time "cal" is part of this rule
* *
@ -597,14 +693,10 @@ public class OpeningHoursParser {
*/ */
@Override @Override
public boolean isOpenedForTime(Calendar cal, boolean checkPrevious) { public boolean isOpenedForTime(Calendar cal, boolean checkPrevious) {
int i = cal.get(Calendar.DAY_OF_WEEK); int d = getCurrentDay(cal);
int d = (i + 5) % 7; int p = getPreviousDay(d);
int p = d - 1; int time = getCurrentTimeInMinutes(cal); // Time in minutes
if (p < 0) { for (int i = 0; i < startTimes.size(); i++) {
p += 7;
}
int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE); // Time in minutes
for (i = 0; i < startTimes.size(); i++) {
int startTime = this.startTimes.get(i); int startTime = this.startTimes.get(i);
int endTime = this.endTimes.get(i); int endTime = this.endTimes.get(i);
if (startTime < endTime || endTime == -1) { if (startTime < endTime || endTime == -1) {
@ -628,6 +720,30 @@ public class OpeningHoursParser {
return false; return false;
} }
private int getCurrentDay(Calendar cal) {
int i = cal.get(Calendar.DAY_OF_WEEK);
return (i + 5) % 7;
}
private int getPreviousDay(int currentDay) {
int p = currentDay - 1;
if (p < 0) {
p += 7;
}
return p;
}
private int getNextDay(int currentDay) {
int n = currentDay + 1;
if (n > 6) {
n -= 7;
}
return n;
}
private int getCurrentTimeInMinutes(Calendar cal) {
return cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE);
}
@Override @Override
public String toRuleString() { public String toRuleString() {
@ -658,24 +774,17 @@ public class OpeningHoursParser {
addArray(dayMonths, null, b); addArray(dayMonths, null, b);
} }
// Day // Day
boolean open24_7 = true;
for (int i = 0; i < 7; i++) {
if (!days[i]) {
open24_7 = false;
break;
}
}
appendDaysString(b, dayNames); appendDaysString(b, dayNames);
// Time // Time
if (startTimes == null || startTimes.size() == 0) { if (startTimes == null || startTimes.size() == 0) {
b.append("off"); b.append("off");
} else { } else {
if (isOpened24_7()) {
return "24/7";
}
for (int i = 0; i < startTimes.size(); i++) { for (int i = 0; i < startTimes.size(); i++) {
int startTime = startTimes.get(i); int startTime = startTimes.get(i);
int endTime = endTimes.get(i); int endTime = endTimes.get(i);
if (open24_7 && startTime == 0 && endTime / 60 == 24) {
return "24/7";
}
if(i > 0) { if(i > 0) {
b.append(", "); b.append(", ");
} }
@ -725,6 +834,84 @@ public class OpeningHoursParser {
return toRuleString(localDaysStr, localMothsStr); return toRuleString(localDaysStr, localMothsStr);
} }
@Override
public boolean isOpened24_7() {
boolean opened24_7 = true;
for (int i = 0; i < 7; i++) {
if (!days[i]) {
opened24_7 = false;
break;
}
}
if (opened24_7 && startTimes != null && startTimes.size() > 0) {
for (int i = 0; i < startTimes.size(); i++) {
int startTime = startTimes.get(i);
int endTime = endTimes.get(i);
if (startTime == 0 && endTime / 60 == 24) {
return true;
}
}
}
return false;
}
@Override
public String getTime(Calendar cal, boolean checkAnotherDay, int limit, boolean opening) {
StringBuilder sb = new StringBuilder();
int d = getCurrentDay(cal);
int ad = opening ? getNextDay(d) : getPreviousDay(d);
int time = getCurrentTimeInMinutes(cal);
for (int i = 0; i < startTimes.size(); i++) {
int startTime = startTimes.get(i);
int endTime = endTimes.get(i);
if (opening) {
if (startTime < endTime || endTime == -1) {
if (days[d] && !checkAnotherDay) {
int diff = startTime - time;
if (limit == WITHOUT_TIME_LIMIT || ((time <= startTime) && (diff <= limit))) {
formatTime(startTime, sb);
break;
}
}
} else {
int diff = -1;
if (time <= startTime && days[d] && !checkAnotherDay) {
diff = startTime - time;
} else if (time > endTime && days[ad] && checkAnotherDay) {
diff = 24 * 60 - endTime + time;
}
if (limit == WITHOUT_TIME_LIMIT || ((diff != -1) && (diff <= limit))) {
formatTime(startTime, sb);
break;
}
}
} else {
if (startTime < endTime && endTime != -1) {
if (days[d] && !checkAnotherDay) {
int diff = endTime - time;
if (limit == WITHOUT_TIME_LIMIT || ((time <= endTime) && (diff <= limit))) {
formatTime(endTime, sb);
break;
}
}
} else {
int diff = -1;
if (time <= endTime && days[d] && !checkAnotherDay) {
diff = 24 * 60 - time + endTime;
} else if (time < endTime && days[ad] && checkAnotherDay) {
diff = startTime - time;
}
if (limit == WITHOUT_TIME_LIMIT || ((diff != -1) && (diff <= limit))) {
formatTime(endTime, sb);
break;
}
}
}
}
return sb.toString();
}
@Override @Override
public String toString() { public String toString() {
return toRuleString(); return toRuleString();
@ -900,6 +1087,11 @@ public class OpeningHoursParser {
return false; return false;
} }
@Override
public boolean containsNextDay(Calendar cal) {
return false;
}
@Override @Override
public boolean containsMonth(Calendar cal) { public boolean containsMonth(Calendar cal) {
return false; return false;
@ -915,6 +1107,16 @@ public class OpeningHoursParser {
return toRuleString(); return toRuleString();
} }
@Override
public boolean isOpened24_7() {
return false;
}
@Override
public String getTime(Calendar cal, boolean checkAnotherDay, int limit, boolean opening) {
return "";
}
@Override @Override
public String toString() { public String toString() {
return toRuleString(); return toRuleString();
@ -1260,6 +1462,11 @@ public class OpeningHoursParser {
b.append(t); b.append(t);
} }
private static void formatTime(int minutes, StringBuilder sb) {
int hour = minutes / 60;
int time = minutes - hour * 60;
formatTime(hour, time, sb);
}
/** /**
* test if the calculated opening hours are what you expect * test if the calculated opening hours are what you expect

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -6,7 +6,7 @@
<item> <item>
<shape> <shape>
<solid <solid
android:color="@color/bg_color_dark" /> android:color="@color/ctx_menu_bg_dark" />
</shape> </shape>
</item> </item>
</layer-list> </layer-list>

View file

@ -6,7 +6,7 @@
<item> <item>
<shape> <shape>
<solid <solid
android:color="@color/bg_color_light" /> android:color="@color/ctx_menu_bg_light" />
</shape> </shape>
</item> </item>
</layer-list> </layer-list>

View file

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

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctx_menu_controller_button_bg_color_dark_n" />
<stroke
android:width="1dp"
android:color="@color/ctx_menu_controller_button_outline_color_dark_n" />
<corners android:radius="3dp" />
</shape>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctx_menu_controller_button_bg_color_dark_p" />
<stroke
android:width="1dp"
android:color="@color/ctx_menu_controller_button_outline_color_dark_p" />
<corners android:radius="3dp" />
</shape>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctx_menu_bottom_view_bg_dark" />
<stroke
android:width="1dp"
android:color="@color/ctx_menu_controller_button_outline_color_dark_n" />
<corners android:radius="3dp" />
</shape>

View file

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

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctx_menu_controller_button_bg_color_dark_n" />
<corners android:radius="3dp" />
</shape>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctx_menu_controller_button_bg_color_dark_p" />
<corners android:radius="3dp" />
</shape>

View file

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

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctx_menu_controller_button_bg_color_light_n" />
<stroke
android:width="1dp"
android:color="@color/ctx_menu_controller_button_outline_color_light_n" />
<corners android:radius="3dp" />
</shape>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctx_menu_controller_button_bg_color_light_p" />
<stroke
android:width="1dp"
android:color="@color/ctx_menu_controller_button_outline_color_light_p" />
<corners android:radius="3dp" />
</shape>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctx_menu_bottom_view_bg_light" />
<stroke
android:width="1dp"
android:color="@color/ctx_menu_controller_button_outline_color_light_n" />
<corners android:radius="3dp" />
</shape>

View file

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

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctx_menu_controller_button_bg_color_light_n" />
<corners android:radius="3dp" />
</shape>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/ctx_menu_controller_button_bg_color_light_p" />
<corners android:radius="3dp" />
</shape>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/ctx_menu_controller_button_text_color_dark_p" android:state_pressed="true"/>
<item android:color="@color/ctx_menu_controller_button_text_color_dark_n"/>
</selector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/ctx_menu_controller_button_text_color_light_p" android:state_pressed="true"/>
<item android:color="@color/ctx_menu_controller_button_text_color_light_n"/>
</selector>

View file

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

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/route_info_go_btn_bg_dark" />
<stroke
android:width="1dp"
android:color="@color/route_info_go_btn_inking_dark" />
<corners android:radius="3dp" />
</shape>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/route_info_go_btn_bg_dark_p" />
<stroke
android:width="1dp"
android:color="@color/route_info_go_btn_inking_dark" />
<corners android:radius="3dp" />
</shape>

View file

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

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/route_info_go_btn_bg_light" />
<stroke
android:width="1dp"
android:color="@color/route_info_go_btn_inking_light" />
<corners android:radius="3dp" />
</shape>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/route_info_go_btn_bg_light_p" />
<stroke
android:width="1dp"
android:color="@color/route_info_go_btn_inking_light" />
<corners android:radius="3dp" />
</shape>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bg_contextmenu_shadow_top_light" />
</item>
<item>
<shape>
<solid android:color="@color/route_info_bg_dark" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bg_contextmenu_shadow_right_light" />
</item>
<item>
<shape>
<solid
android:color="@color/route_info_bg_dark" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bg_contextmenu_shadow_right_light" />
</item>
<item>
<shape>
<solid
android:color="@color/route_info_bg_light" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<nine-patch android:src="@drawable/bg_contextmenu_shadow_top_light" />
</item>
<item>
<shape>
<solid android:color="@color/route_info_bg_light" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/dashboard_blue" />
<corners android:radius="3dp" />
</shape>

View file

@ -5,16 +5,49 @@
android:layout_width="@dimen/dashboard_land_width" android:layout_width="@dimen/dashboard_land_width"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="?attr/left_menu_view_bg" tools:background="?attr/left_menu_view_bg"
android:orientation="vertical"> android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools">
<ListView <LinearLayout
android:id="@+id/list" android:orientation="vertical"
android:id="@+id/content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:divider="@null"
android:dividerHeight="0dp">
</ListView> <ListView
android:clipToPadding="false"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="@null"
android:dividerHeight="0dp"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/cancel_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/cancel_row_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -5,14 +5,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/color_transparent" android:background="@color/color_transparent"
android:clickable="true"> android:clickable="true"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout <LinearLayout
android:id="@+id/main_view" android:id="@+id/main_view"
android:layout_width="@dimen/dashboard_land_width" android:layout_width="@dimen/dashboard_land_width"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@drawable/bg_left_menu_dark" tools:background="@drawable/route_info_menu_bg_dark"
android:clickable="true" android:clickable="true"
android:orientation="vertical"> android:orientation="vertical">
@ -24,7 +25,7 @@
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height" android:layout_height="@dimen/route_info_modes_height"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
@ -73,162 +74,214 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <FrameLayout
android:id="@+id/FromLayout" android:layout_width="match_parent"
android:layout_width="fill_parent" android:layout_height="wrap_content">
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/fromIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:orientation="vertical"
android:layout_height="match_parent" android:layout_width="match_parent"
android:layout_weight="1" android:layout_height="wrap_content">
android:orientation="vertical">
<TextView <LinearLayout
android:id="@+id/fromTitle" android:id="@+id/FromLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="5dp"
android:text="@string/route_from"
android:textSize="@dimen/default_sub_text_size"/>
<Spinner
android:id="@+id/FromSpinner"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/list_item_height"
android:layout_marginLeft="-8dp" android:orientation="horizontal">
android:background="@null"
android:textSize="@dimen/default_list_text_size"/> <ImageView
android:id="@+id/fromIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/fromTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="5dp"
android:text="@string/route_from"
android:textSize="@dimen/default_sub_text_size"/>
<Spinner
android:id="@+id/FromSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/fromDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
<View
android:id="@+id/from_layout_empty_view"
android:layout_width="@dimen/route_info_directions_margin"
android:layout_height="match_parent"/>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_marginStart="@dimen/route_info_divider_margin"
android:layout_marginLeft="@dimen/route_info_divider_margin"
android:layout_marginRight="@dimen/route_info_directions_margin"
android:layout_marginEnd="@dimen/route_info_directions_margin"
android:id="@+id/dividerFromDropDown"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dashboard_divider_dark"
android:focusable="false"/>
<View
android:id="@+id/divider_from_drop_down_empty"
android:layout_gravity="end"
android:layout_width="@dimen/route_info_directions_margin"
android:layout_height="1dp"
android:focusable="false"
android:background="@color/dashboard_divider_dark"/>
</FrameLayout>
<LinearLayout
android:id="@+id/ViaLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/viaIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/ViaSubView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="@string/route_via"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:id="@+id/ViaView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/list_content_padding"
android:gravity="left"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_marginStart="@dimen/route_info_divider_margin"
android:layout_marginLeft="@dimen/route_info_divider_margin"
android:id="@+id/viaLayoutDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dashboard_divider_dark"
android:focusable="false"/>
<LinearLayout
android:id="@+id/ToLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/toIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/toTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:text="@string/route_to"
android:textSize="@dimen/default_sub_text_size">
</TextView>
<Spinner
android:id="@+id/ToSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/toDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
<View
android:id="@+id/to_layout_empty_view"
android:layout_width="@dimen/route_info_directions_margin"
android:layout_height="match_parent"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:id="@+id/fromDropDownIcon" android:id="@+id/swap_direction_image_view"
android:visibility="gone"
android:paddingRight="@dimen/route_info_icon_padding_right"
android:paddingLeft="@dimen/route_info_icon_padding_right"
android:layout_gravity="end"
tools:src="@drawable/ic_action_test_light"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"/>
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/dividerFromDropDown"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dashboard_divider_dark"
android:focusable="false"/>
<LinearLayout
android:id="@+id/ViaLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/viaIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/ViaSubView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="@string/route_via"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:id="@+id/ViaView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/list_content_padding"
android:gravity="left"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/viaLayoutDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dashboard_divider_dark"
android:focusable="false"/>
<LinearLayout
android:id="@+id/ToLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/toIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/toTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:text="@string/route_to"
android:textSize="@dimen/default_sub_text_size">
</TextView>
<Spinner
android:id="@+id/ToSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/toDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout>
<View <View
android:id="@+id/dividerToDropDown" android:id="@+id/dividerToDropDown"
@ -373,7 +426,9 @@
android:background="@color/dashboard_divider_dark" android:background="@color/dashboard_divider_dark"
android:focusable="false"/> android:focusable="false"/>
<include layout="@layout/map_route_prepare_bottom"/> <include
android:id="@+id/map_route_prepare_bottom_view"
layout="@layout/map_route_prepare_bottom"/>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
</LinearLayout>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_fav_dark"/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:text="@string/import_as_favorites"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/header_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
android:paddingStart="@dimen/content_padding"
tools:text="@string/import_file"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout>

View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingBottom="12dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">
<net.osmand.plus.widgets.TextViewEx
android:textAllCaps="true"
osmand:typeface="@string/font_roboto_medium"
android:id="@+id/route_ref"
android:layout_width="32dp"
android:layout_height="18dp"
android:background="@drawable/transport_stop_route_bg"
android:gravity="center"
android:textColor="@color/color_white"
android:textSize="@dimen/default_sub_text_size_small"
tools:text="3"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:orientation="vertical">
<TextView
android:textSize="16sp"
android:id="@+id/route_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="№5: Льва Толстого площа - Белицкая улица (25м)"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="8dp">
<ImageView
android:id="@+id/route_type_icon"
android:layout_marginRight="@dimen/context_menu_transport_grid_spacing"
android:layout_marginEnd="@dimen/context_menu_transport_grid_spacing"
android:layout_width="@dimen/context_menu_transport_icon_size"
android:layout_height="@dimen/context_menu_transport_icon_size"
tools:src="@drawable/ic_action_polygom_dark"/>
<TextView
android:id="@+id/route_type_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Метро "/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
<include layout="@layout/bottom_sheet_dialog_fragment_title"/>
<LinearLayout
android:orientation="vertical"
android:id="@+id/context_menu_items_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/cancel_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>

View file

@ -5,7 +5,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/transparent"> android:background="@android:color/transparent"
xmlns:osmand="http://schemas.android.com/apk/res-auto">
<LinearLayout <LinearLayout
android:id="@+id/context_menu_main" android:id="@+id/context_menu_main"
@ -13,14 +14,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:id="@+id/context_menu_top_shadow"
android:layout_width="match_parent"
android:layout_height="@dimen/context_menu_top_shadow_h"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/context_menu_top_shadow_all" android:id="@+id/context_menu_top_shadow_all"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -33,132 +26,118 @@
android:id="@+id/context_menu_top_view" android:id="@+id/context_menu_top_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/context_menu_first_line_bottom_margin" android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:baselineAligned="false" android:paddingRight="@dimen/context_menu_padding_margin_default"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/context_menu_icon_layout" android:layout_marginTop="@dimen/context_menu_first_line_top_margin"
android:layout_width="52dp" android:layout_marginRight="@dimen/context_menu_padding_margin_default"
android:layout_height="match_parent"> android:layout_marginEnd="@dimen/context_menu_padding_margin_default"
android:layout_width="0dp"
<ImageView android:layout_weight="1"
android:id="@+id/context_menu_icon_view"
android:layout_width="@dimen/map_widget_icon"
android:layout_height="@dimen/map_widget_icon"
android:layout_marginLeft="16dp"
android:layout_marginStart="12dp"
android:layout_marginTop="@dimen/context_menu_icon_top_padding"
android:src="@drawable/ic_action_building_number"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <TextView
android:layout_width="match_parent" android:id="@+id/context_menu_line1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:text="@string/search_address_building"
android:orientation="horizontal"> style="@style/TextAppearance.ContextMenuTitle"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_marginTop="@dimen/context_menu_subtitle_margin"
android:layout_height="wrap_content" android:id="@+id/context_menu_line2_layout"
android:layout_marginTop="@dimen/context_menu_first_line_top_margin" android:layout_width="wrap_content"
android:layout_weight="1"> android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/context_menu_line1" android:id="@+id/context_menu_line2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/search_address_building"
style="@style/TextAppearance.ContextMenuTitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/context_menu_close_btn_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:minWidth="@dimen/context_menu_top_right_button_min_width" android:layout_gravity="center_vertical"
android:orientation="horizontal"> android:text="@string/amenity_type_finance"
style="@style/TextAppearance.ContextMenuSubtitle"/>
<Button
android:id="@+id/title_button_top_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:text="@string/shared_string_others"
android:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout </LinearLayout>
android:layout_width="match_parent"
<ImageView
android:id="@+id/context_menu_icon_view"
android:layout_width="@dimen/map_widget_icon"
android:layout_height="@dimen/map_widget_icon"
android:layout_marginTop="@dimen/context_menu_padding_margin_default"
android:src="@drawable/ic_action_building_number"/>
</LinearLayout>
<GridView
android:id="@+id/transport_stop_routes_grid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnWidth="@dimen/context_menu_transport_grid_item_width"
android:horizontalSpacing="@dimen/context_menu_transport_grid_spacing"
android:numColumns="auto_fit"
android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:paddingRight="@dimen/context_menu_padding_margin_default"
android:paddingTop="@dimen/context_menu_transport_padding_top"
android:paddingBottom="@dimen/context_menu_transport_grid_spacing"
android:verticalSpacing="@dimen/context_menu_transport_grid_spacing"
android:visibility="gone"/>
<LinearLayout
android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:paddingRight="@dimen/context_menu_padding_margin_default"
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
android:layout_marginBottom="@dimen/context_menu_direction_margin"
android:gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="@dimen/context_menu_sub_info_height"
android:orientation="horizontal">
<TextView
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:layout_marginEnd="@dimen/context_menu_padding_margin_small"
tools:text="Museum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/context_menu_line3"
style="@style/TextAppearance.ContextMenuSubtitle"/>
<TextView
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:layout_marginEnd="@dimen/context_menu_padding_margin_small"
tools:text="Closed till 10:00"
android:id="@+id/opening_hours_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/compass_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
tools:src="@drawable/ic_direction_arrow"
android:id="@+id/direction"
android:layout_width="@dimen/directionIconSize"
android:layout_height="@dimen/directionIconSize"
android:layout_marginTop="1sp"
android:layout_gravity="center_vertical"/>
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_gravity="center_vertical"
android:layout_marginTop="@dimen/context_menu_second_line_top_margin" android:layout_marginLeft="2dp"
android:orientation="horizontal"> android:layout_marginStart="2dp"
tools:textColor="?android:textColorSecondary"
<LinearLayout android:textSize="@dimen/default_desc_text_size"
android:layout_width="match_parent" tools:text="100500 km"/>
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/context_menu_line2_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/context_menu_line2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/amenity_type_finance"
style="@style/TextAppearance.ContextMenuSubtitle"/>
</LinearLayout>
<LinearLayout
android:id="@+id/compass_layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="@dimen/context_menu_top_right_button_min_width"
android:orientation="horizontal">
<ImageView
android:id="@+id/direction"
android:layout_width="@dimen/directionIconSize"
android:layout_height="@dimen/directionIconSize"
android:layout_marginTop="1sp"
android:layout_gravity="center_vertical"/>
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="2dp"
android:layout_marginRight="4dp"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="100500 km"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
@ -168,145 +147,187 @@
android:id="@+id/title_button_container" android:id="@+id/title_button_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/context_menu_buttons_top_margin"
android:clickable="true" android:clickable="true"
android:minHeight="@dimen/context_menu_action_buttons_h" android:orientation="horizontal"
android:orientation="vertical" android:paddingBottom="@dimen/context_menu_padding_margin_small"
android:paddingBottom="@dimen/context_menu_buttons_padding_bottom"
android:paddingLeft="62dp"
android:paddingRight="2dp"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_height="wrap_content"> android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:id="@+id/title_button_view"
android:background="?attr/ctx_menu_controller_bg"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/context_menu_controller_height"
android:orientation="horizontal">
<Button <net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_medium"
android:id="@+id/title_button" android:id="@+id/title_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="?attr/selectableItemBackground" android:background="@null"
android:gravity="left|center_vertical" android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x" android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x" android:paddingRight="@dimen/context_menu_button_padding_x"
android:textAllCaps="true"
android:text="@string/recording_context_menu_play" android:text="@string/recording_context_menu_play"
android:textColor="?attr/contextMenuButtonColor" android:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_desc_text_size"/>
<TextView <TextView
android:id="@+id/title_button_right_text" android:id="@+id/title_button_right_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="-4dp"
android:clickable="true"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
tools:text="— 00:26"/> tools:text="— 00:26"/>
<Button </LinearLayout>
<LinearLayout
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:id="@+id/title_button_right_view"
android:background="?attr/ctx_menu_controller_bg"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/context_menu_controller_height"
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_medium"
android:textAllCaps="true"
android:id="@+id/title_button_right" android:id="@+id/title_button_right"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="?attr/selectableItemBackground" android:background="@null"
android:gravity="center" android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x" android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x" android:paddingRight="@dimen/context_menu_button_padding_x"
android:text="@string/shared_string_delete" android:text="@string/shared_string_delete"
android:textColor="?attr/contextMenuButtonColor" android:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout> </LinearLayout>
<View
android:id="@+id/title_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:background="?attr/dashboard_divider"
android:visibility="gone"
tools:visibility="visible"/>
<Button
android:id="@+id/subtitle_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="left|center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:text="@string/recording_context_menu_play"
android:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/download_buttons_container" android:id="@+id/download_buttons_container"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="@dimen/context_menu_action_buttons_h"
android:layout_marginTop="@dimen/context_menu_buttons_top_margin"
android:clickable="true" android:clickable="true"
android:orientation="vertical" android:orientation="horizontal"
android:paddingBottom="@dimen/context_menu_buttons_padding_bottom" android:paddingBottom="@dimen/context_menu_padding_margin_small"
android:paddingLeft="62dp"
android:paddingRight="2dp"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">
<View
android:id="@+id/download_buttons_top_border"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:background="?attr/dashboard_divider"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:id="@+id/download_button_left_view"
android:layout_height="wrap_content" android:background="?attr/ctx_menu_controller_bg"
android:orientation="horizontal"> android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/context_menu_controller_height">
<Button <net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_medium"
android:textAllCaps="true"
android:id="@+id/download_button_left" android:id="@+id/download_button_left"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="?attr/selectableItemBackground" android:background="@null"
android:gravity="left|center_vertical" android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x" android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x" android:paddingRight="@dimen/context_menu_button_padding_x"
android:text="@string/shared_string_download" android:text="@string/shared_string_download"
android:textColor="?attr/contextMenuButtonColor" android:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_desc_text_size"/>
<Button </LinearLayout>
<LinearLayout
android:id="@+id/download_button_right_view"
android:background="?attr/ctx_menu_controller_bg"
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="@dimen/context_menu_controller_height">
<net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_medium"
android:textAllCaps="true"
android:id="@+id/download_button_right" android:id="@+id/download_button_right"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="?attr/selectableItemBackground" android:background="@null"
android:gravity="center" android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x" android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x" android:paddingRight="@dimen/context_menu_button_padding_x"
android:text="@string/shared_string_delete" android:text="@string/shared_string_delete"
android:textColor="?attr/contextMenuButtonColor" android:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"/> android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/title_bottom_button_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:orientation="horizontal"
android:paddingBottom="@dimen/context_menu_padding_margin_small"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:id="@+id/title_button_bottom_view"
android:layout_width="0dp"
android:layout_height="@dimen/context_menu_controller_height"
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
android:layout_weight="1"
android:background="?attr/ctx_menu_controller_bg">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title_button_bottom"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"
android:gravity="center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:text="@string/shared_string_others"
android:textAllCaps="true"
android:textColor="?attr/ctx_menu_controller_text_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/title_progress_container" android:id="@+id/title_progress_container"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/context_menu_buttons_top_margin"
android:clickable="true" android:clickable="true"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="@dimen/context_menu_action_buttons_h" android:minHeight="@dimen/context_menu_action_buttons_h"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingBottom="@dimen/context_menu_buttons_padding_bottom" android:paddingBottom="@dimen/context_menu_padding_margin_small"
android:paddingLeft="72dp" android:paddingLeft="@dimen/context_menu_progress_padding_left"
android:paddingRight="2dp" android:paddingStart="@dimen/context_menu_progress_padding_left"
android:paddingRight="@dimen/context_menu_progress_padding_right"
android:paddingEnd="@dimen/context_menu_progress_padding_right"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">
@ -358,74 +379,194 @@
android:id="@+id/buttons_top_border" android:id="@+id/buttons_top_border"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?attr/dashboard_divider"/> android:background="?attr/ctx_menu_divider"/>
<LinearLayout <LinearLayout
android:paddingLeft="@dimen/context_menu_padding_margin_small"
android:paddingRight="@dimen/context_menu_padding_margin_small"
android:id="@+id/context_menu_buttons" android:id="@+id/context_menu_buttons"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/context_menu_action_buttons_h"> android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton <LinearLayout
android:id="@+id/context_menu_fav_button" android:background="?selectableItemBackground"
android:contentDescription="@string/shared_string_add_to_favorites" android:clickable="true"
android:layout_width="match_parent" android:id="@+id/context_menu_fav_view"
android:layout_height="match_parent" android:gravity="center"
android:layout_gravity="center_vertical" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/dashboard_button" android:layout_height="wrap_content"
android:scaleType="center" android:orientation="vertical"
android:src="@drawable/map_action_fav_dark"/> android:paddingTop="@dimen/context_menu_main_actions_padding_top"
android:paddingBottom="@dimen/context_menu_main_actions_padding_bottom">
<View <ImageView
android:id="@+id/divider_hor_1" android:layout_marginBottom="@dimen/context_menu_main_actions_icon_margin"
android:layout_width="1dp" android:id="@+id/context_menu_fav_image_view"
android:layout_height="match_parent" android:contentDescription="@string/shared_string_add_to_favorites"
android:background="?attr/dashboard_divider"/> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:src="@drawable/map_action_fav_dark"/>
<ImageButton <net.osmand.plus.widgets.TextViewEx
android:id="@+id/context_menu_route_button" android:maxLines="1"
android:layout_width="match_parent" android:ellipsize="end"
android:layout_height="match_parent" android:id="@+id/context_menu_fav_text_view"
android:layout_gravity="center_vertical" android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/shared_string_add"
android:textColor="@color/ctx_menu_buttons_text_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"/>
</LinearLayout>
<LinearLayout
android:background="?selectableItemBackground"
android:clickable="true"
android:id="@+id/context_menu_route_view"
android:gravity="center"
android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/dashboard_button" android:layout_height="wrap_content"
android:scaleType="center" android:orientation="vertical"
android:src="@drawable/map_action_flag_dark"/> android:paddingTop="@dimen/context_menu_main_actions_padding_top"
android:paddingBottom="@dimen/context_menu_main_actions_padding_bottom">
<View <ImageView
android:id="@+id/divider_hor_2" android:layout_marginBottom="@dimen/context_menu_main_actions_icon_margin"
android:layout_width="1dp" android:id="@+id/context_menu_route_image_view"
android:layout_height="match_parent" android:layout_width="wrap_content"
android:background="?attr/dashboard_divider"/> android:layout_height="wrap_content"
android:scaleType="center"
android:src="@drawable/map_action_flag_dark"/>
<ImageButton <net.osmand.plus.widgets.TextViewEx
android:id="@+id/context_menu_share_button" android:maxLines="1"
android:contentDescription="@string/context_menu_item_share_location" android:ellipsize="end"
android:layout_width="match_parent" android:id="@+id/context_menu_route_text_view"
android:layout_height="match_parent" android:layout_width="wrap_content"
android:layout_gravity="center_vertical" android:layout_height="wrap_content"
android:text="@string/shared_string_marker"
android:textColor="@color/ctx_menu_buttons_text_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"/>
</LinearLayout>
<LinearLayout
android:background="?selectableItemBackground"
android:clickable="true"
android:id="@+id/context_menu_share_view"
android:gravity="center"
android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/dashboard_button" android:layout_height="wrap_content"
android:scaleType="center" android:orientation="vertical"
android:src="@drawable/map_action_gshare_dark"/> android:paddingTop="@dimen/context_menu_main_actions_padding_top"
android:paddingBottom="@dimen/context_menu_main_actions_padding_bottom">
<View <ImageView
android:id="@+id/divider_hor_3" android:layout_marginBottom="@dimen/context_menu_main_actions_icon_margin"
android:layout_width="1dp" android:id="@+id/context_menu_share_image_view"
android:layout_height="match_parent" android:contentDescription="@string/context_menu_item_share_location"
android:background="?attr/dashboard_divider"/> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:src="@drawable/map_action_gshare_dark"/>
<ImageButton <net.osmand.plus.widgets.TextViewEx
android:id="@+id/context_menu_more_button" android:maxLines="1"
android:contentDescription="@string/shared_string_more" android:ellipsize="end"
android:layout_width="match_parent" android:id="@+id/context_menu_share_text_view"
android:layout_height="match_parent" android:layout_width="wrap_content"
android:layout_gravity="center_vertical" android:layout_height="wrap_content"
android:text="@string/shared_string_share"
android:textColor="@color/ctx_menu_buttons_text_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"/>
</LinearLayout>
<LinearLayout
android:background="?selectableItemBackground"
android:clickable="true"
android:id="@+id/context_menu_more_view"
android:gravity="center"
android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:background="?attr/dashboard_button" android:layout_height="wrap_content"
android:scaleType="center" android:orientation="vertical"
android:src="@drawable/map_overflow_menu_white"/> android:paddingTop="@dimen/context_menu_main_actions_padding_top"
android:paddingBottom="@dimen/context_menu_main_actions_padding_bottom">
<ImageView
android:layout_marginBottom="@dimen/context_menu_main_actions_icon_margin"
android:id="@+id/context_menu_more_image_view"
android:contentDescription="@string/shared_string_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="center"
android:src="@drawable/map_overflow_menu_white"/>
<net.osmand.plus.widgets.TextViewEx
android:maxLines="1"
android:ellipsize="end"
android:id="@+id/context_menu_more_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shared_string_actions"
android:textColor="@color/ctx_menu_buttons_text_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/buttons_bottom_border"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/ctx_menu_divider"/>
<LinearLayout
android:id="@+id/context_menu_bottom_buttons"
android:layout_width="match_parent"
android:layout_height="@dimen/context_menu_buttons_bottom_height">
<net.osmand.plus.widgets.TextViewEx
android:textAllCaps="true"
android:background="?attr/selectableItemBackground"
android:id="@+id/context_menu_details_button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:paddingRight="@dimen/context_menu_padding_margin_default"
android:gravity="start|center_vertical"
android:layout_gravity="center_vertical"
tools:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
android:text="@string/description"/>
<net.osmand.plus.widgets.TextViewEx
android:textAllCaps="true"
android:background="?attr/selectableItemBackground"
android:id="@+id/context_menu_directions_button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:paddingLeft="@dimen/context_menu_padding_margin_default"
android:paddingRight="@dimen/context_menu_padding_margin_default"
android:gravity="end|center_vertical"
tools:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
android:text="@string/get_directions"/>
</LinearLayout> </LinearLayout>
@ -441,13 +582,13 @@
android:id="@+id/context_menu_bottom_scroll" android:id="@+id/context_menu_bottom_scroll"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/ctx_menu_info_view_bg"> tools:background="?attr/ctx_menu_info_view_bg">
<LinearLayout <LinearLayout
android:id="@+id/context_menu_bottom_view" android:id="@+id/context_menu_bottom_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/ctx_menu_info_view_bg" tools:background="?attr/ctx_menu_info_view_bg"
android:orientation="vertical"> android:orientation="vertical">
</LinearLayout> </LinearLayout>
@ -460,7 +601,8 @@
<FrameLayout <FrameLayout
android:id="@+id/context_menu_fab_container" android:id="@+id/context_menu_fab_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
tools:visibility="gone">
<LinearLayout <LinearLayout
android:id="@+id/context_menu_zoom_buttons" android:id="@+id/context_menu_zoom_buttons"
@ -491,17 +633,6 @@
tools:src="@drawable/ic_action_test_light"/> tools:src="@drawable/ic_action_test_light"/>
</LinearLayout> </LinearLayout>
<ImageView
android:id="@+id/context_menu_fab_view"
android:contentDescription="@string/layer_route"
android:layout_width="@dimen/fab_size_with_shadow"
android:layout_height="@dimen/fab_size_with_shadow"
android:layout_gravity="right"
android:layout_marginRight="@dimen/fab_margin_right"
android:background="@drawable/fab_background_style"
android:scaleType="center"
android:src="@drawable/map_directions"/>
</FrameLayout> </FrameLayout>
</FrameLayout> </FrameLayout>

View file

@ -1,16 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map_route_preparation_layout" android:id="@+id/map_route_preparation_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/map_route_buttons_height" android:layout_height="wrap_content"
android:layout_gravity="bottom" > tools:background="@color/route_info_bottom_view_bg_dark"
android:layout_gravity="bottom">
<ImageButton <ImageButton
android:id="@+id/map_cancel_route_button" android:id="@+id/map_cancel_route_button"
android:contentDescription="@string/cancel_route" android:contentDescription="@string/cancel_route"
android:layout_width="@dimen/map_route_buttons_width" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:paddingTop="@dimen/route_info_buttons_padding_top_bottom"
android:paddingBottom="@dimen/route_info_buttons_padding_top_bottom"
android:paddingLeft="@dimen/route_info_buttons_padding_left_right"
android:paddingRight="@dimen/route_info_buttons_padding_left_right"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="?attr/dashboard_button" android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_test_light" /> android:src="@drawable/ic_action_test_light" />
@ -19,13 +25,20 @@
android:id="@+id/dividerBtn1" android:id="@+id/dividerBtn1"
android:layout_width="1dp" android:layout_width="1dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/dashboard_divider_dark"/> android:layout_marginTop="@dimen/route_info_buttons_padding_top_bottom"
android:layout_marginBottom="@dimen/route_info_buttons_padding_top_bottom"
android:layout_gravity="center"
tools:background="@color/route_info_divider_dark"/>
<ImageButton <ImageButton
android:id="@+id/map_waypoints_route_button" android:id="@+id/map_waypoints_route_button"
android:contentDescription="@string/waypoints" android:contentDescription="@string/waypoints"
android:layout_width="@dimen/map_route_buttons_width" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:paddingTop="@dimen/route_info_buttons_padding_top_bottom"
android:paddingBottom="@dimen/route_info_buttons_padding_top_bottom"
android:paddingLeft="@dimen/route_info_buttons_padding_left_right"
android:paddingRight="@dimen/route_info_buttons_padding_left_right"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="?attr/dashboard_button" android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_test_light" /> android:src="@drawable/ic_action_test_light" />
@ -34,34 +47,41 @@
android:id="@+id/dividerBtn2" android:id="@+id/dividerBtn2"
android:layout_width="1dp" android:layout_width="1dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/dashboard_divider_dark"/> android:layout_marginTop="@dimen/route_info_buttons_padding_top_bottom"
android:layout_marginBottom="@dimen/route_info_buttons_padding_top_bottom"
android:layout_gravity="center"
tools:background="@color/route_info_divider_dark"/>
<ImageButton <ImageButton
android:id="@+id/map_options_route_button" android:id="@+id/map_options_route_button"
android:contentDescription="@string/shared_string_more" android:contentDescription="@string/shared_string_more"
android:layout_width="@dimen/map_route_buttons_width" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:paddingTop="@dimen/route_info_buttons_padding_top_bottom"
android:paddingBottom="@dimen/route_info_buttons_padding_top_bottom"
android:paddingLeft="@dimen/route_info_buttons_padding_left_right"
android:paddingRight="@dimen/route_info_buttons_padding_left_right"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="?attr/dashboard_button" android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_test_light" /> android:src="@drawable/ic_action_test_light" />
<View
android:id="@+id/dividerBtn3"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/dashboard_divider_dark"/>
<TextView <TextView
android:textAllCaps="true"
android:id="@+id/map_go_route_button" android:id="@+id/map_go_route_button"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="?attr/dashboard_button" tools:drawableLeft="@drawable/ic_action_test_light"
android:drawableLeft="@drawable/ic_action_test_light"
android:drawablePadding="4dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingLeft="12dp" android:drawablePadding="@dimen/route_info_button_go_drawable_padding"
android:paddingLeft="@dimen/route_info_button_go_drawable_padding"
android:paddingStart="@dimen/route_info_button_go_drawable_padding"
android:layout_marginTop="@dimen/route_info_button_go_margin"
android:layout_marginBottom="@dimen/route_info_button_go_margin"
android:layout_marginRight="@dimen/route_info_button_go_margin"
android:layout_marginEnd="@dimen/route_info_button_go_margin"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
android:textStyle="bold" /> android:textStyle="bold"
tools:background="@drawable/route_info_go_btn_bg_dark"/>
</LinearLayout> </LinearLayout>

View file

@ -2,78 +2,68 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/list_item_height" android:minHeight="@dimen/list_item_height"
android:orientation="horizontal" android:orientation="vertical"
android:baselineAligned="false"> android:baselineAligned="false">
<LinearLayout <LinearLayout
android:id="@+id/context_menu_icon_layout" android:id="@+id/content"
android:layout_width="42dp" android:background="?attr/expandable_list_item_background"
android:layout_height="match_parent" android:paddingLeft="@dimen/list_content_padding"
android:orientation="horizontal"> android:paddingRight="@dimen/list_content_padding"
<ImageView
android:id="@+id/context_menu_icon_view"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginLeft="16dp"
android:layout_marginStart="12dp"
android:layout_marginTop="17dp"
android:src="@drawable/ic_action_building_number"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="14dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/context_menu_line1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:text="@string/search_address_building"
android:maxLines="3"
android:ellipsize="end"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size_large"/>
<TextView
android:id="@+id/context_menu_line2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="4dp"
android:text="@string/other_location"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
<LinearLayout
android:id="@+id/context_menu_close_btn_layout"
android:layout_width="32dp"
android:layout_height="match_parent"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="gone"> android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView <LinearLayout
android:id="@+id/close_btn_view" android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="top" android:paddingBottom="@dimen/content_padding_small"
android:layout_marginTop="12dp" android:paddingTop="@dimen/list_content_padding"
android:scaleType="center" android:layout_weight="1"
android:src="@drawable/ic_action_remove_dark"/> android:orientation="vertical">
<TextView
android:id="@+id/context_menu_line1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/search_address_building"
style="@style/TextAppearance.ContextMenuTitle"/>
<TextView
android:id="@+id/context_menu_line2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/context_menu_second_line_top_margin"
android:text="@string/other_location"
style="@style/TextAppearance.ContextMenuSubtitle"/>
</LinearLayout>
<LinearLayout
android:paddingTop="@dimen/list_content_padding"
android:id="@+id/context_menu_icon_layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/context_menu_icon_view"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:src="@drawable/ic_action_building_number"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
<View
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginStart="@dimen/list_content_padding"
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout> </LinearLayout>

View file

@ -5,16 +5,49 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="?attr/bottom_menu_view_bg" tools:background="?attr/bottom_menu_view_bg"
android:orientation="vertical"> android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools">
<ListView <LinearLayout
android:id="@+id/list" android:id="@+id/content"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content">
android:divider="@null"
android:dividerHeight="0dp">
</ListView> <ListView
android:clipToPadding="false"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="@null"
android:dividerHeight="0dp"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/cancel_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/cancel_row_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/multi_selection_header_height"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/header_title"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/ctx_menu_subtitle_color"
android:text="@string/what_is_here"/>
</LinearLayout>

View file

@ -1,17 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp" android:layout_width="@dimen/route_info_modes_height"
android:layout_height="48dp" > android:layout_height="@dimen/route_info_modes_height"
xmlns:tools="http://schemas.android.com/tools">
<ImageView <ImageView
android:id="@+id/app_mode_icon" android:id="@+id/app_mode_icon"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" android:layout_height="match_parent"
android:layout_gravity="center" tools:src="@drawable/ic_dashboard_dark"
android:gravity="center"
android:src="@drawable/ic_dashboard_dark"
android:background="?attr/dashboard_button" android:background="?attr/dashboard_button"
android:scaleType="center" /> android:scaleType="center"/>
<View <View

View file

@ -5,14 +5,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/color_transparent" android:background="@color/color_transparent"
android:clickable="true"> android:clickable="true"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout <LinearLayout
android:id="@+id/main_view" android:id="@+id/main_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@drawable/bg_bottom_menu_dark" tools:background="@drawable/route_info_menu_bg_dark"
android:clickable="true" android:clickable="true"
android:orientation="vertical"> android:orientation="vertical">
@ -24,7 +25,7 @@
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height" android:layout_height="@dimen/route_info_modes_height"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
@ -72,162 +73,219 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <FrameLayout
android:id="@+id/FromLayout" android:layout_width="match_parent"
android:layout_width="fill_parent" android:layout_height="wrap_content">
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/fromIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:orientation="vertical"
android:layout_height="match_parent" android:layout_width="match_parent"
android:layout_weight="1" android:layout_height="wrap_content">
android:orientation="vertical">
<TextView <LinearLayout
android:id="@+id/fromTitle" android:id="@+id/FromLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="5dp"
android:text="@string/route_from"
android:textSize="@dimen/default_sub_text_size"/>
<Spinner
android:id="@+id/FromSpinner"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/list_item_height"
android:layout_marginLeft="-8dp" android:orientation="horizontal">
android:background="@null"
android:textSize="@dimen/default_list_text_size"/> <ImageView
android:id="@+id/fromIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/route_info_icon_padding_left"
android:layout_marginLeft="@dimen/route_info_icon_padding_left"
android:layout_marginRight="@dimen/route_info_icon_padding_right"
android:layout_marginEnd="@dimen/route_info_icon_padding_right"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/fromTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="5dp"
android:text="@string/route_from"
android:textSize="@dimen/default_sub_text_size"/>
<Spinner
android:id="@+id/FromSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/fromDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
<View
android:id="@+id/from_layout_empty_view"
android:layout_width="@dimen/route_info_directions_margin"
android:layout_height="match_parent"/>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_marginStart="@dimen/route_info_divider_margin"
android:layout_marginLeft="@dimen/route_info_divider_margin"
android:layout_marginRight="@dimen/route_info_directions_margin"
android:layout_marginEnd="@dimen/route_info_directions_margin"
android:id="@+id/dividerFromDropDown"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dashboard_divider_dark"
android:focusable="false"/>
<View
android:id="@+id/divider_from_drop_down_empty"
android:layout_gravity="end"
android:layout_width="@dimen/route_info_directions_margin"
android:layout_height="1dp"
android:focusable="false"
android:background="@color/dashboard_divider_dark"/>
</FrameLayout>
<LinearLayout
android:id="@+id/ViaLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/viaIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/route_info_icon_padding_left"
android:layout_marginLeft="@dimen/route_info_icon_padding_left"
android:layout_marginRight="@dimen/route_info_icon_padding_right"
android:layout_marginEnd="@dimen/route_info_icon_padding_right"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/ViaSubView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="@string/route_via"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:id="@+id/ViaView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/list_content_padding"
android:gravity="left"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_marginStart="@dimen/route_info_divider_margin"
android:layout_marginLeft="@dimen/route_info_divider_margin"
android:id="@+id/viaLayoutDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dashboard_divider_dark"
android:focusable="false"/>
<LinearLayout
android:id="@+id/ToLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/toIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/route_info_icon_padding_left"
android:layout_marginLeft="@dimen/route_info_icon_padding_left"
android:layout_marginRight="@dimen/route_info_icon_padding_right"
android:layout_marginEnd="@dimen/route_info_icon_padding_right"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/toTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:text="@string/route_to"
android:textSize="@dimen/default_sub_text_size">
</TextView>
<Spinner
android:id="@+id/ToSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/toDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
<View
android:id="@+id/to_layout_empty_view"
android:layout_width="@dimen/route_info_directions_margin"
android:layout_height="match_parent"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
<ImageView <ImageView
android:id="@+id/fromDropDownIcon" android:id="@+id/swap_direction_image_view"
android:paddingRight="@dimen/route_info_icon_padding_right"
android:paddingLeft="@dimen/route_info_icon_padding_right"
android:layout_gravity="end"
tools:src="@drawable/ic_action_test_light"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"/>
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/dividerFromDropDown"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dashboard_divider_dark"
android:focusable="false"/>
<LinearLayout
android:id="@+id/ViaLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/viaIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/ViaSubView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="@string/route_via"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:id="@+id/ViaView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/list_content_padding"
android:gravity="left"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/viaLayoutDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/dashboard_divider_dark"
android:focusable="false"/>
<LinearLayout
android:id="@+id/ToLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/toIcon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/toTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:text="@string/route_to"
android:textSize="@dimen/default_sub_text_size">
</TextView>
<Spinner
android:id="@+id/ToSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/toDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout>
<View <View
android:id="@+id/dividerToDropDown" android:id="@+id/dividerToDropDown"
@ -372,7 +430,8 @@
android:background="@color/dashboard_divider_dark" android:background="@color/dashboard_divider_dark"
android:focusable="false"/> android:focusable="false"/>
<include layout="@layout/map_route_prepare_bottom"/> <include layout="@layout/map_route_prepare_bottom"
android:id="@+id/map_route_prepare_bottom_view"/>
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<net.osmand.plus.widgets.TextViewEx
android:textAllCaps="true"
osmand:typeface="@string/font_roboto_medium"
android:textColor="@color/color_white"
android:textSize="@dimen/default_sub_text_size_small"
tools:text="3"
android:gravity="center"
android:id="@+id/transport_stop_route_text"
android:background="@drawable/transport_stop_route_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/context_menu_transport_grid_item_height"/>
</LinearLayout>

View file

@ -58,6 +58,29 @@
<dimen name="context_menu_progress_min_height">80dp</dimen> <dimen name="context_menu_progress_min_height">80dp</dimen>
<dimen name="context_menu_progress_cancel_button_size">66dp</dimen> <dimen name="context_menu_progress_cancel_button_size">66dp</dimen>
<dimen name="context_menu_action_buttons_h">80dp</dimen> <dimen name="context_menu_action_buttons_h">80dp</dimen>
<dimen name="context_menu_sub_info_height">36dp</dimen>
<dimen name="context_menu_buttons_bottom_height">63dp</dimen>
<dimen name="context_menu_padding_margin_large">30dp</dimen>
<dimen name="context_menu_padding_margin_default">24dp</dimen>
<dimen name="context_menu_padding_margin_medium">15dp</dimen>
<dimen name="context_menu_padding_margin_small">12dp</dimen>
<dimen name="context_menu_padding_margin_tiny">9dp</dimen>
<dimen name="context_menu_title_padding">23dp</dimen>
<dimen name="context_menu_controller_height">54dp</dimen>
<dimen name="context_menu_progress_padding_left">27dp</dimen>
<dimen name="context_menu_progress_padding_right">3dp</dimen>
<dimen name="context_menu_action_buttons_height">84dp</dimen>
<dimen name="context_menu_subtitle_margin">5dp</dimen>
<dimen name="context_menu_direction_margin">18dp</dimen>
<dimen name="context_menu_transport_stop_item_height">24dp</dimen>
<dimen name="context_menu_main_actions_padding_top">11dp</dimen>
<dimen name="context_menu_main_actions_padding_bottom">9dp</dimen>
<dimen name="context_menu_main_actions_icon_margin">5dp</dimen>
<dimen name="context_menu_transport_grid_spacing">6dp</dimen>
<dimen name="context_menu_transport_grid_item_width">48dp</dimen>
<dimen name="context_menu_transport_grid_item_height">27dp</dimen>
<dimen name="context_menu_transport_icon_size">24dp</dimen>
<dimen name="context_menu_transport_padding_top">18dp</dimen>
<dimen name="fab_size_with_shadow">90dp</dimen> <dimen name="fab_size_with_shadow">90dp</dimen>
<dimen name="fab_margin_right">18dp</dimen> <dimen name="fab_margin_right">18dp</dimen>
@ -73,6 +96,7 @@
<dimen name="default_list_text_size">18sp</dimen> <dimen name="default_list_text_size">18sp</dimen>
<dimen name="default_desc_text_size">16sp</dimen> <dimen name="default_desc_text_size">16sp</dimen>
<dimen name="default_sub_text_size">14sp</dimen> <dimen name="default_sub_text_size">14sp</dimen>
<dimen name="default_sub_text_size_small">12sp</dimen>
<dimen name="welcome_header_text_size">27sp</dimen> <dimen name="welcome_header_text_size">27sp</dimen>
<dimen name="dialog_header_text_size">24sp</dimen> <dimen name="dialog_header_text_size">24sp</dimen>
@ -138,4 +162,17 @@
<dimen name="shadow_height">8dp</dimen> <dimen name="shadow_height">8dp</dimen>
<dimen name="map_marker_title_height">42dp</dimen> <dimen name="map_marker_title_height">42dp</dimen>
<!--Route info-->
<dimen name="route_info_buttons_padding_top_bottom">24dp</dimen>
<dimen name="route_info_buttons_padding_left_right">33dp</dimen>
<dimen name="route_info_button_go_margin">5dp</dimen>
<dimen name="route_info_button_go_drawable_padding">21dp</dimen>
<dimen name="route_info_directions_margin">72dp</dimen>
<dimen name="route_info_icon_padding_left">18dp</dimen>
<dimen name="route_info_icon_padding_right">24dp</dimen>
<dimen name="route_info_divider_margin">66dp</dimen>
<dimen name="route_info_modes_height">72dp</dimen>
<dimen name="multi_selection_header_height">78dp</dimen>
</resources> </resources>

View file

@ -24,6 +24,9 @@
<attr name="bg_map_context_menu" format="reference" /> <attr name="bg_map_context_menu" format="reference" />
<attr name="bg_point_editor_view" format="reference" /> <attr name="bg_point_editor_view" format="reference" />
<attr name="ctx_menu_info_view_bg" format="reference" /> <attr name="ctx_menu_info_view_bg" format="reference" />
<attr name="ctx_menu_controller_bg" format="reference" />
<attr name="ctx_menu_controller_text_color" format="reference" />
<attr name="ctx_menu_divider" format="reference" />
<attr name="bottom_menu_view_bg" format="reference" /> <attr name="bottom_menu_view_bg" format="reference" />
<attr name="left_menu_view_bg" format="reference" /> <attr name="left_menu_view_bg" format="reference" />

View file

@ -311,4 +311,64 @@
<color name="color_osm_edit_modify">#fac403</color> <color name="color_osm_edit_modify">#fac403</color>
<color name="color_osm_edit_delete">#ee5622</color> <color name="color_osm_edit_delete">#ee5622</color>
<color name="ctx_menu_bg_light">#ffffff</color>
<color name="ctx_menu_bg_dark">#17191a</color>
<color name="ctx_menu_title_color_light">#212121</color>
<color name="ctx_menu_title_color_dark">#cccccc</color>
<color name="ctx_menu_subtitle_color">#727272</color>
<color name="ctx_menu_direction_color_light">#536dfe</color>
<color name="ctx_menu_direction_color_dark">#e69122</color>
<color name="ctx_menu_controller_button_text_color_light_n">#536dfe</color>
<color name="ctx_menu_controller_button_text_color_dark_n">#e69122</color>
<color name="ctx_menu_controller_button_text_color_light_p">#ffffff</color>
<color name="ctx_menu_controller_button_text_color_dark_p">#cccccc</color>
<color name="ctx_menu_controller_button_outline_color_light_n">#e6e6e6</color>
<color name="ctx_menu_controller_button_outline_color_light_p">#4c63e6</color>
<color name="ctx_menu_controller_button_outline_color_dark_n">#2d3133</color>
<color name="ctx_menu_controller_button_outline_color_dark_p">#b36a0b</color>
<color name="ctx_menu_controller_button_bg_color_light_n">#fafafa</color>
<color name="ctx_menu_controller_button_bg_color_light_p">#6d82fc</color>
<color name="ctx_menu_controller_button_bg_color_dark_n">#222526</color>
<color name="ctx_menu_controller_button_bg_color_dark_p">#d28521</color>
<color name="ctx_menu_buttons_bg_light">#f2f2f2</color>
<color name="ctx_menu_buttons_bg_dark">#222526</color>
<color name="ctx_menu_buttons_divider_light">#e6e6e6</color>
<color name="ctx_menu_buttons_divider_dark">#2d3133</color>
<color name="ctx_menu_buttons_text_color">#727272</color>
<color name="ctx_menu_buttons_icon_color">#727272</color>
<color name="ctx_menu_bottom_buttons_text_color_light">#536dfe</color>
<color name="ctx_menu_bottom_buttons_text_color_dark">#e69122</color>
<color name="ctx_menu_bottom_view_bg_light">#ffffff</color>
<color name="ctx_menu_bottom_view_bg_dark">#17191a</color>
<color name="ctx_menu_bottom_view_icon_light">#b3b3b3</color>
<color name="ctx_menu_bottom_view_icon_dark">#536dfe</color>
<color name="ctx_menu_bottom_view_text_color_light">#212121</color>
<color name="ctx_menu_bottom_view_text_color_dark">#cccccc</color>
<color name="ctx_menu_bottom_view_secondary_text_color_light">#a6a6a6</color>
<color name="ctx_menu_bottom_view_secondary_text_color_dark">#595959</color>
<color name="ctx_menu_amenity_opened_text_color">#5baf3f</color>
<color name="ctx_menu_amenity_closed_text_color">#c66545</color>
<color name="ctx_menu_bottom_view_divider_light">#f2f2f2</color>
<color name="ctx_menu_bottom_view_divider_dark">#536dfe</color>
<color name="ctx_menu_bottom_view_url_color_light">#536dfe</color>
<color name="ctx_menu_bottom_view_url_color_dark">#d28521</color>
<color name="route_info_bg_light">#ffffff</color>
<color name="route_info_bg_dark">#17191a</color>
<color name="route_info_bottom_view_bg_light">#f2f2f2</color>
<color name="route_info_bottom_view_bg_dark">#222526</color>
<color name="route_info_divider_light">#e6e6e6</color>
<color name="route_info_divider_dark">#2d3133</color>
<color name="route_info_control_icon_color_light">#505050</color>
<color name="route_info_control_icon_color_dark">#727272</color>
<color name="route_info_go_btn_inking_light">#4c63e6</color>
<color name="route_info_go_btn_inking_dark">#d28521</color>
<color name="route_info_go_btn_bg_light">#6d82fc</color>
<color name="route_info_go_btn_bg_light_p">#4c63e6</color>
<color name="route_info_go_btn_bg_dark">#b36a0b</color>
<color name="route_info_go_btn_bg_dark_p">#d28521</color>
<color name="route_info_checked_mode_icon_color_light">#ff8800</color>
<color name="route_info_checked_mode_icon_color_dark">#d28521</color>
<color name="route_info_unchecked_mode_icon_color">#727272</color>
</resources> </resources>

View file

@ -2099,6 +2099,7 @@
<string name="poi_route_monorail_ref">Monorail</string> <string name="poi_route_monorail_ref">Monorail</string>
<string name="poi_route_funicular_ref">Funicular</string> <string name="poi_route_funicular_ref">Funicular</string>
<string name="poi_route_ferry_ref">Ferry</string> <string name="poi_route_ferry_ref">Ferry</string>
<string name="poi_route_subway_ref">Subway</string>
<string name="poi_route_railway_ref">Route of a railroad</string> <string name="poi_route_railway_ref">Route of a railroad</string>

View file

@ -129,6 +129,29 @@
<dimen name="context_menu_progress_min_height">54dp</dimen> <dimen name="context_menu_progress_min_height">54dp</dimen>
<dimen name="context_menu_progress_cancel_button_size">44dp</dimen> <dimen name="context_menu_progress_cancel_button_size">44dp</dimen>
<dimen name="context_menu_action_buttons_h">54dp</dimen> <dimen name="context_menu_action_buttons_h">54dp</dimen>
<dimen name="context_menu_sub_info_height">24dp</dimen>
<dimen name="context_menu_buttons_bottom_height">48dp</dimen>
<dimen name="context_menu_padding_margin_large">20dp</dimen>
<dimen name="context_menu_padding_margin_default">16dp</dimen>
<dimen name="context_menu_padding_margin_medium">10dp</dimen>
<dimen name="context_menu_padding_margin_small">8dp</dimen>
<dimen name="context_menu_padding_margin_tiny">6dp</dimen>
<dimen name="context_menu_title_padding">15dp</dimen>
<dimen name="context_menu_controller_height">36dp</dimen>
<dimen name="context_menu_progress_padding_left">18dp</dimen>
<dimen name="context_menu_progress_padding_right">2dp</dimen>
<dimen name="context_menu_action_buttons_height">56dp</dimen>
<dimen name="context_menu_subtitle_margin">3dp</dimen>
<dimen name="context_menu_direction_margin">12dp</dimen>
<dimen name="context_menu_transport_stop_item_height">16dp</dimen>
<dimen name="context_menu_main_actions_padding_top">7dp</dimen>
<dimen name="context_menu_main_actions_padding_bottom">6dp</dimen>
<dimen name="context_menu_main_actions_icon_margin">3dp</dimen>
<dimen name="context_menu_transport_grid_spacing">4dp</dimen>
<dimen name="context_menu_transport_grid_item_width">32dp</dimen>
<dimen name="context_menu_transport_grid_item_height">18dp</dimen>
<dimen name="context_menu_transport_icon_size">16dp</dimen>
<dimen name="context_menu_transport_padding_top">12dp</dimen>
<dimen name="fab_size_with_shadow">62dp</dimen> <dimen name="fab_size_with_shadow">62dp</dimen>
<dimen name="fab_margin_right">12dp</dimen> <dimen name="fab_margin_right">12dp</dimen>
@ -138,6 +161,7 @@
<dimen name="default_list_text_size">16sp</dimen> <dimen name="default_list_text_size">16sp</dimen>
<dimen name="default_desc_text_size">14sp</dimen> <dimen name="default_desc_text_size">14sp</dimen>
<dimen name="default_sub_text_size">12sp</dimen> <dimen name="default_sub_text_size">12sp</dimen>
<dimen name="default_sub_text_size_small">10sp</dimen>
<dimen name="welcome_header_text_size">23sp</dimen> <dimen name="welcome_header_text_size">23sp</dimen>
<dimen name="default_split_segments_overview">13sp</dimen> <dimen name="default_split_segments_overview">13sp</dimen>
@ -210,4 +234,17 @@
<dimen name="map_marker_title_height">28dp</dimen> <dimen name="map_marker_title_height">28dp</dimen>
<dimen name="fab_recycler_view_padding_bottom">88dp</dimen> <dimen name="fab_recycler_view_padding_bottom">88dp</dimen>
<!--Route info-->
<dimen name="route_info_buttons_padding_top_bottom">16dp</dimen>
<dimen name="route_info_buttons_padding_left_right">22dp</dimen>
<dimen name="route_info_button_go_margin">3dp</dimen>
<dimen name="route_info_button_go_drawable_padding">14dp</dimen>
<dimen name="route_info_directions_margin">56dp</dimen>
<dimen name="route_info_icon_padding_left">12dp</dimen>
<dimen name="route_info_icon_padding_right">16dp</dimen>
<dimen name="route_info_divider_margin">52dp</dimen>
<dimen name="route_info_modes_height">48dp</dimen>
<dimen name="multi_selection_header_height">52dp</dimen>
</resources> </resources>

View file

@ -9,14 +9,29 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="what_is_here">What\'s here:</string>
<string name="parked_at">parked at</string>
<string name="pick_up_till">Pick up till</string>
<string name="without_time_limit">Without time limit</string>
<string name="context_menu_read_full_article">Read full article</string>
<string name="context_menu_read_article">Read article</string>
<string name="context_menu_points_of_group">All points of group</string>
<string name="opened_from">Opened from</string>
<string name="opened_till">Opened till</string>
<string name="will_be_closed_at">Will be closed at</string>
<string name="will_be_opened_at">Will be opened at</string>
<string name="will_be_opened_on">Will be opened on</string>
<string name="additional_actions">Additional actions</string>
<string name="av_locations_selected_desc">GPX file with coordinates and data of the selected notes.</string> <string name="av_locations_selected_desc">GPX file with coordinates and data of the selected notes.</string>
<string name="av_locations_all_desc">GPX file with coordinates and data of all notes.</string> <string name="av_locations_all_desc">GPX file with coordinates and data of all notes.</string>
<string name="release_3_0"> <string name="release_3_0">
\u2022 Detection of stop signs now considers driving direction\n\n \u2022 Detection of stop signs now considers driving direction\n\n
\u2022 New algorithm providing meaningful ascent/descent values for GPX tracks\n\n \u2022 New algorithm providing meaningful ascent/descent values for GPX tracks\n\n
\u2022 Terrain (ascent) aware hiking time (Naismith\'s rule)\n\n \u2022 Terrain (ascent) aware hiking time (Naismith\'s rule)\n\n
</string> </string>
<string name="modify_the_search_query">Modify the search query.</string> <string name="modify_the_search_query">Modify the search query.</string>
<string name="shared_string_actions">Actions</string>
<string name="shared_string_marker">Marker</string>
<string name="empty_state_osm_edits">Create or modify OSM objects</string> <string name="empty_state_osm_edits">Create or modify OSM objects</string>
<string name="empty_state_osm_edits_descr">Create or modify OSM POI, open or comment OSM Notes, and contribute recorded GPX files.</string> <string name="empty_state_osm_edits_descr">Create or modify OSM POI, open or comment OSM Notes, and contribute recorded GPX files.</string>
<string name="shared_string_deleted">Deleted</string> <string name="shared_string_deleted">Deleted</string>

View file

@ -131,6 +131,9 @@
<item name="divider_color">@color/divider_color</item> <item name="divider_color">@color/divider_color</item>
<item name="dashboard_button">@drawable/dashboard_button_light</item> <item name="dashboard_button">@drawable/dashboard_button_light</item>
<item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_light</item> <item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_light</item>
<item name="ctx_menu_controller_bg">@drawable/context_menu_controller_bg_light</item>
<item name="ctx_menu_controller_text_color">@drawable/context_menu_controller_text_color_light</item>
<item name="ctx_menu_divider">@color/ctx_menu_buttons_divider_light</item>
<item name="search_background">@color/search_background_dark</item> <item name="search_background">@color/search_background_dark</item>
<item name="actionModeCloseDrawable">@drawable/ic_action_mode_back</item> <item name="actionModeCloseDrawable">@drawable/ic_action_mode_back</item>
<item name="actionModeStyle">@style/WhiteActionMode</item> <item name="actionModeStyle">@style/WhiteActionMode</item>
@ -316,6 +319,9 @@
<item name="divider_color">@color/dashboard_divider_dark</item> <item name="divider_color">@color/dashboard_divider_dark</item>
<item name="dashboard_button">@drawable/dashboard_button_dark</item> <item name="dashboard_button">@drawable/dashboard_button_dark</item>
<item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_dark</item> <item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_dark</item>
<item name="ctx_menu_controller_bg">@drawable/context_menu_controller_bg_dark</item>
<item name="ctx_menu_controller_text_color">@drawable/context_menu_controller_text_color_dark</item>
<item name="ctx_menu_divider">@color/ctx_menu_buttons_divider_dark</item>
<item name="search_background">@color/color_white</item> <item name="search_background">@color/color_white</item>
<item name="switch_ex_background">@drawable/switch_ex_background_dark</item> <item name="switch_ex_background">@drawable/switch_ex_background_dark</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item> <item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item>

View file

@ -188,7 +188,11 @@ public class AndroidUtils {
public static void addStatusBarPadding21v(Context ctx, View view) { public static void addStatusBarPadding21v(Context ctx, View view) {
if (Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= 21) {
view.setPadding(0, getStatusBarHeight(ctx), 0, 0); int paddingLeft = view.getPaddingLeft();
int paddingTop = view.getPaddingTop();
int paddingRight = view.getPaddingRight();
int paddingBottom = view.getPaddingBottom();
view.setPadding(paddingLeft, paddingTop + getStatusBarHeight(ctx), paddingRight, paddingBottom);
} }
} }

View file

@ -459,7 +459,7 @@ public abstract class OsmandPlugin {
if (adapter.length() > itemsCount) { if (adapter.length() > itemsCount) {
adapter.addItem(new ContextMenuItem.ItemBuilder() adapter.addItem(new ContextMenuItem.ItemBuilder()
.setPosition(itemsCount) .setPosition(itemsCount)
.setLayout(R.layout.context_menu_list_divider) .setLayout(R.layout.bottom_sheet_dialog_fragment_divider)
.createItem()); .createItem());
} }
} }

View file

@ -8,7 +8,6 @@ import android.graphics.PorterDuff;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider; import android.support.v4.content.FileProvider;
@ -191,6 +190,13 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
getGroupExpandedPreference(groupName).set(true); getGroupExpandedPreference(groupName).set(true);
} }
}); });
String groupNameToShow = ((FavoritesActivity) getActivity()).getGroupNameToShow();
if (groupNameToShow != null) {
int position = favouritesAdapter.getGroupPosition(groupNameToShow);
if (position != -1) {
listView.setSelectedGroup(position);
}
}
return view; return view;
} }
@ -967,6 +973,16 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
public void setFilterResults(Set<?> values) { public void setFilterResults(Set<?> values) {
this.filter = values; this.filter = values;
} }
public int getGroupPosition(String groupName) {
for (int i = 0; i < getGroupCount(); i++) {
FavoriteGroup group = getGroup(i);
if (group.name.equals(groupName)) {
return i;
}
}
return -1;
}
} }
public class FavoritesFilter extends Filter { public class FavoritesFilter extends Filter {

View file

@ -93,6 +93,7 @@ import net.osmand.plus.helpers.GpxImportHelper;
import net.osmand.plus.helpers.GpxImportHelper.ImportGpxBottomSheetDialogFragment; import net.osmand.plus.helpers.GpxImportHelper.ImportGpxBottomSheetDialogFragment;
import net.osmand.plus.helpers.WakeLockHelper; import net.osmand.plus.helpers.WakeLockHelper;
import net.osmand.plus.inapp.InAppHelper; import net.osmand.plus.inapp.InAppHelper;
import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MapContextMenuFragment; import net.osmand.plus.mapcontextmenu.MapContextMenuFragment;
import net.osmand.plus.mapcontextmenu.builders.cards.dialogs.ContextMenuCardDialogFragment; import net.osmand.plus.mapcontextmenu.builders.cards.dialogs.ContextMenuCardDialogFragment;
@ -345,6 +346,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
mapLayers.getMapControlsLayer().getTrackDetailsMenu().hide(); mapLayers.getMapControlsLayer().getTrackDetailsMenu().hide();
} }
removeFragment(ImportGpxBottomSheetDialogFragment.TAG); removeFragment(ImportGpxBottomSheetDialogFragment.TAG);
removeFragment(AdditionalActionsBottomSheetDialogFragment.TAG);
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }

View file

@ -50,6 +50,7 @@ import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.dialogs.FavoriteDialogs; import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.download.IndexItem; import net.osmand.plus.download.IndexItem;
import net.osmand.plus.liveupdates.OsmLiveActivity; import net.osmand.plus.liveupdates.OsmLiveActivity;
import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment;
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext; import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.measurementtool.MeasurementToolFragment;
@ -312,19 +313,18 @@ public class MapActivityActions implements DialogProvider {
} }
} }
final AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
final ArrayAdapter<ContextMenuItem> listAdapter = final ArrayAdapter<ContextMenuItem> listAdapter =
adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContent()); adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContent());
builder.setTitle(R.string.shared_string_more_actions);
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
AdditionalActionsBottomSheetDialogFragment actionsBottomSheetDialogFragment = new AdditionalActionsBottomSheetDialogFragment();
actionsBottomSheetDialogFragment.setAdapter(adapter, new AdditionalActionsBottomSheetDialogFragment.ContextMenuItemClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onItemClick(int position) {
ContextMenuItem item = adapter.getItem(which); ContextMenuItem item = adapter.getItem(position);
int standardId = item.getTitleId(); int standardId = item.getTitleId();
ItemClickListener click = item.getItemClickListener(); ItemClickListener click = item.getItemClickListener();
if (click != null) { if (click != null) {
click.onContextMenuClick(listAdapter, standardId, which, false, null); click.onContextMenuClick(listAdapter, standardId, position, false, null);
} else if (standardId == R.string.context_menu_item_last_intermediate_point) { } else if (standardId == R.string.context_menu_item_last_intermediate_point) {
mapActivity.getContextMenu().addAsLastIntermediate(); mapActivity.getContextMenu().addAsLastIntermediate();
} else if (standardId == R.string.context_menu_item_search) { } else if (standardId == R.string.context_menu_item_search) {
@ -345,8 +345,7 @@ public class MapActivityActions implements DialogProvider {
} }
} }
}); });
builder.setNegativeButton(R.string.shared_string_cancel, null); actionsBottomSheetDialogFragment.show(mapActivity.getSupportFragmentManager(), AdditionalActionsBottomSheetDialogFragment.TAG);
builder.create().show();
} }
public void setGPXRouteParams(GPXFile result) { public void setGPXRouteParams(GPXFile result) {

View file

@ -1,6 +1,7 @@
package net.osmand.plus.activities.actions; package net.osmand.plus.activities.actions;
import android.app.Activity; import android.app.Activity;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -46,17 +47,12 @@ 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, boolean drawer, boolean useMapTheme, final View.OnClickListener onClickListener) { ViewGroup parent, final boolean singleSelection, boolean drawer, boolean useMapTheme, final View.OnClickListener onClickListener) {
View ll = a.getLayoutInflater().inflate(R.layout.mode_toggles, parent); View ll = a.getLayoutInflater().inflate(R.layout.mode_toggles, parent);
if (useMapTheme) { boolean nightMode = isNightMode(((OsmandApplication) a.getApplication()), useMapTheme);
AndroidUtils.setListItemBackground(a, ll, ll.setBackgroundColor(ContextCompat.getColor(a, nightMode ? R.color.route_info_bg_dark : R.color.route_info_bg_light));
((OsmandApplication) a.getApplication()).getDaynightHelper().isNightModeForMapControls());
} else {
AndroidUtils.setListItemBackground(a, ll,
!((OsmandApplication) a.getApplication()).getSettings().isLightContent());
}
final View[] buttons = new View[values.size()]; final View[] buttons = new View[values.size()];
int k = 0; int k = 0;
for(ApplicationMode ma : values) { for(ApplicationMode ma : values) {
buttons[k++] = createToggle(a.getLayoutInflater(), (OsmandApplication) a.getApplication(), (LinearLayout) ll.findViewById(R.id.app_modes_content), ma); buttons[k++] = createToggle(a.getLayoutInflater(), (OsmandApplication) a.getApplication(), (LinearLayout) ll.findViewById(R.id.app_modes_content), ma, useMapTheme);
} }
for (int i = 0; i < buttons.length; i++) { for (int i = 0; i < buttons.length; i++) {
updateButtonState((OsmandApplication) a.getApplication(), values, selected, onClickListener, buttons, i, updateButtonState((OsmandApplication) a.getApplication(), values, selected, onClickListener, buttons, i,
@ -74,14 +70,14 @@ public class AppModeDialog {
final ApplicationMode mode = visible.get(i); final ApplicationMode mode = visible.get(i);
final boolean checked = selected.contains(mode); final boolean checked = selected.contains(mode);
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon); ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
boolean nightMode = isNightMode(ctx, useMapTheme);
if (checked) { if (checked) {
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.osmand_orange)); iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), nightMode ? R.color.route_info_checked_mode_icon_color_dark : R.color.route_info_checked_mode_icon_color_light));
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked))); iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
tb.findViewById(R.id.selection).setVisibility(View.VISIBLE); tb.findViewById(R.id.selection).setVisibility(View.VISIBLE);
} else { } else {
if (useMapTheme) { if (useMapTheme) {
boolean nightMode = ctx.getDaynightHelper().isNightModeForMapControls(); iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.route_info_unchecked_mode_icon_color));
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), !nightMode));
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark); AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
} else { } else {
iv.setImageDrawable(ctx.getIconsCache().getThemedIcon(mode.getSmallIconDark())); iv.setImageDrawable(ctx.getIconsCache().getThemedIcon(mode.getSmallIconDark()));
@ -118,12 +114,12 @@ public class AppModeDialog {
} }
static private View createToggle(LayoutInflater layoutInflater, OsmandApplication ctx, LinearLayout layout, ApplicationMode mode){ static private View createToggle(LayoutInflater layoutInflater, OsmandApplication ctx, LinearLayout layout, ApplicationMode mode, boolean useMapTheme){
int metricsX = (int) ctx.getResources().getDimension(R.dimen.map_mode_button_width); int metricsX = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);
int metricsY = (int) ctx.getResources().getDimension(R.dimen.map_mode_button_width); int metricsY = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);
View tb = layoutInflater.inflate(R.layout.mode_view, null); View tb = layoutInflater.inflate(R.layout.mode_view, null);
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon); ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.osmand_orange)); iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), isNightMode(ctx, useMapTheme) ? R.color.route_info_checked_mode_icon_color_dark : R.color.route_info_checked_mode_icon_color_light));
iv.setContentDescription(mode.toHumanString(ctx)); iv.setContentDescription(mode.toHumanString(ctx));
// tb.setCompoundDrawablesWithIntrinsicBounds(null, ctx.getIconsCache().getIcon(mode.getIconId(), R.color.app_mode_icon_color), null, null); // tb.setCompoundDrawablesWithIntrinsicBounds(null, ctx.getIconsCache().getIcon(mode.getIconId(), R.color.app_mode_icon_color), null, null);
LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY); LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY);
@ -131,4 +127,14 @@ public class AppModeDialog {
layout.addView(tb, lp); layout.addView(tb, lp);
return tb; return tb;
} }
private static boolean isNightMode(OsmandApplication ctx, boolean useMapTheme) {
boolean nightMode;
if (useMapTheme) {
nightMode = ctx.getDaynightHelper().isNightModeForMapControls();
} else {
nightMode = !ctx.getSettings().isLightContent();
}
return nightMode;
}
} }

View file

@ -43,7 +43,7 @@ public class AudioVideoNoteMenuBuilder extends MenuBuilder {
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext()); DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext());
Date date = new Date(recording.getFile().lastModified()); Date date = new Date(recording.getFile().lastModified());
buildRow(view, R.drawable.ic_action_data, dateFormat.format(date) + "" + timeFormat.format(date), buildRow(view, R.drawable.ic_action_data, dateFormat.format(date) + "" + timeFormat.format(date),
0, false, null, false, 0, false, null); 0, false, null, false, 0, false, null, false);
buildPlainMenuItems(view); buildPlainMenuItems(view);

View file

@ -111,6 +111,12 @@ public abstract class DashLocationFragment extends DashBaseFragment {
} }
} }
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
ImageView arrow, int imgColor, TextView txt, int textColor, double toLat, double toLon,
int screenOrientation, OsmandApplication app, Context ctx) {
updateLocationView(useCenter, fromLoc, h, arrow, 0, imgColor, txt, textColor, new LatLon(toLat, toLon), screenOrientation, app, ctx, true);
}
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h, public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
ImageView arrow, TextView txt, double toLat, double toLon, ImageView arrow, TextView txt, double toLat, double toLon,
int screenOrientation, OsmandApplication app, Context ctx) { int screenOrientation, OsmandApplication app, Context ctx) {
@ -120,11 +126,17 @@ public abstract class DashLocationFragment extends DashBaseFragment {
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h, public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
ImageView arrow, int arrowResId, TextView txt, LatLon toLoc, ImageView arrow, int arrowResId, TextView txt, LatLon toLoc,
int screenOrientation, OsmandApplication app, Context ctx, boolean paint) { int screenOrientation, OsmandApplication app, Context ctx, boolean paint) {
updateLocationView(useCenter, fromLoc, h, arrow, arrowResId, 0, txt, toLoc, screenOrientation, app, ctx, paint); updateLocationView(useCenter, fromLoc, h, arrow, arrowResId, 0, txt, 0, toLoc, screenOrientation, app, ctx, paint);
} }
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h, public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
ImageView arrow, int arrowResId, int color, TextView txt, LatLon toLoc, ImageView arrow, int arrowResId, int imgColor, TextView txt, LatLon toLoc,
int screenOrientation, OsmandApplication app, Context ctx, boolean paint) {
updateLocationView(useCenter, fromLoc, h, arrow, arrowResId, imgColor, txt, 0, toLoc, screenOrientation, app, ctx, paint);
}
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
ImageView arrow, int arrowResId, int imgColor, TextView txt, int textColor, LatLon toLoc,
int screenOrientation, OsmandApplication app, Context ctx, boolean paint) { int screenOrientation, OsmandApplication app, Context ctx, boolean paint) {
float[] mes = new float[2]; float[] mes = new float[2];
if (fromLoc != null && toLoc != null) { if (fromLoc != null && toLoc != null) {
@ -142,7 +154,7 @@ public abstract class DashLocationFragment extends DashBaseFragment {
} else { } else {
dd = (DirectionDrawable) arrow.getDrawable(); dd = (DirectionDrawable) arrow.getDrawable();
} }
dd.setImage(arrowResId, color == 0 ? useCenter ? R.color.color_distance : R.color.color_myloc_distance : color); dd.setImage(arrowResId, imgColor == 0 ? useCenter ? R.color.color_distance : R.color.color_myloc_distance : imgColor);
if (fromLoc == null || h == null || toLoc == null) { if (fromLoc == null || h == null || toLoc == null) {
dd.setAngle(0); dd.setAngle(0);
} else { } else {
@ -157,7 +169,7 @@ public abstract class DashLocationFragment extends DashBaseFragment {
if (fromLoc != null && toLoc != null) { if (fromLoc != null && toLoc != null) {
if (paint) { if (paint) {
txt.setTextColor(app.getResources().getColor( txt.setTextColor(app.getResources().getColor(
useCenter ? R.color.color_distance : R.color.color_myloc_distance)); textColor == 0 ? useCenter ? R.color.color_distance : R.color.color_myloc_distance : textColor));
} }
txt.setText(OsmAndFormatter.getFormattedDistance(mes[0], app)); txt.setText(OsmAndFormatter.getFormattedDistance(mes[0], app));
} else { } else {

View file

@ -17,6 +17,10 @@ public class FontCache {
return getFont(context, ROBOTO_MEDIUM); return getFont(context, ROBOTO_MEDIUM);
} }
public static Typeface getRobotoRegular(Context context) {
return getFont(context, ROBOTO_REGULAR);
}
public static Typeface getFont(Context context, String fontName) { public static Typeface getFont(Context context, String fontName) {
Typeface typeface = fontMap.get(fontName); Typeface typeface = fontMap.get(fontName);
if (typeface != null) if (typeface != null)

View file

@ -0,0 +1,143 @@
package net.osmand.plus.mapcontextmenu;
import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.support.design.widget.BottomSheetDialogFragment;
import android.support.v4.content.ContextCompat;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
public class AdditionalActionsBottomSheetDialogFragment extends BottomSheetDialogFragment {
public static final String TAG = "AdditionalActionsBottomSheetDialogFragment";
private boolean nightMode;
private boolean portrait;
private ContextMenuAdapter adapter;
private ContextMenuItemClickListener listener;
public void setAdapter(ContextMenuAdapter adapter, ContextMenuItemClickListener listener) {
this.adapter = adapter;
this.listener = listener;
}
@Override
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
if (getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get()) {
dialog.getWindow().setWindowAnimations(R.style.Animations_NoAnimation);
}
nightMode = getMyApplication().getDaynightHelper().isNightModeForMapControls();
portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
final OsmandSettings settings = getMyApplication().getSettings();
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_context_menu_actions_bottom_sheet_dialog, null);
AndroidUtils.setBackground(getActivity(), mainView, nightMode,
portrait ? R.drawable.bg_bottom_menu_light : R.drawable.bg_bottom_sheet_topsides_landscape_light,
portrait ? R.drawable.bg_bottom_menu_dark : R.drawable.bg_bottom_sheet_topsides_landscape_dark);
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
TextView headerTitle = (TextView) mainView.findViewById(R.id.header_title);
if (nightMode) {
headerTitle.setTextColor(ContextCompat.getColor(getActivity(), R.color.ctx_menu_info_text_dark));
}
headerTitle.setText(getString(R.string.additional_actions));
if (!portrait) {
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
BottomSheetDialog dialog = (BottomSheetDialog) dialogInterface;
FrameLayout bottomSheet = (FrameLayout) dialog.findViewById(android.support.design.R.id.design_bottom_sheet);
BottomSheetBehavior.from(bottomSheet).setState(BottomSheetBehavior.STATE_EXPANDED);
}
});
}
View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onItemClick((int) view.getTag());
}
dismiss();
}
};
LinearLayout itemsLinearLayout = (LinearLayout) mainView.findViewById(R.id.context_menu_items_container);
for (int i = 0; i < adapter.length(); i++) {
ContextMenuItem item = adapter.getItem(i);
int layoutResId = item.getLayout();
layoutResId = layoutResId != ContextMenuItem.INVALID_ID ? layoutResId : R.layout.bottom_sheet_dialog_fragment_item;
View row = View.inflate(new ContextThemeWrapper(getContext(), themeRes), layoutResId, null);
if (layoutResId != R.layout.bottom_sheet_dialog_fragment_divider) {
if (item.getIcon() != ContextMenuItem.INVALID_ID) {
((ImageView) row.findViewById(R.id.icon)).setImageDrawable(getContentIcon(item.getIcon()));
}
((TextView) row.findViewById(R.id.title)).setText(item.getTitle());
}
row.setTag(i);
row.setOnClickListener(onClickListener);
itemsLinearLayout.addView(row);
}
dialog.setContentView(mainView);
((View) mainView.getParent()).setBackgroundResource(0);
}
@Override
public void onStart() {
super.onStart();
if (!portrait) {
final Window window = getDialog().getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.width = getActivity().getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width);
window.setAttributes(params);
}
}
private OsmandApplication getMyApplication() {
return ((MapActivity) getActivity()).getMyApplication();
}
private Drawable getContentIcon(@DrawableRes int id) {
return getMyApplication().getIconsCache().getIcon(id, nightMode ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
}
public interface ContextMenuItemClickListener {
void onItemClick(int position);
}
}

View file

@ -37,6 +37,7 @@ import net.osmand.plus.mapcontextmenu.MenuController.MenuType;
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController; import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController; import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
import net.osmand.plus.mapcontextmenu.controllers.MapDataMenuController; import net.osmand.plus.mapcontextmenu.controllers.MapDataMenuController;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor; import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
import net.osmand.plus.mapcontextmenu.editors.PointEditor; import net.osmand.plus.mapcontextmenu.editors.PointEditor;
import net.osmand.plus.mapcontextmenu.editors.RtePtEditor; import net.osmand.plus.mapcontextmenu.editors.RtePtEditor;
@ -46,6 +47,7 @@ import net.osmand.plus.mapcontextmenu.other.ShareMenu;
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
import net.osmand.plus.mapmarkers.RenameMarkerBottomSheetDialogFragment; import net.osmand.plus.mapmarkers.RenameMarkerBottomSheetDialogFragment;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.parkingpoint.ParkingPositionMenuController;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.ContextMenuLayer; import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.plus.views.OsmandMapLayer; import net.osmand.plus.views.OsmandMapLayer;
@ -415,6 +417,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
init(latLon, pointDescription, object); init(latLon, pointDescription, object);
} }
public boolean navigateInPedestrianMode() {
return menuController instanceof ParkingPositionMenuController;
}
public boolean close() { public boolean close() {
boolean result = false; boolean result = false;
if (active) { if (active) {
@ -710,7 +716,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
public int getFavActionStringId() { public int getFavActionStringId() {
if (menuController != null) if (menuController != null)
return menuController.getFavActionStringId(); return menuController.getFavActionStringId();
return R.string.shared_string_add_to_favorites; return R.string.shared_string_add;
} }
public int getWaypointActionIconId() { public int getWaypointActionIconId() {
@ -753,8 +759,18 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
} }
} }
public void fabPressed() { public List<TransportStopRoute> getTransportStopRoutes() {
mapActivity.getMapLayers().getMapControlsLayer().navigateFab(); if (menuController != null) {
return menuController.getTransportStopRoutes();
}
return null;
}
public void navigateButtonPressed() {
if (navigateInPedestrianMode()) {
settings.APPLICATION_MODE.set(ApplicationMode.PEDESTRIAN);
}
mapActivity.getMapLayers().getMapControlsLayer().navigateButton();
} }
public boolean zoomInPressed() { public boolean zoomInPressed() {
@ -1063,17 +1079,9 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
} }
} }
public TitleButtonController getTopRightTitleButtonController() { public TitleButtonController getBottomTitleButtonController() {
if (menuController != null) { if (menuController != null) {
return menuController.getTopRightTitleButtonController(); return menuController.getBottomTitleButtonController();
} else {
return null;
}
}
public TitleButtonController getLeftSubtitleButtonController() {
if (menuController != null) {
return menuController.getLeftSubtitleButtonController();
} else { } else {
return null; return null;
} }
@ -1107,8 +1115,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
return menuController == null || menuController.supportZoomIn(); return menuController == null || menuController.supportZoomIn();
} }
public boolean fabVisible() { public boolean navigateButtonVisible() {
return menuController == null || menuController.fabVisible(); return menuController == null || menuController.navigateButtonVisible();
} }
public boolean zoomButtonsVisible() { public boolean zoomButtonsVisible() {
@ -1127,6 +1135,17 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
return menuController != null && menuController.displayDistanceDirection(); return menuController != null && menuController.displayDistanceDirection();
} }
public boolean displayAdditionalTypeStrInHours() {
return menuController != null && menuController.displayAdditionalTypeStrInHours();
}
public int getTimeStrColor() {
if (menuController != null) {
return menuController.getTimeStrColor();
}
return 0;
}
public boolean isMapDownloaded() { public boolean isMapDownloaded() {
return menuController != null && menuController.isMapDownloaded(); return menuController != null && menuController.isMapDownloaded();
} }

View file

@ -9,6 +9,8 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -20,8 +22,8 @@ import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.widget.Button;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -30,12 +32,9 @@ import android.widget.TextView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.QuadPoint; import net.osmand.data.QuadPoint;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -46,6 +45,7 @@ import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.mapcontextmenu.MenuController.MenuState; import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController; import net.osmand.plus.mapcontextmenu.MenuController.TitleButtonController;
import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController; import net.osmand.plus.mapcontextmenu.MenuController.TitleProgressController;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu; import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.views.AnimateDraggingMapThread; import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
@ -53,6 +53,8 @@ import net.osmand.plus.views.controls.HorizontalSwipeConfirm;
import net.osmand.plus.views.controls.SingleTapConfirm; import net.osmand.plus.views.controls.SingleTapConfirm;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.util.List;
import static android.util.TypedValue.COMPLEX_UNIT_DIP; import static android.util.TypedValue.COMPLEX_UNIT_DIP;
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP; import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
@ -68,7 +70,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private View view; private View view;
private View mainView; private View mainView;
private ImageView fabView;
private View zoomButtonsView; private View zoomButtonsView;
private ImageButton zoomInButtonView; private ImageButton zoomInButtonView;
private ImageButton zoomOutButtonView; private ImageButton zoomOutButtonView;
@ -77,7 +78,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private OnLayoutChangeListener containerLayoutListener; private OnLayoutChangeListener containerLayoutListener;
private int menuTopViewHeight; private int menuTopViewHeight;
private int menuTopShadowHeight;
private int menuTopShadowAllHeight; private int menuTopShadowAllHeight;
private int menuTitleHeight; private int menuTitleHeight;
private int menuBottomViewHeight; private int menuBottomViewHeight;
@ -90,7 +90,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private int viewHeight; private int viewHeight;
private int zoomButtonsHeight; private int zoomButtonsHeight;
private int fabPaddingTopPx;
private int markerPaddingPx; private int markerPaddingPx;
private int markerPaddingXPx; private int markerPaddingXPx;
@ -112,14 +111,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private int screenOrientation; private int screenOrientation;
private boolean created; private boolean created;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
processScreenHeight(container); processScreenHeight(container);
fabPaddingTopPx = dpToPx(FAB_PADDING_TOP_DP);
markerPaddingPx = dpToPx(MARKER_PADDING_DP); markerPaddingPx = dpToPx(MARKER_PADDING_DP);
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP); markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
@ -152,8 +149,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
} }
// Left title button // Left title button
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button); final View leftTitleButtonView = view.findViewById(R.id.title_button_view);
leftTitleButton.setOnClickListener(new View.OnClickListener() { leftTitleButtonView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController(); TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController();
@ -164,8 +161,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}); });
// Right title button // Right title button
final Button rightTitleButton = (Button) view.findViewById(R.id.title_button_right); final View rightTitleButtonView = view.findViewById(R.id.title_button_right_view);
rightTitleButton.setOnClickListener(new View.OnClickListener() { rightTitleButtonView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController(); TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController();
@ -175,21 +172,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
} }
}); });
// Left subtitle button
final Button leftSubtitleButton = (Button) view.findViewById(R.id.subtitle_button);
leftSubtitleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TitleButtonController leftSubtitleButtonController = menu.getLeftSubtitleButtonController();
if (leftSubtitleButtonController != null) {
leftSubtitleButtonController.buttonPressed();
}
}
});
// Left download button // Left download button
final Button leftDownloadButton = (Button) view.findViewById(R.id.download_button_left); final View leftDownloadButtonView = view.findViewById(R.id.download_button_left_view);
leftDownloadButton.setOnClickListener(new View.OnClickListener() { leftDownloadButtonView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
TitleButtonController leftDownloadButtonController = menu.getLeftDownloadButtonController(); TitleButtonController leftDownloadButtonController = menu.getLeftDownloadButtonController();
@ -200,8 +185,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}); });
// Right download button // Right download button
final Button rightDownloadButton = (Button) view.findViewById(R.id.download_button_right); final View rightDownloadButtonView = (View) view.findViewById(R.id.download_button_right_view);
rightDownloadButton.setOnClickListener(new View.OnClickListener() { rightDownloadButtonView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController(); TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController();
@ -211,14 +196,14 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
} }
}); });
// Top Right title button // Bottom title button
final Button topRightTitleButton = (Button) view.findViewById(R.id.title_button_top_right); final View bottomTitleButton = view.findViewById(R.id.title_button_bottom_view);
topRightTitleButton.setOnClickListener(new View.OnClickListener() { bottomTitleButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
TitleButtonController topRightTitleButtonController = menu.getTopRightTitleButtonController(); TitleButtonController bottomTitleButtonController = menu.getBottomTitleButtonController();
if (topRightTitleButtonController != null) { if (bottomTitleButtonController != null) {
topRightTitleButtonController.buttonPressed(); bottomTitleButtonController.buttonPressed();
} }
} }
}); });
@ -306,12 +291,10 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
setViewY((int) newY, false, false); setViewY((int) newY, false, false);
menuFullHeight = view.getHeight() - (int) newY + 10; menuFullHeight = view.getHeight() - (int) newY + 10;
if (!oldAndroid()) { ViewGroup.LayoutParams lp = mainView.getLayoutParams();
ViewGroup.LayoutParams lp = mainView.getLayoutParams(); lp.height = Math.max(menuFullHeight, menuTitleHeight);
lp.height = Math.max(menuFullHeight, menuTitleHeight); mainView.setLayoutParams(lp);
mainView.setLayoutParams(lp); mainView.requestLayout();
mainView.requestLayout();
}
velocity.addMovement(event); velocity.addMovement(event);
velocity.computeCurrentVelocity(1000); velocity.computeCurrentVelocity(1000);
@ -345,8 +328,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
View topView = view.findViewById(R.id.context_menu_top_view); View topView = view.findViewById(R.id.context_menu_top_view);
topView.setOnTouchListener(slideTouchListener); topView.setOnTouchListener(slideTouchListener);
View topShadowView = view.findViewById(R.id.context_menu_top_shadow);
topShadowView.setOnTouchListener(slideTouchListener);
View topShadowAllView = view.findViewById(R.id.context_menu_top_shadow_all); View topShadowAllView = view.findViewById(R.id.context_menu_top_shadow_all);
AndroidUtils.setBackground(getMapActivity(), topShadowAllView, nightMode, R.drawable.bg_map_context_menu_light, AndroidUtils.setBackground(getMapActivity(), topShadowAllView, nightMode, R.drawable.bg_map_context_menu_light,
R.drawable.bg_map_context_menu_dark); R.drawable.bg_map_context_menu_dark);
@ -362,46 +343,21 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
buildHeader(); buildHeader();
AndroidUtils.setTextPrimaryColor(getMapActivity(), ((TextView) view.findViewById(R.id.context_menu_line1)).setTextColor(ContextCompat.getColor(getContext(),
(TextView) view.findViewById(R.id.context_menu_line1), nightMode); nightMode ? R.color.ctx_menu_title_color_dark : R.color.ctx_menu_title_color_light));
View menuLine2 = view.findViewById(R.id.context_menu_line2); View menuLine2 = view.findViewById(R.id.context_menu_line2);
if (menuLine2 != null) { if (menuLine2 != null) {
AndroidUtils.setTextSecondaryColor(getMapActivity(), (TextView) menuLine2, nightMode); ((TextView) menuLine2).setTextColor(ContextCompat.getColor(getContext(), R.color.ctx_menu_subtitle_color));
} }
((Button) view.findViewById(R.id.title_button_top_right)) ((TextView) view.findViewById(R.id.distance)).setTextColor(ContextCompat.getColor(getContext(),
.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) : getResources().getColor(R.color.osmand_orange)); nightMode ? R.color.ctx_menu_direction_color_dark : R.color.ctx_menu_direction_color_light));
AndroidUtils.setTextSecondaryColor(getMapActivity(),
(TextView) view.findViewById(R.id.distance), nightMode);
((Button) view.findViewById(R.id.title_button))
.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) : getResources().getColor(R.color.osmand_orange));
AndroidUtils.setTextSecondaryColor(getMapActivity(), AndroidUtils.setTextSecondaryColor(getMapActivity(),
(TextView) view.findViewById(R.id.title_button_right_text), nightMode); (TextView) view.findViewById(R.id.title_button_right_text), nightMode);
((Button) view.findViewById(R.id.title_button_right))
.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) : getResources().getColor(R.color.osmand_orange));
AndroidUtils.setTextSecondaryColor(getMapActivity(), AndroidUtils.setTextSecondaryColor(getMapActivity(),
(TextView) view.findViewById(R.id.progressTitle), nightMode); (TextView) view.findViewById(R.id.progressTitle), nightMode);
// FAB
fabView = (ImageView) view.findViewById(R.id.context_menu_fab_view);
if (menu.fabVisible()) {
fabView.setImageDrawable(getIcon(menu.getFabIconId(), 0));
if (menu.isLandscapeLayout()) {
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) fabView.getLayoutParams();
params.setMargins(0, 0, dpToPx(28f), 0);
fabView.setLayoutParams(params);
}
fabView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
menu.fabPressed();
}
});
} else {
fabView.setVisibility(View.GONE);
}
// Zoom buttons // Zoom buttons
zoomButtonsView = view.findViewById(R.id.context_menu_zoom_buttons); zoomButtonsView = view.findViewById(R.id.context_menu_zoom_buttons);
zoomInButtonView = (ImageButton) view.findViewById(R.id.context_menu_zoom_in_button); zoomInButtonView = (ImageButton) view.findViewById(R.id.context_menu_zoom_in_button);
@ -428,94 +384,129 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
zoomButtonsView.setVisibility(View.GONE); zoomButtonsView.setVisibility(View.GONE);
} }
GridView transportStopRoutesGrid = (GridView) view.findViewById(R.id.transport_stop_routes_grid);
List<TransportStopRoute> transportStopRoutes = menu.getTransportStopRoutes();
if (transportStopRoutes != null && transportStopRoutes.size() > 0) {
TransportStopRouteAdapter adapter = new TransportStopRouteAdapter(getContext(), transportStopRoutes);
transportStopRoutesGrid.setAdapter(adapter);
transportStopRoutesGrid.setVisibility(View.VISIBLE);
} else {
transportStopRoutesGrid.setVisibility(View.GONE);
}
View buttonsBottomBorder = view.findViewById(R.id.buttons_bottom_border);
View buttonsTopBorder = view.findViewById(R.id.buttons_top_border); View buttonsTopBorder = view.findViewById(R.id.buttons_top_border);
AndroidUtils.setBackground(getMapActivity(), buttonsTopBorder, nightMode, buttonsBottomBorder.setBackgroundColor(ContextCompat.getColor(getContext(), nightMode ? R.color.ctx_menu_buttons_divider_dark : R.color.ctx_menu_buttons_divider_light));
R.color.dashboard_divider_light, R.color.dashboard_divider_dark); buttonsTopBorder.setBackgroundColor(ContextCompat.getColor(getContext(), nightMode ? R.color.ctx_menu_buttons_divider_dark : R.color.ctx_menu_buttons_divider_light));
View buttons = view.findViewById(R.id.context_menu_buttons);
buttons.setBackgroundColor(ContextCompat.getColor(getContext(), nightMode ? R.color.ctx_menu_buttons_bg_dark : R.color.ctx_menu_buttons_bg_light));
if (!menu.buttonsVisible()) { if (!menu.buttonsVisible()) {
View buttons = view.findViewById(R.id.context_menu_buttons);
buttonsTopBorder.setVisibility(View.GONE); buttonsTopBorder.setVisibility(View.GONE);
buttons.setVisibility(View.GONE); buttons.setVisibility(View.GONE);
} }
View bottomButtons = view.findViewById(R.id.context_menu_bottom_buttons);
AndroidUtils.setBackground(getMapActivity(), mainView.findViewById(R.id.divider_hor_1), nightMode, bottomButtons.setBackgroundColor(ContextCompat.getColor(getContext(), nightMode ? R.color.ctx_menu_buttons_bg_dark : R.color.ctx_menu_buttons_bg_light));
R.color.dashboard_divider_light, R.color.dashboard_divider_dark); if (!menu.navigateButtonVisible()) {
AndroidUtils.setBackground(getMapActivity(), mainView.findViewById(R.id.divider_hor_2), nightMode, bottomButtons.findViewById(R.id.context_menu_directions_button).setVisibility(View.GONE);
R.color.dashboard_divider_light, R.color.dashboard_divider_dark); }
AndroidUtils.setBackground(getMapActivity(), mainView.findViewById(R.id.divider_hor_3), nightMode,
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
// Action buttons // Action buttons
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button); final ImageView imageFavorite = (ImageView) view.findViewById(R.id.context_menu_fav_image_view);
buttonFavorite.setImageDrawable(getIcon(menu.getFavActionIconId(), imageFavorite.setImageDrawable(getIcon(menu.getFavActionIconId(),
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark)); R.color.ctx_menu_buttons_icon_color));
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonFavorite, nightMode); imageFavorite.setContentDescription(getString(menu.getFavActionStringId()));
buttonFavorite.setContentDescription(getString(menu.getFavActionStringId())); ((TextView) view.findViewById(R.id.context_menu_fav_text_view)).setText(menu.getFavActionStringId());
buttonFavorite.setOnClickListener(new View.OnClickListener() { View favView = view.findViewById(R.id.context_menu_fav_view);
favView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
menu.buttonFavoritePressed(); menu.buttonFavoritePressed();
} }
}); });
final ImageButton buttonWaypoint = (ImageButton) view.findViewById(R.id.context_menu_route_button); final ImageView imageWaypoint = (ImageView) view.findViewById(R.id.context_menu_route_image_view);
buttonWaypoint.setImageDrawable(getIcon(menu.getWaypointActionIconId(), imageWaypoint.setImageDrawable(getIcon(menu.getWaypointActionIconId(),
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark)); R.color.ctx_menu_buttons_icon_color));
buttonWaypoint.setContentDescription(getString(menu.getWaypointActionStringId())); imageWaypoint.setContentDescription(getString(menu.getWaypointActionStringId()));
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonWaypoint, nightMode); View waypointView = view.findViewById(R.id.context_menu_route_view);
if (menu.isButtonWaypointEnabled()) { if (menu.isButtonWaypointEnabled()) {
buttonWaypoint.setOnClickListener(new View.OnClickListener() { waypointView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
menu.buttonWaypointPressed(); menu.buttonWaypointPressed();
} }
}); });
} else { } else {
deactivate(buttonWaypoint); deactivate(waypointView);
} }
final ImageButton buttonShare = (ImageButton) view.findViewById(R.id.context_menu_share_button); final ImageView imageShare = (ImageView) view.findViewById(R.id.context_menu_share_image_view);
buttonShare.setImageDrawable(getIcon(R.drawable.map_action_gshare_dark, imageShare.setImageDrawable(getIcon(R.drawable.map_action_gshare_dark,
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark)); R.color.ctx_menu_buttons_icon_color));
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonShare, nightMode); View shareView = view.findViewById(R.id.context_menu_share_view);
buttonShare.setOnClickListener(new View.OnClickListener() { shareView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
menu.buttonSharePressed(); menu.buttonSharePressed();
} }
}); });
final ImageButton buttonMore = (ImageButton) view.findViewById(R.id.context_menu_more_button); final ImageView imageMore = (ImageView) view.findViewById(R.id.context_menu_more_image_view);
buttonMore.setImageDrawable(getIcon(R.drawable.map_overflow_menu_white, imageMore.setImageDrawable(getIcon(R.drawable.map_overflow_menu_white,
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark)); R.color.ctx_menu_buttons_icon_color));
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonMore, nightMode); View moreView = view.findViewById(R.id.context_menu_more_view);
buttonMore.setOnClickListener(new View.OnClickListener() { moreView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
menu.buttonMorePressed(); menu.buttonMorePressed();
} }
}); });
//Bottom buttons
int bottomButtonsColor = nightMode ? R.color.ctx_menu_controller_button_text_color_dark_n : R.color.ctx_menu_controller_button_text_color_light_n;
TextView detailsButton = (TextView) view.findViewById(R.id.context_menu_details_button);
detailsButton.setTextColor(ContextCompat.getColor(getContext(), bottomButtonsColor));
detailsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
menu.openMenuFullScreen();
}
});
TextView directionsButton = (TextView) view.findViewById(R.id.context_menu_directions_button);
int iconResId = R.drawable.map_directions;
if (menu.navigateInPedestrianMode()) {
iconResId = R.drawable.map_action_pedestrian_dark;
}
Drawable drawable = getIcon(iconResId, bottomButtonsColor);
directionsButton.setTextColor(ContextCompat.getColor(getContext(), bottomButtonsColor));
directionsButton.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
directionsButton.setCompoundDrawablePadding(dpToPx(8));
directionsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
menu.navigateButtonPressed();
}
});
buildBottomView(); buildBottomView();
view.findViewById(R.id.context_menu_bottom_scroll).setBackgroundColor(nightMode ? view.findViewById(R.id.context_menu_bottom_scroll).setBackgroundColor(getResources()
getResources().getColor(R.color.ctx_menu_info_view_bg_dark) : getResources().getColor(R.color.ctx_menu_info_view_bg_light)); .getColor(nightMode ? R.color.ctx_menu_bottom_view_bg_dark : R.color.ctx_menu_bottom_view_bg_light));
view.findViewById(R.id.context_menu_bottom_view).setBackgroundColor(nightMode ? view.findViewById(R.id.context_menu_bottom_view).setBackgroundColor(getResources()
getResources().getColor(R.color.ctx_menu_info_view_bg_dark) : getResources().getColor(R.color.ctx_menu_info_view_bg_light)); .getColor(nightMode ? R.color.ctx_menu_bottom_view_bg_dark : R.color.ctx_menu_bottom_view_bg_light));
//getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(false); //getMapActivity().getMapLayers().getMapControlsLayer().setControlsClickable(false);
if (Build.VERSION.SDK_INT >= 11) { containerLayoutListener = new OnLayoutChangeListener() {
containerLayoutListener = new OnLayoutChangeListener() { @Override
@Override public void onLayoutChange(View view, int left, int top, int right, int bottom,
public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
int oldLeft, int oldTop, int oldRight, int oldBottom) { if (bottom != oldBottom) {
if (bottom != oldBottom) { processScreenHeight(view.getParent());
processScreenHeight(view.getParent()); runLayoutListener();
runLayoutListener();
}
} }
}; }
} };
created = true; created = true;
return view; return view;
@ -546,11 +537,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private void processScreenHeight(ViewParent parent) { private void processScreenHeight(ViewParent parent) {
View container = (View)parent; View container = (View)parent;
if (Build.VERSION.SDK_INT >= 11) { screenHeight = container.getHeight() + AndroidUtils.getStatusBarHeight(getActivity());
screenHeight = container.getHeight() + AndroidUtils.getStatusBarHeight(getActivity());
} else {
screenHeight = AndroidUtils.getScreenHeight(getActivity());
}
skipHalfScreenStateLimit = screenHeight * SKIP_HALF_SCREEN_STATE_KOEF; skipHalfScreenStateLimit = screenHeight * SKIP_HALF_SCREEN_STATE_KOEF;
viewHeight = screenHeight - AndroidUtils.getStatusBarHeight(getMapActivity()); viewHeight = screenHeight - AndroidUtils.getStatusBarHeight(getMapActivity());
} }
@ -639,58 +626,41 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
updateMainViewLayout(posY); updateMainViewLayout(posY);
} }
if (!oldAndroid()) { mainView.animate().y(posY)
mainView.animate().y(posY) .setDuration(200)
.setDuration(200) .setInterpolator(new DecelerateInterpolator())
.setInterpolator(new DecelerateInterpolator()) .setListener(new AnimatorListenerAdapter() {
.setListener(new AnimatorListenerAdapter() {
boolean canceled = false; boolean canceled = false;
@Override @Override
public void onAnimationCancel(Animator animation) { public void onAnimationCancel(Animator animation) {
canceled = true; canceled = true;
} }
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
if (!canceled) { if (!canceled) {
if (needCloseMenu) { if (needCloseMenu) {
menu.close(); menu.close();
} else { } else {
updateMainViewLayout(posY); updateMainViewLayout(posY);
if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) { if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) {
doAfterMenuStateChange(previousMenuState, newMenuState); doAfterMenuStateChange(previousMenuState, newMenuState);
}
} }
} }
} }
}) }
.start(); })
.start();
fabView.animate().y(getFabY(posY)) zoomButtonsView.animate().y(getZoomButtonsY(posY))
.setDuration(200) .setDuration(200)
.setInterpolator(new DecelerateInterpolator()) .setInterpolator(new DecelerateInterpolator())
.start(); .start();
zoomButtonsView.animate().y(getZoomButtonsY(posY)) if (needMapAdjust) {
.setDuration(200) adjustMapPosition(posY, true, centered, dZoom);
.setInterpolator(new DecelerateInterpolator())
.start();
if (needMapAdjust) {
adjustMapPosition(posY, true, centered, dZoom);
}
} else {
setViewY(posY, false, needMapAdjust);
if (needCloseMenu) {
menu.close();
} else {
updateMainViewLayout(posY);
if (previousMenuState != 0 && newMenuState != 0 && previousMenuState != newMenuState) {
doAfterMenuStateChange(previousMenuState, newMenuState);
}
}
} }
} }
} }
@ -708,82 +678,70 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (view != null) { if (view != null) {
TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController(); TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController();
TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController(); TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController();
TitleButtonController topRightTitleButtonController = menu.getTopRightTitleButtonController(); TitleButtonController bottomTitleButtonController = menu.getBottomTitleButtonController();
TitleButtonController leftSubtitleButtonController = menu.getLeftSubtitleButtonController();
TitleButtonController leftDownloadButtonController = menu.getLeftDownloadButtonController(); TitleButtonController leftDownloadButtonController = menu.getLeftDownloadButtonController();
TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController(); TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController();
TitleProgressController titleProgressController = menu.getTitleProgressController(); TitleProgressController titleProgressController = menu.getTitleProgressController();
// Title buttons // Title buttons
boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null); boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null);
boolean showTitleDivider = leftSubtitleButtonController != null;
final View titleButtonsContainer = view.findViewById(R.id.title_button_container); final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
titleButtonsContainer.setVisibility(showTitleButtonsContainer ? View.VISIBLE : View.GONE); titleButtonsContainer.setVisibility(showTitleButtonsContainer ? View.VISIBLE : View.GONE);
view.findViewById(R.id.title_divider).setVisibility(showTitleDivider ? View.VISIBLE : View.GONE);
// Left title button // Left title button
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button); final View leftTitleButtonView = view.findViewById(R.id.title_button_view);
final TextView leftTitleButton = (TextView) view.findViewById(R.id.title_button);
final TextView titleButtonRightText = (TextView) view.findViewById(R.id.title_button_right_text); final TextView titleButtonRightText = (TextView) view.findViewById(R.id.title_button_right_text);
if (leftTitleButtonController != null) { if (leftTitleButtonController != null) {
leftTitleButton.setText(leftTitleButtonController.caption); leftTitleButton.setText(leftTitleButtonController.caption);
leftTitleButton.setVisibility(leftTitleButtonController.visible ? View.VISIBLE : View.GONE); if (leftTitleButtonController.visible) {
leftTitleButtonView.setVisibility(View.VISIBLE);
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
if (leftIcon != null) {
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
leftTitleButton.setCompoundDrawablePadding(dpToPx(8f));
}
Drawable leftIcon = leftTitleButtonController.getLeftIcon(); if (leftTitleButtonController.needRightText) {
if (leftIcon != null) { titleButtonRightText.setText(leftTitleButtonController.rightTextCaption);
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null); titleButtonRightText.setVisibility(View.VISIBLE);
leftTitleButton.setCompoundDrawablePadding(dpToPx(8f)); } else {
} titleButtonRightText.setVisibility(View.GONE);
}
if (leftTitleButtonController.needRightText) {
titleButtonRightText.setText(leftTitleButtonController.rightTextCaption);
titleButtonRightText.setVisibility(View.VISIBLE);
} else { } else {
titleButtonRightText.setVisibility(View.GONE); leftTitleButtonView.setVisibility(View.INVISIBLE);
} }
} else { } else {
leftTitleButton.setVisibility(View.GONE); leftTitleButtonView.setVisibility(View.INVISIBLE);
titleButtonRightText.setVisibility(View.GONE); titleButtonRightText.setVisibility(View.GONE);
} }
// Right title button // Right title button
final Button rightTitleButton = (Button) view.findViewById(R.id.title_button_right); final View rightTitleButtonView = view.findViewById(R.id.title_button_right_view);
final TextView rightTitleButton = (TextView) view.findViewById(R.id.title_button_right);
if (rightTitleButtonController != null) { if (rightTitleButtonController != null) {
rightTitleButton.setText(rightTitleButtonController.caption); rightTitleButton.setText(rightTitleButtonController.caption);
rightTitleButton.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.GONE); rightTitleButtonView.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
Drawable leftIcon = rightTitleButtonController.getLeftIcon(); Drawable leftIcon = rightTitleButtonController.getLeftIcon();
rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null); rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
rightTitleButton.setCompoundDrawablePadding(dpToPx(8f)); rightTitleButton.setCompoundDrawablePadding(dpToPx(8f));
} else { } else {
rightTitleButton.setVisibility(View.GONE); rightTitleButtonView.setVisibility(View.INVISIBLE);
} }
// Top Right title button // Bottom title button
final Button topRightTitleButton = (Button) view.findViewById(R.id.title_button_top_right); final View bottomTitleButtonView = view.findViewById(R.id.title_button_bottom_view);
if (topRightTitleButtonController != null) { final TextView bottomTitleButton = (TextView) view.findViewById(R.id.title_button_bottom);
topRightTitleButton.setText(topRightTitleButtonController.caption); if (bottomTitleButtonController != null) {
topRightTitleButton.setVisibility(topRightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE); bottomTitleButton.setText(bottomTitleButtonController.caption);
bottomTitleButtonView.setVisibility(bottomTitleButtonController.visible ? View.VISIBLE : View.GONE);
Drawable leftIcon = topRightTitleButtonController.getLeftIcon(); Drawable leftIcon = bottomTitleButtonController.getLeftIcon();
topRightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null); bottomTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
topRightTitleButton.setCompoundDrawablePadding(dpToPx(8f)); bottomTitleButton.setCompoundDrawablePadding(dpToPx(8f));
} else { } else {
topRightTitleButton.setVisibility(View.GONE); bottomTitleButtonView.setVisibility(View.GONE);
}
// Left subtitle button
final Button leftSubtitleButton = (Button) view.findViewById(R.id.subtitle_button);
if (leftSubtitleButtonController != null) {
leftSubtitleButton.setText(leftSubtitleButtonController.caption);
leftSubtitleButton.setVisibility(leftSubtitleButtonController.visible ? View.VISIBLE : View.GONE);
Drawable leftIcon = leftSubtitleButtonController.getLeftIcon();
if (leftIcon != null) {
leftSubtitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
leftSubtitleButton.setCompoundDrawablePadding(dpToPx(8f));
}
} else {
leftSubtitleButton.setVisibility(View.GONE);
} }
// Download buttons // Download buttons
@ -794,21 +752,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
final View downloadButtonsContainer = view.findViewById(R.id.download_buttons_container); final View downloadButtonsContainer = view.findViewById(R.id.download_buttons_container);
downloadButtonsContainer.setVisibility(showDownloadButtonsContainer ? View.VISIBLE : View.GONE); downloadButtonsContainer.setVisibility(showDownloadButtonsContainer ? View.VISIBLE : View.GONE);
if (showDownloadButtonsContainer) {
view.findViewById(R.id.download_buttons_top_border).setVisibility(showTitleButtonsContainer ? View.VISIBLE : View.INVISIBLE);
if (showTitleButtonsContainer) {
LinearLayout.LayoutParams ll = (LinearLayout.LayoutParams) downloadButtonsContainer.getLayoutParams();
if (ll.topMargin != 0) {
ll.setMargins(0, 0, 0, 0);
}
}
}
// Left download button // Left download button
final Button leftDownloadButton = (Button) view.findViewById(R.id.download_button_left); final View leftDownloadButtonView = view.findViewById(R.id.download_button_left_view);
final TextView leftDownloadButton = (TextView) view.findViewById(R.id.download_button_left);
if (leftDownloadButtonController != null) { if (leftDownloadButtonController != null) {
leftDownloadButton.setText(leftDownloadButtonController.caption); leftDownloadButton.setText(leftDownloadButtonController.caption);
leftDownloadButton.setVisibility(leftDownloadButtonController.visible ? View.VISIBLE : View.GONE); leftDownloadButtonView.setVisibility(leftDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
Drawable leftIcon = leftDownloadButtonController.getLeftIcon(); Drawable leftIcon = leftDownloadButtonController.getLeftIcon();
if (leftIcon != null) { if (leftIcon != null) {
@ -816,20 +765,21 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
leftDownloadButton.setCompoundDrawablePadding(dpToPx(8f)); leftDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
} }
} else { } else {
leftDownloadButton.setVisibility(View.GONE); leftDownloadButtonView.setVisibility(View.INVISIBLE);
} }
// Right download button // Right download button
final Button rightDownloadButton = (Button) view.findViewById(R.id.download_button_right); final View rightDownloadButtonView = view.findViewById(R.id.download_button_right_view);
final TextView rightDownloadButton = (TextView) view.findViewById(R.id.download_button_right);
if (rightDownloadButtonController != null) { if (rightDownloadButtonController != null) {
rightDownloadButton.setText(rightDownloadButtonController.caption); rightDownloadButton.setText(rightDownloadButtonController.caption);
rightDownloadButton.setVisibility(rightDownloadButtonController.visible ? View.VISIBLE : View.GONE); rightDownloadButtonView.setVisibility(rightDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
Drawable leftIcon = rightDownloadButtonController.getLeftIcon(); Drawable leftIcon = rightDownloadButtonController.getLeftIcon();
rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null); rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
rightDownloadButton.setCompoundDrawablePadding(dpToPx(8f)); rightDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
} else { } else {
rightDownloadButton.setVisibility(View.GONE); rightDownloadButtonView.setVisibility(View.INVISIBLE);
} }
// Progress bar // Progress bar
@ -861,19 +811,18 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private void buildHeader() { private void buildHeader() {
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
if (app != null && view != null) { if (app != null && view != null) {
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view); final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
Drawable icon = menu.getLeftIcon(); Drawable icon = menu.getLeftIcon();
int iconId = menu.getLeftIconId(); int iconId = menu.getLeftIconId();
if (icon != null) { if (icon != null) {
iconView.setImageDrawable(icon); iconView.setImageDrawable(icon);
iconLayout.setVisibility(View.VISIBLE); iconView.setVisibility(View.VISIBLE);
} else if (iconId != 0) { } else if (iconId != 0) {
iconView.setImageDrawable(getIcon(iconId, iconView.setImageDrawable(getIcon(iconId,
!nightMode ? R.color.osmand_orange : R.color.osmand_orange_dark)); !nightMode ? R.color.osmand_orange : R.color.osmand_orange_dark));
iconLayout.setVisibility(View.VISIBLE); iconView.setVisibility(View.VISIBLE);
} else { } else {
iconLayout.setVisibility(View.GONE); iconView.setVisibility(View.GONE);
} }
setAddressLocation(); setAddressLocation();
} }
@ -956,10 +905,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
public void rebuildMenu(boolean centered) { public void rebuildMenu(boolean centered) {
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
if (app != null && view != null) { if (app != null && view != null) {
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button); final ImageView buttonFavorite = (ImageView) view.findViewById(R.id.context_menu_fav_image_view);
buttonFavorite.setImageDrawable(getIcon(menu.getFavActionIconId(), buttonFavorite.setImageDrawable(getIcon(menu.getFavActionIconId(),
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark)); !nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
buttonFavorite.setContentDescription(getString(menu.getFavActionStringId())); String favActionString = getString(menu.getFavActionStringId());
buttonFavorite.setContentDescription(favActionString);
((TextView) view.findViewById(R.id.context_menu_fav_text_view)).setText(favActionString);
buildHeader(); buildHeader();
@ -997,7 +948,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
} }
int newMenuTopViewHeight = view.findViewById(R.id.context_menu_top_view).getHeight(); int newMenuTopViewHeight = view.findViewById(R.id.context_menu_top_view).getHeight();
menuTopShadowHeight = view.findViewById(R.id.context_menu_top_shadow).getHeight();
int newMenuTopShadowAllHeight = view.findViewById(R.id.context_menu_top_shadow_all).getHeight(); int newMenuTopShadowAllHeight = view.findViewById(R.id.context_menu_top_shadow_all).getHeight();
menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight(); menuFullHeight = view.findViewById(R.id.context_menu_main).getHeight();
zoomButtonsHeight = zoomButtonsView.getHeight(); zoomButtonsHeight = zoomButtonsView.getHeight();
@ -1015,35 +965,28 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
line2MeasuredHeight = line2.getMeasuredHeight(); line2MeasuredHeight = line2.getMeasuredHeight();
} }
int dp16 = dpToPx(16f);
boolean has16margin = false;
int titleButtonHeight = 0; int titleButtonHeight = 0;
View titleButtonContainer = view.findViewById(R.id.title_button_container); View titleButtonContainer = view.findViewById(R.id.title_button_container);
if (titleButtonContainer.getVisibility() == View.VISIBLE) { if (titleButtonContainer.getVisibility() == View.VISIBLE) {
titleButtonHeight = titleButtonContainer.getMeasuredHeight() - dp16; titleButtonHeight = titleButtonContainer.getMeasuredHeight();
if (titleButtonHeight < 0) {
titleButtonHeight = 0;
} else {
has16margin = true;
}
} }
int downloadButtonsHeight = 0; int downloadButtonsHeight = 0;
View downloadButtonsContainer = view.findViewById(R.id.download_buttons_container); View downloadButtonsContainer = view.findViewById(R.id.download_buttons_container);
if (downloadButtonsContainer.getVisibility() == View.VISIBLE) { if (downloadButtonsContainer.getVisibility() == View.VISIBLE) {
downloadButtonsHeight = downloadButtonsContainer.getMeasuredHeight() - (has16margin ? 0 : dp16); downloadButtonsHeight = downloadButtonsContainer.getMeasuredHeight();
if (downloadButtonsHeight < 0) {
downloadButtonsHeight = 0;
} else {
has16margin = true;
}
} }
int titleBottomButtonHeight = 0;
View titleBottomButtonContainer = view.findViewById(R.id.title_bottom_button_container);
if (titleBottomButtonContainer.getVisibility() == View.VISIBLE) {
titleBottomButtonHeight = titleBottomButtonContainer.getMeasuredHeight();
}
int titleProgressHeight = 0; int titleProgressHeight = 0;
View titleProgressContainer = view.findViewById(R.id.title_progress_container); View titleProgressContainer = view.findViewById(R.id.title_progress_container);
if (titleProgressContainer.getVisibility() == View.VISIBLE) { if (titleProgressContainer.getVisibility() == View.VISIBLE) {
titleProgressHeight = titleProgressContainer.getMeasuredHeight() - (has16margin ? 0 : dp16); titleProgressHeight = titleProgressContainer.getMeasuredHeight();
if (titleProgressHeight < 0) {
titleProgressHeight = 0;
}
} }
if (menuTopViewHeight != 0) { if (menuTopViewHeight != 0) {
@ -1051,17 +994,17 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (titleHeight < line1.getMeasuredHeight() + line2MeasuredHeight) { if (titleHeight < line1.getMeasuredHeight() + line2MeasuredHeight) {
titleHeight = line1.getMeasuredHeight() + line2MeasuredHeight; titleHeight = line1.getMeasuredHeight() + line2MeasuredHeight;
} }
newMenuTopViewHeight = menuTopViewHeightExcludingTitle + titleHeight + titleButtonHeight + downloadButtonsHeight + titleProgressHeight; newMenuTopViewHeight = menuTopViewHeightExcludingTitle + titleHeight + titleButtonHeight + downloadButtonsHeight + titleBottomButtonHeight + titleProgressHeight;
dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight - (newMenuTopShadowAllHeight - menuTopShadowAllHeight)); dy = Math.max(0, newMenuTopViewHeight - menuTopViewHeight - (newMenuTopShadowAllHeight - menuTopShadowAllHeight));
} else { } else {
menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight() - line2MeasuredHeight - titleButtonHeight - downloadButtonsHeight - titleProgressHeight; menuTopViewHeightExcludingTitle = newMenuTopViewHeight - line1.getMeasuredHeight() - line2MeasuredHeight - titleButtonHeight - downloadButtonsHeight - titleBottomButtonHeight - titleProgressHeight;
menuTitleTopBottomPadding = (line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight()) menuTitleTopBottomPadding = (line1.getMeasuredHeight() - line1.getLineCount() * line1.getLineHeight())
+ (line2MeasuredHeight - line2LineCount * line2LineHeight); + (line2MeasuredHeight - line2LineCount * line2LineHeight);
} }
} }
menuTopViewHeight = newMenuTopViewHeight; menuTopViewHeight = newMenuTopViewHeight;
menuTopShadowAllHeight = newMenuTopShadowAllHeight; menuTopShadowAllHeight = newMenuTopShadowAllHeight;
menuTitleHeight = menuTopShadowHeight + menuTopShadowAllHeight + dy; menuTitleHeight = menuTopShadowAllHeight + dy;
menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight(); menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight();
menuFullHeightMax = menuTitleHeight + menuBottomViewHeight; menuFullHeightMax = menuTitleHeight + menuBottomViewHeight;
@ -1168,6 +1111,60 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
} }
line2.setText(line2Str.toString()); line2.setText(line2Str.toString());
} }
TextView line3 = (TextView) view.findViewById(R.id.context_menu_line3);
String additionalTypeStr = menu.getAdditionalTypeStr();
boolean displayAdditionalTypeStrInHours = menu.displayAdditionalTypeStrInHours();
boolean emptyAdditionalTypeStr = TextUtils.isEmpty(additionalTypeStr);
if (emptyAdditionalTypeStr || displayAdditionalTypeStrInHours) {
line3.setVisibility(View.GONE);
} else {
line3.setVisibility(View.VISIBLE);
line3.setText(additionalTypeStr);
Drawable icon = menu.getAdditionalLineTypeIcon();
line3.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
line3.setCompoundDrawablePadding(dpToPx(5f));
}
TextView openingHoursTextView = (TextView) view.findViewById(R.id.opening_hours_text_view);
OpeningHoursInfo openingHoursInfo = menu.getOpeningHoursInfo();
boolean containsOpeningHours = openingHoursInfo != null && openingHoursInfo.containsInfo();
if (containsOpeningHours || (displayAdditionalTypeStrInHours && !emptyAdditionalTypeStr)) {
int colorId;
if (containsOpeningHours) {
colorId = openingHoursInfo.isOpened() ? R.color.ctx_menu_amenity_opened_text_color : R.color.ctx_menu_amenity_closed_text_color;
} else {
colorId = menu.getTimeStrColor();
}
String timeInfo = "";
if (containsOpeningHours) {
if (openingHoursInfo.isOpened24_7()) {
timeInfo = getString(R.string.shared_string_is_open_24_7);
} else if (!Algorithms.isEmpty(openingHoursInfo.getNearToOpeningTime())) {
timeInfo = getString(R.string.will_be_opened_at) + " " + openingHoursInfo.getNearToOpeningTime();
} else if (!Algorithms.isEmpty(openingHoursInfo.getOpeningTime())) {
timeInfo = getString(R.string.opened_from) + " " + openingHoursInfo.getOpeningTime();
} else if (!Algorithms.isEmpty(openingHoursInfo.getNearToClosingTime())) {
timeInfo = getString(R.string.will_be_closed_at) + " " + openingHoursInfo.getNearToClosingTime();
} else if (!Algorithms.isEmpty(openingHoursInfo.getClosingTime())) {
timeInfo = getString(R.string.opened_till) + " " + openingHoursInfo.getClosingTime();
} else if (!Algorithms.isEmpty(openingHoursInfo.getOpeningDay())) {
timeInfo = getString(R.string.will_be_opened_on) + " " + openingHoursInfo.getOpeningDay() + ".";
}
} else {
timeInfo = additionalTypeStr;
}
if (colorId != 0) {
openingHoursTextView.setTextColor(ContextCompat.getColor(getContext(), colorId));
Drawable drawable = getIcon(R.drawable.ic_action_opening_hour_16, colorId);
openingHoursTextView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
openingHoursTextView.setCompoundDrawablePadding(dpToPx(8));
}
openingHoursTextView.setText(timeInfo);
openingHoursTextView.setVisibility(View.VISIBLE);
} else {
openingHoursTextView.setVisibility(View.GONE);
}
} }
updateCompassVisibility(); updateCompassVisibility();
} }
@ -1181,11 +1178,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
updateDistanceDirection(); updateDistanceDirection();
compassView.setVisibility(View.VISIBLE); compassView.setVisibility(View.VISIBLE);
} else { } else {
if (!menu.displayDistanceDirection()) { compassView.setVisibility(View.INVISIBLE);
compassView.setVisibility(View.GONE);
} else {
compassView.setVisibility(View.INVISIBLE);
}
} }
} }
} }
@ -1197,8 +1190,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
TextView distanceText = (TextView) view.findViewById(R.id.distance); TextView distanceText = (TextView) view.findViewById(R.id.distance);
ImageView direction = (ImageView) view.findViewById(R.id.direction); ImageView direction = (ImageView) view.findViewById(R.id.direction);
float myHeading = menu.getHeading() == null ? 0f : menu.getHeading(); float myHeading = menu.getHeading() == null ? 0f : menu.getHeading();
DashLocationFragment.updateLocationView(false, menu.getMyLocation(), myHeading, direction, distanceText, int color = nightMode ? R.color.ctx_menu_direction_color_dark : R.color.ctx_menu_direction_color_light;
menu.getLatLon().getLatitude(), menu.getLatLon().getLongitude(), screenOrientation, app, activity); DashLocationFragment.updateLocationView(false, menu.getMyLocation(), myHeading, direction, color, distanceText,
color, menu.getLatLon().getLatitude(), menu.getLatLon().getLongitude(), screenOrientation, app, activity);
} }
} }
@ -1231,7 +1225,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
posY = Math.max(posY, minHalfY); posY = Math.max(posY, minHalfY);
break; break;
case MenuState.FULL_SCREEN: case MenuState.FULL_SCREEN:
posY = -menuTopShadowHeight - dpToPx(SHADOW_HEIGHT_TOP_DP); posY = -dpToPx(SHADOW_HEIGHT_TOP_DP);
posY = addStatusBarHeightIfNeeded(posY); posY = addStatusBarHeightIfNeeded(posY);
break; break;
default: default:
@ -1254,33 +1248,20 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private void updateMainViewLayout(int posY) { private void updateMainViewLayout(int posY) {
if (view != null) { if (view != null) {
menuFullHeight = view.getHeight() - posY; menuFullHeight = view.getHeight() - posY;
if (!oldAndroid()) { ViewGroup.LayoutParams lp = mainView.getLayoutParams();
ViewGroup.LayoutParams lp = mainView.getLayoutParams(); lp.height = Math.max(menuFullHeight, menuTitleHeight);
lp.height = Math.max(menuFullHeight, menuTitleHeight); mainView.setLayoutParams(lp);
mainView.setLayoutParams(lp); mainView.requestLayout();
mainView.requestLayout();
}
} }
} }
private int getViewY() { private int getViewY() {
if (!oldAndroid()) { return (int) mainView.getY();
return (int) mainView.getY();
} else {
return mainView.getPaddingTop();
}
} }
private void setViewY(int y, boolean animated, boolean adjustMapPos) { private void setViewY(int y, boolean animated, boolean adjustMapPos) {
if (!oldAndroid()) { mainView.setY(y);
mainView.setY(y); zoomButtonsView.setY(getZoomButtonsY(y));
fabView.setY(getFabY(y));
zoomButtonsView.setY(getZoomButtonsY(y));
} else {
mainView.setPadding(0, y, 0, 0);
fabView.setPadding(0, getFabY(y), 0, 0);
zoomButtonsView.setPadding(0, getZoomButtonsY(y), 0, 0);
}
if (!customMapCenter) { if (!customMapCenter) {
if (adjustMapPos) { if (adjustMapPos) {
adjustMapPosition(y, animated, centered, 0); adjustMapPosition(y, animated, centered, 0);
@ -1372,21 +1353,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
return latlon; return latlon;
} }
private int getFabY(int y) {
int fabY = y + fabPaddingTopPx;
if (fabY < fabPaddingTopPx) {
fabY = fabPaddingTopPx;
fabY = addStatusBarHeightIfNeeded(fabY);
}
return fabY;
}
private int getZoomButtonsY(int y) { private int getZoomButtonsY(int y) {
return y - zoomButtonsHeight - fabPaddingTopPx; return y - zoomButtonsHeight;
}
private boolean oldAndroid() {
return (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH);
} }
private void doLayoutMenu() { private void doLayoutMenu() {

View file

@ -3,20 +3,21 @@ package net.osmand.plus.mapcontextmenu;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.view.ContextThemeWrapper; import android.support.v7.view.ContextThemeWrapper;
import android.support.v7.widget.AppCompatButton;
import android.text.ClipboardManager; import android.text.ClipboardManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.util.Linkify; import android.text.util.Linkify;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -28,22 +29,33 @@ import android.widget.Toast;
import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.data.Amenity; import net.osmand.data.Amenity;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.data.QuadRect; import net.osmand.data.QuadRect;
import net.osmand.osm.PoiCategory; import net.osmand.osm.PoiCategory;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.IconsCache; import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.OsmandSettings.OsmandPreference;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.mapcontextmenu.builders.cards.AbstractCard; import net.osmand.plus.mapcontextmenu.builders.cards.AbstractCard;
import net.osmand.plus.mapcontextmenu.builders.cards.CardsRowBuilder; import net.osmand.plus.mapcontextmenu.builders.cards.CardsRowBuilder;
import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard; import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard;
import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask; import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask;
import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard; import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.views.TransportStopsLayer;
import net.osmand.plus.widgets.TextViewEx;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
@ -67,6 +79,7 @@ public class MenuBuilder {
protected OsmandApplication app; protected OsmandApplication app;
protected LinkedList<PlainMenuItem> plainMenuItems; protected LinkedList<PlainMenuItem> plainMenuItems;
private boolean firstRow; private boolean firstRow;
protected boolean matchWidthDivider;
protected boolean light; protected boolean light;
private long objectId; private long objectId;
private LatLon latLon; private LatLon latLon;
@ -76,6 +89,7 @@ public class MenuBuilder {
private boolean showOnlinePhotos = true; private boolean showOnlinePhotos = true;
protected List<Amenity> nearestWiki = new ArrayList<>(); protected List<Amenity> nearestWiki = new ArrayList<>();
private List<OsmandPlugin> menuPlugins = new ArrayList<>(); private List<OsmandPlugin> menuPlugins = new ArrayList<>();
private List<TransportStopRoute> routes = new ArrayList<>();
private CardsRowBuilder onlinePhotoCardsRow; private CardsRowBuilder onlinePhotoCardsRow;
private List<AbstractCard> onlinePhotoCards; private List<AbstractCard> onlinePhotoCards;
@ -199,6 +213,10 @@ public class MenuBuilder {
transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get(); transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get();
} }
public void setRoutes(List<TransportStopRoute> routes) {
this.routes = routes;
}
public String getPreferredMapLang() { public String getPreferredMapLang() {
return preferredMapLang; return preferredMapLang;
} }
@ -270,6 +288,10 @@ public class MenuBuilder {
if (showTitleIfTruncated) { if (showTitleIfTruncated) {
buildTitleRow(view); buildTitleRow(view);
} }
if (showTransportRoutes()) {
buildRow(view, 0, app.getString(R.string.transport_Routes), 0, true, getCollapsableTransportStopRoutesView(view.getContext(), false),
false, 0, false, null, true);
}
buildNearestWikiRow(view); buildNearestWikiRow(view);
if (needBuildPlainMenuItems()) { if (needBuildPlainMenuItems()) {
buildPlainMenuItems(view); buildPlainMenuItems(view);
@ -282,6 +304,10 @@ public class MenuBuilder {
buildAfter(view); buildAfter(view);
} }
private boolean showTransportRoutes() {
return routes.size() > 0;
}
void onHide() { void onHide() {
hidden = true; hidden = true;
} }
@ -299,7 +325,7 @@ public class MenuBuilder {
protected void buildPlainMenuItems(View view) { protected void buildPlainMenuItems(View view) {
for (PlainMenuItem item : plainMenuItems) { for (PlainMenuItem item : plainMenuItems) {
buildRow(view, item.getIconId(), item.getText(), 0, item.collapsable, item.collapsableView, buildRow(view, item.getIconId(), item.getText(), 0, item.collapsable, item.collapsableView,
item.isNeedLinks(), 0, item.isUrl(), item.getOnClickListener()); item.isNeedLinks(), 0, item.isUrl(), item.getOnClickListener(), false);
} }
} }
@ -323,7 +349,7 @@ public class MenuBuilder {
if (mapContextMenu != null) { if (mapContextMenu != null) {
String title = mapContextMenu.getTitleStr(); String title = mapContextMenu.getTitleStr();
if (title.length() > TITLE_LIMIT) { if (title.length() > TITLE_LIMIT) {
buildRow(view, R.drawable.ic_action_note_dark, title, 0, false, null, false, 0, false, null); buildRow(view, R.drawable.ic_action_note_dark, title, 0, false, null, false, 0, false, null, false);
} }
} }
} }
@ -332,7 +358,7 @@ public class MenuBuilder {
if (processNearstWiki() && nearestWiki.size() > 0) { if (processNearstWiki() && nearestWiki.size() > 0) {
buildRow(view, R.drawable.ic_action_wikipedia, app.getString(R.string.wiki_around) + " (" + nearestWiki.size()+")", 0, buildRow(view, R.drawable.ic_action_wikipedia, app.getString(R.string.wiki_around) + " (" + nearestWiki.size()+")", 0,
true, getCollapsableWikiView(view.getContext(), true), true, getCollapsableWikiView(view.getContext(), true),
false, 0, false, null); false, 0, false, null, false);
} }
} }
@ -355,7 +381,7 @@ public class MenuBuilder {
} }
}); });
buildRow(view, R.drawable.ic_action_photo_dark, app.getString(R.string.online_photos), 0, true, buildRow(view, R.drawable.ic_action_photo_dark, app.getString(R.string.online_photos), 0, true,
collapsableView, false, 1, false, null); collapsableView, false, 1, false, null, false);
if (needUpdateOnly && onlinePhotoCards != null) { if (needUpdateOnly && onlinePhotoCards != null) {
onlinePhotoCardsRow.setCards(onlinePhotoCards); onlinePhotoCardsRow.setCards(onlinePhotoCards);
@ -400,7 +426,7 @@ public class MenuBuilder {
} }
protected void buildAfter(View view) { protected void buildAfter(View view) {
buildRowDivider(view, false); buildRowDivider(view);
} }
public boolean isFirstRow() { public boolean isFirstRow() {
@ -413,17 +439,17 @@ public class MenuBuilder {
public View buildRow(View view, int iconId, String text, int textColor, public View buildRow(View view, int iconId, String text, int textColor,
boolean collapsable, final CollapsableView collapsableView, boolean collapsable, final CollapsableView collapsableView,
boolean needLinks, int textLinesLimit, boolean isUrl, OnClickListener onClickListener) { boolean needLinks, int textLinesLimit, boolean isUrl, OnClickListener onClickListener, boolean matchWidthDivider) {
return buildRow(view, getRowIcon(iconId), text, textColor, collapsable, collapsableView, return buildRow(view, iconId == 0 ? null : getRowIcon(iconId), text, textColor, null, collapsable, collapsableView,
needLinks, textLinesLimit, isUrl, onClickListener); needLinks, textLinesLimit, isUrl, onClickListener, matchWidthDivider);
} }
public View buildRow(final View view, Drawable icon, final String text, int textColor, public View buildRow(final View view, Drawable icon, final String text, int textColor, String secondaryText,
boolean collapsable, final CollapsableView collapsableView, boolean needLinks, boolean collapsable, final CollapsableView collapsableView, boolean needLinks,
int textLinesLimit, boolean isUrl, OnClickListener onClickListener) { int textLinesLimit, boolean isUrl, OnClickListener onClickListener, boolean matchWidthDivider) {
if (!isFirstRow()) { if (!isFirstRow()) {
buildRowDivider(view, false); buildRowDivider(view);
} }
LinearLayout baseView = new LinearLayout(view.getContext()); LinearLayout baseView = new LinearLayout(view.getContext());
@ -447,35 +473,44 @@ public class MenuBuilder {
baseView.addView(ll); baseView.addView(ll);
// Icon // Icon
LinearLayout llIcon = new LinearLayout(view.getContext()); if (icon != null) {
llIcon.setOrientation(LinearLayout.HORIZONTAL); LinearLayout llIcon = new LinearLayout(view.getContext());
llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(72f), dpToPx(48f))); llIcon.setOrientation(LinearLayout.HORIZONTAL);
llIcon.setGravity(Gravity.CENTER_VERTICAL); llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(64f), dpToPx(48f)));
ll.addView(llIcon); llIcon.setGravity(Gravity.CENTER_VERTICAL);
ll.addView(llIcon);
ImageView iconView = new ImageView(view.getContext()); ImageView iconView = new ImageView(view.getContext());
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(32f), dpToPx(12f)); llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconParams.gravity = Gravity.CENTER_VERTICAL; llIconParams.gravity = Gravity.CENTER_VERTICAL;
iconView.setLayoutParams(llIconParams); iconView.setLayoutParams(llIconParams);
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
iconView.setImageDrawable(icon); iconView.setImageDrawable(icon);
llIcon.addView(iconView); llIcon.addView(iconView);
}
// Text // Text
LinearLayout llText = new LinearLayout(view.getContext()); LinearLayout llText = new LinearLayout(view.getContext());
llText.setOrientation(LinearLayout.VERTICAL); llText.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextViewParams.weight = 1f;
llTextViewParams.setMargins(0, 0, dpToPx(10f), 0);
llTextViewParams.gravity = Gravity.CENTER_VERTICAL;
llText.setLayoutParams(llTextViewParams);
ll.addView(llText); ll.addView(llText);
TextView textView = new TextView(view.getContext()); // Primary text
TextViewEx textView = new TextViewEx(view.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextParams.setMargins(0, dpToPx(8f), 0, dpToPx(8f)); llTextParams.setMargins(icon != null ? 0 : dpToPx(16f), dpToPx(secondaryText != null ? 10f : 8f), 0, dpToPx(secondaryText != null ? 6f : 8f));
textView.setLayoutParams(llTextParams); textView.setLayoutParams(llTextParams);
textView.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textView.setTextSize(16); textView.setTextSize(16);
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark)); textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
if (isUrl) { if (isUrl) {
textView.setTextColor(textView.getLinkTextColors()); textView.setTextColor(ContextCompat.getColor(view.getContext(), light ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark));
} else if (needLinks) { } else if (needLinks) {
textView.setAutoLinkMask(Linkify.ALL); textView.setAutoLinkMask(Linkify.ALL);
textView.setLinksClickable(true); textView.setLinksClickable(true);
@ -488,14 +523,21 @@ public class MenuBuilder {
if (textColor > 0) { if (textColor > 0) {
textView.setTextColor(view.getResources().getColor(textColor)); textView.setTextColor(view.getResources().getColor(textColor));
} }
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextViewParams.weight = 1f;
llTextViewParams.setMargins(0, 0, dpToPx(10f), 0);
llTextViewParams.gravity = Gravity.CENTER_VERTICAL;
llText.setLayoutParams(llTextViewParams);
llText.addView(textView); llText.addView(textView);
// Secondary text
if (!TextUtils.isEmpty(secondaryText)) {
TextViewEx textViewSecondary = new TextViewEx(view.getContext());
LinearLayout.LayoutParams llTextSecondaryParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextSecondaryParams.setMargins(icon != null ? 0 : dpToPx(16f), 0, 0, dpToPx(6f));
textViewSecondary.setLayoutParams(llTextSecondaryParams);
textViewSecondary.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textViewSecondary.setTextSize(14);
textViewSecondary.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_secondary_text_color_light: R.color.ctx_menu_bottom_view_secondary_text_color_dark));
textViewSecondary.setText(secondaryText);
llText.addView(textViewSecondary);
}
final ImageView iconViewCollapse = new ImageView(view.getContext()); final ImageView iconViewCollapse = new ImageView(view.getContext());
if (collapsable && collapsableView != null) { if (collapsable && collapsableView != null) {
// Icon // Icon
@ -506,12 +548,12 @@ public class MenuBuilder {
ll.addView(llIconCollapse); ll.addView(llIconCollapse);
LinearLayout.LayoutParams llIconCollapseParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); LinearLayout.LayoutParams llIconCollapseParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
llIconCollapseParams.setMargins(0, dpToPx(12f), dpToPx(32f), dpToPx(12f)); llIconCollapseParams.setMargins(0, dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL; llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL;
iconViewCollapse.setLayoutParams(llIconCollapseParams); iconViewCollapse.setLayoutParams(llIconCollapseParams);
iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
iconViewCollapse.setImageDrawable(app.getIconsCache().getThemedIcon(collapsableView.getContenView().getVisibility() == View.GONE ? iconViewCollapse.setImageDrawable(app.getIconsCache().getIcon(collapsableView.getContenView().getVisibility() == View.GONE ?
R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up)); R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up, light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark));
llIconCollapse.addView(iconViewCollapse); llIconCollapse.addView(iconViewCollapse);
ll.setOnClickListener(new View.OnClickListener() { ll.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -519,17 +561,17 @@ public class MenuBuilder {
if (collapsableView.getContenView().getVisibility() == View.VISIBLE) { if (collapsableView.getContenView().getVisibility() == View.VISIBLE) {
collapsableView.setCollapsed(true); collapsableView.setCollapsed(true);
collapsableView.getContenView().setVisibility(View.GONE); collapsableView.getContenView().setVisibility(View.GONE);
iconViewCollapse.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_arrow_down)); iconViewCollapse.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_down, light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark));
} else { } else {
collapsableView.setCollapsed(false); collapsableView.setCollapsed(false);
collapsableView.getContenView().setVisibility(View.VISIBLE); collapsableView.getContenView().setVisibility(View.VISIBLE);
iconViewCollapse.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_arrow_up)); iconViewCollapse.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_up, light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark));
} }
} }
}); });
if (collapsableView.isCollapsed()) { if (collapsableView.isCollapsed()) {
collapsableView.getContenView().setVisibility(View.GONE); collapsableView.getContenView().setVisibility(View.GONE);
iconViewCollapse.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_arrow_down)); iconViewCollapse.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_arrow_down, light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark));
} }
baseView.addView(collapsableView.getContenView()); baseView.addView(collapsableView.getContenView());
} }
@ -551,9 +593,15 @@ public class MenuBuilder {
rowBuilt(); rowBuilt();
setDividerWidth(matchWidthDivider);
return ll; return ll;
} }
protected void setDividerWidth(boolean matchWidthDivider) {
this.matchWidthDivider = matchWidthDivider;
}
protected void copyToClipboard(String text, Context ctx) { protected void copyToClipboard(String text, Context ctx) {
((ClipboardManager) app.getSystemService(Activity.CLIPBOARD_SERVICE)).setText(text); ((ClipboardManager) app.getSystemService(Activity.CLIPBOARD_SERVICE)).setText(text);
Toast.makeText(ctx, Toast.makeText(ctx,
@ -603,15 +651,15 @@ public class MenuBuilder {
rowBuilt(); rowBuilt();
} }
public void buildRowDivider(View view, boolean matchWidth) { public void buildRowDivider(View view) {
View horizontalLine = new View(view.getContext()); View horizontalLine = new View(view.getContext());
LinearLayout.LayoutParams llHorLineParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(1f)); LinearLayout.LayoutParams llHorLineParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(1f));
llHorLineParams.gravity = Gravity.BOTTOM; llHorLineParams.gravity = Gravity.BOTTOM;
if (!matchWidth) { if (!matchWidthDivider) {
llHorLineParams.setMargins(dpToPx(72f), 0, 0, 0); llHorLineParams.setMargins(dpToPx(64f), 0, 0, 0);
} }
horizontalLine.setLayoutParams(llHorLineParams); horizontalLine.setLayoutParams(llHorLineParams);
horizontalLine.setBackgroundColor(app.getResources().getColor(light ? R.color.ctx_menu_info_divider_light : R.color.ctx_menu_info_divider_dark)); horizontalLine.setBackgroundColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_divider_light : R.color.ctx_menu_bottom_view_divider_dark));
((LinearLayout) view).addView(horizontalLine); ((LinearLayout) view).addView(horizontalLine);
} }
@ -638,15 +686,13 @@ public class MenuBuilder {
public Drawable getRowIcon(int iconId) { public Drawable getRowIcon(int iconId) {
IconsCache iconsCache = app.getIconsCache(); IconsCache iconsCache = app.getIconsCache();
return iconsCache.getIcon(iconId, return iconsCache.getIcon(iconId, light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark);
light ? R.color.icon_color : R.color.icon_color_light);
} }
public Drawable getRowIcon(Context ctx, String fileName) { public Drawable getRowIcon(Context ctx, String fileName) {
Drawable d = RenderingIcons.getBigIcon(ctx, fileName); Drawable d = RenderingIcons.getBigIcon(ctx, fileName);
if (d != null) { if (d != null) {
d.setColorFilter(app.getResources() d.setColorFilter(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark), PorterDuff.Mode.SRC_IN);
.getColor(light ? R.color.icon_color : R.color.icon_color_light), PorterDuff.Mode.SRC_IN);
return d; return d;
} else { } else {
return null; return null;
@ -668,53 +714,260 @@ public class MenuBuilder {
); );
} }
private void buildTransportRouteRow(ViewGroup parent, TransportStopRoute r, OnClickListener listener) {
if (!isFirstRow()) {
buildRowDivider(parent);
}
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.ctx_menu_transport_route_layout, parent, false);
TextView routeDesc = (TextView) view.findViewById(R.id.route_desc);
routeDesc.setText(r.getDescription(getMapActivity().getMyApplication(), true));
routeDesc.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
int drawableResId = r.type == null ? R.drawable.ic_action_polygom_dark : r.type.getResourceId();
((ImageView) view.findViewById(R.id.route_type_icon)).setImageDrawable(getRowIcon(drawableResId));
((TextView) view.findViewById(R.id.route_ref)).setText(r.route.getRef());
view.setOnClickListener(listener);
int typeResId;
switch (r.type) {
case BUS:
typeResId = R.string.poi_route_bus_ref;
break;
case TRAM:
typeResId = R.string.poi_route_tram_ref;
break;
case FERRY:
typeResId = R.string.poi_route_ferry_ref;
break;
case TRAIN:
typeResId = R.string.poi_route_train_ref;
break;
case SHARE_TAXI:
typeResId = R.string.poi_route_share_taxi_ref;
break;
case FUNICULAR:
typeResId = R.string.poi_route_funicular_ref;
break;
case LIGHT_RAIL:
typeResId = R.string.poi_route_light_rail_ref;
break;
case MONORAIL:
typeResId = R.string.poi_route_monorail_ref;
break;
case TROLLEYBUS:
typeResId = R.string.poi_route_trolleybus_ref;
break;
case RAILWAY:
typeResId = R.string.poi_route_railway_ref;
break;
case SUBWAY:
typeResId = R.string.poi_route_subway_ref;
break;
default:
typeResId = R.string.poi_filter_public_transport;
break;
}
((TextView) view.findViewById(R.id.route_type_text)).setText(typeResId);
parent.addView(view);
rowBuilt();
}
private CollapsableView getCollapsableTransportStopRoutesView(final Context context, boolean collapsed) {
LinearLayout view = (LinearLayout) buildCollapsableContentView(context, collapsed, false);
for (final TransportStopRoute r : routes) {
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View arg0) {
MapContextMenu mm = getMapActivity().getContextMenu();
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE,
r.getDescription(getMapActivity().getMyApplication(), false));
mm.show(latLon, pd, r);
TransportStopsLayer stopsLayer = getMapActivity().getMapLayers().getTransportStopsLayer();
stopsLayer.setRoute(r.route);
int cz = r.calculateZoom(0, getMapActivity().getMapView().getCurrentRotatedTileBox());
getMapActivity().changeZoom(cz - getMapActivity().getMapView().getZoom());
}
};
buildTransportRouteRow(view, r, listener);
}
return new CollapsableView(view, collapsed);
}
protected CollapsableView getCollapsableTextView(Context context, boolean collapsed, String text) { protected CollapsableView getCollapsableTextView(Context context, boolean collapsed, String text) {
final TextView textView = new TextView(context); final TextViewEx textView = new TextViewEx(context);
textView.setVisibility(collapsed ? View.GONE : View.VISIBLE); textView.setVisibility(collapsed ? View.GONE : View.VISIBLE);
LinearLayout.LayoutParams llTextDescParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextDescParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextDescParams.setMargins(dpToPx(72f), 0, dpToPx(40f), dpToPx(13f)); llTextDescParams.setMargins(dpToPx(64f), 0, dpToPx(40f), dpToPx(13f));
textView.setLayoutParams(llTextDescParams); textView.setLayoutParams(llTextDescParams);
textView.setTypeface(FontCache.getRobotoRegular(context));
textView.setTextSize(16); textView.setTextSize(16);
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark)); textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
textView.setText(text); textView.setText(text);
return new CollapsableView(textView, collapsed); return new CollapsableView(textView, collapsed);
} }
protected CollapsableView getCollapsableFavouritesView(final Context context, boolean collapsed, @NonNull final FavoriteGroup group, FavouritePoint selectedPoint) {
LinearLayout view = (LinearLayout) buildCollapsableContentView(context, collapsed, true);
List<FavouritePoint> points = group.points;
for (int i = 0; i < points.size() && i < 10; i++) {
final FavouritePoint point = points.get(i);
boolean selected = selectedPoint != null && selectedPoint.equals(point);
TextViewEx button = buildButtonInCollapsableView(context, selected, false);
String name = point.getName();
button.setText(name);
if (!selected) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LatLon latLon = new LatLon(point.getLatitude(), point.getLongitude());
PointDescription pointDescription = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getName());
mapActivity.getContextMenu().show(latLon, pointDescription, point);
}
});
}
view.addView(button);
}
if (points.size() > 10) {
TextViewEx button = buildButtonInCollapsableView(context, false, true);
button.setText(context.getString(R.string.shared_string_show_all));
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
OsmAndAppCustomization appCustomization = app.getAppCustomization();
final Intent intent = new Intent(context, appCustomization.getFavoritesActivity());
intent.putExtra(FavoritesActivity.OPEN_FAVOURITES_TAB, true);
intent.putExtra(FavoritesActivity.GROUP_NAME_TO_SHOW, group.name);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(intent);
}
});
view.addView(button);
}
return new CollapsableView(view, collapsed);
}
protected CollapsableView getCollapsableWaypointsView(final Context context, boolean collapsed, @NonNull final GPXFile gpxFile, WptPt selectedPoint) {
LinearLayout view = (LinearLayout) buildCollapsableContentView(context, collapsed, true);
List<WptPt> points = gpxFile.getPoints();
for (int i = 0; i < points.size() && i < 10; i++) {
final WptPt point = points.get(i);
boolean selected = selectedPoint != null && selectedPoint.equals(point);
TextViewEx button = buildButtonInCollapsableView(context, selected, false);
button.setText(point.name);
if (!selected) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LatLon latLon = new LatLon(point.getLatitude(), point.getLongitude());
PointDescription pointDescription = new PointDescription(PointDescription.POINT_TYPE_WPT, point.name);
mapActivity.getContextMenu().show(latLon, pointDescription, point);
}
});
}
view.addView(button);
}
if (points.size() > 10) {
TextViewEx button = buildButtonInCollapsableView(context, false, true);
button.setText(context.getString(R.string.shared_string_show_all));
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
OsmAndAppCustomization appCustomization = app.getAppCustomization();
final Intent intent = new Intent(context, appCustomization.getTrackActivity());
intent.putExtra(TrackActivity.TRACK_FILE_NAME, gpxFile.path);
intent.putExtra(TrackActivity.OPEN_POINTS_TAB, true);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(intent);
}
});
view.addView(button);
}
return new CollapsableView(view, collapsed);
}
protected CollapsableView getCollapsableWikiView(Context context, boolean collapsed) { protected CollapsableView getCollapsableWikiView(Context context, boolean collapsed) {
LinearLayout view = (LinearLayout) buildCollapsableContentView(context, collapsed, true);
for (final Amenity wiki : nearestWiki) {
TextViewEx button = buildButtonInCollapsableView(context, false, false);
String name = wiki.getName(preferredMapAppLang, transliterateNames);
button.setText(name);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LatLon latLon = new LatLon(wiki.getLocation().getLatitude(), wiki.getLocation().getLongitude());
PointDescription pointDescription = mapActivity.getMapLayers().getPoiMapLayer().getObjectName(wiki);
mapActivity.getContextMenu().show(latLon, pointDescription, wiki);
}
});
view.addView(button);
}
return new CollapsableView(view, collapsed);
}
protected LinearLayout buildCollapsableContentView(Context context, boolean collapsed, boolean needMargin) {
final LinearLayout view = new LinearLayout(context); final LinearLayout view = new LinearLayout(context);
view.setOrientation(LinearLayout.VERTICAL); view.setOrientation(LinearLayout.VERTICAL);
view.setVisibility(collapsed ? View.GONE : View.VISIBLE); view.setVisibility(collapsed ? View.GONE : View.VISIBLE);
LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llParams.setMargins(dpToPx(68f), 0, dpToPx(12f), dpToPx(13f)); if (needMargin) {
view.setLayoutParams(llParams); llParams.setMargins(dpToPx(64f), 0, dpToPx(12f), 0);
for (final Amenity wiki : nearestWiki) {
AppCompatButton wikiButton = new AppCompatButton(
new ContextThemeWrapper(view.getContext(), light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme));
LinearLayout.LayoutParams llWikiButtonParams =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
wikiButton.setLayoutParams(llWikiButtonParams);
wikiButton.setPadding(dpToPx(14f), 0, dpToPx(14f), 0);
wikiButton.setTextColor(app.getResources()
.getColor(light ? R.color.color_dialog_buttons_light : R.color.color_dialog_buttons_dark));
wikiButton.setText(wiki.getName(preferredMapAppLang, transliterateNames));
wikiButton.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
wikiButton.setSingleLine(true);
wikiButton.setEllipsize(TextUtils.TruncateAt.END);
wikiButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PointDescription pointDescription = mapActivity.getMapLayers().getPoiMapLayer().getObjectName(wiki);
mapActivity.getContextMenu().show(
new LatLon(wiki.getLocation().getLatitude(), wiki.getLocation().getLongitude()),
pointDescription, wiki);
}
});
view.addView(wikiButton);
} }
view.setLayoutParams(llParams);
return view;
}
return new CollapsableView(view, collapsed); protected TextViewEx buildButtonInCollapsableView(Context context, boolean selected, boolean showAll) {
TextViewEx button = new TextViewEx(new ContextThemeWrapper(context, light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme));
LinearLayout.LayoutParams llWikiButtonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(36f));
llWikiButtonParams.setMargins(0, 0, 0, dpToPx(8f));
button.setLayoutParams(llWikiButtonParams);
button.setTypeface(FontCache.getRobotoRegular(context));
int bg;
if (selected) {
bg = light ? R.drawable.context_menu_controller_bg_light_selected: R.drawable.context_menu_controller_bg_dark_selected;
} else if (showAll) {
bg = light ? R.drawable.context_menu_controller_bg_light_show_all : R.drawable.context_menu_controller_bg_dark_show_all;
} else {
bg = light ? R.drawable.context_menu_controller_bg_light : R.drawable.context_menu_controller_bg_dark;
}
button.setBackgroundResource(bg);
button.setTextSize(14);
int paddingSides = dpToPx(10f);
button.setPadding(paddingSides, 0, paddingSides, 0);
if (!selected) {
ColorStateList buttonColorStateList = new ColorStateList(
new int[][] {
new int[]{android.R.attr.state_pressed},
new int[]{}
},
new int[] {
context.getResources().getColor(light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p),
context.getResources().getColor(light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n)
}
);
button.setTextColor(buttonColorStateList);
} else {
button.setTextColor(ContextCompat.getColor(context, light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
}
button.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
button.setSingleLine(true);
button.setEllipsize(TextUtils.TruncateAt.END);
return button;
} }
protected boolean processNearstWiki() { protected boolean processNearstWiki() {

View file

@ -98,8 +98,7 @@ public abstract class MenuController extends BaseMenuController {
protected TitleButtonController leftTitleButtonController; protected TitleButtonController leftTitleButtonController;
protected TitleButtonController rightTitleButtonController; protected TitleButtonController rightTitleButtonController;
protected TitleButtonController topRightTitleButtonController; protected TitleButtonController bottomTitleButtonController;
protected TitleButtonController leftSubtitleButtonController;
protected TitleButtonController leftDownloadButtonController; protected TitleButtonController leftDownloadButtonController;
protected TitleButtonController rightDownloadButtonController; protected TitleButtonController rightDownloadButtonController;
@ -319,12 +318,8 @@ public abstract class MenuController extends BaseMenuController {
return rightTitleButtonController; return rightTitleButtonController;
} }
public TitleButtonController getTopRightTitleButtonController() { public TitleButtonController getBottomTitleButtonController() {
return topRightTitleButtonController; return bottomTitleButtonController;
}
public TitleButtonController getLeftSubtitleButtonController() {
return leftSubtitleButtonController;
} }
public TitleButtonController getLeftDownloadButtonController() { public TitleButtonController getLeftDownloadButtonController() {
@ -355,7 +350,7 @@ public abstract class MenuController extends BaseMenuController {
return true; return true;
} }
public boolean fabVisible() { public boolean navigateButtonVisible() {
return true; return true;
} }
@ -391,6 +386,10 @@ public abstract class MenuController extends BaseMenuController {
return false; return false;
} }
public boolean displayAdditionalTypeStrInHours() {
return false;
}
public int getLeftIconId() { public int getLeftIconId() {
return 0; return 0;
} }
@ -403,12 +402,16 @@ public abstract class MenuController extends BaseMenuController {
return null; return null;
} }
public Drawable getAdditionalLineTypeIcon() {
return null;
}
public int getFavActionIconId() { public int getFavActionIconId() {
return R.drawable.map_action_fav_dark; return R.drawable.map_action_fav_dark;
} }
public int getFavActionStringId() { public int getFavActionStringId() {
return R.string.shared_string_add_to_favorites; return R.string.shared_string_add;
} }
public int getWaypointActionIconId() { public int getWaypointActionIconId() {
@ -429,6 +432,18 @@ public abstract class MenuController extends BaseMenuController {
return ""; return "";
} }
public String getAdditionalTypeStr() {
return "";
}
public int getTimeStrColor() {
return 0;
}
public OpeningHoursInfo getOpeningHoursInfo() {
return null;
}
public String getCommonTypeStr() { public String getCommonTypeStr() {
return ""; return "";
} }
@ -437,6 +452,10 @@ public abstract class MenuController extends BaseMenuController {
return pointDescription.getName(); return pointDescription.getName();
} }
public List<TransportStopRoute> getTransportStopRoutes() {
return null;
}
public void share(LatLon latLon, String title, String address) { public void share(LatLon latLon, String title, String address) {
ShareMenu.show(latLon, title, address, getMapActivity()); ShareMenu.show(latLon, title, address, getMapActivity());
} }

View file

@ -15,9 +15,12 @@ public abstract class MenuTitleController {
protected Drawable leftIcon; protected Drawable leftIcon;
protected String nameStr = ""; protected String nameStr = "";
protected String typeStr = ""; protected String typeStr = "";
protected String additionalTypeStr = "";
protected String commonTypeStr = ""; protected String commonTypeStr = "";
protected Drawable secondLineTypeIcon; protected Drawable secondLineTypeIcon;
protected Drawable additionalLineTypeIcon;
protected String streetStr = ""; protected String streetStr = "";
protected OpeningHoursInfo openingHoursInfo;
private AddressLookupRequest addressLookupRequest; private AddressLookupRequest addressLookupRequest;
@ -77,6 +80,10 @@ public abstract class MenuTitleController {
return secondLineTypeIcon; return secondLineTypeIcon;
} }
public Drawable getAdditionalLineTypeIcon() {
return additionalLineTypeIcon;
}
public String getTypeStr() { public String getTypeStr() {
MenuController menuController = getMenuController(); MenuController menuController = getMenuController();
if (menuController != null && menuController.needTypeStr()) { if (menuController != null && menuController.needTypeStr()) {
@ -86,6 +93,15 @@ public abstract class MenuTitleController {
} }
} }
public String getAdditionalTypeStr() {
MenuController menuController = getMenuController();
if (menuController != null) {
return additionalTypeStr;
} else {
return "";
}
}
public String getStreetStr() { public String getStreetStr() {
if (needStreetName()) { if (needStreetName()) {
if (searchingAddress()) { if (searchingAddress()) {
@ -98,6 +114,10 @@ public abstract class MenuTitleController {
} }
} }
public OpeningHoursInfo getOpeningHoursInfo() {
return openingHoursInfo;
}
protected void initTitle() { protected void initTitle() {
searchAddressStr = PointDescription.getSearchAddressStr(getMapActivity()); searchAddressStr = PointDescription.getSearchAddressStr(getMapActivity());
addressNotFoundStr = PointDescription.getAddressNotFoundStr(getMapActivity()); addressNotFoundStr = PointDescription.getAddressNotFoundStr(getMapActivity());
@ -111,6 +131,8 @@ public abstract class MenuTitleController {
if (needStreetName()) { if (needStreetName()) {
acquireStreetName(); acquireStreetName();
} }
acquireOpeningHoursInfo();
} }
protected boolean needStreetName() { protected boolean needStreetName() {
@ -128,11 +150,13 @@ public abstract class MenuTitleController {
leftIconId = 0; leftIconId = 0;
leftIcon = null; leftIcon = null;
secondLineTypeIcon = null; secondLineTypeIcon = null;
additionalLineTypeIcon = null;
if (menuController != null) { if (menuController != null) {
leftIconId = menuController.getLeftIconId(); leftIconId = menuController.getLeftIconId();
leftIcon = menuController.getLeftIcon(); leftIcon = menuController.getLeftIcon();
secondLineTypeIcon = menuController.getSecondLineTypeIcon(); secondLineTypeIcon = menuController.getSecondLineTypeIcon();
additionalLineTypeIcon = menuController.getAdditionalLineTypeIcon();
} }
} }
@ -146,6 +170,7 @@ public abstract class MenuTitleController {
if (menuController != null) { if (menuController != null) {
nameStr = menuController.getNameStr(); nameStr = menuController.getNameStr();
typeStr = menuController.getTypeStr(); typeStr = menuController.getTypeStr();
additionalTypeStr = menuController.getAdditionalTypeStr();
commonTypeStr = menuController.getCommonTypeStr(); commonTypeStr = menuController.getCommonTypeStr();
} }
@ -186,6 +211,13 @@ public abstract class MenuTitleController {
getMapActivity().getMyApplication().getGeocodingLookupService().lookupAddress(addressLookupRequest); getMapActivity().getMyApplication().getGeocodingLookupService().lookupAddress(addressLookupRequest);
} }
protected void acquireOpeningHoursInfo() {
MenuController menuController = getMenuController();
if (menuController != null) {
openingHoursInfo = menuController.getOpeningHoursInfo();
}
}
protected void onSearchAddressDone() { protected void onSearchAddressDone() {
} }

View file

@ -0,0 +1,79 @@
package net.osmand.plus.mapcontextmenu;
import net.osmand.util.Algorithms;
public class OpeningHoursInfo {
private boolean opened;
private boolean opened24_7;
private String openingTime = "";
private String nearToOpeningTime = "";
private String closingTime = "";
private String nearToClosingTime = "";
private String openingDay = "";
public boolean isOpened() {
return opened;
}
public void setOpened(boolean opened) {
this.opened = opened;
}
public boolean isOpened24_7() {
return opened24_7;
}
public void setOpened24_7(boolean opened24_7) {
this.opened24_7 = opened24_7;
}
public String getOpeningTime() {
return openingTime;
}
public void setOpeningTime(String openFromTime) {
this.openingTime = openFromTime;
}
public String getNearToOpeningTime() {
return nearToOpeningTime;
}
public void setNearToOpeningTime(String nearToOpeningTime) {
this.nearToOpeningTime = nearToOpeningTime;
}
public String getClosingTime() {
return closingTime;
}
public void setClosingTime(String closingTime) {
this.closingTime = closingTime;
}
public String getNearToClosingTime() {
return nearToClosingTime;
}
public void setNearToClosingTime(String nearToClosingTime) {
this.nearToClosingTime = nearToClosingTime;
}
public String getOpeningDay() {
return openingDay;
}
public void setOpeningDay(String openingDay) {
this.openingDay = openingDay;
}
public boolean containsInfo() {
return opened24_7
|| !Algorithms.isEmpty(openingTime)
|| !Algorithms.isEmpty(nearToOpeningTime)
|| !Algorithms.isEmpty(closingTime)
|| !Algorithms.isEmpty(nearToClosingTime)
|| !Algorithms.isEmpty(openingDay);
}
}

View file

@ -0,0 +1,34 @@
package net.osmand.plus.mapcontextmenu;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import net.osmand.plus.R;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
import java.util.List;
public class TransportStopRouteAdapter extends ArrayAdapter<TransportStopRoute> {
public TransportStopRouteAdapter(@NonNull Context context, @NonNull List<TransportStopRoute> objects) {
super(context, 0, objects);
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.transport_stop_route_item, parent, false);
}
((TextView) convertView.findViewById(R.id.transport_stop_route_text)).setText(getItem(position).route.getRef());
return convertView;
}
}

View file

@ -2,11 +2,11 @@ package net.osmand.plus.mapcontextmenu.builders;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.AppCompatButton; import android.support.v7.view.ContextThemeWrapper;
import android.text.Html; import android.text.Html;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.TextUtils; import android.text.TextUtils;
@ -29,9 +29,11 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.plus.views.POIMapLayer; import net.osmand.plus.views.POIMapLayer;
import net.osmand.plus.widgets.TextViewEx;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.OpeningHoursParser; import net.osmand.util.OpeningHoursParser;
@ -60,18 +62,18 @@ public class AmenityMenuBuilder extends MenuBuilder {
private void buildRow(View view, int iconId, String text, String textPrefix, private void buildRow(View view, int iconId, String text, String textPrefix,
boolean collapsable, final CollapsableView collapsableView, boolean collapsable, final CollapsableView collapsableView,
int textColor, boolean isWiki, boolean isText, boolean needLinks, int textColor, boolean isWiki, boolean isText, boolean needLinks,
boolean isPhoneNumber, boolean isUrl) { boolean isPhoneNumber, boolean isUrl, boolean matchWidthDivider) {
buildRow(view, getRowIcon(iconId), text, textPrefix, collapsable, collapsableView, textColor, buildRow(view, iconId == 0 ? null : getRowIcon(iconId), text, textPrefix, collapsable, collapsableView, textColor,
isWiki, isText, needLinks, isPhoneNumber, isUrl); isWiki, isText, needLinks, isPhoneNumber, isUrl, matchWidthDivider);
} }
protected void buildRow(final View view, Drawable icon, final String text, final String textPrefix, protected void buildRow(final View view, Drawable icon, final String text, final String textPrefix,
boolean collapsable, final CollapsableView collapsableView, boolean collapsable, final CollapsableView collapsableView,
int textColor, boolean isWiki, boolean isText, boolean needLinks, int textColor, boolean isWiki, boolean isText, boolean needLinks,
boolean isPhoneNumber, boolean isUrl) { boolean isPhoneNumber, boolean isUrl, boolean matchWidthDivider) {
if (!isFirstRow()) { if (!isFirstRow()) {
buildRowDivider(view, false); buildRowDivider(view);
} }
final String txt; final String txt;
@ -102,20 +104,22 @@ public class AmenityMenuBuilder extends MenuBuilder {
baseView.addView(ll); baseView.addView(ll);
// Icon // Icon
LinearLayout llIcon = new LinearLayout(view.getContext()); if (icon != null) {
llIcon.setOrientation(LinearLayout.HORIZONTAL); LinearLayout llIcon = new LinearLayout(view.getContext());
llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(72f), dpToPx(48f))); llIcon.setOrientation(LinearLayout.HORIZONTAL);
llIcon.setGravity(Gravity.CENTER_VERTICAL); llIcon.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(64f), dpToPx(48f)));
ll.addView(llIcon); llIcon.setGravity(Gravity.CENTER_VERTICAL);
ll.addView(llIcon);
ImageView iconView = new ImageView(view.getContext()); ImageView iconView = new ImageView(view.getContext());
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(32f), dpToPx(12f)); llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconParams.gravity = Gravity.CENTER_VERTICAL; llIconParams.gravity = Gravity.CENTER_VERTICAL;
iconView.setLayoutParams(llIconParams); iconView.setLayoutParams(llIconParams);
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
iconView.setImageDrawable(icon); iconView.setImageDrawable(icon);
llIcon.addView(iconView); llIcon.addView(iconView);
}
// Text // Text
LinearLayout llText = new LinearLayout(view.getContext()); LinearLayout llText = new LinearLayout(view.getContext());
@ -124,7 +128,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
TextView textView = new TextView(view.getContext()); TextView textView = new TextView(view.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextParams.setMargins(0, collapsable ? dpToPx(13f) : dpToPx(8f), 0, collapsable ? dpToPx(13f) : dpToPx(8f)); llTextParams.setMargins(icon == null ? dpToPx(16f) : 0, collapsable ? dpToPx(13f) : dpToPx(8f), 0, collapsable ? dpToPx(13f) : dpToPx(8f));
textView.setLayoutParams(llTextParams); textView.setLayoutParams(llTextParams);
textView.setTextSize(16); textView.setTextSize(16);
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark)); textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_info_text_light : R.color.ctx_menu_info_text_dark));
@ -175,7 +179,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ll.addView(llIconCollapse); ll.addView(llIconCollapse);
LinearLayout.LayoutParams llIconCollapseParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); LinearLayout.LayoutParams llIconCollapseParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
llIconCollapseParams.setMargins(0, dpToPx(12f), dpToPx(32f), dpToPx(12f)); llIconCollapseParams.setMargins(0, dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL; llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL;
iconViewCollapse.setLayoutParams(llIconCollapseParams); iconViewCollapse.setLayoutParams(llIconCollapseParams);
iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@ -204,21 +208,41 @@ public class AmenityMenuBuilder extends MenuBuilder {
} }
if (isWiki) { if (isWiki) {
AppCompatButton wikiButton = new AppCompatButton(view.getContext()); TextViewEx button = new TextViewEx(new ContextThemeWrapper(view.getContext(), light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme));
LinearLayout.LayoutParams llWikiButtonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams llWikiButtonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dpToPx(36f));
llWikiButtonParams.setMargins(0, dpToPx(10f), dpToPx(2f), dpToPx(10f)); llWikiButtonParams.setMargins(dpToPx(16f), 0, 0, dpToPx(16f));
wikiButton.setLayoutParams(llWikiButtonParams); button.setLayoutParams(llWikiButtonParams);
wikiButton.setPadding(dpToPx(14f), 0, dpToPx(14f), 0); button.setTypeface(FontCache.getRobotoMedium(app));
wikiButton.setBackgroundResource(R.drawable.blue_button_drawable); button.setBackgroundResource(light ? R.drawable.context_menu_controller_bg_light : R.drawable.context_menu_controller_bg_dark);
wikiButton.setTextColor(Color.WHITE); button.setTextSize(14);
wikiButton.setText(app.getString(R.string.read_more)); int paddingSides = dpToPx(10f);
wikiButton.setOnClickListener(new View.OnClickListener() { button.setPadding(paddingSides, 0, paddingSides, 0);
ColorStateList buttonColorStateList = new ColorStateList(
new int[][] {
new int[]{android.R.attr.state_pressed},
new int[]{}
},
new int[] {
view.getResources().getColor(light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p),
view.getResources().getColor(light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n)
}
);
button.setTextColor(buttonColorStateList);
button.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
button.setSingleLine(true);
button.setEllipsize(TextUtils.TruncateAt.END);
button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View view) {
POIMapLayer.showWikipediaDialog(view.getContext(), app, amenity); POIMapLayer.showWikipediaDialog(view.getContext(), app, amenity);
} }
}); });
llText.addView(wikiButton); button.setAllCaps(true);
button.setText(R.string.context_menu_read_full_article);
Drawable compoundDrawable = app.getIconsCache().getIcon(R.drawable.ic_action_note_dark, light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
button.setCompoundDrawablesWithIntrinsicBounds(compoundDrawable, null, null, null);
button.setCompoundDrawablePadding(dpToPx(8f));
llText.addView(button);
} }
((LinearLayout) view).addView(baseView); ((LinearLayout) view).addView(baseView);
@ -273,6 +297,8 @@ public class AmenityMenuBuilder extends MenuBuilder {
} }
rowBuilt(); rowBuilt();
setDividerWidth(matchWidthDivider);
} }
@Override @Override
@ -284,7 +310,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
List<AmenityInfoRow> descriptions = new LinkedList<>(); List<AmenityInfoRow> descriptions = new LinkedList<>();
for (Map.Entry<String, String> e : amenity.getAdditionalInfo().entrySet()) { for (Map.Entry<String, String> e : amenity.getAdditionalInfo().entrySet()) {
int iconId; int iconId = 0;
Drawable icon = null; Drawable icon = null;
int textColor = 0; int textColor = 0;
String key = e.getKey(); String key = e.getKey();
@ -322,7 +348,6 @@ public class AmenityMenuBuilder extends MenuBuilder {
if (amenity.getType().isWiki()) { if (amenity.getType().isWiki()) {
if (!hasWiki) { if (!hasWiki) {
iconId = R.drawable.ic_action_note_dark;
String lng = amenity.getContentLanguage("content", preferredLang, "en"); String lng = amenity.getContentLanguage("content", preferredLang, "en");
if (Algorithms.isEmpty(lng)) { if (Algorithms.isEmpty(lng)) {
lng = "en"; lng = "en";
@ -378,6 +403,8 @@ public class AmenityMenuBuilder extends MenuBuilder {
sb.append(poiTypes.getPoiTranslation("cuisine_" + c).toLowerCase()); sb.append(poiTypes.getPoiTranslation("cuisine_" + c).toLowerCase());
} }
vl = sb.toString(); vl = sb.toString();
} else if (key.contains(Amenity.ROUTE)) {
continue;
} else { } else {
if (key.contains(Amenity.DESCRIPTION)) { if (key.contains(Amenity.DESCRIPTION)) {
iconId = R.drawable.ic_action_note_dark; iconId = R.drawable.ic_action_note_dark;
@ -421,15 +448,16 @@ public class AmenityMenuBuilder extends MenuBuilder {
isUrl = true; isUrl = true;
} }
boolean matchWidthDivider = !isDescription && isWiki;
if (isDescription) { if (isDescription) {
descriptions.add(new AmenityInfoRow(key, R.drawable.ic_action_note_dark, textPrefix, descriptions.add(new AmenityInfoRow(key, R.drawable.ic_action_note_dark, textPrefix,
vl, collapsable, collapsableView, 0, false, true, true, 0, "", false, false)); vl, collapsable, collapsableView, 0, false, true, true, 0, "", false, false, matchWidthDivider));
} else if (icon != null) { } else if (icon != null) {
infoRows.add(new AmenityInfoRow(key, icon, textPrefix, vl, collapsable, collapsableView, infoRows.add(new AmenityInfoRow(key, icon, textPrefix, vl, collapsable, collapsableView,
textColor, isWiki, isText, needLinks, poiTypeOrder, poiTypeKeyName, isPhoneNumber, isUrl)); textColor, isWiki, isText, needLinks, poiTypeOrder, poiTypeKeyName, isPhoneNumber, isUrl, matchWidthDivider));
} else { } else {
infoRows.add(new AmenityInfoRow(key, iconId, textPrefix, vl, collapsable, collapsableView, infoRows.add(new AmenityInfoRow(key, iconId, textPrefix, vl, collapsable, collapsableView,
textColor, isWiki, isText, needLinks, poiTypeOrder, poiTypeKeyName, isPhoneNumber, isUrl)); textColor, isWiki, isText, needLinks, poiTypeOrder, poiTypeKeyName, isPhoneNumber, isUrl, matchWidthDivider));
} }
} }
@ -472,7 +500,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
AmenityInfoRow wikiInfo = new AmenityInfoRow( AmenityInfoRow wikiInfo = new AmenityInfoRow(
"nearest_wiki", R.drawable.ic_action_wikipedia, null, app.getString(R.string.wiki_around) + " (" + nearestWiki.size() + ")", true, "nearest_wiki", R.drawable.ic_action_wikipedia, null, app.getString(R.string.wiki_around) + " (" + nearestWiki.size() + ")", true,
getCollapsableWikiView(view.getContext(), true), getCollapsableWikiView(view.getContext(), true),
0, false, false, false, 1000, null, false, false); 0, false, false, false, 1000, null, false, false, false);
buildAmenityRow(view, wikiInfo); buildAmenityRow(view, wikiInfo);
} }
@ -489,11 +517,11 @@ public class AmenityMenuBuilder extends MenuBuilder {
link = "https://www.openstreetmap.org/way/"; link = "https://www.openstreetmap.org/way/";
} }
buildRow(view, R.drawable.ic_action_info_dark, link + (amenity.getId() >> 1), buildRow(view, R.drawable.ic_action_info_dark, link + (amenity.getId() >> 1),
0, false, null, true, 0, true, null); 0, false, null, true, 0, true, null, false);
} }
buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app, buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app,
amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), true) amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), true)
.replaceAll("\n", " "), 0, false, null, false, 0, false, null); .replaceAll("\n", " "), 0, false, null, false, 0, false, null, false);
//if (st.COORDINATES_FORMAT.get() != PointDescription.OLC_FORMAT) //if (st.COORDINATES_FORMAT.get() != PointDescription.OLC_FORMAT)
// buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationOlcName( // buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationOlcName(
// amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude()) // amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude())
@ -504,10 +532,10 @@ public class AmenityMenuBuilder extends MenuBuilder {
public void buildAmenityRow(View view, AmenityInfoRow info) { public void buildAmenityRow(View view, AmenityInfoRow info) {
if (info.icon != null) { if (info.icon != null) {
buildRow(view, info.icon, info.text, info.textPrefix, info.collapsable, info.collapsableView, buildRow(view, info.icon, info.text, info.textPrefix, info.collapsable, info.collapsableView,
info.textColor, info.isWiki, info.isText, info.needLinks, info.isPhoneNumber, info.isUrl); info.textColor, info.isWiki, info.isText, info.needLinks, info.isPhoneNumber, info.isUrl, info.matchWidthDivider);
} else if (info.iconId != 0) { } else {
buildRow(view, info.iconId, info.text, info.textPrefix, info.collapsable, info.collapsableView, buildRow(view, info.iconId, info.text, info.textPrefix, info.collapsable, info.collapsableView,
info.textColor, info.isWiki, info.isText, info.needLinks, info.isPhoneNumber, info.isUrl); info.textColor, info.isWiki, info.isText, info.needLinks, info.isPhoneNumber, info.isUrl, info.matchWidthDivider);
} }
} }
@ -542,11 +570,12 @@ public class AmenityMenuBuilder extends MenuBuilder {
private boolean isUrl; private boolean isUrl;
private int order; private int order;
private String name; private String name;
private boolean matchWidthDivider;
public AmenityInfoRow(String key, Drawable icon, String textPrefix, String text, public AmenityInfoRow(String key, Drawable icon, String textPrefix, String text,
boolean collapsable, CollapsableView collapsableView, boolean collapsable, CollapsableView collapsableView,
int textColor, boolean isWiki, boolean isText, boolean needLinks, int textColor, boolean isWiki, boolean isText, boolean needLinks,
int order, String name, boolean isPhoneNumber, boolean isUrl) { int order, String name, boolean isPhoneNumber, boolean isUrl, boolean matchWidthDivider) {
this.key = key; this.key = key;
this.icon = icon; this.icon = icon;
this.textPrefix = textPrefix; this.textPrefix = textPrefix;
@ -561,12 +590,13 @@ public class AmenityMenuBuilder extends MenuBuilder {
this.name = name; this.name = name;
this.isPhoneNumber = isPhoneNumber; this.isPhoneNumber = isPhoneNumber;
this.isUrl = isUrl; this.isUrl = isUrl;
this.matchWidthDivider = matchWidthDivider;
} }
public AmenityInfoRow(String key, int iconId, String textPrefix, String text, public AmenityInfoRow(String key, int iconId, String textPrefix, String text,
boolean collapsable, CollapsableView collapsableView, boolean collapsable, CollapsableView collapsableView,
int textColor, boolean isWiki, boolean isText, boolean needLinks, int textColor, boolean isWiki, boolean isText, boolean needLinks,
int order, String name, boolean isPhoneNumber, boolean isUrl) { int order, String name, boolean isPhoneNumber, boolean isUrl, boolean matchWidthDivider) {
this.key = key; this.key = key;
this.iconId = iconId; this.iconId = iconId;
this.textPrefix = textPrefix; this.textPrefix = textPrefix;
@ -581,6 +611,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
this.name = name; this.name = name;
this.isPhoneNumber = isPhoneNumber; this.isPhoneNumber = isPhoneNumber;
this.isUrl = isUrl; this.isUrl = isUrl;
this.matchWidthDivider = matchWidthDivider;
} }
} }
} }

View file

@ -1,18 +1,25 @@
package net.osmand.plus.mapcontextmenu.builders; package net.osmand.plus.mapcontextmenu.builders;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View; import android.view.View;
import android.widget.LinearLayout;
import net.osmand.ResultMatcher; import net.osmand.ResultMatcher;
import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.data.Amenity; import net.osmand.data.Amenity;
import net.osmand.data.FavouritePoint; import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.QuadRect; import net.osmand.data.QuadRect;
import net.osmand.data.TransportStop; import net.osmand.data.TransportStop;
import net.osmand.osm.PoiCategory; import net.osmand.osm.PoiCategory;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapillary.MapillaryPlugin; import net.osmand.plus.widgets.TextViewEx;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import java.util.List; import java.util.List;
@ -60,6 +67,21 @@ public class FavouritePointMenuBuilder extends MenuBuilder {
builder.setLight(light); builder.setLight(light);
builder.buildInternal(view); builder.buildInternal(view);
} }
buildGroupFavouritesView(view);
}
private void buildGroupFavouritesView(View view) {
FavoriteGroup favoriteGroup = app.getFavorites().getGroup(fav);
List<FavouritePoint> groupFavourites = favoriteGroup.points;
if (groupFavourites.size() > 0) {
int color = favoriteGroup.color == 0 || favoriteGroup.color == Color.BLACK ? view.getResources().getColor(R.color.color_favorite) : favoriteGroup.color;
int disabledColor = light ? R.color.secondary_text_light : R.color.secondary_text_dark;
color = favoriteGroup.visible ? (color | 0xff000000) : view.getResources().getColor(disabledColor);
String name = view.getContext().getString(R.string.context_menu_points_of_group);
buildRow(view, app.getIconsCache().getPaintedIcon(R.drawable.ic_action_folder, color), name, 0, null,
true, getCollapsableFavouritesView(view.getContext(), true, favoriteGroup, fav),
false, 0, false, null, false);
}
} }
private Amenity findAmenity(String nameStringEn, double lat, double lon) { private Amenity findAmenity(String nameStringEn, double lat, double lon) {

View file

@ -34,7 +34,7 @@ public class GpxItemMenuBuilder extends MenuBuilder {
String description = GpxUiHelper.getDescription(app, item.analysis, false); String description = GpxUiHelper.getDescription(app, item.analysis, false);
String[] lines = description.split("\n"); String[] lines = description.split("\n");
for (String line : lines) { for (String line : lines) {
buildRow(view, R.drawable.ic_action_info_dark, line, 0, false, null, false, 0, false, null); buildRow(view, R.drawable.ic_action_info_dark, line, 0, false, null, false, 0, false, null, false);
} }
} }

View file

@ -1,8 +1,14 @@
package net.osmand.plus.mapcontextmenu.builders; package net.osmand.plus.mapcontextmenu.builders;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.view.View; import android.view.View;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
@ -11,8 +17,10 @@ import net.osmand.plus.mapillary.MapillaryPlugin;
import net.osmand.plus.views.POIMapLayer; import net.osmand.plus.views.POIMapLayer;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.io.File;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
public class WptPtMenuBuilder extends MenuBuilder { public class WptPtMenuBuilder extends MenuBuilder {
@ -36,23 +44,23 @@ public class WptPtMenuBuilder extends MenuBuilder {
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext()); DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(view.getContext());
Date date = new Date(wpt.time); Date date = new Date(wpt.time);
buildRow(view, R.drawable.ic_action_data, buildRow(view, R.drawable.ic_action_data,
dateFormat.format(date) + "" + timeFormat.format(date), 0, false, null, false, 0, false, null); dateFormat.format(date) + "" + timeFormat.format(date), 0, false, null, false, 0, false, null, false);
} }
if (wpt.speed > 0) { if (wpt.speed > 0) {
buildRow(view, R.drawable.ic_action_speed, buildRow(view, R.drawable.ic_action_speed,
OsmAndFormatter.getFormattedSpeed((float)wpt.speed, app), 0, false, null, false, 0, false, null); OsmAndFormatter.getFormattedSpeed((float)wpt.speed, app), 0, false, null, false, 0, false, null, false);
} }
if (!Double.isNaN(wpt.ele)) { if (!Double.isNaN(wpt.ele)) {
buildRow(view, R.drawable.ic_action_altitude, buildRow(view, R.drawable.ic_action_altitude,
OsmAndFormatter.getFormattedDistance((float) wpt.ele, app), 0, false, null, false, 0, false, null); OsmAndFormatter.getFormattedDistance((float) wpt.ele, app), 0, false, null, false, 0, false, null, false);
} }
if (!Double.isNaN(wpt.hdop)) { if (!Double.isNaN(wpt.hdop)) {
buildRow(view, R.drawable.ic_action_gps_info, buildRow(view, R.drawable.ic_action_gps_info,
Algorithms.capitalizeFirstLetterAndLowercase(app.getString(R.string.plugin_distance_point_hdop)) + ": " + (int)wpt.hdop, 0, Algorithms.capitalizeFirstLetterAndLowercase(app.getString(R.string.plugin_distance_point_hdop)) + ": " + (int)wpt.hdop, 0,
false, null, false, 0, false, null); false, null, false, 0, false, null, false);
} }
if (!Algorithms.isEmpty(wpt.desc)) { if (!Algorithms.isEmpty(wpt.desc)) {
final View row = buildRow(view, R.drawable.ic_action_note_dark, wpt.desc, 0, false, null, true, 10, false, null); final View row = buildRow(view, R.drawable.ic_action_note_dark, wpt.desc, 0, false, null, true, 10, false, null, false);
row.setOnClickListener(new View.OnClickListener() { row.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -63,7 +71,7 @@ public class WptPtMenuBuilder extends MenuBuilder {
} }
if (!Algorithms.isEmpty(wpt.comment)) { if (!Algorithms.isEmpty(wpt.comment)) {
final View rowc = buildRow(view, R.drawable.ic_action_note_dark, wpt.comment, 0, final View rowc = buildRow(view, R.drawable.ic_action_note_dark, wpt.comment, 0,
false, null, true, 10, false, null); false, null, true, 10, false, null, false);
rowc.setOnClickListener(new View.OnClickListener() { rowc.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -73,6 +81,44 @@ public class WptPtMenuBuilder extends MenuBuilder {
}); });
} }
buildWaypointsView(view);
buildPlainMenuItems(view); buildPlainMenuItems(view);
} }
private void buildWaypointsView(View view) {
GpxSelectionHelper gpxSelectionHelper = app.getSelectedGpxHelper();
SelectedGpxFile selectedGpxFile = gpxSelectionHelper.getSelectedGPXFile(wpt);
if (selectedGpxFile != null) {
List<WptPt> points = selectedGpxFile.getGpxFile().getPoints();
GPXUtilities.GPXFile gpx = selectedGpxFile.getGpxFile();
if (points.size() > 0) {
String title = view.getContext().getString(R.string.context_menu_points_of_group);
File file = new File(gpx.path);
String gpxName = file.getName().replace(".gpx", "").replace("/", " ").replace("_", " ");
int color = getPointColor(wpt, getFileColor(selectedGpxFile));
buildRow(view, app.getIconsCache().getPaintedIcon(R.drawable.ic_type_waypoints_group, color), title, 0, gpxName,
true, getCollapsableWaypointsView(view.getContext(), true, gpx, wpt),
false, 0, false, null, false);
}
}
}
private int getFileColor(@NonNull SelectedGpxFile g) {
return g.getColor() == 0 ? ContextCompat.getColor(app, R.color.gpx_color_point) : g.getColor();
}
@ColorInt
private int getPointColor(WptPt o, @ColorInt int fileColor) {
boolean visit = isPointVisited(o);
return visit ? ContextCompat.getColor(app, R.color.color_ok) : o.getColor(fileColor);
}
private boolean isPointVisited(WptPt o) {
boolean visit = false;
String visited = o.getExtensionsToRead().get("VISITED_KEY");
if (visited != null && !visited.equals("0")) {
visit = true;
}
return visit;
}
} }

View file

@ -17,15 +17,19 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController; import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.OpeningHoursInfo;
import net.osmand.plus.mapcontextmenu.builders.AmenityMenuBuilder; import net.osmand.plus.mapcontextmenu.builders.AmenityMenuBuilder;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute; import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.resources.TransportIndexRepository; import net.osmand.plus.resources.TransportIndexRepository;
import net.osmand.plus.views.POIMapLayer;
import net.osmand.plus.views.TransportStopsLayer; import net.osmand.plus.views.TransportStopsLayer;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import net.osmand.util.OpeningHoursParser;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
@ -38,7 +42,7 @@ public class AmenityMenuController extends MenuController {
private MapMarker marker; private MapMarker marker;
public AmenityMenuController(MapActivity mapActivity, PointDescription pointDescription, Amenity amenity) { public AmenityMenuController(final MapActivity mapActivity, PointDescription pointDescription, final Amenity amenity) {
super(new AmenityMenuBuilder(mapActivity, amenity), pointDescription, mapActivity); super(new AmenityMenuBuilder(mapActivity, amenity), pointDescription, mapActivity);
this.amenity = amenity; this.amenity = amenity;
if (amenity.getType().getKeyName().equals("transportation")) { if (amenity.getType().getKeyName().equals("transportation")) {
@ -62,7 +66,16 @@ public class AmenityMenuController extends MenuController {
MapMarkerMenuController markerMenuController = MapMarkerMenuController markerMenuController =
new MapMarkerMenuController(mapActivity, marker.getPointDescription(mapActivity), marker); new MapMarkerMenuController(mapActivity, marker.getPointDescription(mapActivity), marker);
leftTitleButtonController = markerMenuController.getLeftTitleButtonController(); leftTitleButtonController = markerMenuController.getLeftTitleButtonController();
leftSubtitleButtonController = markerMenuController.getLeftSubtitleButtonController(); rightTitleButtonController = markerMenuController.getRightTitleButtonController();
} else if (amenity.getType().isWiki()) {
leftTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
POIMapLayer.showWikipediaDialog(mapActivity, mapActivity.getMyApplication(), amenity);
}
};
leftTitleButtonController.caption = getMapActivity().getString(R.string.context_menu_read_article);
leftTitleButtonController.leftIcon = getIcon(R.drawable.ic_action_note_dark, isLight() ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
} }
} }
@ -132,6 +145,11 @@ public class AmenityMenuController extends MenuController {
return getTypeStr(amenity); return getTypeStr(amenity);
} }
@Override
public OpeningHoursInfo getOpeningHoursInfo() {
return processOpeningHours(amenity);
}
public static String getTypeStr(Amenity amenity) { public static String getTypeStr(Amenity amenity) {
PoiCategory pc = amenity.getType(); PoiCategory pc = amenity.getType();
PoiType pt = pc.getPoiTypeByKeyName(amenity.getSubType()); PoiType pt = pc.getPoiTypeByKeyName(amenity.getSubType());
@ -144,37 +162,41 @@ public class AmenityMenuController extends MenuController {
return typeStr; return typeStr;
} }
public static OpeningHoursInfo processOpeningHours(Amenity amenity) {
OpeningHoursParser.OpeningHours openingHours = OpeningHoursParser.parseOpenedHours(amenity.getOpeningHours());
if (openingHours == null) {
return null;
} else {
OpeningHoursInfo info = new OpeningHoursInfo();
Calendar cal = Calendar.getInstance();
boolean opened = openingHours.isOpenedForTime(cal);
info.setOpened(opened);
if (opened) {
info.setOpened24_7(openingHours.isOpened24_7());
info.setClosingTime(openingHours.getClosingTime(cal));
info.setNearToClosingTime(openingHours.getNearToClosingTime(cal));
} else {
info.setOpeningTime(openingHours.getOpeningTime(cal));
info.setNearToOpeningTime(openingHours.getNearToOpeningTime(cal));
info.setOpeningDay(openingHours.getOpeningDay(cal));
}
return info;
}
}
@Override @Override
public String getCommonTypeStr() { public String getCommonTypeStr() {
PoiCategory pc = amenity.getType(); PoiCategory pc = amenity.getType();
return pc.getTranslation(); return pc.getTranslation();
} }
@Override
public List<TransportStopRoute> getTransportStopRoutes() {
return routes;
}
@Override @Override
public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) { public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) {
addPlainMenuItems(amenity, typeStr, builder);
for (final TransportStopRoute r : routes) {
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View arg0) {
MapContextMenu mm = getMapActivity().getContextMenu();
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE,
r.getDescription(getMapActivity().getMyApplication(), false));
mm.show(amenity.getLocation(), pd, r);
TransportStopsLayer stopsLayer = getMapActivity().getMapLayers().getTransportStopsLayer();
stopsLayer.setRoute(r.route);
int cz = r.calculateZoom(0, getMapActivity().getMapView().getCurrentRotatedTileBox());
getMapActivity().changeZoom(cz - getMapActivity().getMapView().getZoom());
}
};
if (r.type == null) {
builder.addPlainMenuItem(R.drawable.ic_action_polygom_dark, r.getDescription(getMapActivity().getMyApplication(), true),
false, false, listener);
} else {
builder.addPlainMenuItem(r.type.getResourceId(), r.getDescription(getMapActivity().getMyApplication(), true),
false, false, listener);
}
}
} }
public static void addPlainMenuItems(Amenity amenity, String typeStr, MenuBuilder builder) { public static void addPlainMenuItems(Amenity amenity, String typeStr, MenuBuilder builder) {
@ -223,21 +245,34 @@ public class AmenityMenuController extends MenuController {
return o1.desc.compareTo(o2.desc); return o1.desc.compareTo(o2.desc);
} }
}); });
builder.setRoutes(routes);
} }
private void addRoutes(boolean useEnglishNames, TransportIndexRepository t, TransportStop s, int dist) { private void addRoutes(boolean useEnglishNames, TransportIndexRepository t, TransportStop s, int dist) {
Collection<TransportRoute> rts = t.getRouteForStop(s); Collection<TransportRoute> rts = t.getRouteForStop(s);
if (rts != null) { if (rts != null) {
for (TransportRoute rs : rts) { for (TransportRoute rs : rts) {
TransportStopController.TransportStopType type = TransportStopController.TransportStopType.findType(rs.getType()); if (!containsRef(rs)) {
TransportStopRoute r = new TransportStopRoute(); TransportStopController.TransportStopType type = TransportStopController.TransportStopType.findType(rs.getType());
r.type = type; TransportStopRoute r = new TransportStopRoute();
r.desc = rs.getRef() + " " + (useEnglishNames ? rs.getEnName(true) : rs.getName()); r.type = type;
r.route = rs; r.desc = useEnglishNames ? rs.getEnName(true) : rs.getName();
r.stop = s; r.route = rs;
r.distance = dist; r.stop = s;
this.routes.add(r); r.distance = dist;
this.routes.add(r);
}
} }
} }
} }
private boolean containsRef(TransportRoute transportRoute) {
for (TransportStopRoute route : routes) {
if (route.route.getRef().equals(transportRoute.getRef())) {
return true;
}
}
return false;
}
} }

View file

@ -14,15 +14,20 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.FavoriteImageDrawable; import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.mapcontextmenu.MenuController; import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.OpeningHoursInfo;
import net.osmand.plus.mapcontextmenu.builders.FavouritePointMenuBuilder; import net.osmand.plus.mapcontextmenu.builders.FavouritePointMenuBuilder;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor; import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragment; import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragment;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.util.ArrayList;
import java.util.List;
public class FavouritePointMenuController extends MenuController { public class FavouritePointMenuController extends MenuController {
private FavouritePoint fav; private FavouritePoint fav;
private MapMarker mapMarker; private MapMarker mapMarker;
private List<TransportStopController.TransportStopRoute> routes = new ArrayList<>();
public FavouritePointMenuController(MapActivity mapActivity, PointDescription pointDescription, final FavouritePoint fav) { public FavouritePointMenuController(MapActivity mapActivity, PointDescription pointDescription, final FavouritePoint fav) {
super(new FavouritePointMenuBuilder(mapActivity, fav), pointDescription, mapActivity); super(new FavouritePointMenuBuilder(mapActivity, fav), pointDescription, mapActivity);
@ -37,7 +42,13 @@ public class FavouritePointMenuController extends MenuController {
MapMarkerMenuController markerMenuController = MapMarkerMenuController markerMenuController =
new MapMarkerMenuController(mapActivity, mapMarker.getPointDescription(mapActivity), mapMarker); new MapMarkerMenuController(mapActivity, mapMarker.getPointDescription(mapActivity), mapMarker);
leftTitleButtonController = markerMenuController.getLeftTitleButtonController(); leftTitleButtonController = markerMenuController.getLeftTitleButtonController();
leftSubtitleButtonController = markerMenuController.getLeftSubtitleButtonController(); rightTitleButtonController = markerMenuController.getRightTitleButtonController();
}
if (getObject() instanceof TransportStop) {
TransportStop stop = (TransportStop) getObject();
TransportStopController transportStopController = new TransportStopController(getMapActivity(), pointDescription, stop);
routes = transportStopController.processTransportStop();
builder.setRoutes(routes);
} }
} }
@ -53,6 +64,11 @@ public class FavouritePointMenuController extends MenuController {
return fav; return fav;
} }
@Override
public List<TransportStopController.TransportStopRoute> getTransportStopRoutes() {
return routes;
}
@Override @Override
public boolean handleSingleTapOnMap() { public boolean handleSingleTapOnMap() {
Fragment fragment = getMapActivity().getSupportFragmentManager().findFragmentByTag(FavoritePointEditor.TAG); Fragment fragment = getMapActivity().getSupportFragmentManager().findFragmentByTag(FavoritePointEditor.TAG);
@ -90,7 +106,7 @@ public class FavouritePointMenuController extends MenuController {
@Override @Override
public Drawable getSecondLineTypeIcon() { public Drawable getSecondLineTypeIcon() {
return getIcon(R.drawable.map_small_group); return getIcon(R.drawable.ic_action_group_name_16);
} }
@Override @Override
@ -100,7 +116,7 @@ public class FavouritePointMenuController extends MenuController {
@Override @Override
public int getFavActionStringId() { public int getFavActionStringId() {
return R.string.favourites_context_menu_edit; return R.string.shared_string_edit;
} }
@Override @Override
@ -123,15 +139,18 @@ public class FavouritePointMenuController extends MenuController {
if (originObject instanceof Amenity) { if (originObject instanceof Amenity) {
Amenity amenity = (Amenity) originObject; Amenity amenity = (Amenity) originObject;
AmenityMenuController.addPlainMenuItems(amenity, AmenityMenuController.getTypeStr(amenity), builder); AmenityMenuController.addPlainMenuItems(amenity, AmenityMenuController.getTypeStr(amenity), builder);
} else if (originObject instanceof TransportStop) {
TransportStop stop = (TransportStop) originObject;
TransportStopController transportStopController =
new TransportStopController(getMapActivity(), pointDescription, stop);
transportStopController.addPlainMenuItems(builder, latLon);
addMyLocationToPlainItems(latLon);
} }
} else { } else {
addMyLocationToPlainItems(latLon); addMyLocationToPlainItems(latLon);
} }
} }
@Override
public OpeningHoursInfo getOpeningHoursInfo() {
Object originObject = getBuilder().getOriginObject();
if (originObject instanceof Amenity) {
return AmenityMenuController.processOpeningHours((Amenity) originObject);
}
return null;
}
} }

View file

@ -134,7 +134,7 @@ public class MapDataMenuController extends MenuController {
rightDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_delete); rightDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
rightDownloadButtonController.leftIconId = R.drawable.ic_action_delete_dark; rightDownloadButtonController.leftIconId = R.drawable.ic_action_delete_dark;
topRightTitleButtonController = new TitleButtonController() { bottomTitleButtonController = new TitleButtonController() {
@Override @Override
public void buttonPressed() { public void buttonPressed() {
getMapActivity().getContextMenu().close(); getMapActivity().getContextMenu().close();
@ -158,7 +158,7 @@ public class MapDataMenuController extends MenuController {
mapActivity.getContextMenu().getLatLon(), selectedObjects); mapActivity.getContextMenu().getLatLon(), selectedObjects);
} }
}; };
topRightTitleButtonController.caption = getMapActivity().getString(R.string.download_select_map_types); bottomTitleButtonController.caption = getMapActivity().getString(R.string.download_select_map_types);
titleProgressController = new TitleProgressController() { titleProgressController = new TitleProgressController() {
@Override @Override
@ -300,7 +300,7 @@ public class MapDataMenuController extends MenuController {
} }
@Override @Override
public boolean fabVisible() { public boolean navigateButtonVisible() {
return false; return false;
} }
@ -350,7 +350,7 @@ public class MapDataMenuController extends MenuController {
} }
rightDownloadButtonController.visible = downloaded; rightDownloadButtonController.visible = downloaded;
topRightTitleButtonController.visible = (otherIndexItems != null && otherIndexItems.size() > 0) bottomTitleButtonController.visible = (otherIndexItems != null && otherIndexItems.size() > 0)
|| (otherLocalIndexInfos != null && otherLocalIndexInfos.size() > 0); || (otherLocalIndexInfos != null && otherLocalIndexInfos.size() > 0);
boolean internetConnectionAvailable = boolean internetConnectionAvailable =

View file

@ -38,7 +38,7 @@ public class MapMarkerMenuController extends MenuController {
leftTitleButtonController.caption = getMapActivity().getString(R.string.mark_passed); leftTitleButtonController.caption = getMapActivity().getString(R.string.mark_passed);
leftTitleButtonController.leftIconId = isLight() ? R.drawable.passed_icon_light : R.drawable.passed_icon_dark; leftTitleButtonController.leftIconId = isLight() ? R.drawable.passed_icon_light : R.drawable.passed_icon_dark;
leftSubtitleButtonController = new TitleButtonController() { rightTitleButtonController = new TitleButtonController() {
@Override @Override
public void buttonPressed() { public void buttonPressed() {
OsmandSettings.OsmandPreference<Boolean> indication = app.getSettings().MARKERS_DISTANCE_INDICATION_ENABLED; OsmandSettings.OsmandPreference<Boolean> indication = app.getSettings().MARKERS_DISTANCE_INDICATION_ENABLED;
@ -50,8 +50,8 @@ public class MapMarkerMenuController extends MenuController {
getMapActivity().getContextMenu().close(); getMapActivity().getContextMenu().close();
} }
}; };
leftSubtitleButtonController.caption = getMapActivity().getString(R.string.make_active); rightTitleButtonController.caption = getMapActivity().getString(R.string.make_active);
leftSubtitleButtonController.leftIcon = createShowOnTopbarIcon(); rightTitleButtonController.leftIcon = createShowOnTopbarIcon();
} }
private Drawable createShowOnTopbarIcon() { private Drawable createShowOnTopbarIcon() {

View file

@ -78,7 +78,7 @@ public class TransportRouteController extends MenuController {
} }
@Override @Override
public boolean fabVisible() { public boolean navigateButtonVisible() {
return false; return false;
} }

View file

@ -82,14 +82,16 @@ public class TransportStopController extends MenuController {
PointDescription pointDescription, TransportStop transportStop) { PointDescription pointDescription, TransportStop transportStop) {
super(new MenuBuilder(mapActivity), pointDescription, mapActivity); super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
this.transportStop = transportStop; this.transportStop = transportStop;
processTransportStop(); routes = processTransportStop();
builder.setRoutes(routes);
} }
@Override @Override
protected void setObject(Object object) { protected void setObject(Object object) {
if (object instanceof TransportStop) { if (object instanceof TransportStop) {
this.transportStop = (TransportStop) object; this.transportStop = (TransportStop) object;
processTransportStop(); routes = processTransportStop();
builder.setRoutes(routes);
} }
} }
@ -107,6 +109,11 @@ public class TransportStopController extends MenuController {
} }
} }
@Override
public List<TransportStopRoute> getTransportStopRoutes() {
return routes;
}
@Override @Override
public boolean needStreetName() { public boolean needStreetName() {
return Algorithms.isEmpty(getNameStr()); return Algorithms.isEmpty(getNameStr());
@ -122,39 +129,8 @@ public class TransportStopController extends MenuController {
return getPointDescription().getTypeName(); return getPointDescription().getTypeName();
} }
@Override public List<TransportStopRoute> processTransportStop() {
public void addPlainMenuItems(String typeStr, PointDescription pointDescription, final LatLon latLon) { ArrayList<TransportStopRoute> routes = new ArrayList<>();
addPlainMenuItems(builder, latLon);
super.addPlainMenuItems(typeStr, pointDescription, latLon);
}
public void addPlainMenuItems(MenuBuilder builder, final LatLon latLon) {
for (final TransportStopRoute r : routes) {
OnClickListener listener = new OnClickListener() {
@Override
public void onClick(View arg0) {
MapContextMenu mm = getMapActivity().getContextMenu();
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE,
r.getDescription(getMapActivity().getMyApplication(), false));
mm.show(latLon, pd, r);
TransportStopsLayer stopsLayer = getMapActivity().getMapLayers().getTransportStopsLayer();
stopsLayer.setRoute(r.route);
int cz = r.calculateZoom(0, getMapActivity().getMapView().getCurrentRotatedTileBox());
getMapActivity().changeZoom(cz - getMapActivity().getMapView().getZoom());
}
};
if (r.type == null) {
builder.addPlainMenuItem(R.drawable.ic_action_polygom_dark, r.getDescription(getMapActivity().getMyApplication(), true),
false, false, listener );
} else {
builder.addPlainMenuItem(r.type.getResourceId(), r.getDescription(getMapActivity().getMyApplication(), true),
false, false, listener);
}
}
}
private void processTransportStop() {
routes.clear();
List<TransportIndexRepository> reps = getMapActivity().getMyApplication() List<TransportIndexRepository> reps = getMapActivity().getMyApplication()
.getResourceManager().searchTransportRepositories(transportStop.getLocation().getLatitude(), .getResourceManager().searchTransportRepositories(transportStop.getLocation().getLatitude(),
transportStop.getLocation().getLongitude()); transportStop.getLocation().getLongitude());
@ -165,14 +141,14 @@ public class TransportStopController extends MenuController {
if (t.acceptTransportStop(transportStop)) { if (t.acceptTransportStop(transportStop)) {
boolean empty = transportStop.getReferencesToRoutes() == null || transportStop.getReferencesToRoutes().length == 0; boolean empty = transportStop.getReferencesToRoutes() == null || transportStop.getReferencesToRoutes().length == 0;
if(!empty) { if(!empty) {
addRoutes(useEnglishNames, t, transportStop, transportStop, 0); addRoutes(routes, useEnglishNames, t, transportStop, transportStop, 0);
} }
ArrayList<TransportStop> ls = new ArrayList<>(); ArrayList<TransportStop> ls = new ArrayList<>();
QuadRect ll = MapUtils.calculateLatLonBbox(transportStop.getLocation().getLatitude(), transportStop.getLocation().getLongitude(), 150); QuadRect ll = MapUtils.calculateLatLonBbox(transportStop.getLocation().getLatitude(), transportStop.getLocation().getLongitude(), 150);
t.searchTransportStops(ll.top, ll.left, ll.bottom, ll.right, -1, ls, null); t.searchTransportStops(ll.top, ll.left, ll.bottom, ll.right, -1, ls, null);
for(TransportStop tstop : ls) { for(TransportStop tstop : ls) {
if(tstop.getId().longValue() != transportStop.getId().longValue() || empty) { if(tstop.getId().longValue() != transportStop.getId().longValue() || empty) {
addRoutes(useEnglishNames, t, tstop, transportStop, addRoutes(routes, useEnglishNames, t, tstop, transportStop,
(int) MapUtils.getDistance(tstop.getLocation(), transportStop.getLocation())); (int) MapUtils.getDistance(tstop.getLocation(), transportStop.getLocation()));
} }
} }
@ -193,28 +169,41 @@ public class TransportStopController extends MenuController {
return o1.desc.compareTo(o2.desc); return o1.desc.compareTo(o2.desc);
} }
}); });
return routes;
} }
private void addRoutes(boolean useEnglishNames, TransportIndexRepository t, TransportStop s, TransportStop refStop, int dist) { private void addRoutes(List<TransportStopRoute> routes, boolean useEnglishNames, TransportIndexRepository t, TransportStop s, TransportStop refStop, int dist) {
Collection<TransportRoute> rts = t.getRouteForStop(s); Collection<TransportRoute> rts = t.getRouteForStop(s);
if (rts != null) { if (rts != null) {
for (TransportRoute rs : rts) { for (TransportRoute rs : rts) {
TransportStopType type = TransportStopType.findType(rs.getType()); TransportStopType type = TransportStopType.findType(rs.getType());
TransportStopRoute r = new TransportStopRoute();
if (topType == null && type != null && type.isTopType()) { if (topType == null && type != null && type.isTopType()) {
topType = type; topType = type;
} }
r.type = type; if (!containsRef(routes, rs)) {
r.desc = rs.getRef() + " " + (useEnglishNames ? rs.getEnName(true) : rs.getName()); TransportStopRoute r = new TransportStopRoute();
r.route = rs; r.type = type;
r.refStop = refStop; r.desc = useEnglishNames ? rs.getEnName(true) : rs.getName();
r.stop = s; r.route = rs;
r.distance = dist; r.refStop = refStop;
this.routes.add(r); r.stop = s;
r.distance = dist;
routes.add(r);
}
} }
} }
} }
private boolean containsRef(List<TransportStopRoute> routes, TransportRoute transportRoute) {
for (TransportStopRoute route : routes) {
if (route.route.getRef().equals(transportRoute.getRef())) {
return true;
}
}
return false;
}
public static class TransportStopRoute { public static class TransportStopRoute {
public TransportStop refStop; public TransportStop refStop;
public TransportStopType type; public TransportStopType type;

View file

@ -6,6 +6,8 @@ import android.support.v4.content.ContextCompat;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -15,6 +17,8 @@ import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.builders.WptPtMenuBuilder; import net.osmand.plus.mapcontextmenu.builders.WptPtMenuBuilder;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.io.File;
public class WptPtMenuController extends MenuController { public class WptPtMenuController extends MenuController {
private WptPt wpt; private WptPt wpt;
@ -33,7 +37,7 @@ public class WptPtMenuController extends MenuController {
MapMarkerMenuController markerMenuController = MapMarkerMenuController markerMenuController =
new MapMarkerMenuController(mapActivity, mapMarker.getPointDescription(mapActivity), mapMarker); new MapMarkerMenuController(mapActivity, mapMarker.getPointDescription(mapActivity), mapMarker);
leftTitleButtonController = markerMenuController.getLeftTitleButtonController(); leftTitleButtonController = markerMenuController.getLeftTitleButtonController();
leftSubtitleButtonController = markerMenuController.getLeftSubtitleButtonController(); rightTitleButtonController = markerMenuController.getRightTitleButtonController();
} }
} }
@ -78,11 +82,11 @@ public class WptPtMenuController extends MenuController {
} }
@Override @Override
public Drawable getSecondLineTypeIcon() { public Drawable getAdditionalLineTypeIcon() {
if (Algorithms.isEmpty(getTypeStr())) { if (Algorithms.isEmpty(getAdditionalTypeStr())) {
return null; return null;
} else { } else {
return getIcon(R.drawable.map_small_group); return getIcon(R.drawable.ic_action_group_name_16);
} }
} }
@ -93,6 +97,21 @@ public class WptPtMenuController extends MenuController {
@Override @Override
public String getTypeStr() { public String getTypeStr() {
GpxSelectionHelper helper = getMapActivity().getMyApplication().getSelectedGpxHelper();
SelectedGpxFile selectedGpxFile = helper.getSelectedGPXFile(wpt);
StringBuilder sb = new StringBuilder();
sb.append(getMapActivity().getString(R.string.gpx_wpt));
sb.append(", ");
if (selectedGpxFile != null) {
File file = new File(selectedGpxFile.getGpxFile().path);
String gpxName = file.getName().replace(".gpx", "").replace("/", " ").replace("_", " ");
sb.append(gpxName);
}
return sb.toString();
}
@Override
public String getAdditionalTypeStr() {
return wpt.category != null ? wpt.category : ""; return wpt.category != null ? wpt.category : "";
} }

View file

@ -1,40 +1,29 @@
package net.osmand.plus.mapcontextmenu.other; package net.osmand.plus.mapcontextmenu.other;
import android.annotation.SuppressLint;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.plus.IconsCache;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu.MenuObject; import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu.MenuObject;
import net.osmand.plus.widgets.TextViewEx;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import static android.util.TypedValue.COMPLEX_UNIT_DIP; public class MapMultiSelectionMenuFragment extends Fragment implements MultiSelectionArrayAdapter.OnClickListener {
public class MapMultiSelectionMenuFragment extends Fragment implements AdapterView.OnItemClickListener {
public static final String TAG = "MapMultiSelectionMenuFragment"; public static final String TAG = "MapMultiSelectionMenuFragment";
private View view; private View view;
private ArrayAdapter<MenuObject> listAdapter; private MultiSelectionArrayAdapter listAdapter;
private MapMultiSelectionMenu menu; private MapMultiSelectionMenu menu;
private boolean dismissing = false; private boolean dismissing = false;
private boolean wasDrawerDisabled; private boolean wasDrawerDisabled;
@ -57,15 +46,25 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
ListView listView = (ListView) view.findViewById(R.id.list); ListView listView = (ListView) view.findViewById(R.id.list);
if (menu.isLandscapeLayout() && Build.VERSION.SDK_INT >= 21) { if (menu.isLandscapeLayout() && Build.VERSION.SDK_INT >= 21) {
AndroidUtils.addStatusBarPadding21v(getActivity(), listView); AndroidUtils.addStatusBarPadding21v(getActivity(), listView);
listView.setClipToPadding(false);
} }
View headerView = inflater.inflate(R.layout.menu_obj_selection_header, listView, false);
if (!menu.isLight()) {
((TextViewEx) headerView.findViewById(R.id.header_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
}
headerView.setOnClickListener(null);
listView.addHeaderView(headerView);
listAdapter = createAdapter(); listAdapter = createAdapter();
listAdapter.setListener(this);
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
listView.setOnItemClickListener(this);
if (!oldAndroid()) { runLayoutListener();
runLayoutListener();
} view.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismissMenu();
}
});
return view; return view;
} }
@ -140,8 +139,25 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
@Override @Override
public void onGlobalLayout() { public void onGlobalLayout() {
int maxHeight = (int) (getScreenHeight() * menu.getHalfScreenMaxHeightKoef()); if (!menu.isLandscapeLayout() && listAdapter.getCount() > 3) {
int height = view.findViewById(R.id.main_view).getHeight(); View contentView = view.findViewById(R.id.content);
float headerHeight = contentView.getResources().getDimension(R.dimen.multi_selection_header_height);
float cancelRowHeight = contentView.getResources().getDimension(R.dimen.bottom_sheet_cancel_button_height);
int maxHeight = (int) (headerHeight + cancelRowHeight);
for (int i = 0; i < 3; i++) {
View childView = listAdapter.getView(0, null, (ListView) contentView.findViewById(R.id.list));
childView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
maxHeight += childView.getMeasuredHeight();
}
int height = contentView.getHeight();
if (height > maxHeight) {
ViewGroup.LayoutParams lp = contentView.getLayoutParams();
lp.height = maxHeight;
contentView.setLayoutParams(lp);
contentView.requestLayout();
}
}
ViewTreeObserver obs = view.getViewTreeObserver(); ViewTreeObserver obs = view.getViewTreeObserver();
@ -150,71 +166,21 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
} else { } else {
obs.removeGlobalOnLayoutListener(this); obs.removeGlobalOnLayoutListener(this);
} }
if (!menu.isLandscapeLayout() && height > maxHeight) {
ViewGroup.LayoutParams lp = view.getLayoutParams();
lp.height = maxHeight;
view.setLayoutParams(lp);
view.requestLayout();
}
} }
}); });
} }
private ArrayAdapter<MenuObject> createAdapter() { private MultiSelectionArrayAdapter createAdapter() {
final List<MenuObject> items = new LinkedList<>(menu.getObjects()); final List<MenuObject> items = new LinkedList<>(menu.getObjects());
return new ArrayAdapter<MenuObject>(menu.getMapActivity(), R.layout.menu_obj_list_item, items) { return new MultiSelectionArrayAdapter(menu, R.layout.menu_obj_list_item, items);
@SuppressLint("InflateParams")
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
v = menu.getMapActivity().getLayoutInflater().inflate(R.layout.menu_obj_list_item, null);
}
final MenuObject item = getItem(position);
buildHeader(v, item, menu.getMapActivity());
return v;
}
};
}
private void buildHeader(View view, MenuObject item, MapActivity mapActivity) {
AndroidUtils.setBackground(mapActivity, view, !menu.isLight(), R.drawable.expandable_list_item_background_light, R.drawable.expandable_list_item_background_dark);
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
Drawable icon = item.getLeftIcon();
int iconId = item.getLeftIconId();
if (icon != null) {
iconView.setImageDrawable(icon);
iconLayout.setVisibility(View.VISIBLE);
} else if (iconId != 0) {
iconView.setImageDrawable(iconsCache.getIcon(iconId,
menu.isLight() ? R.color.osmand_orange : R.color.osmand_orange_dark));
iconLayout.setVisibility(View.VISIBLE);
} else {
iconLayout.setVisibility(View.GONE);
}
// Text line 1
TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1);
AndroidUtils.setTextPrimaryColor(mapActivity, line1, !menu.isLight());
line1.setText(item.getTitleStr());
// Text line 2
TextView line2 = (TextView) view.findViewById(R.id.context_menu_line2);
AndroidUtils.setTextSecondaryColor(mapActivity, line2, !menu.isLight());
line2.setText(item.getTypeStr());
Drawable slIcon = item.getTypeIcon();
line2.setCompoundDrawablesWithIntrinsicBounds(slIcon, null, null, null);
line2.setCompoundDrawablePadding(dpToPx(5f));
} }
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onClick(int position) {
menu.openContextMenu(listAdapter.getItem(position)); MenuObject menuObject = listAdapter.getItem(position);
if (menuObject != null) {
menu.openContextMenu(menuObject);
}
} }
public void dismissMenu() { public void dismissMenu() {
@ -225,23 +191,4 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
menu.getMapActivity().getSupportFragmentManager().popBackStack(); menu.getMapActivity().getSupportFragmentManager().popBackStack();
} }
} }
private int dpToPx(float dp) {
Resources r = getActivity().getResources();
return (int) TypedValue.applyDimension(
COMPLEX_UNIT_DIP,
dp,
r.getDisplayMetrics()
);
}
private int getScreenHeight() {
DisplayMetrics dm = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
return dm.heightPixels;
}
private boolean oldAndroid() {
return (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH);
}
} }

View file

@ -19,6 +19,7 @@ import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.ValueHolder; import net.osmand.ValueHolder;
import net.osmand.data.FavouritePoint; import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
@ -258,10 +259,22 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
private void updateViaView(final View parentView) { private void updateViaView(final View parentView) {
String via = generateViaDescription(); String via = generateViaDescription();
View viaLayout = parentView.findViewById(R.id.ViaLayout); View viaLayout = parentView.findViewById(R.id.ViaLayout);
View fromLayoutEmptyView = parentView.findViewById(R.id.from_layout_empty_view);
View toLayoutEmptyView = parentView.findViewById(R.id.to_layout_empty_view);
View dividerFromDropDownEmpty = parentView.findViewById(R.id.divider_from_drop_down_empty);
ImageView swapDirectionView = (ImageView) parentView.findViewById(R.id.swap_direction_image_view);
if (via.length() == 0) { if (via.length() == 0) {
viaLayout.setVisibility(View.GONE); viaLayout.setVisibility(View.GONE);
parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.GONE); parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.GONE);
dividerFromDropDownEmpty.setVisibility(View.GONE);
fromLayoutEmptyView.setVisibility(View.VISIBLE);
toLayoutEmptyView.setVisibility(View.VISIBLE);
swapDirectionView.setVisibility(View.VISIBLE);
} else { } else {
fromLayoutEmptyView.setVisibility(View.GONE);
toLayoutEmptyView.setVisibility(View.GONE);
swapDirectionView.setVisibility(View.GONE);
dividerFromDropDownEmpty.setVisibility(View.VISIBLE);
viaLayout.setVisibility(View.VISIBLE); viaLayout.setVisibility(View.VISIBLE);
parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.VISIBLE); parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.VISIBLE);
((TextView) parentView.findViewById(R.id.ViaView)).setText(via); ((TextView) parentView.findViewById(R.id.ViaView)).setText(via);
@ -278,6 +291,36 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
ImageView viaIcon = (ImageView) parentView.findViewById(R.id.viaIcon); ImageView viaIcon = (ImageView) parentView.findViewById(R.id.viaIcon);
viaIcon.setImageDrawable(getIconOrig(R.drawable.list_intermediate)); viaIcon.setImageDrawable(getIconOrig(R.drawable.list_intermediate));
swapDirectionView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_change_navigation_points,
isLight() ? R.color.route_info_control_icon_color_light : R.color.route_info_control_icon_color_dark));
AndroidUtils.setBackground(mapActivity, swapDirectionView, nightMode, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
swapDirectionView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
TargetPointsHelper targetPointsHelper = getTargets();
TargetPoint startPoint = targetPointsHelper.getPointToStart();
TargetPoint endPoint = targetPointsHelper.getPointToNavigate();
if (startPoint == null) {
Location loc = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
if (loc != null) {
startPoint = TargetPoint.createStartPoint(new LatLon(loc.getLatitude(), loc.getLongitude()),
new PointDescription(PointDescription.POINT_TYPE_MY_LOCATION,
mapActivity.getString(R.string.shared_string_my_location)));
}
}
if (startPoint != null) {
targetPointsHelper.navigateToPoint(startPoint.point, false, -1, startPoint.getPointDescription(mapActivity));
targetPointsHelper.setStartPoint(endPoint.point, false, endPoint.getPointDescription(mapActivity));
targetPointsHelper.updateRouteAndRefresh(true);
updateFromIcon();
updateToIcon(parentView);
}
}
});
} }
private void updateToSpinner(final View parentView) { private void updateToSpinner(final View parentView) {
@ -593,9 +636,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
infoDurationView.setVisibility(View.GONE); infoDurationView.setVisibility(View.GONE);
textView.setVisibility(View.VISIBLE); textView.setVisibility(View.VISIBLE);
} else { } else {
infoIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_polygom_dark, isLight())); infoIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_route_distance, R.color.route_info_unchecked_mode_icon_color));
infoIcon.setVisibility(View.VISIBLE); infoIcon.setVisibility(View.VISIBLE);
durationIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_time, isLight())); durationIcon.setImageDrawable(ctx.getIconsCache().getIcon(R.drawable.ic_action_time, R.color.route_info_unchecked_mode_icon_color));
durationIcon.setVisibility(View.VISIBLE); durationIcon.setVisibility(View.VISIBLE);
infoDistanceView.setVisibility(View.VISIBLE); infoDistanceView.setVisibility(View.VISIBLE);
infoDurationView.setVisibility(View.VISIBLE); infoDurationView.setVisibility(View.VISIBLE);

View file

@ -139,27 +139,30 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
boolean landscapeLayout = !portraitMode; boolean landscapeLayout = !portraitMode;
boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls(); boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls();
if (!landscapeLayout) { if (!landscapeLayout) {
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark); AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.route_info_menu_bg_light, R.drawable.route_info_menu_bg_dark);
} else { } else {
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark); AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.route_info_menu_bg_left_light, R.drawable.route_info_menu_bg_left_dark);
} }
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.map_route_prepare_bottom_view), nightMode,
R.color.route_info_bottom_view_bg_light, R.color.route_info_bottom_view_bg_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerModesLayout), nightMode, AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerModesLayout), nightMode,
R.color.dashboard_divider_light, R.color.dashboard_divider_dark); R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerFromDropDown), nightMode, AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerFromDropDown), nightMode,
R.color.dashboard_divider_light, R.color.dashboard_divider_dark); R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.divider_from_drop_down_empty), nightMode,
R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.viaLayoutDivider), nightMode, AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.viaLayoutDivider), nightMode,
R.color.dashboard_divider_light, R.color.dashboard_divider_dark); R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerToDropDown), nightMode, AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerToDropDown), nightMode,
R.color.dashboard_divider_light, R.color.dashboard_divider_dark); R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerButtons), nightMode, AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerButtons), nightMode,
R.color.dashboard_divider_light, R.color.dashboard_divider_dark); R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn1), nightMode, AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn1), nightMode,
R.color.dashboard_divider_light, R.color.dashboard_divider_dark); R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn2), nightMode, AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn2), nightMode,
R.color.dashboard_divider_light, R.color.dashboard_divider_dark); R.color.route_info_divider_light, R.color.route_info_divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerBtn3), nightMode,
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaView), nightMode); AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaView), nightMode);
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaSubView), nightMode); AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.ViaSubView), nightMode);

View file

@ -0,0 +1,91 @@
package net.osmand.plus.mapcontextmenu.other;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.IconsCache;
import net.osmand.plus.R;
import java.util.List;
public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMenu.MenuObject> {
private MapMultiSelectionMenu menu;
private OnClickListener listener;
MultiSelectionArrayAdapter(@NonNull MapMultiSelectionMenu menu, int resource, @NonNull List<MapMultiSelectionMenu.MenuObject> objects) {
super(menu.getMapActivity(), resource, objects);
this.menu = menu;
}
public void setListener(OnClickListener listener) {
this.listener = listener;
}
@NonNull
@Override
public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
if (convertView == null) {
convertView = menu.getMapActivity().getLayoutInflater().inflate(R.layout.menu_obj_list_item, parent, false);
}
final MapMultiSelectionMenu.MenuObject item = getItem(position);
if (item != null) {
AndroidUtils.setBackground(menu.getMapActivity(), convertView, !menu.isLight(), R.drawable.expandable_list_item_background_light, R.drawable.expandable_list_item_background_dark);
convertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onClick(position);
}
}
});
IconsCache iconsCache = menu.getMapActivity().getMyApplication().getIconsCache();
final View iconLayout = convertView.findViewById(R.id.context_menu_icon_layout);
final ImageView iconView = (ImageView) convertView.findViewById(R.id.context_menu_icon_view);
Drawable icon = item.getLeftIcon();
int iconId = item.getLeftIconId();
if (icon != null) {
iconView.setImageDrawable(icon);
iconLayout.setVisibility(View.VISIBLE);
} else if (iconId != 0) {
iconView.setImageDrawable(iconsCache.getIcon(iconId,
menu.isLight() ? R.color.osmand_orange : R.color.osmand_orange_dark));
iconLayout.setVisibility(View.VISIBLE);
} else {
iconLayout.setVisibility(View.GONE);
}
// Text line 1
TextView line1 = (TextView) convertView.findViewById(R.id.context_menu_line1);
((TextView) convertView.findViewById(R.id.context_menu_line1)).setTextColor(ContextCompat.getColor(getContext(),
!menu.isLight() ? R.color.ctx_menu_title_color_dark : R.color.ctx_menu_title_color_light));
line1.setText(item.getTitleStr());
// Text line 2
TextView line2 = (TextView) convertView.findViewById(R.id.context_menu_line2);
((TextView) line2).setTextColor(ContextCompat.getColor(getContext(), R.color.ctx_menu_subtitle_color));
line2.setText(item.getTypeStr());
Drawable slIcon = item.getTypeIcon();
line2.setCompoundDrawablesWithIntrinsicBounds(slIcon, null, null, null);
line2.setCompoundDrawablePadding(AndroidUtils.dpToPx(menu.getMapActivity(), 5f));
// Divider
View divider = convertView.findViewById(R.id.divider);
divider.setVisibility(position != getCount() - 1 ? View.VISIBLE : View.GONE);
}
return convertView;
}
public interface OnClickListener {
void onClick(int position);
}
}

View file

@ -44,6 +44,8 @@ public class FavoritesActivity extends TabActivity {
private static final int OPEN_GPX_DOCUMENT_REQUEST = 1006; private static final int OPEN_GPX_DOCUMENT_REQUEST = 1006;
private static final int IMPORT_FAVOURITES_REQUEST = 1007; private static final int IMPORT_FAVOURITES_REQUEST = 1007;
public static final String GROUP_NAME_TO_SHOW = "group_name_to_show";
public static final String OPEN_FAVOURITES_TAB = "open_favourites_tab"; public static final String OPEN_FAVOURITES_TAB = "open_favourites_tab";
public static final String OPEN_MY_PLACES_TAB = "open_my_places_tab"; public static final String OPEN_MY_PLACES_TAB = "open_my_places_tab";
@ -52,6 +54,7 @@ public class FavoritesActivity extends TabActivity {
protected List<WeakReference<Fragment>> fragList = new ArrayList<>(); protected List<WeakReference<Fragment>> fragList = new ArrayList<>();
private int tabSize; private int tabSize;
private GpxImportHelper gpxImportHelper; private GpxImportHelper gpxImportHelper;
private String groupNameToShow;
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
@ -74,16 +77,25 @@ public class FavoritesActivity extends TabActivity {
// setupHomeButton(); // setupHomeButton();
ViewPager mViewPager = (ViewPager) findViewById(R.id.pager); ViewPager mViewPager = (ViewPager) findViewById(R.id.pager);
Intent intent = getIntent(); if (icicle == null) {
if (intent != null) { Intent intent = getIntent();
if (intent.hasExtra(OPEN_FAVOURITES_TAB) && intent.getBooleanExtra(OPEN_FAVOURITES_TAB, false)) { if (intent != null) {
mViewPager.setCurrentItem(0, false); if (intent.hasExtra(OPEN_FAVOURITES_TAB) && intent.getBooleanExtra(OPEN_FAVOURITES_TAB, false)) {
} else if (intent.hasExtra(OPEN_MY_PLACES_TAB) && intent.getBooleanExtra(OPEN_MY_PLACES_TAB, false)) { if (intent.hasExtra(GROUP_NAME_TO_SHOW)) {
mViewPager.setCurrentItem(1, false); groupNameToShow = intent.getStringExtra(GROUP_NAME_TO_SHOW);
}
mViewPager.setCurrentItem(0, false);
} else if (intent.hasExtra(OPEN_MY_PLACES_TAB) && intent.getBooleanExtra(OPEN_MY_PLACES_TAB, false)) {
mViewPager.setCurrentItem(1, false);
}
} }
} }
} }
public String getGroupNameToShow() {
return groupNameToShow;
}
public void addTrack() { public void addTrack() {
Intent intent = getImportGpxIntent(); Intent intent = getImportGpxIntent();
startActivityForResult(intent, OPEN_GPX_DOCUMENT_REQUEST); startActivityForResult(intent, OPEN_GPX_DOCUMENT_REQUEST);

View file

@ -30,8 +30,8 @@ public class EditPOIMenuBuilder extends MenuBuilder {
if (osmPoint instanceof OsmNotesPoint) { if (osmPoint instanceof OsmNotesPoint) {
OsmNotesPoint notes = (OsmNotesPoint) osmPoint; OsmNotesPoint notes = (OsmNotesPoint) osmPoint;
buildRow(view, R.drawable.ic_action_note_dark, notes.getText(), 0, false, null, false, 0, false, null); buildRow(view, R.drawable.ic_action_note_dark, notes.getText(), 0, false, null, false, 0, false, null, false);
buildRow(view, R.drawable.ic_group, notes.getAuthor(), 0, false, null, false, 0, false, null); buildRow(view, R.drawable.ic_group, notes.getAuthor(), 0, false, null, false, 0, false, null, false);
} else if (osmPoint instanceof OpenstreetmapPoint) { } else if (osmPoint instanceof OpenstreetmapPoint) {
OpenstreetmapPoint point = (OpenstreetmapPoint) osmPoint; OpenstreetmapPoint point = (OpenstreetmapPoint) osmPoint;
@ -56,7 +56,7 @@ public class EditPOIMenuBuilder extends MenuBuilder {
if (resId == 0) { if (resId == 0) {
resId = R.drawable.ic_action_folder_stroke; resId = R.drawable.ic_action_folder_stroke;
} }
buildRow(view, resId, poiTranslation, 0, false, null, false, 0, false, null); buildRow(view, resId, poiTranslation, 0, false, null, false, 0, false, null, false);
break; break;
} }
} }
@ -67,12 +67,12 @@ public class EditPOIMenuBuilder extends MenuBuilder {
continue; continue;
} }
String text = e.getKey() + "=" + e.getValue(); String text = e.getKey() + "=" + e.getValue();
buildRow(view, R.drawable.ic_action_info_dark, text, 0, false, null, false, 0, false, null); buildRow(view, R.drawable.ic_action_info_dark, text, 0, false, null, false, 0, false, null, false);
} }
} }
buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app, buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app,
osmPoint.getLatitude(), osmPoint.getLongitude(), true) osmPoint.getLatitude(), osmPoint.getLongitude(), true)
.replaceAll("\n", " "), 0, false, null, false, 0, false, null); .replaceAll("\n", " "), 0, false, null, false, 0, false, null, false);
} }
} }

View file

@ -1,6 +1,7 @@
package net.osmand.plus.parkingpoint; package net.osmand.plus.parkingpoint;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
@ -8,12 +9,13 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController; import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.util.Algorithms;
public class ParkingPositionMenuController extends MenuController { public class ParkingPositionMenuController extends MenuController {
private ParkingPositionPlugin plugin; private ParkingPositionPlugin plugin;
private String parkingDescription = ""; private String parkingStartDescription = "";
private String parkingLeftDescription = "";
private String parkingTitle = "";
public ParkingPositionMenuController(MapActivity mapActivity, PointDescription pointDescription) { public ParkingPositionMenuController(MapActivity mapActivity, PointDescription pointDescription) {
super(new MenuBuilder(mapActivity), pointDescription, mapActivity); super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
@ -34,13 +36,9 @@ public class ParkingPositionMenuController extends MenuController {
} }
private void buildParkingDescription(MapActivity mapActivity) { private void buildParkingDescription(MapActivity mapActivity) {
StringBuilder sb = new StringBuilder(); parkingStartDescription = plugin.getParkingStartDesc(mapActivity);
sb.append(plugin.getParkingStartDesc(mapActivity)); parkingLeftDescription = plugin.getParkingLeftDesc(mapActivity);
String leftDesc = plugin.getParkingLeftDesc(mapActivity); parkingTitle = plugin.getParkingTitle(mapActivity);
if (!Algorithms.isEmpty(leftDesc)) {
sb.append("\n").append(leftDesc);
}
parkingDescription = sb.toString();
} }
@Override @Override
@ -62,7 +60,27 @@ public class ParkingPositionMenuController extends MenuController {
@Override @Override
public boolean needTypeStr() { public boolean needTypeStr() {
return !Algorithms.isEmpty(parkingDescription); return true;
}
@Override
public String getAdditionalTypeStr() {
return parkingLeftDescription;
}
@Override
public boolean displayAdditionalTypeStrInHours() {
return true;
}
@Override
public int getTimeStrColor() {
return plugin.getParkingType() ? R.color.ctx_menu_amenity_closed_text_color : isLight() ? R.color.icon_color : R.color.dash_search_icon_dark;
}
@Override
public String getNameStr() {
return parkingTitle;
} }
@Override @Override
@ -77,7 +95,7 @@ public class ParkingPositionMenuController extends MenuController {
@Override @Override
public String getTypeStr() { public String getTypeStr() {
return parkingDescription; return parkingStartDescription;
} }
@Override @Override

Some files were not shown because too many files have changed in this diff Show more