build.gradle
dependencies {
...
implementation 'com.radiance.winddirections:winddirections:1.0.0'
}
To display a WindDirections in an activity, add a petal to the activity's layout XML file:
<com.radiance.winddirections.WindDirections
android:id="@+id/wd_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:directionsCount="eight"
app:grid_text_size="18dp"
app:grid_text_color="#000000"
app:grid_line_size="1dp"
app:grid_line_color="#000000"
app:petal_color="@color/colorAccent"
app:petal_border_color="#000000"
app:petal_border_size="2dp"
app:petal_margin="2dp"
app:petal_top_style="sector"
app:petal_bottom_style="sector"
app:petal_bottom_radius="4dp" />
To set wind power:
// 1. Create WindPower object. WindPower contains wind power depending on the direction.
val windPower = WindDirections.WindPower().apply {N = 400
S = 300
E = 200
W = 500}
// 2. Find windDirection view
val windDirections = findViewById<WindDirections>(R.id.wd_id)
// 3. Set windPower property
windDirections.windPower = windPower
Value |
Sample |
XML property |
Kotlin property |
margin |
|
app:petal_margin="2dp" |
wdView.petalMargin = 4.0 |
Value |
Sample |
XML property |
Kotlin property |
radius |
|
app:petal_bottom_radius="4dp" |
wdView.bottomRadius = 4.0 |
Value |
Sample |
XML property |
Kotlin property |
color |
|
app:petal_color="@color/colorAccent" |
wdView.petalColor = color |
border size |
|
app:petal_border_size="2dp" |
wdView.petalBorder = 3.0 |
border color |
|
app:petal_border_color="#000000" |
wdView.petalBorderColor = color |
Value |
Sample |
XML property |
Kotlin property |
sector |
|
app:petal_top_style="sector" |
wdView.topStyle = Petal.TopStyle.Sector |
flat |
|
app:petal_top_style="flat" |
wdView.topStyle = Petal.TopStyle.Flat |
Value |
Sample |
XML property |
Kotlin property |
sector |
|
app:petal_bottom_style="sector" |
wdView.bottomStyle = Petal.BottomStyle.Sector |
flat |
|
app:petal_bottom_style="flat" |
wdView.bottomStyle = Petal.BottomStyle.Flat |
Value |
Sample |
XML property |
Kotlin property |
eight |
|
app:directionsCount="eight" |
wdView.angle = WindDirections.Angle.Eight |
sixteen |
|
app:directionsCount="sixteen" |
wdView.angle = WindDirections.AngleSixteen |
Value |
Sample |
XML property |
Kotlin property |
size |
|
app:grid_text_size="18dp" |
wdView.gridTextSize = 10.0 |
color |
|
app:grid_text_color="#000000" |
wdView.gridTextColor = color |
Value |
Sample |
XML property |
Kotlin property |
size |
|
app:grid_line_size="1dp" |
wdView.gridLineSize = 3.0 |
color |
|
app:grid_line_color="#000000" |
wdView.gridLineColor = color |