From 8d67e0b0f14b9dc56d49c673f13b7b38d460699c Mon Sep 17 00:00:00 2001 From: Da-Jin Chu Date: Wed, 24 Dec 2014 20:49:54 -0800 Subject: [PATCH] Added a "No players found" message to MPRIS Plugin when player list is empty --- res/layout/mpris_control.xml | 8 ++++++++ res/values/strings.xml | 1 + .../kde/kdeconnect/Plugins/MprisPlugin/MprisActivity.java | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/res/layout/mpris_control.xml b/res/layout/mpris_control.xml index c264f4ea..613df3f1 100644 --- a/res/layout/mpris_control.xml +++ b/res/layout/mpris_control.xml @@ -12,6 +12,14 @@ android:paddingRight="60dip" android:paddingBottom="5dip"> + + (read only) Camera pictures Add host/IP + No players found Use this option only if your device is not automatically detected. Enter IP address or hostname below and touch the button to add it to the list. Touch an existing item to remove it from the list. %1$s on %2$s diff --git a/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisActivity.java b/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisActivity.java index 4f06ac6e..22181acc 100644 --- a/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisActivity.java +++ b/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisActivity.java @@ -135,6 +135,14 @@ public class MprisActivity extends ActionBarActivity { //String prevPlayer = (String)spinner.getSelectedItem(); spinner.setAdapter(adapter); + if(playerList.isEmpty()){ + findViewById(R.id.no_players).setVisibility(View.VISIBLE); + spinner.setVisibility(View.GONE); + }else{ + findViewById(R.id.no_players).setVisibility(View.GONE); + spinner.setVisibility(View.VISIBLE); + } + spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView arg0, View arg1, int pos, long id) {