Add the ability to specify custom color for back button on the TopToolbar
This commit is contained in:
parent
2355bda633
commit
c8a24d4f8e
1 changed files with 20 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.views.mapwidgets;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
@ -233,6 +234,10 @@ public class MapInfoWidgetsFactory {
|
|||
int backBtnIconClrLightId = R.color.icon_color;
|
||||
@ColorRes
|
||||
int backBtnIconClrDarkId = 0;
|
||||
@ColorInt
|
||||
int backBtnIconClrLight = -1;
|
||||
@ColorInt
|
||||
int backBtnIconClrDark = -1;
|
||||
|
||||
@DrawableRes
|
||||
int closeBtnIconLightId = R.drawable.ic_action_remove_dark;
|
||||
|
@ -332,6 +337,11 @@ public class MapInfoWidgetsFactory {
|
|||
this.backBtnIconClrDarkId = backBtnIconClrDarkId;
|
||||
}
|
||||
|
||||
public void setBackBtnIconClrs(int backBtnIconClrLight, int backBtnIconClrDark) {
|
||||
this.backBtnIconClrLight = backBtnIconClrLight;
|
||||
this.backBtnIconClrDark = backBtnIconClrDark;
|
||||
}
|
||||
|
||||
public void setCloseBtnIconIds(int closeBtnIconLightId, int closeBtnIconDarkId) {
|
||||
this.closeBtnIconLightId = closeBtnIconLightId;
|
||||
this.closeBtnIconDarkId = closeBtnIconDarkId;
|
||||
|
@ -621,9 +631,13 @@ public class MapInfoWidgetsFactory {
|
|||
topBarLayout.setBackgroundResource(AndroidUiHelper.isOrientationPortrait(map) ? controller.bgDarkId : controller.bgDarkLandId);
|
||||
if (controller.backBtnIconDarkId == 0) {
|
||||
backButton.setImageDrawable(null);
|
||||
} else {
|
||||
if (controller.backBtnIconClrDark != -1) {
|
||||
backButton.setImageDrawable(app.getUIUtilities().getPaintedIcon(controller.backBtnIconDarkId, controller.backBtnIconClrDark));
|
||||
} else {
|
||||
backButton.setImageDrawable(app.getUIUtilities().getIcon(controller.backBtnIconDarkId, controller.backBtnIconClrDarkId));
|
||||
}
|
||||
}
|
||||
if (controller.closeBtnIconDarkId == 0) {
|
||||
closeButton.setImageDrawable(null);
|
||||
} else {
|
||||
|
@ -643,9 +657,13 @@ public class MapInfoWidgetsFactory {
|
|||
topBarLayout.setBackgroundResource(AndroidUiHelper.isOrientationPortrait(map) ? controller.bgLightId : controller.bgLightLandId);
|
||||
if (controller.backBtnIconLightId == 0) {
|
||||
backButton.setImageDrawable(null);
|
||||
} else {
|
||||
if (controller.backBtnIconClrLight != -1) {
|
||||
backButton.setImageDrawable(app.getUIUtilities().getPaintedIcon(controller.backBtnIconLightId, controller.backBtnIconClrLight));
|
||||
} else {
|
||||
backButton.setImageDrawable(app.getUIUtilities().getIcon(controller.backBtnIconLightId, controller.backBtnIconClrLightId));
|
||||
}
|
||||
}
|
||||
if (controller.closeBtnIconLightId == 0) {
|
||||
closeButton.setImageDrawable(null);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue