Fix #2139: Now showing "Upload your media" text properly (#2539)

* "Upload your media..." text was being shown while contributions were
  still being loaded. Fixed things to show after load is finished and no
  contributions are present. Also updated text string since UI now uses
  FAB button for uploads (no camera/gallery) icons any more.
* Removed waitingMessage in ContributionsListFragment and from layout
  since its never VISIBLE, only GONE.
This commit is contained in:
srinivas1729 2019-03-05 11:06:08 -08:00 committed by Vivek Maskara
parent def0d3da43
commit 0c2ae1df18
4 changed files with 8 additions and 25 deletions

View file

@ -309,7 +309,7 @@ public class ContributionsFragment
((CursorAdapter) contributionsListFragment.getAdapter()).swapCursor(cursor);
}
contributionsListFragment.clearSyncMessage();
contributionsListFragment.showWelcomeTip(cursor.getCount() == 0);
notifyAndMigrateDataSetObservers();
((ContributionsListAdapter)contributionsListFragment.getAdapter()).setUploadService(uploadService);
}

View file

@ -36,8 +36,6 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
@BindView(R.id.contributionsList)
GridView contributionsList;
@BindView(R.id.waitingMessage)
TextView waitingMessage;
@BindView(R.id.loadingContributionsProgressBar)
ProgressBar progressBar;
@BindView(R.id.fab_plus)
@ -46,8 +44,8 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
FloatingActionButton fabCamera;
@BindView(R.id.fab_gallery)
FloatingActionButton fabGallery;
@BindView(R.id.noDataYet)
TextView noDataYet;
@BindView(R.id.noContributionsYet)
TextView noContributionsYet;
@Inject @Named("default_preferences") BasicKvStore basicKvStore;
@Inject @Named("direct_nearby_upload_prefs") JsonKvStore directKvStore;
@ -67,7 +65,6 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
contributionsList.setOnItemClickListener((AdapterView.OnItemClickListener) getParentFragment());
changeEmptyScreen(true);
changeProgressBarVisibility(true);
return view;
}
@ -79,10 +76,6 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
setListeners();
}
public void changeEmptyScreen(boolean isEmpty){
this.noDataYet.setVisibility(isEmpty ? VISIBLE : GONE);
}
private void initializeAnimations() {
fab_open = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_open);
fab_close = AnimationUtils.loadAnimation(getActivity(), R.anim.fab_close);
@ -125,11 +118,10 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
}
/**
* Clears sync message displayed with progress bar before contributions list became visible
* Shows welcome message if user has no contributions yet i.e. new user.
*/
protected void clearSyncMessage() {
waitingMessage.setVisibility(GONE);
noDataYet.setVisibility(GONE);
protected void showWelcomeTip(boolean noContributions) {
noContributionsYet.setVisibility(noContributions ? VISIBLE : GONE);
}
public ListAdapter getAdapter() {

View file

@ -8,7 +8,7 @@
>
<TextView
android:id="@+id/noDataYet"
android:id="@+id/noContributionsYet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/no_uploads"
@ -19,15 +19,6 @@
android:layout_marginEnd="@dimen/tiny_gap"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/waiting_first_sync"
android:id="@+id/waitingMessage"
android:layout_gravity="center"
android:visibility="gone"
android:layout_centerHorizontal="true"
/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -417,7 +417,7 @@
<string name="uploaded_by_myself">Uploaded by myself on %1$s, used in %2$d article(s).</string>
<string name="no_uploads">Welcome to Commons!\n
Upload your first media by touching the camera or gallery icon above.</string>
Upload your first media by tapping on the add button.</string>
<string name="desc_language_Worldwide">Worldwide</string>
<string name="desc_language_America">America</string>