From a16505b757d1df2ae118c315d78c4cc7126c1bce Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 1 Jul 2014 16:09:30 +0200 Subject: [PATCH] Added file count to repository list item (ref #49). --- .../nutomic/syncthingandroid/util/ReposAdapter.java | 11 ++++++----- src/main/res/layout/repo_list_item.xml | 9 ++++++++- src/main/res/values/strings.xml | 3 +++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/util/ReposAdapter.java b/src/main/java/com/nutomic/syncthingandroid/util/ReposAdapter.java index 0a444117..1f4f66f2 100644 --- a/src/main/java/com/nutomic/syncthingandroid/util/ReposAdapter.java +++ b/src/main/java/com/nutomic/syncthingandroid/util/ReposAdapter.java @@ -38,7 +38,8 @@ public class ReposAdapter extends ArrayAdapter TextView state = (TextView) convertView.findViewById(R.id.state); TextView folder = (TextView) convertView.findViewById(R.id.folder); - TextView progress = (TextView) convertView.findViewById(R.id.progress); + TextView items = (TextView) convertView.findViewById(R.id.items); + TextView size = (TextView) convertView.findViewById(R.id.size); TextView invalid = (TextView) convertView.findViewById(R.id.invalid); id.setText(getItem(position).ID); @@ -50,10 +51,10 @@ public class ReposAdapter extends ArrayAdapter (model.globalBytes <= 0) ? 100 : (int) ((model.localBytes / (float) model.globalBytes) * 100))); - progress.setText( - RestApi.readableFileSize(getContext(), model.localBytes) + " / " + - RestApi.readableFileSize(getContext(), model.globalBytes) - ); + items.setText(getContext() + .getString(R.string.files, model.localFiles, model.globalFiles)); + size.setText(RestApi.readableFileSize(getContext(), model.localBytes) + " / " + + RestApi.readableFileSize(getContext(), model.globalBytes)); invalid.setText(model.invalid); invalid.setVisibility((model.invalid.equals("")) ? View.INVISIBLE : View.VISIBLE); } diff --git a/src/main/res/layout/repo_list_item.xml b/src/main/res/layout/repo_list_item.xml index 631b70d7..ddff7e00 100644 --- a/src/main/res/layout/repo_list_item.xml +++ b/src/main/res/layout/repo_list_item.xml @@ -29,12 +29,19 @@ android:layout_height="wrap_content" /> + + No repositories found + + %1$d / %2$d Files + Nodes