mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-03 08:13:55 +01:00
#3847 Convert Media and Contribution to Kotlin Data Classes - convert to data classes - compose a contribution with a media (#3848)
Co-authored-by: Vivek Maskara <maskaravivek@gmail.com>
This commit is contained in:
parent
3361155fad
commit
cc2f14dab8
34 changed files with 334 additions and 741 deletions
|
|
@ -188,7 +188,8 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
|||
return;
|
||||
}
|
||||
|
||||
Media m = provider.getMediaAtPosition(pager.getCurrentItem());
|
||||
final int position = pager.getCurrentItem();
|
||||
Media m = provider.getMediaAtPosition(position);
|
||||
if (m != null) {
|
||||
// Enable default set of actions, then re-enable different set of actions only if it is a failed contrib
|
||||
menu.findItem(R.id.menu_browser_current_image).setEnabled(true).setVisible(true);
|
||||
|
|
@ -204,10 +205,9 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
|||
BookmarkPicturesContentProvider.uriForName(m.getFilename())
|
||||
);
|
||||
updateBookmarkState(menu.findItem(R.id.menu_bookmark_current_image));
|
||||
|
||||
if (m instanceof Contribution) {
|
||||
Contribution c = (Contribution) m;
|
||||
switch (c.getState()) {
|
||||
final Integer contributionState = provider.getContributionStateAt(position);
|
||||
if (contributionState != null) {
|
||||
switch (contributionState) {
|
||||
case Contribution.STATE_FAILED:
|
||||
case Contribution.STATE_IN_PROGRESS:
|
||||
case Contribution.STATE_QUEUED:
|
||||
|
|
@ -289,6 +289,8 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
|||
Media getMediaAtPosition(int i);
|
||||
|
||||
int getTotalMediaCount();
|
||||
|
||||
Integer getContributionStateAt(int position);
|
||||
}
|
||||
|
||||
//FragmentStatePagerAdapter allows user to swipe across collection of images (no. of images undetermined)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue