Fixes #2843 New main screen UI in v3.0 (#3891)

* Add additional classes from 2019 hackathon implementation

* Make first tab work

* Make explore tab work

* Handle back button for contrib and nearby

* Fix framelayout and nav bar allignment

* Fix nav bar tint

* Fix nearby card layout

* Make contributions number visible

* Change menu icon according to fragment

* Make notification icon work and remove drawer

* Make favourites accessible from nav bar

* Turn bookmark and explore activities into fragments

* Use bottom sheet instead of more fragment

* Add actions

* Remove unused classes

* Fix indentation

* remove more fragment title

* Fix explore fragment indentation

* Make toolbar settings as we wanted

* Set card view styles

* Make colors for explore actiivty

* Remove drawer from achievements activity

* Add back button to achievements activity

* remove drawer from review activity

* Remove drawer from settings activity

* Remove drawer from about activity

* Fix dagger injection of fragment

* Implement skip login version

* Add theme missing colors

* Add style to moresheet

* refactor name

* call login with button

* Remove all old bookmarks activity dependency

* Make explore tab items clickable

* Do nothing if same tab is selected

* Fix notification icon color for dark theme

* Fix wrong drawable colors

* Handle back button after media details is visible from contrib and explore fragments

* make favourites open media details

* Fix profile icon

* Make user name visible instead

* Move user back to contrib fragment

* Remove NavigationBaseAvticity

* Fix typo in bookmark fragment

* Fix menu button colors

* Remove explore activity

* remove drawer and dependencies

* Make bookmark media details visible

* Cleanup code

* Code cleanup

* Remove unused layout

* Make contriblist UI look like in mockups

* Change limited connecton toggle

* Move list menu item to nearby fragment

* Fix search button crash

* Make media detail appear

* Back button added

* Fix back button npe

* Change bookmark list view

* Fix always the firs item displayed issue

* Allign contrib list bottom line to simple drawee bottom

* fix fragment string

* Fix back button for mobile uploads

* Make lists appear

* Make fav item selected

* Make favourites clickable

* Add back button to media details

* Add toolbar of notification activity

* Change contributions icon

* Fix card UI

* Fix back button in explore

* Make card views look similar to mockups

* Solve campaign bug visible issue

* Make borders a little softer
This commit is contained in:
neslihanturan 2020-11-06 19:04:04 +03:00 committed by GitHub
parent 5d82629109
commit 71d200ee41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
110 changed files with 2225 additions and 1629 deletions

View file

@ -280,9 +280,11 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
if (getParentFragment() != null && getParentFragment().getParentFragment() != null) {
//Added a check because, not necessarily, the parent fragment will have a parent fragment, say
// in the case when MediaDetailPagerFragment is directly started by the CategoryImagesActivity
((ContributionsFragment) (getParentFragment()
if (getParentFragment() instanceof ContributionsFragment) {
((ContributionsFragment) (getParentFragment()
.getParentFragment())).nearbyNotificationCardView
.setVisibility(View.GONE);
}
}
categoryEditSearchRecyclerViewAdapter =
new CategoryEditSearchRecyclerViewAdapter(getContext(), new ArrayList<>(
@ -795,7 +797,6 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
}
private void rebuildCatList(List<String> categories) {
Log.d("deneme","rebuild cat list size:"+categories.size());
categoryContainer.removeAllViews();
for (String category : categories) {
categoryContainer.addView(buildCatLabel(sanitise(category), categoryContainer));

View file

@ -27,8 +27,10 @@ import fr.free.nrw.commons.bookmarks.Bookmark;
import fr.free.nrw.commons.bookmarks.pictures.BookmarkPicturesContentProvider;
import fr.free.nrw.commons.bookmarks.pictures.BookmarkPicturesDao;
import fr.free.nrw.commons.contributions.Contribution;
import fr.free.nrw.commons.contributions.MainActivity;
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
import fr.free.nrw.commons.mwapi.OkHttpJsonApiClient;
import fr.free.nrw.commons.theme.BaseActivity;
import fr.free.nrw.commons.utils.DownloadUtils;
import fr.free.nrw.commons.utils.ImageUtils;
import fr.free.nrw.commons.utils.NetworkUtils;
@ -57,6 +59,8 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
MediaDetailAdapter adapter;
private Bookmark bookmark;
private MediaDetailProvider provider;
private boolean isFromFeaturedRootFragment;
private int position;
public MediaDetailPagerFragment() {
this(false, false);
@ -66,6 +70,15 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
public MediaDetailPagerFragment(Boolean editable, boolean isFeaturedImage) {
this.editable = editable;
this.isFeaturedImage = isFeaturedImage;
isFromFeaturedRootFragment = false;
}
@SuppressLint("ValidFragment")
public MediaDetailPagerFragment(Boolean editable, boolean isFeaturedImage, int position) {
this.editable = editable;
this.isFeaturedImage = isFeaturedImage;
isFromFeaturedRootFragment = true;
this.position = position;
}
@Override
@ -77,6 +90,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
pager.addOnPageChangeListener(this);
adapter = new MediaDetailAdapter(getChildFragmentManager());
((BaseActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (savedInstanceState != null) {
final int pageNumber = savedInstanceState.getInt("current-page");
@ -97,6 +111,9 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
} else {
pager.setAdapter(adapter);
}
if (getActivity() instanceof MainActivity) {
((MainActivity)getActivity()).hideTabs();
}
return view;
}
@ -218,8 +235,13 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
if(provider == null) {
return;
}
final int position;
if (isFromFeaturedRootFragment) {
position = this.position;
} else {
position = 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
@ -276,7 +298,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
private void updateBookmarkState(MenuItem item) {
boolean isBookmarked = bookmarkDao.findBookmark(bookmark);
int icon = isBookmarked ? R.drawable.ic_round_star_filled_24px : R.drawable.ic_round_star_border_24px;
int icon = isBookmarked ? R.drawable.menu_ic_round_star_filled_24px : R.drawable.menu_ic_round_star_border_24px;
item.setIcon(icon);
}
@ -349,7 +371,11 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
}
pager.postDelayed(() -> getActivity().invalidateOptionsMenu(), 5);
}
return MediaDetailFragment.forMedia(i, editable, isFeaturedImage, isWikipediaButtonDisplayed);
if (isFromFeaturedRootFragment) {
return MediaDetailFragment.forMedia(position+i, editable, isFeaturedImage, isWikipediaButtonDisplayed);
} else {
return MediaDetailFragment.forMedia(i, editable, isFeaturedImage, isWikipediaButtonDisplayed);
}
}
@Override