Skip to content

Commit

Permalink
View attribute names are updated
Browse files Browse the repository at this point in the history
  • Loading branch information
eo committed Mar 2, 2019
1 parent fc675e5 commit e76dd18
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Library contains both `SignalStrengthView` and `SignalStrengthDrawable` classes.
<eo.view.signalstrength.SignalStrengthView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:signalColor="?colorAccent"
app:signalLevel="50"
app:signalTheme="rounded" />
app:signalStrengthColor="?colorAccent"
app:signalStrengthLevel="50"
app:signalStrengthTheme="rounded" />
```

Style
Expand Down
6 changes: 3 additions & 3 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
app:layout_constraintEnd_toEndOf="@id/endGuideline"
app:layout_constraintStart_toStartOf="@id/startGuideline"
app:layout_constraintTop_toTopOf="@id/topGuideline"
app:signalColor="?colorAccent"
app:signalLevel="50"
app:signalTheme="rounded" />
app:signalStrengthColor="?colorAccent"
app:signalStrengthLevel="50"
app:signalStrengthTheme="rounded" />

<TextView
android:id="@+id/themeTitle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ class SignalStrengthView @JvmOverloads constructor(
)

val themes = SignalStrength.Theme.values()
val themeIndex = typedArray.getInt(R.styleable.SignalStrengthView_signalTheme, 0)
val themeIndex = typedArray.getInt(R.styleable.SignalStrengthView_signalStrengthTheme, 0)
.coerceIn(0, themes.lastIndex)

signalStrengthDrawable = SignalStrengthDrawable(context, themes[themeIndex])

signalLevel = typedArray.getInt(R.styleable.SignalStrengthView_signalLevel, signalLevel)
color = typedArray.getColor(R.styleable.SignalStrengthView_signalColor, color)
signalLevel =
typedArray.getInt(R.styleable.SignalStrengthView_signalStrengthLevel, signalLevel)
color = typedArray.getColor(R.styleable.SignalStrengthView_signalStrengthColor, color)

typedArray.recycle()

Expand Down
6 changes: 3 additions & 3 deletions signalstrength/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<attr name="signalStrengthStyle" type="reference" />

<declare-styleable name="SignalStrengthView">
<attr name="signalTheme" format="enum">
<attr name="signalStrengthColor" format="color" />
<attr name="signalStrengthTheme" format="enum">
<enum name="rounded" value="0" />
<enum name="sharp" value="1" />
</attr>

<attr name="signalLevel" format="integer" />
<attr name="signalColor" format="color" />
<attr name="signalStrengthLevel" format="integer" />
</declare-styleable>

</resources>
4 changes: 2 additions & 2 deletions signalstrength/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<resources>

<style name="Widget.SignalStrength" parent="android:Widget">
<item name="signalTheme">rounded</item>
<item name="signalColor">?android:colorForeground</item>
<item name="signalStrengthTheme">rounded</item>
<item name="signalStrengthColor">?android:colorForeground</item>
</style>

</resources>

0 comments on commit e76dd18

Please sign in to comment.