Skip to content

Commit

Permalink
feat: Added Retry Button Style
Browse files Browse the repository at this point in the history
  • Loading branch information
plsankar committed Jun 14, 2021
1 parent ff65ba1 commit 50f317a
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ onButtonClick {

## Attributes

| Attribute | Usage |
|-------------|----------------------|
| buttonText | Retry Button Text |
| emptyImage | Empty State Icon |
| errorImage | Error State Icon |
| loadingView | Custom Loading View |
| Attribute | Usage |
|------------------|----------------------|
| buttonText | Retry Button Text |
| emptyImage | Empty State Icon |
| errorImage | Error State Icon |
| loadingView | Custom Loading View |
| retryButtonStyle | Retry Button Style |
1 change: 1 addition & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<style name="Theme.StateLayoutDemo.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="retryButtonStyle">@style/Widget.MaterialComponents.Button.OutlinedButton</item>
</style>

<style name="Theme.StateLayoutDemo.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
Expand Down
2 changes: 1 addition & 1 deletion statelayout/src/main/res/layout/view_statelayout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

<Button
android:id="@+id/btn_retry"
style="@style/Widget.MaterialComponents.Button.TextButton"
style="?attr/retryButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/statelayout_default_buttonText" />
Expand Down
1 change: 1 addition & 0 deletions statelayout/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<resources>
<declare-styleable name="StateLayout">
<attr name="retryButtonStyle" format="reference" />
<attr name="buttonText" format="reference" />
<attr name="errorImage" format="reference" />
<attr name="emptyImage" format="reference" />
Expand Down
27 changes: 27 additions & 0 deletions statelayout/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ MIT License
~
~ Copyright (c) 2021 CtrlBytes Technologies
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all
~ copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
~ SOFTWARE.
-->

<resources>

</resources>

0 comments on commit 50f317a

Please sign in to comment.