From 1ef3ebc9453a1749ba223e69f87f30f862595645 Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Sun, 20 Dec 2020 16:46:18 +0200 Subject: [PATCH] Add custom item view for DeviceListAdapter.java. --- .../ui/settings/device/DeviceListAdapter.java | 10 +++++--- .../res/drawable/ic_baseline_delete_24.xml | 5 ++++ .../main/res/drawable/ic_baseline_star_24.xml | 10 ++++++++ .../drawable/ic_baseline_star_border_24.xml | 10 ++++++++ .../res/layout/settings_device_list_item.xml | 25 +++++++++++++++++++ .../app/src/main/res/values/strings.xml | 2 ++ 6 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 NucuHub.Android/app/src/main/res/drawable/ic_baseline_delete_24.xml create mode 100644 NucuHub.Android/app/src/main/res/drawable/ic_baseline_star_24.xml create mode 100644 NucuHub.Android/app/src/main/res/drawable/ic_baseline_star_border_24.xml create mode 100644 NucuHub.Android/app/src/main/res/layout/settings_device_list_item.xml diff --git a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/device/DeviceListAdapter.java b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/device/DeviceListAdapter.java index 55aa532..94f6aa5 100644 --- a/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/device/DeviceListAdapter.java +++ b/NucuHub.Android/app/src/main/java/dev/nuculabs/nucuhub/ui/settings/device/DeviceListAdapter.java @@ -6,6 +6,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; +import dev.nuculabs.nucuhub.R; import dev.nuculabs.nucuhub.domain.Device; import java.util.ArrayList; @@ -44,14 +45,15 @@ public class DeviceListAdapter extends BaseAdapter { @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; - final TextView text; if (view == null) { - view = inflater.inflate(android.R.layout.simple_list_item_1, null); + view = inflater.inflate(R.layout.settings_device_list_item, null); } - - text = (TextView) view; + final TextView text = view.findViewById(R.id.settingsDeviceListDeviceListItemText); text.setText(items.get(position).toString()); + // TODO: Add click listeners for Delete And Select Buttons. + // TODO: Mark selected item row? + return view; } diff --git a/NucuHub.Android/app/src/main/res/drawable/ic_baseline_delete_24.xml b/NucuHub.Android/app/src/main/res/drawable/ic_baseline_delete_24.xml new file mode 100644 index 0000000..de738a6 --- /dev/null +++ b/NucuHub.Android/app/src/main/res/drawable/ic_baseline_delete_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/NucuHub.Android/app/src/main/res/drawable/ic_baseline_star_24.xml b/NucuHub.Android/app/src/main/res/drawable/ic_baseline_star_24.xml new file mode 100644 index 0000000..3383294 --- /dev/null +++ b/NucuHub.Android/app/src/main/res/drawable/ic_baseline_star_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/NucuHub.Android/app/src/main/res/drawable/ic_baseline_star_border_24.xml b/NucuHub.Android/app/src/main/res/drawable/ic_baseline_star_border_24.xml new file mode 100644 index 0000000..b6d93ca --- /dev/null +++ b/NucuHub.Android/app/src/main/res/drawable/ic_baseline_star_border_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/NucuHub.Android/app/src/main/res/layout/settings_device_list_item.xml b/NucuHub.Android/app/src/main/res/layout/settings_device_list_item.xml new file mode 100644 index 0000000..a1720d3 --- /dev/null +++ b/NucuHub.Android/app/src/main/res/layout/settings_device_list_item.xml @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/NucuHub.Android/app/src/main/res/values/strings.xml b/NucuHub.Android/app/src/main/res/values/strings.xml index 27ace7e..d9b42ec 100644 --- a/NucuHub.Android/app/src/main/res/values/strings.xml +++ b/NucuHub.Android/app/src/main/res/values/strings.xml @@ -49,4 +49,6 @@ Download incoming attachments Automatically download attachments for incoming emails Only download attachments when manually requested + Delete Icon + Select Icon \ No newline at end of file