Modification of Leanback Video Player UI - java

I want to modify the Leanback Video Player UI. There are two things I want to change:
The Seekbar in which I want to to be able to put the cue point markers for ads.
I want to change the positions of the buttons and the title and subtitle.
I tried extending the androidx.leanback.widget.SeekBar class and modifying it and overriding the lb_playback_transport_controls_row.xml file but that class has been marked as final. I already have the cue point locations and just need to modify the Seekbar.
I don't know which class to extend and modify and which layout file to override to put the poster in.

Related

MapActivity, how to add a progress bar in the marker popup?

I'm using MapActivity and I would like to put a progress bar in the marker popup that appears by clicking on it. I would like to put it under the marker title, in the area where the snippet would have been.
the marker I use is declared as it follows
new MarkerOptions().position(infoLocal.getUserLocation()).title("Your Location").snippet("This is you!").icon(BitmapDescriptorFactory.fromResource(R.drawable.player3)).anchor(0.5f, 0.5f)
As per the Android docs:
'An info window is not a live View. Instead, the view is rendered as an image on the map. As a result, any listeners you set on the view are disregarded and you cannot distinguish between click events on various parts of the view. You are advised not to place interactive components — such as buttons, checkboxes, or text inputs — within your custom info window.'
Hence you can not put live components (like progress bar) in a info window, As it converts the whole view to an image.
If you still want to achieve this, this library may help:
https://github.com/Appolica/InteractiveInfoWindowAndroid

What object let's me have two different components on the screen at once?

I'm trying to make a minesweeper game and I sort of want it to look like this.
To clarify, I want there to be a top object so I can place the timer, the number of mines left, and the smiley face button on it (I do not want to put these on the action menu).
And the bottom object be the actual game (I already made this as a Table Layout).
The problem is, I don't know what kind of object I should be using for this. Fragments? Activities? Layouts? What do I need to accomplish this?
I do not want to put these on the action menu
Then you need to decide between Activity & Fragment. Layout is common for both Activity & Fragment which need for views.
If you use fragment then it may be little hard to implement because you constantly communicate between your table fragment & timer fragment. But advantage you found that you use it more flexible way for different device size.
I think it is easy to implement in activity. Just need vertical Linear Layout to separate your table & timer.

Create a view class that is a combination of two views Android

In my app, I have a screen that displays some images next to text. These images are downloaded from the internet, so there will be some latency in displaying them. Right now I have an ImageView and a ProgressBar overlaying each other, and toggling the visibilities when the Bitmap becomes available. Is there any way to combine the two into one class that will handle it all in case I want to use this somewhere else?
One way to go about solving the problem is to make your own custom view which extends ProgressBar and draw the image in the ondraw(Canvasn canvas) using a Rect. That way, your image can be embedded in your view and you can always make it reusable by allowing your self to set the image via a setter/resource xml files which specify the attributes that go along with your custom view. Here's a reusable ProgressButton that I wrote that maybe of use to you, it shows how I did something similar to what I described (it's one which I think works well):
PregressButton
Yes there are a number of ways to combine widgets into a single custom class. Have a read of Custom Components. This should help you decide which approach you want to use for your situation.

Creating own "SeekBar"

I want to create my own kind of a SeekBar which means I want to have for example two horizontal-sliders on a plot.
How can I do this? I just managed to bind a class to my view which draws a plot, but how can I put two sliders on it? I was thinking about putting a new layer on the plot and set a move-listener to it but have no idea how to do this. Or should I redraw the slider each time the user moves it?
The SeekBar is just for testing purpose. What I want is a slider on the plot:
Please check this question: Android Seekbar with two thumbs. Android doesn't have a standard UI control but you should be able to find third-party source code.

View different images depending on what item in my list view I click

I'm fairly new to Android programming and I've got this project I need to finish and I'm currently stuck.
I've got a standard listview in a Menu class with an array containing around 20 different elements. So what I want to do is load images in an imageview depending on which item in the listview I click, and since I'm a beginner the only idea I had was to make a new activity for each imageview which seems like a pretty bad way to do it since I'd need about 20-30 new activities..
To sum things up what I want is:
Code for making ONE activity that will display a different image depending on which item in the listview I click, probably pretty basic coding I want as simple solution as possible.
If possible I'm also looking for a solution that includes an SQLite database that stores the URL of an image and then display it in a single activity, also depending on which item I press in my current listview.
(I hope you understand my needs, and if you need I can also post my current code for the Menu class if it helps you help me) Or you can just show me a different way to make this work, I appreciate every answer! Thanks in advance!
NOTE
And please keep in mind, I'm a noob at Java and Android so keep it rather simple or at least explain what you do.
When you click on a list item, display the image in another view in the same layout, unless you want the image to take up the entire screen real estate. If you want it in the entire screen, go to a new Activity by sending the activity an Intent.
Activities are the "controller" of your application. They interact with the visible UI and the input from the user. You don't need a separate activity for each image, just an activity that's associated with a "place" in the UI (an ImageView) where you'll display the image.
I'd start by adding the images as resources under res/drawable before going on to databases.
You are going to have to do most of this yourself. There really isn't any substitute for taking the time to learn Java and Android. There are several tutorials and Android University classes under the Resources tab in the Developers Guide; I suggest you do all of them.

Categories