2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-29 13:17:43 +00:00

Minor changes

This commit is contained in:
Albert Vaca 2014-09-29 18:50:25 -07:00
parent 03ede77bd1
commit adb88560b5
4 changed files with 14 additions and 12 deletions

View File

@ -630,7 +630,7 @@ public class Device implements BaseLink.PackageReceiver {
} }
public boolean hasPluginsLoaded() { public boolean hasPluginsLoaded() {
return !(plugins.isEmpty() && failedPlugins.isEmpty()); return !plugins.isEmpty() || !failedPlugins.isEmpty();
} }
public void reloadPluginsFromSettings() { public void reloadPluginsFromSettings() {

View File

@ -9,11 +9,11 @@ import org.kde.kdeconnect_tp.R;
public class SectionItem implements ListAdapter.Item { public class SectionItem implements ListAdapter.Item {
private final String title; private final String title;
public boolean isEmpty; public boolean isSectionEmpty;
public SectionItem(String title) { public SectionItem(String title) {
this.title = title; this.title = title;
this.isEmpty = false; this.isSectionEmpty = false;
} }
@Override @Override
@ -21,13 +21,14 @@ public class SectionItem implements ListAdapter.Item {
View v = layoutInflater.inflate(R.layout.list_item_category, null); View v = layoutInflater.inflate(R.layout.list_item_category, null);
//Make it not selectable
v.setOnClickListener(null); v.setOnClickListener(null);
v.setOnLongClickListener(null); v.setOnLongClickListener(null);
TextView sectionView = (TextView) v.findViewById(R.id.list_item_category_text); TextView sectionView = (TextView) v.findViewById(R.id.list_item_category_text);
sectionView.setText(title); sectionView.setText(title);
if (isEmpty) { if (isSectionEmpty) {
v.findViewById(R.id.list_item_category_empty_placeholder).setVisibility(View.VISIBLE); v.findViewById(R.id.list_item_category_empty_placeholder).setVisibility(View.VISIBLE);
} }

View File

@ -104,35 +104,35 @@ public class MainActivity extends ActionBarActivity {
Resources res = getResources(); Resources res = getResources();
section = new SectionItem(res.getString(R.string.category_connected_devices)); section = new SectionItem(res.getString(R.string.category_connected_devices));
section.isEmpty = true; section.isSectionEmpty = true;
items.add(section); items.add(section);
for(Device d : devices) { for(Device d : devices) {
if (d.isReachable() && d.isPaired()) { if (d.isReachable() && d.isPaired()) {
items.add(new DeviceItem(MainActivity.this, d)); items.add(new DeviceItem(MainActivity.this, d));
section.isEmpty = false; section.isSectionEmpty = false;
} }
} }
section = new SectionItem(res.getString(R.string.category_not_paired_devices)); section = new SectionItem(res.getString(R.string.category_not_paired_devices));
section.isEmpty = true; section.isSectionEmpty = true;
items.add(section); items.add(section);
for(Device d : devices) { for(Device d : devices) {
if (d.isReachable() && !d.isPaired()) { if (d.isReachable() && !d.isPaired()) {
items.add(new DeviceItem(MainActivity.this, d)); items.add(new DeviceItem(MainActivity.this, d));
section.isEmpty = false; section.isSectionEmpty = false;
} }
} }
section = new SectionItem(res.getString(R.string.category_remembered_devices)); section = new SectionItem(res.getString(R.string.category_remembered_devices));
section.isEmpty = true; section.isSectionEmpty = true;
items.add(section); items.add(section);
for(Device d : devices) { for(Device d : devices) {
if (!d.isReachable() && d.isPaired()) { if (!d.isReachable() && d.isPaired()) {
items.add(new DeviceItem(MainActivity.this, d)); items.add(new DeviceItem(MainActivity.this, d));
section.isEmpty = false; section.isSectionEmpty = false;
} }
} }
if (section.isEmpty) { if (section.isSectionEmpty) {
items.remove(items.size()-1); //Remove remembered devices section if empty items.remove(items.size()-1); //Remove remembered devices section if empty
} }

View File

@ -136,7 +136,8 @@ public class ShareToReceiver extends ActionBarActivity {
queuedSendUriList(device, uriList); queuedSendUriList(device, uriList);
} catch (Exception e) { } catch (Exception e) {
Log.e(this.getClass().getName(), e.toString()); e.printStackTrace();
Log.e("ShareToReceiver", "Exception");
} }
} else if (extras.containsKey(Intent.EXTRA_TEXT)) { } else if (extras.containsKey(Intent.EXTRA_TEXT)) {