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
This commit is contained in:
Rulino 2018-10-20 17:00:02 +02:00 committed by Vivek Maskara
parent 6bee91496e
commit 2af57fc594
4 changed files with 24 additions and 0 deletions

View file

@ -256,6 +256,9 @@ public class ContributionsActivity
((CursorAdapter) contributionsList.getAdapter()).swapCursor(cursor); ((CursorAdapter) contributionsList.getAdapter()).swapCursor(cursor);
} }
if(contributionsList.getAdapter().getCount()>0){
contributionsList.changeEmptyScreen(false);
}
contributionsList.clearSyncMessage(); contributionsList.clearSyncMessage();
notifyAndMigrateDataSetObservers(); notifyAndMigrateDataSetObservers();
} }

View file

@ -47,6 +47,8 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
TextView waitingMessage; TextView waitingMessage;
@BindView(R.id.loadingContributionsProgressBar) @BindView(R.id.loadingContributionsProgressBar)
ProgressBar progressBar; ProgressBar progressBar;
@BindView(R.id.noDataYet)
TextView noDataYet;
@Inject @Inject
@Named("prefs") @Named("prefs")
@ -79,6 +81,7 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
waitingMessage.setVisibility(GONE); waitingMessage.setVisibility(GONE);
} }
changeEmptyScreen(true);
changeProgressBarVisibility(true); changeProgressBarVisibility(true);
return v; 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) { public void changeProgressBarVisibility(boolean isVisible) {
this.progressBar.setVisibility(isVisible ? View.VISIBLE : View.GONE); this.progressBar.setVisibility(isVisible ? View.VISIBLE : View.GONE);
} }

View file

@ -7,6 +7,18 @@
android:background="?attr/mainBackground" android:background="?attr/mainBackground"
> >
<TextView
android:id="@+id/noDataYet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/no_uploads"
android:gravity="center"
android:layout_centerInParent="true"
android:visibility="gone"
android:layout_marginRight="@dimen/tiny_gap"
android:layout_marginEnd="@dimen/tiny_gap"
/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -358,4 +358,6 @@
<string name="write_storage_permission_rationale_for_image_share">We need your permission to access the external storage of your device in order to upload images.</string> <string name="write_storage_permission_rationale_for_image_share">We need your permission to access the external storage of your device in order to upload images.</string>
<string name="log_collection_started">Log collection started. Please RESTART the app, perform action that you wish to log, and then tap \'Send Logs\' again</string> <string name="log_collection_started">Log collection started. Please RESTART the app, perform action that you wish to log, and then tap \'Send Logs\' again</string>
<string name="no_uploads">Welcome to Commons!\n
Upload your first media by touching the camera or gallery icon above.</string>
</resources> </resources>