Merge branch 'r3.3'
This commit is contained in:
commit
c9524d7dbf
7 changed files with 79 additions and 71 deletions
|
@ -412,9 +412,9 @@ dependencies {
|
|||
// turn off for now
|
||||
//implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2'
|
||||
// JS core
|
||||
implementation group: 'org.mozilla', name: 'rhino', version: '1.7.9'
|
||||
|
||||
// size restrictions
|
||||
// implementation 'com.ibm.icu:icu4j:50.1'
|
||||
// implementation 'net.sf.trove4j:trove4j:3.0.3'
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?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"
|
||||
android:layout_gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
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:layout_gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_controls_container"
|
||||
|
@ -185,17 +186,19 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/map_horizontal_progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_height="4dp"
|
||||
android:max="100"
|
||||
android:visibility="gone"
|
||||
tools:progress="60"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
||||
android:id="@+id/map_horizontal_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:max="100"
|
||||
android:visibility="gone"
|
||||
osmand:mpb_progressStyle="horizontal"
|
||||
osmand:mpb_useIntrinsicPadding="false"
|
||||
osmand:mpb_setBothDrawables="true"
|
||||
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
|
||||
tools:progress="60"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?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"
|
||||
android:layout_gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
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:layout_gravity="bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!--<net.osmand.plus.quickaction.QuickActionsWidget
|
||||
android:id="@+id/quick_action_widget"
|
||||
|
@ -224,16 +225,20 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
||||
android:id="@+id/map_horizontal_progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:max="100"
|
||||
android:visibility="gone"
|
||||
osmand:mpb_progressStyle="horizontal"
|
||||
osmand:mpb_useIntrinsicPadding="false"
|
||||
osmand:mpb_setBothDrawables="true"
|
||||
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
|
||||
tools:progress="60"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
|
|
|
@ -501,16 +501,17 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:max="100"
|
||||
android:visibility="gone"
|
||||
tools:progress="60"
|
||||
tools:visibility="visible" />
|
||||
osmand:mpb_progressStyle="horizontal"
|
||||
osmand:mpb_useIntrinsicPadding="false"
|
||||
osmand:mpb_setBothDrawables="true"
|
||||
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
|
|
@ -540,6 +540,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
: ContextCompat.getColor(this, R.color.wikivoyage_active_light);
|
||||
|
||||
pb.setProgressDrawable(AndroidUtils.createProgressDrawable(bgColor, progressColor));
|
||||
pb.setIndeterminate(getRoutingHelper().getAppMode() == ApplicationMode.PUBLIC_TRANSPORT);
|
||||
pb.getIndeterminateDrawable().setColorFilter(progressColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
||||
public ImportHelper getImportHelper() {
|
||||
|
|
|
@ -383,7 +383,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
if (fragmentRef != null && fragment.isVisible()) {
|
||||
setRouteCalculationInProgress(true);
|
||||
fragment.updateRouteCalculationProgress(0);
|
||||
fragment.updateControlButtons();
|
||||
fragment.updateInfo();
|
||||
}
|
||||
}
|
||||
|
@ -396,7 +395,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
fragment.updateInfo();
|
||||
}
|
||||
fragment.updateRouteCalculationProgress(progress);
|
||||
fragment.updateControlButtons();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,7 +405,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
if (app != null && fragmentRef != null && fragment.isVisible()) {
|
||||
boolean routeCalculating = app.getRoutingHelper().isRouteBeingCalculated() || app.getTransportRoutingHelper().isRouteBeingCalculated();
|
||||
if (setRouteCalculationInProgress(routeCalculating)) {
|
||||
fragment.updateControlButtons();
|
||||
fragment.updateInfo();
|
||||
if (!routeCalculationInProgress) {
|
||||
fragment.hideRouteCalculationProgressBar();
|
||||
|
@ -870,17 +867,33 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
View startButton = mainView.findViewById(R.id.start_button);
|
||||
TextViewExProgress startButtonText = (TextViewExProgress) mainView.findViewById(R.id.start_button_descr);
|
||||
boolean publicTransportMode = helper.getAppMode() == ApplicationMode.PUBLIC_TRANSPORT;
|
||||
boolean routeCalculated = isRouteCalculated();
|
||||
int iconId = publicTransportMode ? R.drawable.ic_map : R.drawable.ic_action_start_navigation;
|
||||
int color;
|
||||
if (isRouteCalculated()) {
|
||||
AndroidUtils.setBackground(app, startButton, nightMode, R.color.active_buttons_and_links_light, R.color.active_buttons_and_links_dark);
|
||||
color = nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light;
|
||||
int color1;
|
||||
int color2;
|
||||
if (publicTransportMode) {
|
||||
if (routeCalculated) {
|
||||
color1 = nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light;
|
||||
AndroidUtils.setBackground(app, startButton, nightMode, R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
|
||||
color2 = color1;
|
||||
} else {
|
||||
color1 = R.color.description_font_and_bottom_sheet_icons;
|
||||
AndroidUtils.setBackground(app, startButton, nightMode, R.color.activity_background_light, R.color.activity_background_dark);
|
||||
color2 = color1;
|
||||
}
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, startButton, nightMode, R.color.activity_background_light, R.color.activity_background_dark);
|
||||
color = R.color.description_font_and_bottom_sheet_icons;
|
||||
color1 = nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light;
|
||||
if (routeCalculated) {
|
||||
AndroidUtils.setBackground(app, startButton, nightMode, R.color.active_buttons_and_links_light, R.color.active_buttons_and_links_dark);
|
||||
color2 = nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light;
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, startButton, nightMode, R.color.activity_background_light, R.color.activity_background_dark);
|
||||
color2 = R.color.description_font_and_bottom_sheet_icons;
|
||||
}
|
||||
}
|
||||
startButtonText.color2 = ContextCompat.getColor(app, color);
|
||||
startButtonText.setCompoundDrawablesWithIntrinsicBounds(app.getUIUtilities().getIcon(iconId, color), null, null, null);
|
||||
startButtonText.color1 = ContextCompat.getColor(mapActivity, color1);
|
||||
startButtonText.color2 = ContextCompat.getColor(mapActivity, color2);
|
||||
startButtonText.setCompoundDrawablesWithIntrinsicBounds(app.getUIUtilities().getIcon(iconId, color2), null, null, null);
|
||||
if (publicTransportMode) {
|
||||
startButtonText.setText(R.string.shared_string_show_on_map);
|
||||
} else if (helper.isFollowingMode() || helper.isPauseNavigation()) {
|
||||
|
|
|
@ -152,7 +152,6 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
|||
dismiss();
|
||||
return;
|
||||
}
|
||||
updateControlButtons();
|
||||
updateInfo();
|
||||
View mainView = getMainView();
|
||||
if (mainView != null) {
|
||||
|
@ -355,6 +354,11 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isPublicTransportMode() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
return app != null && app.getRoutingHelper().getAppMode() == ApplicationMode.PUBLIC_TRANSPORT;
|
||||
}
|
||||
|
||||
public void updateRouteCalculationProgress(int progress) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
View mainView = getMainView();
|
||||
|
@ -362,9 +366,12 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
|||
if (mapActivity == null || mainView == null || view == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean publicTransportMode = isPublicTransportMode();
|
||||
ProgressBar progressBar = (ProgressBar) mainView.findViewById(R.id.progress_bar);
|
||||
if (progressBar != null) {
|
||||
if (progress == 0) {
|
||||
progressBar.setIndeterminate(publicTransportMode);
|
||||
}
|
||||
if (progressBar.getVisibility() != View.VISIBLE) {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
@ -372,8 +379,9 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
|||
}
|
||||
ProgressBar progressBarButton = (ProgressBar) view.findViewById(R.id.progress_bar_button);
|
||||
if (progressBarButton != null) {
|
||||
if (progressBarButton.getVisibility() != View.VISIBLE) {
|
||||
progressBarButton.setVisibility(View.VISIBLE);
|
||||
int visibility = publicTransportMode ? View.GONE : View.VISIBLE;
|
||||
if (progressBarButton.getVisibility() != visibility) {
|
||||
progressBarButton.setVisibility(visibility);
|
||||
}
|
||||
progressBarButton.setProgress(progress);
|
||||
}
|
||||
|
@ -398,31 +406,8 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
|||
if (progressBarButton != null) {
|
||||
progressBarButton.setVisibility(View.GONE);
|
||||
}
|
||||
int color = isNightMode() ? R.color.main_font_dark : R.color.card_and_list_background_light;
|
||||
((TextView) view.findViewById(R.id.start_button_descr)).setTextColor(ContextCompat.getColor(mapActivity, color));
|
||||
}
|
||||
|
||||
public void updateControlButtons() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
View view = getView();
|
||||
if (app != null && mapActivity != null && view != null) {
|
||||
TextViewExProgress textViewExProgress = (TextViewExProgress) view.findViewById(R.id.start_button_descr);
|
||||
textViewExProgress.color1 = ContextCompat.getColor(mapActivity, isNightMode() ? R.color.main_font_dark : R.color.card_and_list_background_light);
|
||||
textViewExProgress.color2 = ContextCompat.getColor(mapActivity, R.color.description_font_and_bottom_sheet_icons);
|
||||
|
||||
boolean publicTransportMode = app.getRoutingHelper().getAppMode() == ApplicationMode.PUBLIC_TRANSPORT;
|
||||
if (menu != null && menu.isRouteCalculated()) {
|
||||
if (publicTransportMode) {
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.start_button), isNightMode(), R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
|
||||
textViewExProgress.color1 = ContextCompat.getColor(mapActivity, isNightMode() ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.start_button), isNightMode(), R.color.active_buttons_and_links_light, R.color.active_buttons_and_links_dark);
|
||||
textViewExProgress.color1 = ContextCompat.getColor(mapActivity, isNightMode() ? R.color.main_font_dark : R.color.card_and_list_background_light);
|
||||
}
|
||||
textViewExProgress.percent = 1;
|
||||
}
|
||||
}
|
||||
TextViewExProgress textViewExProgress = (TextViewExProgress) view.findViewById(R.id.start_button_descr);
|
||||
textViewExProgress.percent = 1;
|
||||
}
|
||||
|
||||
public void show(MapActivity mapActivity) {
|
||||
|
@ -495,8 +480,6 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
|||
|
||||
ctx.setupRouteCalculationProgressBar((ProgressBar) mainView.findViewById(R.id.progress_bar));
|
||||
setupRouteCalculationButtonProgressBar((ProgressBar) view.findViewById(R.id.progress_bar_button));
|
||||
|
||||
updateControlButtons();
|
||||
}
|
||||
|
||||
public static boolean showInstance(final MapActivity mapActivity, int initialMenuState) {
|
||||
|
@ -540,6 +523,7 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
|||
int bgColor = ContextCompat.getColor(mapActivity, isNightMode() ? R.color.activity_background_dark : R.color.activity_background_light);
|
||||
int progressColor = ContextCompat.getColor(mapActivity, isNightMode() ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
pb.setProgressDrawable(AndroidUtils.createProgressDrawable(bgColor, progressColor));
|
||||
pb.getIndeterminateDrawable().setColorFilter(progressColor, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue