Signal dynamic icon
This commit is contained in:
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
17
.idea/deploymentTargetDropDown.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetDropDown">
|
||||||
|
<runningDeviceTargetSelectedWithDropDown>
|
||||||
|
<Target>
|
||||||
|
<type value="RUNNING_DEVICE_TARGET" />
|
||||||
|
<deviceKey>
|
||||||
|
<Key>
|
||||||
|
<type value="SERIAL_NUMBER" />
|
||||||
|
<value value="3d29e5a6" />
|
||||||
|
</Key>
|
||||||
|
</deviceKey>
|
||||||
|
</Target>
|
||||||
|
</runningDeviceTargetSelectedWithDropDown>
|
||||||
|
<timeTargetWasSelectedWithDropDown value="2023-06-24T21:15:01.924740400Z" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -16,8 +16,7 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.HeliBLE"
|
android:theme="@style/Theme.HeliBLE">
|
||||||
tools:targetApi="31">
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ControlActivity"
|
android:name=".ControlActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
@@ -24,7 +25,10 @@ class BleDeviceAdapter(private val devices: List<BleDevice>, private val gotoCon
|
|||||||
override fun onBindViewHolder(holder: BleDeviceViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: BleDeviceViewHolder, position: Int) {
|
||||||
holder.nameView.text = devices[position].name
|
holder.nameView.text = devices[position].name
|
||||||
holder.addressView.text = devices[position].address
|
holder.addressView.text = devices[position].address
|
||||||
holder.rssiView.text = devices[position].rssi.toString()
|
if (devices[position].rssi >= -80) holder.rssiView.setImageResource(R.drawable.signal_icon4)
|
||||||
|
else if (devices[position].rssi >= -90) holder.rssiView.setImageResource(R.drawable.signal_icon3)
|
||||||
|
else if (devices[position].rssi >= -100) holder.rssiView.setImageResource(R.drawable.signal_icon2)
|
||||||
|
else holder.rssiView.setImageResource(R.drawable.signal_icon1)
|
||||||
holder.cardView.isSelected = position == selectedPosition
|
holder.cardView.isSelected = position == selectedPosition
|
||||||
holder.cardView.setOnClickListener {
|
holder.cardView.setOnClickListener {
|
||||||
AppState.bleDevice = devices[position]
|
AppState.bleDevice = devices[position]
|
||||||
@@ -40,6 +44,6 @@ class BleDeviceAdapter(private val devices: List<BleDevice>, private val gotoCon
|
|||||||
val cardView = itemView.rootView
|
val cardView = itemView.rootView
|
||||||
val nameView = itemView.findViewById<TextView>(R.id.deviceName)
|
val nameView = itemView.findViewById<TextView>(R.id.deviceName)
|
||||||
val addressView = itemView.findViewById<TextView>(R.id.deviceAddress)
|
val addressView = itemView.findViewById<TextView>(R.id.deviceAddress)
|
||||||
val rssiView = itemView.findViewById<TextView>(R.id.deviceRssi)
|
val rssiView = itemView.findViewById<ImageView>(R.id.deviceRssi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
app/src/main/res/drawable/signal_icon1.xml
Normal file
4
app/src/main/res/drawable/signal_icon1.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="500" android:viewportHeight="500">
|
||||||
|
<path android:fillColor="?android:textColorPrimary" android:pathData="M 15 340 L 80 340 Q 95 340 95 355 L 95 485 Q 95 500 80 500 L 15 500 Q 0 500 0 485 L 0 355 Q 0 340 15 340 Z"/>
|
||||||
|
</vector>
|
||||||
14
app/src/main/res/drawable/signal_icon2.xml
Normal file
14
app/src/main/res/drawable/signal_icon2.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="500"
|
||||||
|
android:viewportHeight="500">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="?android:textColorPrimary"
|
||||||
|
android:pathData="M 15 340 L 80 340 Q 95 340 95 355 L 95 485 Q 95 500 80 500 L 15 500 Q 0 500 0 485 L 0 355 Q 0 340 15 340 Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="?android:textColorPrimary"
|
||||||
|
android:pathData="M 150 220 L 215 220 Q 230 220 230 235 L 230 485 Q 230 500 215 500 L 150 500 Q 135 500 135 485 L 135 235 Q 135 220 150 220 Z" />
|
||||||
|
</vector>
|
||||||
17
app/src/main/res/drawable/signal_icon3.xml
Normal file
17
app/src/main/res/drawable/signal_icon3.xml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="500"
|
||||||
|
android:viewportHeight="500">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="?android:textColorPrimary"
|
||||||
|
android:pathData="M 15 340 L 80 340 Q 95 340 95 355 L 95 485 Q 95 500 80 500 L 15 500 Q 0 500 0 485 L 0 355 Q 0 340 15 340 Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="?android:textColorPrimary"
|
||||||
|
android:pathData="M 150 220 L 215 220 Q 230 220 230 235 L 230 485 Q 230 500 215 500 L 150 500 Q 135 500 135 485 L 135 235 Q 135 220 150 220 Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="?android:textColorPrimary"
|
||||||
|
android:pathData="M 285 120 L 350 120 Q 365 120 365 135 L 365 485 Q 365 500 350 500 L 285 500 Q 270 500 270 485 L 270 135 Q 270 120 285 120 Z" />
|
||||||
|
</vector>
|
||||||
20
app/src/main/res/drawable/signal_icon4.xml
Normal file
20
app/src/main/res/drawable/signal_icon4.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="500"
|
||||||
|
android:viewportHeight="500">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="?android:textColorPrimary"
|
||||||
|
android:pathData="M 15 340 L 80 340 Q 95 340 95 355 L 95 485 Q 95 500 80 500 L 15 500 Q 0 500 0 485 L 0 355 Q 0 340 15 340 Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="?android:textColorPrimary"
|
||||||
|
android:pathData="M 150 220 L 215 220 Q 230 220 230 235 L 230 485 Q 230 500 215 500 L 150 500 Q 135 500 135 485 L 135 235 Q 135 220 150 220 Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="?android:textColorPrimary"
|
||||||
|
android:pathData="M 285 120 L 350 120 Q 365 120 365 135 L 365 485 Q 365 500 350 500 L 285 500 Q 270 500 270 485 L 270 135 Q 270 120 285 120 Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="?android:textColorPrimary"
|
||||||
|
android:pathData="M 420 0 L 485 0 Q 500 0 500 15 L 500 485 Q 500 500 485 500 L 420 500 Q 405 500 405 485 L 405 15 Q 405 0 420 0 Z" />
|
||||||
|
</vector>
|
||||||
@@ -28,14 +28,13 @@
|
|||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:text="C3:7A:F4:6E:2F:D6" />
|
android:text="C3:7A:F4:6E:2F:D6" />
|
||||||
|
|
||||||
<TextView
|
<ImageView
|
||||||
android:id="@+id/deviceRssi"
|
android:id="@+id/deviceRssi"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:textSize="16sp"
|
android:src="@drawable/signal_icon4" />
|
||||||
android:text="-70" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user