how to implement Facebook like layout to show photos in android - android

I want to show photos in my application like Faceook shows. Currently I have a recyclerview and the list of this recyclerview contains some images, textviews etc. In this list I want to add a GridView also to show images as the no of images may be more than 1, so I want to show them in Grid.
My whole layout is like how facebook shows news feeds, but I want to implement the same layout of photos as well.
Can anybody help me here, so that I can implement the same layout of photos also.
Thank you so much in advanced.

Related

Displaying One or Multiple Photos in post like Instagram

I am creating a photo blog app using firebase. I am able to allow user to post one or multiple photos on the firebase database and I am also able to retrieve them successfully.
Above image is the bottom view of an instagram post.
Just like that I want some type of View or Layout. I already have a working layout which can show only one image with like, comment and share options.
If the user wants post one photo, the layout should show just one slide and if user wants to post multiple photos, it should create a so called Sliding View to display all images side by side.
How do I do this ?
If you want me to clarify anything in more detail, please let me know.
If you need to build something similar that you mentioned then take example from the following library.
View Pager Indicator
You need to use ViewPager along with CirclePageIndicator mentioned in the library.
ViewPager - images container
CirclePageIndicator - circle indicator
You will need to add another overlapping view, which will contain like, comments and other buttons.

How to share adapter items with two recycler views?

I am trying to implement Instagram like Search fragment where they have explore posts(contains only the image) in a grid layout and when we click on them, it changes to another feed like view showing more details.
The way I am thinking to implement is to have two fragments with recycler views: 1 for grid layout and 1 for feed like. Share the currently, loaded feed items between these two recycler view adapters.
Question: Is it the correct approach to share adapter items between two views? If not, what would the design be? I suspect I will run into issues if we share the items.
Kindly let me know if any more details is needed. I can share pictures as well in case someone needs for android device.
I went ahead and implemented my design. Till now, I haven't seen any issues.

Facebook timeline like listview

The Facebook timeline seems to display all the feeds in the listview vertically. When the user shares his/her multiple photos, then those photos are displayed in horizontal list view. Has anybody any idea, how this actually works. Because I don't think nesting a horizontal listview within vertical listview works. Nor does the horizontal listview functions smoothly within the vertical scrollbar. So, if anybody has any idea about how Facebook implements its views in timeline, do share it here.
To use a gallery for the photos check out that example:
https://stackoverflow.com/a/11544447/944070
You may also need an implementation of different list items per case, so this answer would also be helpful https://stackoverflow.com/a/3515221/944070
That can be done using custom list view. Below tutorial covers facebook like feed view using volley networking library
Android Facebook like Custom ListView Feed using Volley

Custom Adapter for Gallery View in Android

hi i want to split my gallery with 5 images in 2 rows.
Please let me know how to do this in android using Gallery View & custom adapter for Gallery view.
Is there any sample code available please share it, i have already checked the previous posts in this site.
Thanks
If you still need this and Pagination instead of scroll will work for you, you might look at: https://github.com/sfarooq/PaginatedGallery
I designed it using ViewPager so you can manipulate the adapter to send any kind of views you want including two row views.
If you must use scrolling galleries you could implement two separate gallery in a vertical orientation and send touch events from each to the other.

How to display images on demand inside a listview?

I am building a android aplication which will be consuming a json file from the internet. This json file contains a list of news from a particular website. Each json object contains information such like title, summary, descripition and web links for the news thumbnail and the original image.
I will be displaying in a listview three information: the news thumbnail, the title and the summary. Here resides my problem. I dont want to load all thumbnails from the internet if they wont be displayed. What I am trying to say is that why download a thumbnail from the 30th news if the user wont scroll down the image. So, i will, initially only download the thumnails from those news that are being displayed in the screen and when the user scrolls down to see more news, as soon as the list item appers to the screen i want to download the image and then display.
Is there a way to achieve this? Is it possible to find out if the list item is on the screen? I have been searching all over the internet for a solution for this but i am running out of ideas.
Thanks
T
You essentially want to lazy load your images. This will only load images that are currently being shown and as you scroll through the list view it will go and fetch those currently shown images.

Categories

Resources