Fix route calculation progress bar color
This commit is contained in:
parent
f2864c0f13
commit
67a2d9b1eb
3 changed files with 19 additions and 15 deletions
|
@ -434,11 +434,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
boolean night = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
setupRouteCalculationProgressBar(pb);
|
||||||
int bgColor = ContextCompat.getColor(app, night
|
|
||||||
? R.color.map_progress_bar_bg_dark : R.color.map_progress_bar_bg_light);
|
|
||||||
pb.setProgressDrawable(AndroidUtils
|
|
||||||
.createProgressDrawable(bgColor, mapLayers.getRouteLayer().getRouteLineColor(night)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -499,6 +495,22 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setupRouteCalculationProgressBar(@NonNull ProgressBar pb) {
|
||||||
|
DayNightHelper dayNightHelper = getMyApplication().getDaynightHelper();
|
||||||
|
|
||||||
|
boolean nightMode = dayNightHelper.isNightModeForMapControls();
|
||||||
|
boolean useRouteLineColor = nightMode == dayNightHelper.isNightMode();
|
||||||
|
|
||||||
|
int bgColorId = nightMode ? R.color.map_progress_bar_bg_dark : R.color.map_progress_bar_bg_light;
|
||||||
|
int bgColor = ContextCompat.getColor(this, bgColorId);
|
||||||
|
|
||||||
|
int progressColor = useRouteLineColor
|
||||||
|
? mapLayers.getRouteLayer().getRouteLineColor(nightMode)
|
||||||
|
: ContextCompat.getColor(this, R.color.wikivoyage_active_light);
|
||||||
|
|
||||||
|
pb.setProgressDrawable(AndroidUtils.createProgressDrawable(bgColor, progressColor));
|
||||||
|
}
|
||||||
|
|
||||||
private void changeKeyguardFlags() {
|
private void changeKeyguardFlags() {
|
||||||
if (settings.WAKE_ON_VOICE_INT.get() > 0) {
|
if (settings.WAKE_ON_VOICE_INT.get() > 0) {
|
||||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,
|
||||||
|
|
|
@ -840,11 +840,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
AndroidUtils.setTextSecondaryColor(mapActivity, listEmptyTextView, nightMode);
|
AndroidUtils.setTextSecondaryColor(mapActivity, listEmptyTextView, nightMode);
|
||||||
|
|
||||||
if (planRouteProgressBar != null) {
|
if (planRouteProgressBar != null) {
|
||||||
int bgColor = ContextCompat.getColor(mapActivity, nightMode
|
mapActivity.setupRouteCalculationProgressBar(planRouteProgressBar);
|
||||||
? R.color.map_progress_bar_bg_dark : R.color.map_progress_bar_bg_light);
|
|
||||||
planRouteProgressBar.setProgressDrawable(AndroidUtils.createProgressDrawable(
|
|
||||||
bgColor, mapActivity.getMapLayers().getRouteLayer().getRouteLineColor(nightMode)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
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.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -193,10 +192,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationText), nightMode);
|
AndroidUtils.setTextPrimaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationText), nightMode);
|
||||||
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationTitle), nightMode);
|
AndroidUtils.setTextSecondaryColor(ctx, (TextView) mainView.findViewById(R.id.DurationTitle), nightMode);
|
||||||
|
|
||||||
int bgColor = ContextCompat.getColor(ctx, nightMode
|
ctx.setupRouteCalculationProgressBar((ProgressBar) mainView.findViewById(R.id.progress_bar));
|
||||||
? R.color.map_progress_bar_bg_dark : R.color.map_progress_bar_bg_light);
|
|
||||||
((ProgressBar) mainView.findViewById(R.id.progress_bar)).setProgressDrawable(AndroidUtils
|
|
||||||
.createProgressDrawable(bgColor, ctx.getMapLayers().getRouteLayer().getRouteLineColor(nightMode)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showInstance(final MapActivity mapActivity) {
|
public static boolean showInstance(final MapActivity mapActivity) {
|
||||||
|
|
Loading…
Reference in a new issue