From 5ed0e9efec0dcfd13db8b1d353bb7e8b282282a5 Mon Sep 17 00:00:00 2001 From: Torsten Grote <t@grobox.de> Date: Fri, 17 Aug 2018 12:09:30 -0300 Subject: [PATCH] Implement new empty state icons --- briar-android/artwork/empty_state_blog.svg | 91 +++++++++++++++++++ .../artwork/empty_state_contact_list.svg | 56 ++++++++++++ .../artwork/empty_state_forum_list.svg | 81 +++++++++++++++++ .../artwork/empty_state_group_list.svg | 86 ++++++++++++++++++ .../briar/android/blog/FeedFragment.java | 2 + .../android/contact/ContactListFragment.java | 2 + .../android/forum/ForumListFragment.java | 1 - .../privategroup/list/GroupListFragment.java | 2 + .../briar/android/view/BriarRecyclerView.java | 52 +++++++++-- .../main/res/drawable/ic_empty_state_blog.xml | 21 +++++ .../drawable/ic_empty_state_contact_list.xml | 9 ++ .../drawable/ic_empty_state_forum_list.xml | 15 +++ .../drawable/ic_empty_state_group_list.xml | 18 ++++ .../main/res/layout/briar_recycler_view.xml | 72 +++++++++++++-- .../main/res/layout/fragment_forum_list.xml | 18 ++-- briar-android/src/main/res/values/attrs.xml | 2 + briar-android/src/main/res/values/strings.xml | 12 ++- 17 files changed, 508 insertions(+), 32 deletions(-) create mode 100644 briar-android/artwork/empty_state_blog.svg create mode 100644 briar-android/artwork/empty_state_contact_list.svg create mode 100644 briar-android/artwork/empty_state_forum_list.svg create mode 100644 briar-android/artwork/empty_state_group_list.svg create mode 100644 briar-android/src/main/res/drawable/ic_empty_state_blog.xml create mode 100644 briar-android/src/main/res/drawable/ic_empty_state_contact_list.xml create mode 100644 briar-android/src/main/res/drawable/ic_empty_state_forum_list.xml create mode 100644 briar-android/src/main/res/drawable/ic_empty_state_group_list.xml diff --git a/briar-android/artwork/empty_state_blog.svg b/briar-android/artwork/empty_state_blog.svg new file mode 100644 index 0000000000..eb1cd25c74 --- /dev/null +++ b/briar-android/artwork/empty_state_blog.svg @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="162" + height="156" + viewBox="0 0 162 156" + fill="none" + version="1.1" + id="svg16" + sodipodi:docname="No-Posts.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + <metadata + id="metadata22"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs20" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="754" + inkscape:window-height="480" + id="namedview18" + showgrid="false" + inkscape:zoom="1.5128205" + inkscape:cx="81" + inkscape:cy="78" + inkscape:window-x="0" + inkscape:window-y="20" + inkscape:window-maximized="0" + inkscape:current-layer="svg16" /> + <rect + width="80.9997" + height="78" + fill="black" + fill-opacity="0" + transform="scale(2)" + id="rect2" /> + <rect + width="80.9997" + height="78" + fill="black" + fill-opacity="0" + transform="scale(2)" + id="rect4" /> + <path + d="M140.87 53.647H91.5654V64.2352H140.87V53.647Z" + fill="white" + fill-opacity="0.6" + id="path6" /> + <path + d="M140.869 99.5292V88.9409H115.512L126.077 99.5292H140.869Z" + fill="white" + fill-opacity="0.6" + id="path8" /> + <path + d="M140.869 71.2939H97.9038L108.469 81.8822H140.869V71.2939Z" + fill="white" + fill-opacity="0.6" + id="path10" /> + <path + d="M147.912 14.8232H41.5557L84.5209 57.8821V28.9409H147.912V120.706H147.208L157.773 131.294C160.59 128.47 161.999 124.941 161.999 120.706V28.9409C161.999 21.1762 155.66 14.8232 147.912 14.8232Z" + fill="white" + fill-opacity="0.6" + id="path12" /> + <path + d="M129.6 120.706L84.5217 75.5294L23.9478 14.8235L9.15652 0L0 9.17647L10.5652 19.7647C8.45217 21.8824 7.04348 25.4118 7.04348 28.9412V120.706C7.04348 128.471 13.3826 134.824 21.1304 134.824H125.374L146.504 156L155.661 146.824L143.687 134.824L129.6 120.706ZM84.5217 120.706V93.8824L111.287 120.706H84.5217Z" + fill="white" + fill-opacity="0.6" + id="path14" /> +</svg> diff --git a/briar-android/artwork/empty_state_contact_list.svg b/briar-android/artwork/empty_state_contact_list.svg new file mode 100644 index 0000000000..efc3f10baf --- /dev/null +++ b/briar-android/artwork/empty_state_contact_list.svg @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="164" + height="164" + viewBox="0 0 164 164" + fill="none" + version="1.1" + id="svg12" + sodipodi:docname="empty_state_contact_list.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16" /> + <sodipodi:namedview + pagecolor="#000000" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="1.4390244" + inkscape:cx="81.305085" + inkscape:cy="109.79661" + inkscape:window-x="1440" + inkscape:window-y="24" + inkscape:window-maximized="0" + inkscape:current-layer="svg12" /> + <path + style="clip-rule:evenodd;display:inline;fill:#ffffff;fill-rule:evenodd" + d="M 27.333984 0 L 27.333984 13.666016 L 136.66797 13.666016 L 136.66797 0 L 27.333984 0 z M 27.333984 27.333984 C 19.817284 27.333984 13.666016 33.4834 13.666016 41 L 13.666016 123 C 13.666016 130.517 19.817284 136.66797 27.333984 136.66797 L 136.66797 136.66797 C 144.18397 136.66797 150.33203 130.517 150.33203 123 L 150.33203 41 C 150.33203 33.4834 144.18397 27.333984 136.66797 27.333984 L 27.333984 27.333984 z M 82.150391 44.757812 C 89.592295 44.757812 95.348492 46.476807 99.419922 49.914062 C 103.52467 53.351338 105.57617 58.23949 105.57617 64.580078 C 105.57617 67.349967 105.0272 69.869409 103.92578 72.138672 C 102.82458 74.407935 101.05521 76.728225 98.619141 79.097656 L 92.863281 84.453125 C 91.227921 86.021639 90.093094 87.640125 89.458984 89.308594 C 88.824874 90.943745 88.475053 93.030171 88.408203 95.566406 L 74.091797 95.566406 C 74.091797 90.694273 74.640917 86.855942 75.742188 84.052734 C 76.843435 81.216209 78.63001 78.762286 81.099609 76.693359 C 83.568995 74.624218 85.436853 72.739109 86.705078 71.037109 C 88.006403 69.30179 88.658203 67.400958 88.658203 65.332031 C 88.658203 60.292857 86.488795 57.771484 82.150391 57.771484 C 80.1481 57.771484 78.529614 58.506262 77.294922 59.974609 C 76.060186 61.442955 75.40854 63.42881 75.341797 65.931641 L 58.423828 65.931641 C 58.490468 59.25736 60.592402 54.067509 64.730469 50.363281 C 68.868538 46.625672 74.675257 44.757813 82.150391 44.757812 z M 81.398438 102.32422 C 84.068159 102.32422 86.287795 103.12473 88.056641 104.72656 C 89.858601 106.29508 90.759766 108.31381 90.759766 110.7832 C 90.759766 113.2528 89.858601 115.28879 88.056641 116.89062 C 86.287795 118.45914 84.068159 119.24219 81.398438 119.24219 C 78.728717 119.24219 76.493467 118.45914 74.691406 116.89062 C 72.922705 115.28879 72.039062 113.2528 72.039062 110.7832 C 72.039062 108.31381 72.922705 106.29508 74.691406 104.72656 C 76.493467 103.12473 78.728716 102.32422 81.398438 102.32422 z M 27.333984 150.33203 L 27.333984 164 L 136.66797 164 L 136.66797 150.33203 L 27.333984 150.33203 z " + id="path8" /> +</svg> diff --git a/briar-android/artwork/empty_state_forum_list.svg b/briar-android/artwork/empty_state_forum_list.svg new file mode 100644 index 0000000000..101eca192d --- /dev/null +++ b/briar-android/artwork/empty_state_forum_list.svg @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="148" + height="148" + viewBox="0 0 148 148" + fill="none" + version="1.1" + id="svg12" + sodipodi:docname="No-Forums.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1366" + inkscape:window-height="720" + id="namedview14" + showgrid="false" + inkscape:zoom="1.5945946" + inkscape:cx="74" + inkscape:cy="74" + inkscape:window-x="0" + inkscape:window-y="20" + inkscape:window-maximized="1" + inkscape:current-layer="svg12" /> + <rect + width="74" + height="74" + fill="black" + fill-opacity="0" + transform="scale(2)" + id="rect2" /> + <rect + width="74" + height="74" + fill="black" + fill-opacity="0" + transform="scale(2)" + id="rect4" /> + <path + d="M107.266 74.6791C111.34 74.6791 114.055 71.9635 114.055 67.8901V6.78901C114.055 2.7156 111.34 0 107.266 0H24.4404L99.1194 74.6791H107.266Z" + fill="white" + fill-opacity="0.6" + id="path6" /> + <path + d="M141.211 27.156H127.633V88.2571H112.697L148 123.56V33.945C148 29.8716 144.606 27.156 141.211 27.156Z" + fill="white" + fill-opacity="0.6" + id="path8" /> + <path + d="M8.8257 1.35742L0 10.1831L12.2202 22.4033V101.835L39.3762 74.6787H64.4955L78.0735 88.2567H39.3762V101.835C39.3762 105.908 42.0918 108.624 46.1652 108.624H98.4405L137.817 148L146.642 139.174L8.8257 1.35742Z" + fill="white" + fill-opacity="0.6" + id="path10" /> +</svg> diff --git a/briar-android/artwork/empty_state_group_list.svg b/briar-android/artwork/empty_state_group_list.svg new file mode 100644 index 0000000000..58e0218d74 --- /dev/null +++ b/briar-android/artwork/empty_state_group_list.svg @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="172" + height="140" + viewBox="0 0 172 140" + fill="none" + version="1.1" + id="svg14" + sodipodi:docname="No-Groups.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + <metadata + id="metadata20"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs18" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="754" + inkscape:window-height="480" + id="namedview16" + showgrid="false" + inkscape:zoom="1.6857143" + inkscape:cx="86" + inkscape:cy="70" + inkscape:window-x="0" + inkscape:window-y="20" + inkscape:window-maximized="0" + inkscape:current-layer="svg14" /> + <rect + width="85.9999" + height="70" + fill="black" + fill-opacity="0" + transform="scale(2)" + id="rect2" /> + <rect + width="85.9999" + height="70" + fill="black" + fill-opacity="0" + transform="scale(2)" + id="rect4" /> + <path + d="M125.091 103.444L71.9274 50.5556L38.3092 17.1111L21.1091 0L10.9455 10.1111L31.2728 30.3333C31.2728 31.8889 31.2728 32.6667 31.2728 34.2222C31.2728 47.4444 41.4365 57.5556 54.7274 57.5556C56.291 57.5556 57.0729 57.5556 58.6365 56.7778L78.182 76.2222C69.582 74.6667 60.982 73.1111 54.7274 73.1111C36.7455 73.1111 0 82.4444 0 100.333V119.778H109.455V107.333L142.291 140L152.455 129.889L142.291 119.778L125.091 103.444Z" + fill="white" + fill-opacity="0.6" + id="path6" /> + <path + d="M117.273 57.5549C130.227 57.5549 140.728 47.1082 140.728 34.2215C140.728 21.3349 130.227 10.8882 117.273 10.8882C104.319 10.8882 93.8184 21.3349 93.8184 34.2215C93.8184 47.1082 104.319 57.5549 117.273 57.5549Z" + fill="white" + fill-opacity="0.6" + id="path8" /> + <path + d="M78.1819 34.2215C78.1819 20.9993 68.0182 10.8882 54.7273 10.8882C53.9455 10.8882 53.1637 10.8882 52.3818 10.8882L78.1819 36.5548C78.1819 35.7771 78.1819 34.9993 78.1819 34.2215Z" + fill="white" + fill-opacity="0.6" + id="path10" /> + <path + d="M117.272 73.1104C116.49 73.1104 115.709 73.1104 114.927 73.1104L161.836 119.777H172V100.333C172 82.4437 135.254 73.1104 117.272 73.1104Z" + fill="white" + fill-opacity="0.6" + id="path12" /> +</svg> diff --git a/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java index 6d82236814..6c44abbc49 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/blog/FeedFragment.java @@ -81,7 +81,9 @@ public class FeedFragment extends BaseFragment implements list = v.findViewById(R.id.postList); list.setLayoutManager(layoutManager); list.setAdapter(adapter); + list.setEmptyImage(R.drawable.ic_empty_state_blog); list.setEmptyText(R.string.blogs_feed_empty_state); + list.setEmptyAction(R.string.blogs_feed_empty_state_action); return v; } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java index 2dc00d67f6..5ab78c73c8 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/contact/ContactListFragment.java @@ -148,7 +148,9 @@ public class ContactListFragment extends BaseFragment implements EventListener { list = contentView.findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(getContext())); list.setAdapter(adapter); + list.setEmptyImage(R.drawable.ic_empty_state_contact_list); list.setEmptyText(getString(R.string.no_contacts)); + list.setEmptyAction(getString(R.string.no_contacts_action)); return contentView; } diff --git a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java index 7817169b18..8e6b1fa2ae 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/forum/ForumListFragment.java @@ -97,7 +97,6 @@ public class ForumListFragment extends BaseEventFragment implements list = contentView.findViewById(R.id.forumList); list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setAdapter(adapter); - list.setEmptyText(getString(R.string.no_forums)); snackbar = Snackbar.make(list, "", LENGTH_INDEFINITE); snackbar.getView().setBackgroundResource(R.color.briar_primary); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java index d12ee90873..2015069be5 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListFragment.java @@ -69,7 +69,9 @@ public class GroupListFragment extends BaseFragment implements adapter = new GroupListAdapter(getContext(), this); list = v.findViewById(R.id.list); + list.setEmptyImage(R.drawable.ic_empty_state_group_list); list.setEmptyText(R.string.groups_list_empty); + list.setEmptyAction(R.string.groups_list_empty_action); list.setLayoutManager(new LinearLayoutManager(getContext())); list.setAdapter(adapter); diff --git a/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java b/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java index 69d063bf94..61e6bffebc 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/view/BriarRecyclerView.java @@ -2,8 +2,13 @@ package org.briarproject.briar.android.view; import android.content.Context; import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Looper; +import android.support.annotation.DrawableRes; +import android.support.annotation.StringRes; +import android.support.constraint.Group; +import android.support.v7.widget.AppCompatImageView; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.Adapter; import android.util.AttributeSet; @@ -29,7 +34,9 @@ public class BriarRecyclerView extends FrameLayout { private final Handler handler = new Handler(Looper.getMainLooper()); private RecyclerView recyclerView; - private TextView emptyView; + private Group emptyState; + private AppCompatImageView emptyImage; + private TextView emptyText, emptyAction; private ProgressBar progressBar; private RecyclerView.AdapterDataObserver emptyObserver; private Runnable refresher = null; @@ -51,9 +58,15 @@ public class BriarRecyclerView extends FrameLayout { R.styleable.BriarRecyclerView); isScrollingToEnd = attributes .getBoolean(R.styleable.BriarRecyclerView_scrollToEnd, true); + Drawable drawable = attributes + .getDrawable(R.styleable.BriarRecyclerView_emptyImage); + if (drawable != null) setEmptyImage(drawable); String emtpyText = attributes.getString(R.styleable.BriarRecyclerView_emptyText); if (emtpyText != null) setEmptyText(emtpyText); + String emtpyAction = + attributes.getString(R.styleable.BriarRecyclerView_emptyAction); + if (emtpyAction != null) setEmptyAction(emtpyAction); attributes.recycle(); } @@ -68,7 +81,10 @@ public class BriarRecyclerView extends FrameLayout { R.layout.briar_recycler_view, this, true); recyclerView = v.findViewById(R.id.recyclerView); - emptyView = v.findViewById(R.id.emptyView); + emptyState = v.findViewById(R.id.emptyState); + emptyImage = v.findViewById(R.id.emptyImage); + emptyText = v.findViewById(R.id.emptyText); + emptyAction = v.findViewById(R.id.emptyAction); progressBar = v.findViewById(R.id.progressBar); showProgressBar(); @@ -129,20 +145,40 @@ public class BriarRecyclerView extends FrameLayout { } } + public void setEmptyImage(Drawable drawable) { + if (recyclerView == null) initViews(); + emptyImage.setImageDrawable(drawable); + } + + public void setEmptyImage(@DrawableRes int res) { + if (recyclerView == null) initViews(); + emptyImage.setImageResource(res); + } + public void setEmptyText(String text) { if (recyclerView == null) initViews(); - emptyView.setText(text); + emptyText.setText(text); + } + + public void setEmptyText(@StringRes int res) { + if (recyclerView == null) initViews(); + emptyText.setText(res); + } + + public void setEmptyAction(String text) { + if (recyclerView == null) initViews(); + emptyAction.setText(text); } - public void setEmptyText(int res) { + public void setEmptyAction(@StringRes int res) { if (recyclerView == null) initViews(); - emptyView.setText(res); + emptyAction.setText(res); } public void showProgressBar() { if (recyclerView == null) initViews(); recyclerView.setVisibility(INVISIBLE); - emptyView.setVisibility(INVISIBLE); + emptyState.setVisibility(INVISIBLE); progressBar.setVisibility(VISIBLE); } @@ -151,11 +187,11 @@ public class BriarRecyclerView extends FrameLayout { Adapter adapter = recyclerView.getAdapter(); if (adapter != null) { if (adapter.getItemCount() == 0) { - emptyView.setVisibility(VISIBLE); + emptyState.setVisibility(VISIBLE); recyclerView.setVisibility(INVISIBLE); } else { // use GONE here so empty view doesn't use space on small lists - emptyView.setVisibility(GONE); + emptyState.setVisibility(GONE); recyclerView.setVisibility(VISIBLE); } progressBar.setVisibility(GONE); diff --git a/briar-android/src/main/res/drawable/ic_empty_state_blog.xml b/briar-android/src/main/res/drawable/ic_empty_state_blog.xml new file mode 100644 index 0000000000..a93f3eb1a5 --- /dev/null +++ b/briar-android/src/main/res/drawable/ic_empty_state_blog.xml @@ -0,0 +1,21 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="100dp" + android:height="96dp" + android:viewportHeight="156" + android:viewportWidth="162"> + <path + android:fillColor="#ffffff" + android:pathData="M140.87,53.647H91.565V64.235H140.87V53.647Z"/> + <path + android:fillColor="#ffffff" + android:pathData="M140.869,99.529V88.941H115.512L126.077,99.529H140.869Z"/> + <path + android:fillColor="#ffffff" + android:pathData="M140.869,71.294H97.904L108.469,81.882H140.869V71.294Z"/> + <path + android:fillColor="#ffffff" + android:pathData="M147.912,14.823H41.556L84.521,57.882V28.941H147.912V120.706H147.208L157.773,131.294C160.59,128.47 161.999,124.941 161.999,120.706V28.941C161.999,21.176 155.66,14.823 147.912,14.823Z"/> + <path + android:fillColor="#ffffff" + android:pathData="M129.6,120.706L84.522,75.529L23.948,14.823L9.157,0L0,9.176L10.565,19.765C8.452,21.882 7.043,25.412 7.043,28.941V120.706C7.043,128.471 13.383,134.824 21.13,134.824H125.374L146.504,156L155.661,146.824L143.687,134.824L129.6,120.706ZM84.522,120.706V93.882L111.287,120.706H84.522Z"/> +</vector> diff --git a/briar-android/src/main/res/drawable/ic_empty_state_contact_list.xml b/briar-android/src/main/res/drawable/ic_empty_state_contact_list.xml new file mode 100644 index 0000000000..560b137c50 --- /dev/null +++ b/briar-android/src/main/res/drawable/ic_empty_state_contact_list.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="100dp" + android:height="100dp" + android:viewportHeight="164" + android:viewportWidth="164"> + <path + android:fillColor="#ffffff" + android:pathData="M27.334,0L27.334,13.666L136.668,13.666L136.668,0L27.334,0zM27.334,27.334C19.817,27.334 13.666,33.483 13.666,41L13.666,123C13.666,130.517 19.817,136.668 27.334,136.668L136.668,136.668C144.184,136.668 150.332,130.517 150.332,123L150.332,41C150.332,33.483 144.184,27.334 136.668,27.334L27.334,27.334zM82.15,44.758C89.592,44.758 95.348,46.477 99.42,49.914C103.525,53.351 105.576,58.239 105.576,64.58C105.576,67.35 105.027,69.869 103.926,72.139C102.825,74.408 101.055,76.728 98.619,79.098L92.863,84.453C91.228,86.022 90.093,87.64 89.459,89.309C88.825,90.944 88.475,93.03 88.408,95.566L74.092,95.566C74.092,90.694 74.641,86.856 75.742,84.053C76.843,81.216 78.63,78.762 81.1,76.693C83.569,74.624 85.437,72.739 86.705,71.037C88.006,69.302 88.658,67.401 88.658,65.332C88.658,60.293 86.489,57.771 82.15,57.771C80.148,57.771 78.53,58.506 77.295,59.975C76.06,61.443 75.409,63.429 75.342,65.932L58.424,65.932C58.49,59.257 60.592,54.068 64.73,50.363C68.869,46.626 74.675,44.758 82.15,44.758zM81.398,102.324C84.068,102.324 86.288,103.125 88.057,104.727C89.859,106.295 90.76,108.314 90.76,110.783C90.76,113.253 89.859,115.289 88.057,116.891C86.288,118.459 84.068,119.242 81.398,119.242C78.729,119.242 76.493,118.459 74.691,116.891C72.923,115.289 72.039,113.253 72.039,110.783C72.039,108.314 72.923,106.295 74.691,104.727C76.493,103.125 78.729,102.324 81.398,102.324zM27.334,150.332L27.334,164L136.668,164L136.668,150.332L27.334,150.332z"/> +</vector> diff --git a/briar-android/src/main/res/drawable/ic_empty_state_forum_list.xml b/briar-android/src/main/res/drawable/ic_empty_state_forum_list.xml new file mode 100644 index 0000000000..132ec634ef --- /dev/null +++ b/briar-android/src/main/res/drawable/ic_empty_state_forum_list.xml @@ -0,0 +1,15 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="100dp" + android:height="100dp" + android:viewportHeight="148" + android:viewportWidth="148"> + <path + android:fillColor="#ffffff" + android:pathData="M107.266,74.679C111.34,74.679 114.055,71.964 114.055,67.89V6.789C114.055,2.716 111.34,0 107.266,0H24.44L99.119,74.679H107.266Z"/> + <path + android:fillColor="#ffffff" + android:pathData="M141.211,27.156H127.633V88.257H112.697L148,123.56V33.945C148,29.872 144.606,27.156 141.211,27.156Z"/> + <path + android:fillColor="#ffffff" + android:pathData="M8.826,1.357L0,10.183L12.22,22.403V101.835L39.376,74.679H64.495L78.074,88.257H39.376V101.835C39.376,105.908 42.092,108.624 46.165,108.624H98.44L137.817,148L146.642,139.174L8.826,1.357Z"/> +</vector> diff --git a/briar-android/src/main/res/drawable/ic_empty_state_group_list.xml b/briar-android/src/main/res/drawable/ic_empty_state_group_list.xml new file mode 100644 index 0000000000..21f892221d --- /dev/null +++ b/briar-android/src/main/res/drawable/ic_empty_state_group_list.xml @@ -0,0 +1,18 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="100dp" + android:height="81dp" + android:viewportHeight="140" + android:viewportWidth="172"> + <path + android:fillColor="#ffffff" + android:pathData="M125.091,103.444L71.927,50.556L38.309,17.111L21.109,0L10.946,10.111L31.273,30.333C31.273,31.889 31.273,32.667 31.273,34.222C31.273,47.444 41.437,57.556 54.727,57.556C56.291,57.556 57.073,57.556 58.637,56.778L78.182,76.222C69.582,74.667 60.982,73.111 54.727,73.111C36.745,73.111 0,82.444 0,100.333V119.778H109.455V107.333L142.291,140L152.455,129.889L142.291,119.778L125.091,103.444Z"/> + <path + android:fillColor="#ffffff" + android:pathData="M117.273,57.555C130.227,57.555 140.728,47.108 140.728,34.222C140.728,21.335 130.227,10.888 117.273,10.888C104.319,10.888 93.818,21.335 93.818,34.222C93.818,47.108 104.319,57.555 117.273,57.555Z"/> + <path + android:fillColor="#ffffff" + android:pathData="M78.182,34.222C78.182,20.999 68.018,10.888 54.727,10.888C53.945,10.888 53.164,10.888 52.382,10.888L78.182,36.555C78.182,35.777 78.182,34.999 78.182,34.222Z"/> + <path + android:fillColor="#ffffff" + android:pathData="M117.272,73.11C116.49,73.11 115.709,73.11 114.927,73.11L161.836,119.777H172V100.333C172,82.444 135.254,73.11 117.272,73.11Z"/> +</vector> diff --git a/briar-android/src/main/res/layout/briar_recycler_view.xml b/briar-android/src/main/res/layout/briar_recycler_view.xml index ad50120413..e3791373f0 100644 --- a/briar-android/src/main/res/layout/briar_recycler_view.xml +++ b/briar-android/src/main/res/layout/briar_recycler_view.xml @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout +<android.support.constraint.ConstraintLayout + android:id="@+id/relativeLayout" xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> @@ -10,24 +12,78 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" - tools:listitem="@layout/list_item_contact"/> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:listitem="@layout/list_item_contact" + tools:visibility="visible"/> <ProgressBar android:id="@+id/progressBar" style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_centerInParent="true"/> + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:visibility="invisible"/> - <TextView - android:id="@+id/emptyView" + <android.support.constraint.Group + android:id="@+id/emptyState" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:constraint_referenced_ids="emptyImage, emptyText, emptyAction" + tools:visibility="invisible"/> + + <android.support.v7.widget.AppCompatImageView + android:id="@+id/emptyImage" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_centerInParent="true" + android:layout_marginEnd="16dp" + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + app:layout_constraintBottom_toTopOf="@+id/emptyText" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_chainStyle="packed" + app:tint="?attr/colorControlNormal" + tools:src="@drawable/ic_empty_state_group_list"/> + + <TextView + android:id="@+id/emptyText" + android:layout_width="0dp" + android:layout_height="wrap_content" android:gravity="center" - android:padding="@dimen/margin_activity_horizontal" + android:padding="@dimen/margin_large" android:text="@string/no_data" android:textSize="@dimen/text_size_large" + app:layout_constraintBottom_toTopOf="@+id/emptyAction" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/emptyImage" tools:text="@string/no_contacts"/> -</RelativeLayout> \ No newline at end of file + <TextView + android:id="@+id/emptyAction" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:gravity="center" + android:paddingBottom="@dimen/margin_large" + android:paddingLeft="@dimen/margin_large" + android:paddingRight="@dimen/margin_large" + android:text="@string/no_data" + android:textSize="@dimen/text_size_small" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/emptyText" + tools:text="@string/no_contacts_action"/> + +</android.support.constraint.ConstraintLayout> \ No newline at end of file diff --git a/briar-android/src/main/res/layout/fragment_forum_list.xml b/briar-android/src/main/res/layout/fragment_forum_list.xml index 6b09a7ff6c..2a34c3e783 100644 --- a/briar-android/src/main/res/layout/fragment_forum_list.xml +++ b/briar-android/src/main/res/layout/fragment_forum_list.xml @@ -1,15 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> -<android.support.design.widget.CoordinatorLayout +<org.briarproject.briar.android.view.BriarRecyclerView + android:id="@+id/forumList" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" - android:layout_height="match_parent"> - - <org.briarproject.briar.android.view.BriarRecyclerView - android:id="@+id/forumList" - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_behavior="org.briarproject.briar.android.view.BriarRecyclerViewBehavior"/> - -</android.support.design.widget.CoordinatorLayout> + android:layout_height="match_parent" + app:emptyAction="@string/no_forums_action" + app:emptyImage="@drawable/ic_empty_state_forum_list" + app:emptyText="@string/no_forums" + app:layout_behavior="org.briarproject.briar.android.view.BriarRecyclerViewBehavior"/> diff --git a/briar-android/src/main/res/values/attrs.xml b/briar-android/src/main/res/values/attrs.xml index 8655d2126f..d2e212bb73 100644 --- a/briar-android/src/main/res/values/attrs.xml +++ b/briar-android/src/main/res/values/attrs.xml @@ -3,7 +3,9 @@ <declare-styleable name="BriarRecyclerView"> <attr name="scrollToEnd" format="boolean" /> + <attr name="emptyImage" format="integer" /> <attr name="emptyText" format="string" /> + <attr name="emptyAction" format="string" /> </declare-styleable> <declare-styleable name="AuthorView"> diff --git a/briar-android/src/main/res/values/strings.xml b/briar-android/src/main/res/values/strings.xml index fa73572f32..d9b3fc2f07 100644 --- a/briar-android/src/main/res/values/strings.xml +++ b/briar-android/src/main/res/values/strings.xml @@ -121,7 +121,8 @@ <string name="sorry">Sorry</string> <!-- Contacts and Private Conversations--> - <string name="no_contacts">No contacts to show\n\nTap the + icon to add a contact</string> + <string name="no_contacts">No contacts to show</string> + <string name="no_contacts_action">Tap the + icon to add a contact</string> <string name="date_no_private_messages">No messages.</string> <string name="no_private_messages">No messages to show</string> <string name="message_hint">Type message</string> @@ -177,7 +178,8 @@ </plurals> <!-- Private Groups --> - <string name="groups_list_empty">No groups to show\n\nTap the + icon to create a group, or ask your contacts to share groups with you</string> + <string name="groups_list_empty">No groups to show</string> + <string name="groups_list_empty_action">Tap the + icon to create a group, or ask your contacts to share groups with you</string> <string name="groups_created_by">Created by %s</string> <plurals name="messages"> <item quantity="one">%d message</item> @@ -233,7 +235,8 @@ <string name="groups_reveal_invisible">Contact relationship is not visible to the group</string> <!-- Forums --> - <string name="no_forums">No forums to show\n\nTap the + icon to create a forum, or ask your contacts to share forums with you</string> + <string name="no_forums">No forums to show</string> + <string name="no_forums_action">Tap the + icon to create a forum, or ask your contacts to share forums with you</string> <string name="create_forum_title">Create Forum</string> <string name="choose_forum_hint">Choose a name for your forum</string> <string name="create_forum_button">Create Forum</string> @@ -293,7 +296,8 @@ <string name="blogs_blog_post_created">Blog Post Created</string> <string name="blogs_blog_post_received">New Blog Post Received</string> <string name="blogs_blog_post_scroll_to">Scroll To</string> - <string name="blogs_feed_empty_state">No posts to show\n\nPosts from your contacts and blogs you subscribe to will appear here\n\nTap the pen icon to write a post</string> + <string name="blogs_feed_empty_state">No posts to show</string> + <string name="blogs_feed_empty_state_action">Posts from your contacts and blogs you subscribe to will appear here\n\nTap the pen icon to write a post</string> <string name="blogs_remove_blog">Remove Blog</string> <string name="blogs_remove_blog_dialog_message">Are you sure that you want to remove this blog?\n\nPosts will be removed from your device but not from other people\'s devices.\n\nAny contacts you\'ve shared this blog with might stop receiving updates.</string> <string name="blogs_remove_blog_ok">Remove</string> -- GitLab