-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added some styling methods #222
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -648,6 +648,61 @@ public void setBackButtonColor(@ColorInt int newButtonColor) { | |
setBackButtonColor(ColorStateList.valueOf(newButtonColor)); | ||
} | ||
|
||
/** | ||
* Changes the color for an active step, applied to dotted or progress bars | ||
* | ||
* @param newActiveStepColor the active step color integer | ||
*/ | ||
public void setActiveStepColor(@ColorInt int newActiveStepColor) { | ||
mSelectedColor = newActiveStepColor; | ||
mDottedProgressBar.setSelectedColor(newActiveStepColor); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be moved to I would also remove
from the JavaDoc and implement it for the tabbed stepper instead as the corresponding XML attribute does change the color of the tabs (so that we don't have inconsistencies between XML attribute and Java method). As described above the logic for that should probably be in
+ what is done in |
||
mProgressBar.setProgressColor(newActiveStepColor); | ||
} | ||
|
||
/** | ||
* Changes the color for an inactive step, applied to dotted or progress bars | ||
* | ||
* @param newInactiveStepColor the inactive step color integer | ||
*/ | ||
public void setInactiveStepColor(@ColorInt int newInactiveStepColor) { | ||
mUnselectedColor = newInactiveStepColor; | ||
mDottedProgressBar.setUnselectedColor(newInactiveStepColor); | ||
mProgressBar.setProgressBackgroundColor(newInactiveStepColor); | ||
} | ||
|
||
/** | ||
* Changes the bottom navigation background using a drawable resource | ||
* | ||
* @param newBottomNavigationBackground the drawable resource id | ||
*/ | ||
public void setBottomNavigationBackground(@DrawableRes int newBottomNavigationBackground){ | ||
mBottomNavigationBackground = newBottomNavigationBackground; | ||
mStepNavigation.setBackgroundResource(mBottomNavigationBackground); | ||
} | ||
|
||
/** | ||
* Changes the bottom navigation background using a drawable | ||
* | ||
* @param newBottomNavigationBackground the drawable | ||
*/ | ||
public void setBottomNavigationBackground(@NonNull Drawable newBottomNavigationBackground){ | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use |
||
mStepNavigation.setBackground(newBottomNavigationBackground); | ||
}else { | ||
mStepNavigation.setBackgroundDrawable(newBottomNavigationBackground); | ||
} | ||
} | ||
|
||
/** | ||
* Changes the bottom navigation background color | ||
* | ||
* @param newBottomNavigationBackground the color integer | ||
*/ | ||
public void setBottomNavigationBackgroundColor(@ColorInt int newBottomNavigationBackground){ | ||
mStepNavigation.setBackgroundColor(newBottomNavigationBackground); | ||
} | ||
|
||
|
||
/** | ||
* Updates the error state in the UI. | ||
* It does nothing if showing error state is disabled. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* @author Piotr Zawadzki | ||
*/ | ||
@LargeTest | ||
public class SetButtonColorProgrammaticallyActivityTest extends AbstractActivityTest<SetButtonColorProgrammaticallyActivity> { | ||
public class SetButtonColorProgrammaticallyActivityTest extends AbstractActivityTest<StyledProgrammaticallyActivity> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename the test class name to |
||
|
||
@Test | ||
public void shouldStayOnTheFirstStepWhenVerificationFails() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,23 @@ import butterknife.BindColor | |
/** | ||
* @author Piotr Zawadzki | ||
*/ | ||
class SetButtonColorProgrammaticallyActivity : AbstractStepperActivity() { | ||
class StyledProgrammaticallyActivity : AbstractStepperActivity() { | ||
|
||
@BindColor(R.color.ms_custom_button_text_color) | ||
lateinit var customButtonColor: ColorStateList | ||
|
||
@BindColor(R.color.custom_active_step_color) | ||
@JvmField | ||
var customActiveStepColor: Int = 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use the same code style as above using |
||
|
||
@BindColor(R.color.custom_inactive_step_color) | ||
@JvmField | ||
var customInactiveStepColor: Int = 0 | ||
|
||
@BindColor(R.color.custom_bottom_navigation_background_color) | ||
@JvmField | ||
var customBottomNativationBackgroundColor: Int = 0 | ||
|
||
@ColorInt | ||
@JvmField | ||
@BindColor(R.color.ms_black) | ||
|
@@ -24,9 +36,14 @@ class SetButtonColorProgrammaticallyActivity : AbstractStepperActivity() { | |
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
stepperLayout.setNextButtonColor(customButtonColor) | ||
stepperLayout.setBackButtonColor(customButtonColor) | ||
stepperLayout.setCompleteButtonColor(customButtonColor) | ||
with(stepperLayout) { | ||
setNextButtonColor(customButtonColor) | ||
setBackButtonColor(customButtonColor) | ||
setCompleteButtonColor(customButtonColor) | ||
setActiveStepColor(customActiveStepColor) | ||
setInactiveStepColor(customInactiveStepColor) | ||
setBottomNavigationBackgroundColor(customBottomNativationBackgroundColor) | ||
} | ||
} | ||
|
||
override fun onStepSelected(newStepPosition: Int) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, modify
gradleAndroidVersion
variable above.