navigation in Android TV - android

navigation in Android TV.
How do I create just the navigation android tv. I do not care to use the entire theme, it provides android studio.
And I do not understand much of what is in the example given by android studio.
I understand that is something the String.
I looked on the internet examples, but right now, android tv has no further information at this time.
I'm interested only create menu navigation side, nothing more.
Thank you very much.

I found a really nice tutorial : http://corochann.com/browsefragment-header-customization-android-tv-application-hands-on-tutorial-17-697.html
it shows you how to create a custom navigation side with an image and a text
Here what a tried in my application :
copy his IconHeaderItem class and in your loadRows paste
IconHeaderItem gridItemPresenterHeader = new IconHeaderItem(0, BEWELL_THERMO, R.drawable.bewell_thermo);
GridItemPresenter mGridPresenter = new GridItemPresenter();
ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter);
gridRowAdapter.add(DERNIERE_MESURE);
gridRowAdapter.add(GRID_STRING_GUIDED_STEP_FRAGMENT);
gridRowAdapter.add(GRID_STRING_RECOMMENDATION);
gridRowAdapter.add(GRID_STRING_SPINNER);
mGridItemListRow = new ListRow(gridItemPresenterHeader, gridRowAdapter);
mRowsAdapter.add(mGridItemListRow);
setAdapter(mRowsAdapter);

Related

Xamarin ("old") Navigation side by side with Shell-Navigation

