1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 11:21:29 +00:00

Added file count to repository list item (ref #49).

This commit is contained in:
Felix Ableitner 2014-07-01 16:09:30 +02:00
parent ad1138e5c5
commit a16505b757
3 changed files with 17 additions and 6 deletions

View file

@ -38,7 +38,8 @@ public class ReposAdapter extends ArrayAdapter<RestApi.Repo>
TextView state = (TextView) convertView.findViewById(R.id.state); TextView state = (TextView) convertView.findViewById(R.id.state);
TextView folder = (TextView) convertView.findViewById(R.id.folder); 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); TextView invalid = (TextView) convertView.findViewById(R.id.invalid);
id.setText(getItem(position).ID); id.setText(getItem(position).ID);
@ -50,10 +51,10 @@ public class ReposAdapter extends ArrayAdapter<RestApi.Repo>
(model.globalBytes <= 0) (model.globalBytes <= 0)
? 100 ? 100
: (int) ((model.localBytes / (float) model.globalBytes) * 100))); : (int) ((model.localBytes / (float) model.globalBytes) * 100)));
progress.setText( items.setText(getContext()
RestApi.readableFileSize(getContext(), model.localBytes) + " / " + .getString(R.string.files, model.localFiles, model.globalFiles));
RestApi.readableFileSize(getContext(), model.globalBytes) size.setText(RestApi.readableFileSize(getContext(), model.localBytes) + " / " +
); RestApi.readableFileSize(getContext(), model.globalBytes));
invalid.setText(model.invalid); invalid.setText(model.invalid);
invalid.setVisibility((model.invalid.equals("")) ? View.INVISIBLE : View.VISIBLE); invalid.setVisibility((model.invalid.equals("")) ? View.INVISIBLE : View.VISIBLE);
} }

View file

@ -29,12 +29,19 @@
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <TextView
android:id="@+id/progress" android:id="@+id/items"
android:layout_below="@id/folder" android:layout_below="@id/folder"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView
android:id="@+id/size"
android:layout_below="@id/items"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView <TextView
android:id="@+id/invalid" android:id="@+id/invalid"
android:textColor="@color/text_red" android:textColor="@color/text_red"

View file

@ -40,6 +40,9 @@
<!-- Shown if no repos exist --> <!-- Shown if no repos exist -->
<string name="repositories_list_empty">No repositories found</string> <string name="repositories_list_empty">No repositories found</string>
<!-- Format string for repository file count -->
<string name="files">%1$d / %2$d Files</string>
<!-- NodesFragment --> <!-- NodesFragment -->
<string name="nodes_fragment_title">Nodes</string> <string name="nodes_fragment_title">Nodes</string>