Devsoc-BPGC / DoJMA

DoJMA news app for BITS Pilani K K Birla Goa Campus students
6 stars 18 forks source link

Bug in Article Viewer #120

Closed aryanagarwal15 closed 6 years ago

aryanagarwal15 commented 6 years ago

Issue: In article images must be handled separately in ArticleViewerActivity. Currently the images shown are of actual length and are flowing out of bounds.

Mimic the issue: Search for "Runtastic Routes" article and scroll down to see in article images.

Screenshot:

aryanagarwal15 commented 6 years ago

@Rushi98 Please allot this to me. I'll revamp the Article Activity all together.

Rushi98 commented 6 years ago

How can this be solved? Showing images separately from text might not be a good idea as it would lose context. As can be demonstrated by the post in question itself.

aryanagarwal15 commented 6 years ago

I am planning to apply advanced string manipulation techniques. Will just add a width attribute to image.

Rushi98 commented 6 years ago

please explain (advanced string manipulation techniques)

aryanagarwal15 commented 6 years ago

Basically here I have two methods to try out 1) Adding custom style attribute to each tag. with correct width and padding. 2) Adding a custom style sheet to the html. With specific width for all the images.

Rushi98 commented 6 years ago

how to do it on raw html?

aryanagarwal15 commented 6 years ago

htmlData = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />" + htmlData; // lets assume we have /assets/style.css file webView.loadDataWithBaseURL("file:///android_asset/", htmlData, "text/html", "UTF-8", null);

Rushi98 commented 6 years ago

The example post (http://bitsherald.org/api/get_post/?id=3412) has width and height as inline style. This will override the stylesheet attached. Source: https://www.w3schools.com/css/css_howto.asp

aryanagarwal15 commented 6 years ago

https://stackoverflow.com/questions/16813220/how-can-i-override-inline-styles-with-external-css

We can put !important in external css file for it to override inline style/width attributes.

Rushi98 commented 6 years ago

fixed by #128