Skip to content

Conversation

@ujjwalagrawal17
Copy link
Contributor

Add Search activity, image search feature

Fixes #1521 (Add search Images from commons feature)
Fixes #1522 (Browse search field: Pressing Enter should launch search, rather than add newline character)

Description

  • Search activity added for browse feature
  • Menu added in featured image activity to Open search activity
  • Search Image Fragment added which has a recyclerview to show search results (images)
  • Search Activity contains a toolbar with edittext to search which on text change updates imageList
  • Also onclick of image in search results, a instance of media detail pager fragment replaces a search images fragment. (To open media details)
  • SearchImageRenderer added (handles presentation of individual image)
  • Icons for search and back button are added.

Tests performed

Manually tested on [API 25 Motog5S+] with ProdDebug
Please test on ProdDebug as betaDebug variant doesn't have many images to search

Screenshots showing what changed

screenshot_20180515-140342

screenshot_20180528-125309

screenshot_20180528-125300

screenshot_20180528-125328

screenshot_20180528-125349

@ujjwalagrawal17 ujjwalagrawal17 changed the base branch from master to browse-commons-via-app May 28, 2018 08:19
@ujjwalagrawal17
Copy link
Contributor Author

@neslihanturan @nicolas-raoul I have completed search feature. Can you tell me the improvements? Also, some extra commits are coming due to merging master, how can I remove them?


@Override
public void onBackPressed() {
if (getSupportFragmentManager().getBackStackEntryCount()==1){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces around ==


public class SearchImageFragment extends CommonsDaggerSupportFragment {

public static final int SEARCH_IMAGES_LIMIT = 25;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc


return rootView;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc

private Observable<SearchImageItem> searchImages(String query) {
return mwApi.searchImages(query, SEARCH_IMAGES_LIMIT).map(s -> new SearchImageItem(s));
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc

@@ -0,0 +1,13 @@
package fr.free.nrw.commons.explore.images;

public class SearchImageItem {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc

import java.util.List;


class SearchImagesAdapterFactory {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc

interface ImageClickedListener {
void imageClicked(SearchImageItem item);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc

return CategoryImageUtils.getMediaList(childNodes);
}

@Override
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc

@nicolas-raoul
Copy link
Member

nicolas-raoul commented May 28, 2018

Strangely I get Failed to resolve: common at implementation 'commons-codec:commons-codec:1.10' when building...

Could not find common.jar (android.arch.core:common:1.1.0).
Searched in the following locations:
    https://jcenter.bintray.com/android/arch/core/common/1.1.0/common-1.1.0.jar

@ujjwalagrawal17
Copy link
Contributor Author

Umm, @nicolas-raoul I have not changed anything in gradle files and it is working fine in my Laptop.

@ujjwalagrawal17
Copy link
Contributor Author

@nicolas-raoul Also can we enable codacy for our branch.

@neslihanturan
Copy link
Collaborator

can you ping me when it is ready to test @ujjwalagrawal17 ?

@ujjwalagrawal17
Copy link
Contributor Author

@neslihanturan @nicolas-raoul I think it is ready for review.

@neslihanturan
Copy link
Collaborator

Okay so search is added to featured activity for now. But it will be added to another activity in future right? Our task has no relation with featured activity.

@ujjwalagrawal17
Copy link
Contributor Author

Actually, we can rename featured image activity as explore Activity and menu in a drawer. We don't have to make a new activity for Explore feature then. If we make a separate activity then featured image will not be used. So I think its better to refractor already existing activity.

@neslihanturan
Copy link
Collaborator

We have to think about UIs. Because Featured images is not same with explore. You can explore ALL images. But when we add search icon top of featured images, it feels like user can only search in featured images. This is not the case.

@ujjwalagrawal17
Copy link
Contributor Author

Yes @neslihanturan you are right. There are 2 solutions for this -

  • We can change and refractor featured activity and rename it explore and below toolbar we can maybe mention that below images are featured using a textview maybe.
  • Or create a seperate Explore activity and do it there.

@ujjwalagrawal17
Copy link
Contributor Author

In both cases in toolbar and navigation drawer, we have to write "Explore".

@misaochan
Copy link
Member

@neslihanturan Can that issue not be solved by having existing text in the search bar that says "Search all images in Commons"?

I would personally prefer Browse and Featured to be united in a single activity if possible, as they are highly related and it reduces cluttering. I believe we were discussing this at #1521

@neslihanturan
Copy link
Collaborator

neslihanturan commented May 28, 2018

I also meant we definitely should have them in same activity but maybe different tabs? Or your solution could also work. Under any case I think it is better to discuss on mockups. @ujjwalagrawal17 are you willing to create some mockups to find best solution? @nicolas-raoul I really wonder your opinion about this topic.

Please continue to discussion at #1521

@ujjwalagrawal17
Copy link
Contributor Author

@neslihanturan sure I will share some mock-ups tomorrow. I think we can merge that in a seperate PR.

@neslihanturan
Copy link
Collaborator

Travis fail is not about this PR. Thanks a lot @ujjwalagrawal17 for great job! Looking forward for your other PRs:)

@neslihanturan neslihanturan merged commit df82383 into commons-app:browse-commons-via-app May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants