Skip to content

Commit

Permalink
Fix CASCADE Constructor call in base view
Browse files Browse the repository at this point in the history
  • Loading branch information
Reza Amuzadeh committed Mar 11, 2019
1 parent 1563742 commit 3b9e823
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 35 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ext {
minSdkVersion = 17
targetSdkVersion = 28
versionCode = 11
versionName = "0.2.6"
versionCode = 12
versionName = "0.2.7"
}

buildscript {
Expand Down
10 changes: 5 additions & 5 deletions demo/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>

<color name="colorSelected">#FFC901</color>
<color name="colorUnSelected">#777475</color>
<color name="colorSelected">#2CE218</color>
<color name="colorUnSelected">#EC0A56</color>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class BreadcrumbsView extends FrameLayout {
/**
* Popup Menu Theme Id
*/
private int mPopupThemeId = -1;
private int mTextColorSelected = -1;
private int mTextColorUnSelected = -1;
private int mTextSizeCustom = -1;
Expand All @@ -37,20 +36,24 @@ public class BreadcrumbsView extends FrameLayout {
private static final String KEY_SUPER_STATES = BuildConfig.APPLICATION_ID + ".superStates";
private static final String KEY_BREADCRUMBS = BuildConfig.APPLICATION_ID + ".breadcrumbs";

public BreadcrumbsView(Context context) {
this(context, null);
public BreadcrumbsView(@NonNull Context context) {
super(context);
getCustomAttrs(context, null, 0);
}

public BreadcrumbsView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
super(context, attrs);
getCustomAttrs(context, attrs, 0);
}

public BreadcrumbsView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
getCustomAttrs(context, attrs, defStyleAttr);
}

private void getCustomAttrs(Context context, AttributeSet attrs, int defStyle) {
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BreadcrumbsView, defStyleAttr, 0);
mPopupThemeId = a.getResourceId(R.styleable.BreadcrumbsView_popupTheme, -1);
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);
Expand Down Expand Up @@ -82,9 +85,6 @@ private void init() {
// Init Adapter
if (mAdapter == null) {
mAdapter = new BreadcrumbsAdapter(this, mTextColorSelected, mTextColorUnSelected, mTextSizeCustom);
if (mPopupThemeId != -1) {
mAdapter.setPopupThemeId(mPopupThemeId);
}
}
mRecyclerView.setAdapter(mAdapter);
}
Expand Down
15 changes: 1 addition & 14 deletions library/src/main/res/layout/breadcrumbs_view_dropdown_item.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2006 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
9 changes: 4 additions & 5 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
<resources>

<declare-styleable name="BreadcrumbsView">
<attr name="popupTheme" />
<attr name="textColorSelected" format="reference|integer" />
<attr name="textColorUnSelected" format="reference|integer" />
<attr name="textSizeCustom" format="dimension" />
<attr name="isRtl" format="boolean" />
<attr name="textColorSelected" format="reference|color" />
<attr name="textColorUnSelected" format="reference|color" />
<attr name="textSizeCustom" format="dimension" />
<attr name="isRtl" format="boolean" />
</declare-styleable>

</resources>

0 comments on commit 3b9e823

Please sign in to comment.