Toolbar for kitkat - toolbar

I have a problem with my toolbar when using my KitKat device. On my lollipop device everything works fine.
The problem is that my toolbar doesnt notice my touch in my action button in the toolbar.
I've already tried using a cardview but that didnt helped me.
Also with the cardview my toolbar doesnt fill the hole space in my KitKat device
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#0610DB"
card_view:cardElevation="4dp"
card_view:cardCornerRadius="0dp">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#0610DB"
android:theme="#style/ThemeOverlay.AppCompat.Dark"
android:minHeight="?attr/actionBarSize"/>
</android.support.v7.widget.CardView>

Related

Are Android TV and Fire TV devices always guaranteed to overscan?

I have a super simple video player on Android TV / Fire TV, basically my UI is just a 'Layoutmatching parent and then inside aPlayerView` also matching parent.
On both Android TV and Fire TV on different TVs I'm getting about 2.5% overscan. I can easily correct for this following the guidelines of Android TV development but should I make that apply to all my users? I fear that if I release an update with this then some users will end up with the video not filling the entire TV. Is there maybe a way to know if I need to account for overscan?
This is my layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/black"
tools:context=".connected.VideoFragment">
<com.google.android.exoplayer2.ui.PlayerView
android:id="#+id/videoView"
app:surface_type="texture_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:controller_layout_id="#layout/custom_player_controls" />
</androidx.appcompat.widget.LinearLayoutCompat>
Edit: I would like to mention that I played a YouTube video in the YouTube app that shows you the amount of overscan and the YouTube app also has 2.5% overscan. Replicated this on 3 tvs.
The amount of overscan is specific to the TV panel. Some TVs don't have any but some have up to 5%. Some models allow the user to adjust the overscan, but not all unfortunately. For professional video (e.g., Hollywood movies or TV shows), overscan is considered in the framing of all the content, so it's safe to go edge-to-edge. Some TVs will cut off a small portion of the video, but it won't be anything vital like titles, subtitles, etc. For other types of video, it can be more problematic, especially for screen recordings where menus and tools can be cut off, so it depends on your use case a bit. You can consider making it user-adjustable.
For all of your non-video content, you should account for the overscan for anything important to the user (menus, buttons, text, etc.) but typically a background image will go edge-to-edge. A simple XML layout would be something like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Screen elements that can render outside the overscan safe area go here -->
<!-- Nested RelativeLayout with overscan-safe margin -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="27dp"
android:layout_marginBottom="27dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="48dp">
<!-- Screen elements that need to be within the overscan safe area go here -->
</RelativeLayout>
</RelativeLayout>
Note: If you're using the AndroidX Leanback fragments (e.g., BrowseSupportFragment), then overscan is handled for you.

Remove padding/margin on Xamarin Forms AppShell titlebar (toolbar)

I've been banging my head against a wall trying to figure this out using all kinds of fixes i found on SO and other sites but to no avail...
I'm using AppShell and I can't get the padding/margin next to the hamburger button to go away.
As you can see, next to the hamburger button there is extra padding or margin but i don't think it belongs to the TitleView (the black is a view that i use, it's black to show the boundaries).
In my OnCreate function i already have the ToolbarResource = Resource.Layout.Toolbar;
In Toolbar.xml i added xmlns:app="http://schemas.android.com/apk/res-auto"
and app:contentInsetLeft="0dp" app:contentInsetStart="0dp" app:contentInsetStartWithNavigation="0dp" as suggested here and here but those seem to be solutions for NavigationPage, but i don't use that in AppShell.
Help would be much appreciated!
Edit: I created a CustomRenderer for the AppShell to see if that would make a difference.
but as you can see only the ContentInsetEndWithActions and ContentInsetStartWithNavigation actually get set to 0. The other ones remain 32 so they obviously ignore the Toolbar.xml.
I found the solution:
In the MainActivity replace this code:
this in combination with the CustomRenderer made it work finally...

Setting Orientation in Gluon Application

I want to prevent my Gluon Application which written with javaFX from rotating by setting the Orientation to Portrait only
anyone can help ?
Add this line to your AndroidManifest.xml under the activity tag:
android:screenOrientation="portrait"

Download image and resize to avoid OOM errors, Picasso fit() distorts image

I am trying to show images in a full screen view and using the following code:
// Target to write the image to local storage.
Target target = new Target() {
// Target implementation.
}
// (1) Download and save the image locally.
Picasso.with(context)
.load(url)
.into(target);
// (2) Use the cached version of the image and load the ImageView.
Picasso.with(context)
.load(url)
.into(imgDisplay);
This code works well on newer phones, but on phones with 32MB VMs, I get out of memory issues. So I tried changing (2) to:
Picasso.with(context)
.load(url)
.fit()
.into(imgDisplay);
This resulted in distorted images. Since I do not know the dimensions of the image until it is downloaded, I cannot set the ImageView dimensions, and hence the image is being resized without any consideration to aspect ratio in to my ImageView:
<ImageView
android:id="#+id/imgDisplay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
What is the best way to handle this situation? My original images have max width 768, and height 1024, and I want to downsample when the screens are much smaller than this. If I try to use resize(), my code becomes complicated, as I have to wait for (1) to finish the download and then add the resize() in (2).
I am assuming Transformations do not help in this case, as the input to public Bitmap transform(Bitmap source) will already have the large bitmap which will cause me to run out of memory.
You can combine fit() with centerCrop() or centerInside(), depending on how you want the image to fit your View:
Picasso.with(context)
.load(url)
.fit()
.centerCrop()
.into(imgDisplay);
Picasso.with(context)
.load(url)
.fit()
.centerInside()
.into(imgDisplay);

Flex Video Player fullscreenButton override

I'm using mxml to create a spark video player with controls. When I click on the "fullscreen" button in Chrome, it goes full screen on the browser but I am unable to go back to normal size. In Internet Explorer, the whole screen is filled up but the zoom on the video is too big and thus my controls are no longer visible.
Is there any way that I can use ActionScript to control the size of the fullscreen? How would convert the mxml to Actionscript to override this?
Thanks!
Source code from: Flex Video Player
The code I'm using to create the player:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:VideoPlayer
source="video.flv"
horizontalCenter="0"
verticalCenter="0"
autoPlay="false" />
</s:Application>
You can try to constrain the area for fullscreen display using stage's fullScreenSourceRect property.

Resources