Skip to content

Commit 7a0f74e

Browse files
atm1504mariobehling
authored andcommitted
feat: Enhance the UI of the device card similar to google home (#2296)
* feat: Add manage device section in settings page (#2285) * feat: Add place for manage devices * feat: add manage device page ui * remove finish * feat: Enhance the card of connected devices * feat: Inflate the card from recyclerview * remove hardcoded dimensions * chnage speaker image
1 parent d81189b commit 7a0f74e

File tree

6 files changed

+76
-7
lines changed

6 files changed

+76
-7
lines changed

app/src/main/java/org/fossasia/susi/ai/device/connecteddevices/adapters/ConnectedDevicesAdapter.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import org.fossasia.susi.ai.rest.responses.susi.Device
1111
class ConnectedDevicesAdapter(private val connectedDevicesList: ArrayList<Device>) : RecyclerView.Adapter<ConnectedDevicesAdapter.ViewHolder>() {
1212

1313
override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ViewHolder {
14-
val view = LayoutInflater.from(viewGroup.context).inflate(R.layout.device_layout, viewGroup, false)
14+
val view = LayoutInflater.from(viewGroup.context).inflate(R.layout.item_speaker, viewGroup, false)
1515
return ViewHolder(view)
1616
}
1717

@@ -20,17 +20,14 @@ class ConnectedDevicesAdapter(private val connectedDevicesList: ArrayList<Device
2020
}
2121

2222
override fun onBindViewHolder(holder: ViewHolder, p1: Int) {
23-
holder.ssid_name.text = connectedDevicesList[p1].name
24-
holder.setup_option.text = connectedDevicesList[p1].room
23+
holder.speaker_room.text = connectedDevicesList[p1].room.toString().trim() + " Speaker"
2524
}
2625

2726
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
28-
internal var ssid_name: TextView
29-
internal var setup_option: TextView
27+
internal var speaker_room: TextView
3028

3129
init {
32-
ssid_name = itemView.findViewById(R.id.speakerName)
33-
setup_option = itemView.findViewById(R.id.speakerSetUp)
30+
speaker_room = itemView.findViewById(R.id.speaker_room)
3431
}
3532
}
3633
}
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector android:height="24dp" android:tint="#FFFFFF"
2+
android:viewportHeight="24.0" android:viewportWidth="24.0"
3+
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
4+
<path android:fillColor="#FF000000" android:pathData="M8.59,16.34l4.58,-4.59 -4.58,-4.59L10,5.75l6,6 -6,6z"/>
5+
</vector>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_marginBottom="@dimen/margin_moderate"
6+
android:layout_height="wrap_content">
7+
8+
<android.support.v7.widget.CardView
9+
android:layout_width="match_parent"
10+
android:layout_height="wrap_content">
11+
12+
<LinearLayout
13+
android:layout_width="match_parent"
14+
android:layout_height="wrap_content"
15+
android:background="@color/md_grey_700"
16+
android:orientation="vertical">
17+
18+
<LinearLayout
19+
android:layout_width="match_parent"
20+
android:layout_height="@dimen/height_room_card"
21+
android:background="@drawable/smart_speaker"
22+
android:orientation="vertical">
23+
24+
<android.support.v7.widget.AppCompatTextView
25+
android:id="@+id/speaker_room"
26+
android:layout_width="wrap_content"
27+
android:layout_height="wrap_content"
28+
android:padding="@dimen/padding_large"
29+
android:textColor="@color/blue_grey_300"
30+
android:textSize="@dimen/text_size_extra_large"
31+
android:textStyle="bold"
32+
tools:text="@string/music_services" />
33+
34+
</LinearLayout>
35+
36+
<LinearLayout
37+
android:layout_width="match_parent"
38+
android:layout_height="wrap_content"
39+
android:background="@color/colorPrimary"
40+
android:orientation="horizontal">
41+
42+
<android.support.v7.widget.AppCompatTextView
43+
android:layout_width="0dp"
44+
android:layout_height="wrap_content"
45+
android:layout_weight="6"
46+
android:padding="@dimen/padding_large"
47+
android:text="@string/say_hey_susi"
48+
android:textColor="@color/md_white_1000"
49+
android:textSize="@dimen/text_size_extra_large" />
50+
51+
<ImageButton
52+
android:layout_width="0dp"
53+
android:layout_height="match_parent"
54+
android:layout_weight="1"
55+
android:background="@color/colorPrimary"
56+
android:src="@drawable/ic_arrow_right_white_24dp" />
57+
58+
</LinearLayout>
59+
60+
</LinearLayout>
61+
62+
</android.support.v7.widget.CardView>
63+
64+
</LinearLayout>

app/src/main/res/values/dimens.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,6 @@
141141

142142
<!-- Manage Devices dimensions -->
143143
<dimen name="height_width_spotify">40dp</dimen>
144+
<dimen name="height_room_card">250dp</dimen>
144145

145146
</resources>

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,4 +534,6 @@
534534

535535
<!-- Manage Devices -->
536536
<string name="music_services">Music Services</string>
537+
<string name="say_hey_susi">Start with \"Hey Susi\"</string>
538+
537539
</resources>

0 commit comments

Comments
 (0)