From 2af57fc59421047c58a5bb9df007c170a570821d Mon Sep 17 00:00:00 2001
From: Rulino <43948534+Rulino@users.noreply.github.com>
Date: Sat, 20 Oct 2018 17:00:02 +0200
Subject: [PATCH] Empty screen if no upload fix (#1940)
* Updated contribution screen to show message for no uploads by default, message gets wiped after any picture is inserted into the list
* Changed string as suggested
* Added margin
---
.../commons/contributions/ContributionsActivity.java | 3 +++
.../contributions/ContributionsListFragment.java | 7 +++++++
app/src/main/res/layout/fragment_contributions.xml | 12 ++++++++++++
app/src/main/res/values/strings.xml | 2 ++
4 files changed, 24 insertions(+)
diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java
index ba5894270..a903c6339 100644
--- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java
+++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsActivity.java
@@ -256,6 +256,9 @@ public class ContributionsActivity
((CursorAdapter) contributionsList.getAdapter()).swapCursor(cursor);
}
+ if(contributionsList.getAdapter().getCount()>0){
+ contributionsList.changeEmptyScreen(false);
+ }
contributionsList.clearSyncMessage();
notifyAndMigrateDataSetObservers();
}
diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsListFragment.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsListFragment.java
index e366a1468..a04c1120f 100644
--- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsListFragment.java
+++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsListFragment.java
@@ -47,6 +47,8 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
TextView waitingMessage;
@BindView(R.id.loadingContributionsProgressBar)
ProgressBar progressBar;
+ @BindView(R.id.noDataYet)
+ TextView noDataYet;
@Inject
@Named("prefs")
@@ -79,6 +81,7 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
waitingMessage.setVisibility(GONE);
}
+ changeEmptyScreen(true);
changeProgressBarVisibility(true);
return v;
}
@@ -95,6 +98,10 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
}
}
+ public void changeEmptyScreen(boolean isEmpty){
+ this.noDataYet.setVisibility(isEmpty ? View.VISIBLE : View.GONE);
+ }
+
public void changeProgressBarVisibility(boolean isVisible) {
this.progressBar.setVisibility(isVisible ? View.VISIBLE : View.GONE);
}
diff --git a/app/src/main/res/layout/fragment_contributions.xml b/app/src/main/res/layout/fragment_contributions.xml
index fa53d9721..a016d752c 100644
--- a/app/src/main/res/layout/fragment_contributions.xml
+++ b/app/src/main/res/layout/fragment_contributions.xml
@@ -7,6 +7,18 @@
android:background="?attr/mainBackground"
>
+
+
We need your permission to access the external storage of your device in order to upload images.
Log collection started. Please RESTART the app, perform action that you wish to log, and then tap \'Send Logs\' again
+ Welcome to Commons!\n
+Upload your first media by touching the camera or gallery icon above.