Adding views to MuPDFReaderView - java

I am currently using the MuPDF library from here: http://www.mupdf.com/
I've successfully compiled the library and everything is working great, though I am at a loss on how to achieve the following.
I want to attach views, such as button views, textviews, webviews and imageviews to the MuPDFReaderView. But everytime I try to add the view I fail to get any visible results, I can not see the attached view anywhere and I'm sure it's being added because when I debug it, the code is successfully run.
The reason I want to do this is to overlay views on the PDF view which will then scale and move along with the PDF document.
I ofcourse realise there isn't any code in this question, but I can't really post the entire MuPDF source code here, so here's what I think is relevant in a pastebin:
http://pastebin.com/qJFNsvdV
So yeah, how and where would I attach views to the document so they scale and move with the document properly?

We have a similar feature in our Android customizable magazine app, using muPDF: we add views on top on the pdf view to display slide shows or videos inside a magazine page.
This app is open source and available on Github. It should be easy for you to review the code, and see how we implemented this feature.

Related

Android Studio: View who is visible only in preview

I have a simple question. I'm making application in Android Studio and I have got a problem. My application is creating buttons using Java. I want see these buttons in Preview editor, because I want have easier posibility to editing layout. So I made the same buttons in XML, but here is the problem. When I build my app it is showing both buttons! I want see only the buttons creating by Java code and finally here is my question it is possible remove buttons created in XML? I was thinking about tools:.. but I didn't find any usefull tag. Someone have any idea?
You can use tools:visibility="visible" and android:visibility="gone" together, so they show in the preview, but they're gone when the app is running on a device/emulator.
As already mentioned, you use tools:visibility="visible" in combination with android:visibility="gone" to render any view in preview but not in the build.
Using removeView(someChildElement) on your layout will remove the element you don't want. AFAIK, the XML code will still be there in the APK, but it isn't there at all in the built APK.
I have no clue why you want to show them in preview and not in the finished result. If it is because you want to toggle them manually later, you don't need any XML code. You can also do:
someView.setVisibility(GONE)
And a quick reference:
Visible - the view is visible
Invisible - the view is invisible, but still takes up space
Gone - the view is invisible and takes up no space
You cannot remove the code from the XML file on build though.

How to create a working ViewPager App?

I am trying to develop an application which would be a lot better if it had a clean ViewPagerUI. I dont need fancy menus (yet), all I want is that if I start my application It starts out as one relative Layout, and i can then swipe left and right to view two more Relative Layouts.
I have read, watched and studied tons and tons of tutorials in the past week, but they all seem to either be outdated, don't fit my needs (because they create new "pages" with a while/for loop, which is definetely not what i'm looking for), or are way to complicated/ leave out important information( i am a fresh developer, but I really don't want to give up) like the official guide on the android developers webpage.
I get that experienced developers can get a lot out of these tutorials, but I don't find them to be very informative for beginners/newbs.
Questions I asked myself while reading different guides are:
Which differernt java classes/ xml files do I need to create, and which code goes where?
How does the ViewPager know which Fragment I want to display on any page?
How can I add working, "connected" code to all three fragments?
To give you some helpful information:
The first page should display a chart
The second page contains edit texts, which add items to an array and thus to the chart on the first page on button click
The third page contains settings for the chart
I don't need ANY other pages/activities/main menus whatsoever. Only these three interacting pages.
I`ve found it to be the best option to go with relative layouts.
The second page should be the main page.
I am sorry if you think that my issue is dumb, but i am trying to create this app for over a week now, and i seem to not get any traction.
Thanks in advance!

How to create jquery Tabs in native android

I wanted to know how to create the same ui as in the jquery tabs of following link:
http://jqueryui.com/tabs/
I am concerned with the look and feel the view underneath the selected tabs should be looking exactly the way it is shown in the link above.
Also I need to change the background image of the tab i have 2 separate image for selected and unselected tabs.
How to go ahead with this please guide me with example or tutorial?
I searched a lot but was unable to find any technique for doing this attaching the image for reference
Thanks in Advance please do reply.

XML files and the ActionBar

I am very new to android programming, migrating over from iOS and I am having a hard time.
So, I have set up a new application in Eclipse IDE with a fixed tab and swipe navigation. So it appears to have created a ActionBar. However, I need to change the content of each page rather than it just telling me which tab I clicked.
I have been searching for this for about, 30-45 mins now, and I cannot find anything which makes any sense!
How can I attach a new XML file to a view?
I think the code you are looking for is:
setContentView(R.layout.your_xml_file)
Make sure your xml file is in your res/layout folder in your project
As for your button listener, check this answer.

Android View similar to Google's Youtube app?

I know that Android's Youtube app is not open source, but I pulled apart the apk with apktool and found that they have a class, YoutubeListView used frequently in their app. Is there already an open source implementation of the Youtube Player Activity's title/ fling view/ layout? I know of similar views like Joao Machete's FlingAndScrollViewer, but I need it to be rigge to a title menu and work as smoothly as that on the Youtube app. If there is no open source implementation, either how hard would it be to convince Google to release just that component's source, or to implement it myself?
Thanks
Btw, the footer in this layout is what I am talking about. It has titles like Info & Related videos that can be clicked and it scrolls to them, and it can be scrolled left and right.
I've come to the conclusion that there is no such view. It would be best to make my own custom layout.

Categories