diff --git a/build.gradle b/build.gradle index b592cbc..656a0d7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ ext { minSdkVersion = 17 targetSdkVersion = 28 - versionCode = 13 - versionName = "0.2.8" + versionCode = 14 + versionName = "0.2.9" } buildscript { diff --git a/demo/src/main/java/moe/feng/common/view/breadcrumbs/MainActivity.java b/demo/src/main/java/moe/feng/common/view/breadcrumbs/MainActivity.java index 1ca1458..524e627 100644 --- a/demo/src/main/java/moe/feng/common/view/breadcrumbs/MainActivity.java +++ b/demo/src/main/java/moe/feng/common/view/breadcrumbs/MainActivity.java @@ -42,6 +42,7 @@ protected void onCreate(Bundle savedInstanceState) { mBreadcrumbsView.setItems(new ArrayList<>(Arrays.asList( BreadcrumbItem.createSimpleItem("Root Path") ))); + mBreadcrumbsView.setCallback(new DefaultBreadcrumbsCallback() { @Override public void onNavigateBack(BreadcrumbItem item, int position) { diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml index 12035c1..382606f 100644 --- a/demo/src/main/res/layout/activity_main.xml +++ b/demo/src/main/res/layout/activity_main.xml @@ -23,12 +23,11 @@ + android:layout_height="56dp" + android:background="@color/colorPrimary" + app:CustomTextSize="12sp" + app:SelectedTextColor="@color/colorSelected" + app:UnSelectedTextColor="@color/colorUnSelected" /> diff --git a/library/src/main/java/moe/feng/common/view/breadcrumbs/BreadcrumbsAdapter.java b/library/src/main/java/moe/feng/common/view/breadcrumbs/BreadcrumbsAdapter.java index 8931af5..3431cc5 100644 --- a/library/src/main/java/moe/feng/common/view/breadcrumbs/BreadcrumbsAdapter.java +++ b/library/src/main/java/moe/feng/common/view/breadcrumbs/BreadcrumbsAdapter.java @@ -126,12 +126,12 @@ public void setItem(@NonNull IBreadcrumbItem item) { button.setText(item.getSelectedItem().toString()); button.setTextColor(ViewUtils.getColorFromAttr(getContext(), getAdapterPosition() == getItemCount() - 1 ? android.R.attr.textColorPrimary : android.R.attr.textColorSecondary)); - if (mTextColorSelected != -1) + if (mTextColorSelected != Integer.MAX_VALUE) button.setTextColor(getAdapterPosition() == getItemCount() - 1 ? mTextColorSelected : mtextColorUnSelected); else button.setTextColor(ViewUtils.getColorFromAttr(getContext(), getAdapterPosition() == getItemCount() - 1 ? android.R.attr.textColorPrimary : android.R.attr.textColorSecondary)); - if (mTextSize != -1) + if (mTextSize != Integer.MAX_VALUE) button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize); } } @@ -145,7 +145,7 @@ class ArrowIconHolder extends ItemHolder { super(itemView); Drawable normalDrawable = getContext().getResources().getDrawable(R.drawable.ic_fiber_manual_record_black_24dp); Drawable wrapDrawable = DrawableCompat.wrap(normalDrawable); - if (mtextColorUnSelected != -1) + if (mtextColorUnSelected != Integer.MAX_VALUE) DrawableCompat.setTint(wrapDrawable, mtextColorUnSelected); else DrawableCompat.setTint(wrapDrawable, ViewUtils.getColorFromAttr(getContext(), android.R.attr.textColorSecondary)); diff --git a/library/src/main/java/moe/feng/common/view/breadcrumbs/BreadcrumbsView.java b/library/src/main/java/moe/feng/common/view/breadcrumbs/BreadcrumbsView.java index b0a3838..af93e81 100644 --- a/library/src/main/java/moe/feng/common/view/breadcrumbs/BreadcrumbsView.java +++ b/library/src/main/java/moe/feng/common/view/breadcrumbs/BreadcrumbsView.java @@ -29,9 +29,9 @@ public class BreadcrumbsView extends FrameLayout { /** * Popup Menu Theme Id */ - private int mTextColorSelected = -1; - private int mTextColorUnSelected = -1; - private int mTextSizeCustom = -1; + private int mTextColorSelected = Integer.MAX_VALUE; + private int mTextColorUnSelected = Integer.MAX_VALUE; + private int mTextSizeCustom = Integer.MAX_VALUE; private boolean isRtl = false; private static final String KEY_SUPER_STATES = BuildConfig.APPLICATION_ID + ".superStates"; @@ -55,10 +55,10 @@ public BreadcrumbsView(Context context, AttributeSet attrs, int defStyleAttr) { private void getCustomAttrs(Context context, AttributeSet attrs, int defStyle) { if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BreadcrumbsView, 0, 0); - mTextColorSelected = a.getColor(R.styleable.BreadcrumbsView_textColorSelected, -1); - mTextColorUnSelected = a.getColor(R.styleable.BreadcrumbsView_textColorUnSelected, -1); - mTextSizeCustom = a.getDimensionPixelSize(R.styleable.BreadcrumbsView_textSizeCustom, -1); - isRtl = a.getBoolean(R.styleable.BreadcrumbsView_isRtl, false); + mTextColorSelected = a.getColor(R.styleable.BreadcrumbsView_SelectedTextColor, Integer.MAX_VALUE); + mTextColorUnSelected = a.getColor(R.styleable.BreadcrumbsView_UnSelectedTextColor, Integer.MAX_VALUE); + mTextSizeCustom = a.getDimensionPixelSize(R.styleable.BreadcrumbsView_CustomTextSize, Integer.MAX_VALUE); + isRtl = a.getBoolean(R.styleable.BreadcrumbsView_IsRtl, false); a.recycle(); } else { Toast.makeText(context, "NO ATTRS :|", Toast.LENGTH_SHORT).show(); diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml index 770b03f..05cf0ba 100644 --- a/library/src/main/res/values/attrs.xml +++ b/library/src/main/res/values/attrs.xml @@ -2,10 +2,10 @@ - - - - + + + + \ No newline at end of file