Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enhance the UI of the device card similar to google home #2296

Merged
merged 6 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.fossasia.susi.ai.rest.responses.susi.Device
class ConnectedDevicesAdapter(private val connectedDevicesList: ArrayList<Device>) : RecyclerView.Adapter<ConnectedDevicesAdapter.ViewHolder>() {

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

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

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

inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
internal var ssid_name: TextView
internal var setup_option: TextView
internal var speaker_room: TextView

init {
ssid_name = itemView.findViewById(R.id.speakerName)
setup_option = itemView.findViewById(R.id.speakerSetUp)
speaker_room = itemView.findViewById(R.id.speaker_room)
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_arrow_right_white_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M8.59,16.34l4.58,-4.59 -4.58,-4.59L10,5.75l6,6 -6,6z"/>
</vector>
64 changes: 64 additions & 0 deletions app/src/main/res/layout/item_speaker.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_marginBottom="@dimen/margin_moderate"
android:layout_height="wrap_content">

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/md_grey_700"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/height_room_card"
android:background="@drawable/smart_speaker"
android:orientation="vertical">

<android.support.v7.widget.AppCompatTextView
android:id="@+id/speaker_room"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/padding_large"
android:textColor="@color/blue_grey_300"
android:textSize="@dimen/text_size_extra_large"
android:textStyle="bold"
tools:text="@string/music_services" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:orientation="horizontal">

<android.support.v7.widget.AppCompatTextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:padding="@dimen/padding_large"
android:text="@string/say_hey_susi"
android:textColor="@color/md_white_1000"
android:textSize="@dimen/text_size_extra_large" />

<ImageButton
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:src="@drawable/ic_arrow_right_white_24dp" />

</LinearLayout>

</LinearLayout>

</android.support.v7.widget.CardView>

</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,6 @@

<!-- Manage Devices dimensions -->
<dimen name="height_width_spotify">40dp</dimen>
<dimen name="height_room_card">250dp</dimen>

</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -534,4 +534,6 @@

<!-- Manage Devices -->
<string name="music_services">Music Services</string>
<string name="say_hey_susi">Start with \"Hey Susi\"</string>

</resources>