From 8107def7989522efd72e5982350bc671aa6b8c3d Mon Sep 17 00:00:00 2001 From: Schoumi Date: Fri, 4 Aug 2017 23:20:28 +0200 Subject: [PATCH] Add no device pluggued message in the Browse Device Fragment Fixes #3 --- .../fr/mobdev/lpcprog/fragment/BrowseDeviceFragment.java | 7 +++++++ app/src/main/res/layout/usb_list.xml | 8 ++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 16 insertions(+) diff --git a/app/src/main/java/fr/mobdev/lpcprog/fragment/BrowseDeviceFragment.java b/app/src/main/java/fr/mobdev/lpcprog/fragment/BrowseDeviceFragment.java index 2680dad..c5d94e7 100644 --- a/app/src/main/java/fr/mobdev/lpcprog/fragment/BrowseDeviceFragment.java +++ b/app/src/main/java/fr/mobdev/lpcprog/fragment/BrowseDeviceFragment.java @@ -26,6 +26,7 @@ import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import java.util.List; @@ -82,6 +83,12 @@ public class BrowseDeviceFragment extends Fragment { if(v == null) v = getView(); assert v != null; + TextView nodevice = v.findViewById(R.id.no_device); + if(devices.size() == 0) { + nodevice.setVisibility(View.VISIBLE); + } else { + nodevice.setVisibility(View.GONE); + } DeviceAdapter adapter = new DeviceAdapter(devices,listener); RecyclerView view = v.findViewById(R.id.device_list); view.setAdapter(adapter); diff --git a/app/src/main/res/layout/usb_list.xml b/app/src/main/res/layout/usb_list.xml index 40a968e..1bb6474 100644 --- a/app/src/main/res/layout/usb_list.xml +++ b/app/src/main/res/layout/usb_list.xml @@ -9,7 +9,15 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" > + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6e797a7..5f39764 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -87,6 +87,7 @@ Retry Download Binary Download Binary Informations + No Device Pluggued, please plug one to be able to flash a binary on it. Yes No