I am searching for hours and wondering if it is possible to use the old navigation and the shell navigation in one Xamarin APP.
Background:
The reason for that is, that I am maintaining an old app with 40+ sites - with different Navigation through the sites and sometimes complex data passing through them.
Try to achieve:
Now I've to implement some new sites and just wanted to put them into the Shell-Navigation. Those "Shell-Sites" should also be available in the "old navigation".
So yes - I could try to put it all to shell, but don`t have the resources yet AND: never touch a running system...
Yes, its possible.
First, understand that AppShell starts up by doing this in App.xaml.cs:
MainPage = new AppShell();
To reach individual pages from AppShell, see:
XF Shell Navigation / Register detail page routes.
To navigate away from AppShell into old-style navigation, do either:
Application.Current.MainPage = new SomePage();
OR
Application.Current.MainPage = new NavigationPage();,
depending on how your old navigation was done.
To return to AppShell, do:
Application.Current.MainPage = new AppShell();
To return to a specific page within AppShell, I'm not sure the exact details. Maybe after setting MainPage to appshell, execute a shell "Route".
CAVEAT: When you think through the above, you'll soon realize that you can't leave the old pages "completely" untouched. You need to decide what user will do to go "back and forth". Then decide how to only include that in the "AppShell" version of the code. But that is no longer an AppShell-related topic. Its a standard c# .net build question, plus making some UI decisions.

Insert icon in a tabbed page(Android) on xamarin form

I'm new to StackOverflow community!
I need help with one problem with android in Xamarin Forms. To be precise... I tried with some friends to build our first app. We choose(with the help of our University professor) Xamarin for the cross-platform development of Android and iOS for both systems using the Xamarin Forms. I created the interface part of the app and now I am stuck in a fort with big walls. When I try to add a Tabbed Page the icon for the functional bar, the app crashes(Android) but in iOS, the problem doesn't appear...
I'd try with some solution... like :
-Render in the NameApp.Droid adds different renderer only for the android part but no result...
-Try another way to insert the icon in the .xaml file directly but no result...
-Try to follow another way to modify the .axam file for the "Theme" part
but no result...
I want to integrate all the stuff on time only in the "Main Project". I don't want for now touch the "nameProject.Droid" or "nameProject.iOS" part, But try to make in one shoot both(Andriod & iOS). I've found a different bug in Android (è.é) but for this, I am going crazy...
But I need to modify the ".Droid" no problem I accept the challenge!
This is the result I aspire to create.
"https://storage.googleapis.com/material-design/publish/material_v_12/assets/0B6Okdz75tqQsbHJuWi04N0ZIc0E/components-tabs-usage-mobile7.png"
This is the way I add the Icon in the Tabbed Page. An assumption I add all the stuff in the "Resource" in ".Droid" and ".iOS :
var MainPageTabbed = new MPageTabbed();
var Profile = new Profile();
var ListChat = new ListChat();
if (Device.RuntimePlatform == Device.Android)
{
MainPageTabbed.Icon = "ldpi.png";
Profile.Icon = "ldpi2.png";
Chat.Icon = "ldpi1.png";
}
if (Device.RuntimePlatform == Device.iOS)
{
MainPageTabbed.Icon = "ldpi.png";
Profile.Icon = "ldpi2.png";
ListChat.Icon = "ldpi1.png";
}
NavigationPage.SetHasNavigationBar(this, false);
Children.Add(MainPageTabbed);
Children.Add(Profile);
Children.Add(ListChat);
Someone can help me please to find a solution?
Here you have an example of how to use the TabbedPage in xamarin forms:
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/navigation/tabbed-page/
... Xamarin.forms renders Android tabbed-pages as something called a viewpager combined with a TabPagerStrib, and it looks like the example in the link above.
You might read about BottomNavigationBar for Android instead, or look at this link for a TabPagerStrip with an image:
https://forums.xamarin.com/discussion/39937/adding-icons-to-a-pagertabstrip-instead-of-text
If anyone is interested in a FontAwesome custom icon implementation I followed this tutorial to begin with: FontAwesome with Xamarin Forms
Unfortunately he doesn't give an example of integrating with tabbed pages but after some experimenting I finally figured out a simplified Xaml way to render it without a custom tabbed renderer:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:IBMobile.Views"
xmlns:local2="clr-namespace:FontAwesome"
x:Class="IBMobile.Views.HomePage"
Visual="Material">
<ContentPage.IconImageSource>
<FontImageSource FontFamily="{StaticResource FontAwesomeSolid}" Glyph="{x:Static local2:IconFont.Home}" />
</ContentPage.IconImageSource>

Iconize Xamarin with Fontawesome

I'm new to Xamarin and I'm trying to use the Iconize NuGet package for Xamarin, but I'm not having much luck. At the moment I'm working with a simple Android app. I've installed Iconize per the instructions and, save for an error on the line:
FormsPlugin.Iconize.Droid.IconControls.Init(Resource.Id.toolbar, Resource.Id.tabs);
(the compiler didn't like the Resource.Id.toolbar or Resource.Id.tabs so I removed it) everything compiles and runs. However, when I try to add an IconButton with a Fontawesome image, I get "System.NullReferenceException: Object reference not set to an instance of an object." error that points back to
the line LoadApplication( new App() ); in the MainActivity.cs.
I'm trying to add the IconButton to a grid in code (not XAML) using
grid.Children.Add( new IconButton
{
Image = "fa-info-circle"
}, 3, 2 );
Any ideas on how to make this work? The examples on the Iconize page haven't been very useful and I haven't found any examples on Google.
Okay I finally found something that was useful. I found a clue on this page and some other information on the project issues page on Github.
Ultimately, to get the icon to display I used
grid.Children.Add( new IconButton
{
Text = "fa-info-circle",
}, 3, 2 );
It was the Text property and not the Image property that I should have used.
Hope this helpful to someone else.

Taking Screenshots Using Qt C++ on Android

thanks for checking my question out!
I'm currently working on a project using Qt C++, which is designed to be multi-platform. I'm a bit of a newcoming to it, so I've been asked to set up the ability to take screenshots from within the menu structure, and I'm having issues with the Android version of the companion app.
As a quick overview, it's a bit of software that send the content of a host PC's screen to our app, and I've been able to take screenshots on the Windows version just fine, using QScreen and QPixmap, like so:
overlaywindow.cpp
{
QPixmap screenSnapData = screenGrab->currentBackground();
}
screenGrabber.cpp
{
QScreen *screen = QGuiApplication::primaryScreen();
return screen->grabWindow( QApplication::desktop()->winId() );
}
Unfortunately, Android seems to reject QScreen, and with most suggestions from past Google searches suggesting the now-deprecated QPixmap::grab(), I've gotten a little stuck.
What luck I have had is within the code for the menu itself, and QWidget, but that isn't without issue, of course!
QFile doubleCheckFile("/storage/emulated/0/Pictures/Testing/checking.png");
doubleCheckFile.open(QIODevice::ReadWrite);
QPixmap checkingPixmap = QWidget::grab();
checkingPixmap.save(&doubleCheckFile);
doubleCheckFile.close();
This code does take a screenshot, but only of the button strip currently implemented, and not for the whole screen. I've also taken a 'screenshot' of just a white box with the screen's dimensions by using:
QDesktopWidget dw;
QWidget *screen=dw.screen();
QPixmap checkingPixmap = screen->grab();
Would anyone know of whether there was an alternative to using QScreen to take a screenshot in Android, or whether there's a specific way to get it working as compared to Windows? Or would QWidget be the right track? Any help's greatly appreciated!
as i can read in Qt doc : In your screenGrabber.cpp :
QScreen *screen = QGuiApplication::primaryScreen();
return screen->grabWindow( QApplication::desktop()->winId() );
replace with :
QScreen *screen = QGuiApplication::primaryScreen();
return screen->grabWindow( 0 ); // as 0 is the id of main screen
If you want to take a screenshot of your own widget, you can use the method QWidget::render (Qt Doc):
QPixmap pixmap(widget->size());
widget->render(&pixmap);
If you want to take a screenshot of another app/widget than your app, you should use the Android API...

Google has changed Linkify implementation with custom links in Android 5

We've got some custom links in our application that look like that bar.foo://var?parameter=value
Prior Android 5.0.0 bar.foo was not recognised as a link. However in Android 5.0.0 it is recognized as a link and Android will try to open it in the default browser if you click anywhere on bar.foo:. If you however click on //var?parameter=value it will treat it as a customized link and do the stuff that is intended.
Is there any way to prevent this?
This is our Linkify related code:
Linkify.addLinks(this, Linkify.WEB_URLS); // This one is causing the issue. Unfortunately we can't disable it
for (final Pattern pattern : linkPatterns) {
Linkify.addLinks(this, pattern, linkPrefix);
}

Categories

Resources