dockbar colors fix
This commit is contained in:
+16
-9
@@ -2,6 +2,7 @@ package com.vtosters.lite.ui.bottomnavigation;
|
|||||||
|
|
||||||
import static ru.vtosters.lite.utils.Themes.getCSTDock;
|
import static ru.vtosters.lite.utils.Themes.getCSTDock;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
@@ -43,14 +44,12 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
private MenuItemImpl mItemData;
|
private MenuItemImpl mItemData;
|
||||||
private ColorStateList mColorStateList;
|
private ColorStateList mColorStateList;
|
||||||
private final int mMargin;
|
private final int mMargin;
|
||||||
private final int mDiff;
|
|
||||||
private final float mSmallScale;
|
private final float mSmallScale;
|
||||||
private final float mLargeScale;
|
|
||||||
private boolean mShiftingModeEnabled;
|
private boolean mShiftingModeEnabled;
|
||||||
private boolean mIconsModeEnabled;
|
private boolean mIconsModeEnabled;
|
||||||
private boolean mStaticModeEnabled;
|
private boolean mStaticModeEnabled;
|
||||||
private ImageView mIcon;
|
private final ImageView mIcon;
|
||||||
private ImageView mActionIcon;
|
private final ImageView mActionIcon;
|
||||||
|
|
||||||
public BottomNavigationItemView(@NonNull Context context) {
|
public BottomNavigationItemView(@NonNull Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -64,12 +63,9 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
this.mItemPos = -1;
|
this.mItemPos = -1;
|
||||||
|
|
||||||
var textSize = (float) getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_text_size);
|
|
||||||
var activeTextSize = (float) getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_active_text_size);
|
|
||||||
this.mMargin = getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_margin);
|
this.mMargin = getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_margin);
|
||||||
this.mDiff = (int) (textSize - activeTextSize);
|
this.mSmallScale = 10.0f;
|
||||||
this.mSmallScale = activeTextSize / textSize;
|
float mLargeScale = 10.0f;
|
||||||
this.mLargeScale = textSize / activeTextSize;
|
|
||||||
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.design_bottom_navigation_item, this, true);
|
LayoutInflater.from(context).inflate(R.layout.design_bottom_navigation_item, this, true);
|
||||||
this.setBackgroundResource(R.drawable.design_bottom_navigation_item_background);
|
this.setBackgroundResource(R.drawable.design_bottom_navigation_item_background);
|
||||||
@@ -102,6 +98,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
this.mActionIcon.setVisibility(VISIBLE);
|
this.mActionIcon.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public MenuItemImpl getItemData() {
|
public MenuItemImpl getItemData() {
|
||||||
return this.mItemData;
|
return this.mItemData;
|
||||||
}
|
}
|
||||||
@@ -110,6 +107,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
return this.mItemPos;
|
return this.mItemPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void initialize(MenuItemImpl impl, int i) {
|
public void initialize(MenuItemImpl impl, int i) {
|
||||||
this.mItemData = impl;
|
this.mItemData = impl;
|
||||||
this.setCheckable(impl.isCheckable());
|
this.setCheckable(impl.isCheckable());
|
||||||
@@ -121,6 +119,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
this.setContentDescription(impl.getTitle());
|
this.setContentDescription(impl.getTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public int[] onCreateDrawableState(int extraSpace) {
|
public int[] onCreateDrawableState(int extraSpace) {
|
||||||
int[] baseState = super.onCreateDrawableState(extraSpace + 1);
|
int[] baseState = super.onCreateDrawableState(extraSpace + 1);
|
||||||
if (this.mItemData != null && this.mItemData.isCheckable() && this.mItemData.isChecked()) {
|
if (this.mItemData != null && this.mItemData.isCheckable() && this.mItemData.isChecked()) {
|
||||||
@@ -146,14 +145,17 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public boolean prefersCondensedTitle() {
|
public boolean prefersCondensedTitle() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setCheckable(boolean var1) {
|
public void setCheckable(boolean var1) {
|
||||||
this.refreshDrawableState();
|
this.refreshDrawableState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setChecked(boolean checked) {
|
public void setChecked(boolean checked) {
|
||||||
this.mItemData.setChecked(checked);
|
this.mItemData.setChecked(checked);
|
||||||
|
|
||||||
@@ -264,6 +266,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
this.mIcon.setEnabled(b);
|
this.mIcon.setEnabled(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setIcon(Drawable drawable) {
|
public void setIcon(Drawable drawable) {
|
||||||
if (drawable != null) {
|
if (drawable != null) {
|
||||||
if (drawable.getConstantState() != null)
|
if (drawable.getConstantState() != null)
|
||||||
@@ -276,6 +279,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
this.mIcon.setImageDrawable(drawable);
|
this.mIcon.setImageDrawable(drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setIconTintList(ColorStateList colorStateList) {
|
public void setIconTintList(ColorStateList colorStateList) {
|
||||||
this.mColorStateList = colorStateList;
|
this.mColorStateList = colorStateList;
|
||||||
MenuItemImpl impl = this.mItemData;
|
MenuItemImpl impl = this.mItemData;
|
||||||
@@ -305,17 +309,20 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
this.mShiftingModeEnabled = var1;
|
this.mShiftingModeEnabled = var1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setShortcut(boolean b, char c) {
|
public void setShortcut(boolean b, char c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextColor(ColorStateList colorStateList) {
|
public void setTextColor(ColorStateList colorStateList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setTitle(CharSequence title) {
|
public void setTitle(CharSequence title) {
|
||||||
this.mSmallLabel.setText(title);
|
this.mSmallLabel.setText(title);
|
||||||
this.mLargeLabel.setText(title);
|
this.mLargeLabel.setText(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public boolean showsIcon() {
|
public boolean showsIcon() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class DockBarEditorManager {
|
|||||||
return DockBarTab.valuesOf(
|
return DockBarTab.valuesOf(
|
||||||
"tab_feedback",
|
"tab_feedback",
|
||||||
!milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
|
!milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
|
||||||
!milkshake() ? R.string.friends : R.string.notification,
|
!milkshake() ? R.string.friends : R.string.not_notifications,
|
||||||
R.id.tab_feedback,
|
R.id.tab_feedback,
|
||||||
!milkshake() ? FriendsFragment.class : NotificationsContainerFragment.class);
|
!milkshake() ? FriendsFragment.class : NotificationsContainerFragment.class);
|
||||||
case "tab_profile":
|
case "tab_profile":
|
||||||
@@ -166,7 +166,7 @@ public class DockBarEditorManager {
|
|||||||
return DockBarTab.valuesOf(
|
return DockBarTab.valuesOf(
|
||||||
"tab_friends",
|
"tab_friends",
|
||||||
milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
|
milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
|
||||||
milkshake() ? R.string.friends : R.string.notification,
|
milkshake() ? R.string.friends : R.string.not_notifications,
|
||||||
R.id.menu_friends,
|
R.id.menu_friends,
|
||||||
milkshake() ? FriendsCatalogFragment.class : NotificationsContainerFragment.class);
|
milkshake() ? FriendsCatalogFragment.class : NotificationsContainerFragment.class);
|
||||||
case "tab_groups":
|
case "tab_groups":
|
||||||
|
|||||||
@@ -376,8 +376,8 @@ public class Themes{
|
|||||||
new int[]{-android.R.attr.state_checked}
|
new int[]{-android.R.attr.state_checked}
|
||||||
},
|
},
|
||||||
new int[]{
|
new int[]{
|
||||||
dockbar_accent() ? parseColor("#ff528bcc") : (isDarkTheme() ? parseColor("#ffefefef") : parseColor("#ff545454")),
|
dockbar_accent() ? getAccentColor() : (isDarkTheme() ? getResources().getColor(R.color.white) : getResources().getColor(R.color.gray_700)),
|
||||||
dockbar_accent() ? parseColor("#ffaaaeb3") : (isDarkTheme() ? parseColor("#ff8a8d92") : parseColor("#ffaaaeb3"))
|
isDarkTheme() ? getResources().getColor(R.color.gray_500) : getResources().getColor(R.color.vk_steel_gray_300)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user