I'm trying to show some information about the currently casted media inside the cast menu like this. The example apps provided by Google are using the CastCompanionLibrary, which won't be available in my project.
There isn't any hint in the Development Guide, so I really hope that there is anybody out there who knows how to do this.
Thanks in advance!
You need to write your own MediaRouteDialogFactory which needs your MediaRouteControllerDialogFragment which needs your MediaRouteControllerDialog.
Then use it via [Cast Icon] or [action bar menu item].setDialogFactory(yourMediaRouteDialogFactory).
Best to take a look at the Video Sample App.
Is the question about how to get info, or you are also asking about how to show a custom dialog when a cast icon is clicked on *while casting)? As for information, the image you referred to currently shows (a) some metadata about the media that is playing there (icon, title, ..) and (b) the playback status (paused/playing). These info are available from RemoteMediaPlayer.getMediaInfo() and getMediaStatus(). You should also register the dialog to listen to updates to media status and metadata so when the dialog is open, it can reflect the changes.
CCL is just a wrapper around the SDK apis so you can look at its code to see how it is using the SDK apis to accomplish these tasks.
Related
I am using ExoPlayer to play my streams. I have implemented Picture in Picture which works pretty good but i haven't been able to implement play, pause controls on PiP window until now. I know that by defaul Exoplayer + Picture in Picture does not give us the Picture in Picture media controls we see in the Youtube player for instance.
Anyway i searched a lot about this issue, and found out a code that may help me but the problem is that the code is in Kotlin and i am using Java, as a beginner i wasn't able to find the alternative code for Java to make it work.
This is the recommendation i got:
val mediaSession = MediaSessionCompat(this, packageName)
val mediaSessionConnector = MediaSessionConnector(mediaSession)
mediaSessionConnector.setPlayer(player, null)
mediaSession.isActive = true
I know that i should implement it onStart() after handling Exoplayer. I thinked about converting my project in Kotlin but as a beginner i would like to focus in Java and instead find a way to fix this.
Android will show media controls in Picture-in-picture mode automatically if there is an active media session for the app.
https://developer.android.com/guide/topics/ui/picture-in-picture
Also, the code you posted belongs to the media session extension library for exoplayer, so you need to add it to your build.gradle
https://github.com/google/ExoPlayer/tree/release-v2/extensions/mediasession
I followed this guide https://developers.google.com/admob/android/native/mute-this-ad
I used this code from github googlesamples too mute a Native Ad.
https://github.com/googlesamples/android-ads/blob/master/advanced/APIDemo/app/src/main/java/com/google/android/gms/example/apidemo/AdMobCustomMuteThisAdFragment.java
But how can i get the same dialog as in the first image? Now i'm getting a simple dialog with the reasons.
This is what i want
This is what i have now after following the guide and using code from googlesamples
The GoogleSamples provides only the way to implement the Mute Ad option. Not the UI.
From their example, you only received default short labels (as "Inappropriate", "Repetitive"...) and use android.R.layout.simple_list_item_1 which is the default list item with only a TextView widget. As the first picture, in production they should use custom strings with their own user interface. According to the documentation you linked:
The implementation of the custom mute interface is entirely up to you. You can place a small close button on the ad, or you can provide some other interface for the user to opt to mute the ad.
The solution might be to map the reasons with your own labels in MuteThisAdReasonWrapper into toString(), and use a custom list item instead of simple_list_item_1.
Did you set it to setRequestCustomMuteThisAd(false) and then check nativeAd.isCustomMuteThisAdEnabled() whether its getting set , So that you can confirm that its not enabled.
Moreover check once, If you are building the adloader after you set it to false .
adLoader = new AdLoader.Builder(context, "ad unit ID").withNativeAdOptions(new NativeAdOptions.Builder()
.setRequestCustomMuteThisAd(true)
.build()).build();
adLoader.loadAd(new AdRequest.Builder().build());
I am attempting to populate textview with information from objects. I am new to android development and I do not know how to approach this. Hard Coding this in the xml will not work because eventually I would like to open up the same activity but with different information.
I do not know if this is enough information but thank you for responding and if code is needed I would be more than willing to upload code or screen shots.
textview.setText(user.getName());
Refer this
https://developer.android.com/reference/android/widget/TextView.html#setText(java.lang.CharSequence)
Since using Card.io for credit card scanning,
I had to face with some limitations and looking for alternative solutions.
The issues;
1- Is there any way to customize 'KEYBOARD' button on scanning screen?
2- Is there a way to start my own view after clicking on 'KEYBOARD' button?
3- Is there any way to start my own view after scanning the card for entering expiration date, cvv, card holder name?
It doesn't look like the Card.io library provides any way to modify the text of that button.
It doesn't look like they provide any way to hook your own logic into the button either.
On iOS, it's possible to use the CardIOView class to integrate a card scanning component into your own view which would allow you to implement whatever flow you'd like... but on Android, there doesn't seem to be an equivalent to that class.
It seems like the Card.io library is rather limited on Android, but I haven't yet been able to find any viable alternatives that support both iOS and Android.
I'm sorry for such a silly question, but I can not fathom the name of this component and no amount of googling is yielding results. It's like a dialog window in a chat that holds views. I believe it's a standard UI component (possible in a later version of android).
That is a custom component specific to the search app.
The only API which is similar would be the QuickContact class. It provides a similar contextual popup for actions related to a contact (e.g., call, SMS, email, etc.).
You can use third-party libraries such as GreenDroid for similar functionality.
GreenDroid popup example http://lh4.ggpht.com/_OHO4y8YcQbs/TQFQZTft6OI/AAAAAAAAMpY/hAloaii6kRA/s800/gd7.png
Its nothing but the Quick Action Dialog ..
Check this for the Quick Action Dialog Widget....
On my HTC (with sense, android 2.2) I can get it by adding it trough
longclick -> widget -> 'google search' -> choosing 'all'