How to create Android app WITHOUTH action bar? - eclipse

I can not create an android app with an SDK < 14 (4.0) because all of the templates (including the so-called "Blank") include the "Action Bar", which is a 14+ feature.
How do I create an app WITHOUT an action bar? Does somebody have an old template for Blank without an Action Bar?

You can instantiate the Action Bar object and using the method hide() you will be able to hide it.
final ActionBar bar = getActionBar();
And from the documentation:
Instead of calling this function directly, you can also cause an
ActionBar using the overlay feature to hide through
View.SYSTEM_UI_FLAG_FULLSCREEN. Hiding the ActionBar through this
system UI flag allows you to more seamlessly hide it in conjunction
with other screen decorations
Hope it helps

Related

Status bar menu for Mac Catalyst in .NET MAUI

I have been working on an .NET MAUI app that needs to have a status bar icon and when clicked, menu to be shown. I know it is a platform specific issue and I have been folowing this tutorial from Microsoft. They have image button implemented to be shown in the status menu bar in the TrayService.
This runtime binding and creating objects are diffucult to me. The idea is to create NSMenu object, assign it to the NSStatusBar object, then create NSMenu Items with appropriate click events and assign them to the NSMenu object.
I am struggling since I don't know how to create the NSMenu object, and NSMenuItem objects with Title property for example.
NSMenu have many constructors, properties, methods to use and I don't know how to use them.
I will be very greatful with explanation or example on how to start.
_statusBarMenu = Runtime.GetNSObject(Class.GetHandle("NSMenu"));
IntPtr_objc_msgSend_String(_statusBarMenu.Handle, Selector.GetHandle("initWithTitle:"), "Quit");
void_objc_msgSend_IntPtr(_statusBarItem.Handle, Selector.GetHandle("setMenu:"), _statusBarMenu.Handle);
This compiles fine, but I don't know if IntPtr_objc_msgSend_String method exist because I added it myself at the top. However, nothing shows up in the tray.
It should be noted that Mac Catalyst is used in Maui, NSMenu and NSMenuItem are in Macos, and are not supported in Maui. For the Mac Catalyst creation menu in Maui you can refer to:
Menubar
Adding Menus and Shortcuts to the Menu Bar and User Interface | Apple Developer

How to create custom ActivationPolicy of the app?

Original activation policies is:
// The application is an ordinary app that appears in the Dock and may
// have a user interface.
NSApp.setActivationPolicy(.regular)
// The application does not appear in the Dock and does not have a menu
// bar, but it may be activated programmatically or by clicking on one
// of its windows.
NSApp.setActivationPolicy(.accessory)
// The application does not appear in the Dock and may not create
// windows or be activated.
NSApp.setActivationPolicy(.prohibited)
I need combination of all of those policies:
to display icon in dock like .regular
to do not have menubar like .acessory
[resolved] to display window above fullscreen apps like .prohibited
[resolved] to register window notifications like in .regular and .acessory
[resolved] to have ability to open "Preferences" window like in .regular and .acessory---
How can I create own ActivationPolicy or how can I controll those parameters without "policy" ?
upd: part of problems resolved here:
How to locate window over all of apps (even if they are fullscreen-ed)

Custom button for toolbar Eclipse RCP Application

I am currently working on a web browser application using Eclipse e4.
I want to put on the toolbar a toggle button for saving my favorites url's.
I want it to be like in Google Chrome , a star which gets the yellow color when it's pressed(the link was added to favorites).
How can I do this?
Should I use for this the Application.e4xmi ?
You can use the Application.e4xmi if this is a tool bar for a Window or a Part. You would use a 'Handled Tool Item' in the tool bar.
The Application.e4xmi does not provide a way to set separate icons for the selected and normal states of a tool item so you will have to do this in the handler class. Something like:
#Execute
public void execute(MToolItem mitem)
{
if (mitem.isSelected())
mitem.setIconURI("platform:/plugin/your.plugin.id/icons/selectedimage.png");
else
mitem.setIconURI("platform:/plugin/your.plugin.id/icons/unselectedimage.png");
// TODO other code
}

Add to Chrome app titlebar

I would like to add a button in the titlebar of a Chrome app. Most of my research has lead me to believe that the only way to do this is by disabling the default titlebar and making my own. Is there a way to simply add a button to the existing titlebar? If not, is there a resource that has detailed tutorials or examples of removing the default titlebar and making a custom titlebar?
Nope, there isn't a way to add buttons to "default" titlebars. That wouldn't be portable anyway.
What you can do is create a frameless app window:
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('window.html', {
'outerBounds': {
'width': 400,
'height': 500
},
'frame': 'none' // It will be a rectangle filled with your HTML
});
});
There is a sample app that implements this and also a draggable title bar.
You can use any kind of framework to make an area that looks like a title bar on your page's top, like Bootstrap's navbar, and implement actions like close/maximize/minimize using chrome.app.window API - get a reference to the current AppWindow and use its methods.

How to implement iPhone TitleBar in Android

You know in iPhone, The four components of a typical iPhone application are
a title bar,
a navigation list,
a destination page,
and a button bar.
for The Title Bar
The title bar includes the following elements:
Back button:
Screen title:
Command button:
My question comes, although i can use UI framework tool, such as:
Phonegap,
iui,
jtquery
to develop web app, but i can't display the TitleBar effect in Android,
i can't use below code in Android:
meta content="yes" name="apple-mobile-web-app-capable"
Actually, the above can work in Apple Safari Browser, but I can't use Safari to display our Android Project, which is i don't want to see.
Does anyone know how to fulfill this effect in Android, please help me, your help will be great appreciated.
to
"It's unclear if you developing a native android application or a webapp.
– alexanderblom yesterday"
sorry that i forget to mention, i want to develop a iphone-webapp-style application in Android. Since it's too difficult, i want to use iWebkit, but it seems only work in apple iPhone OS or Safari which contain the specific engine to display the beautiful layout, like below:( -_-! i am new so i can't post images here)
(source: appshopper.com)
If I'm not mistaken, if you want to custom in any way the title bar at the top of your screen, you have to do several things :
First, read this thread about titlebar customisation, as it's quite detailled.
Then, you have to add a few more things to it to match your requirements, all in the same xml file which will be your titlebar.xml:
-a button, on which listener you assign the same keyEvent as the normal back key of every android phone.
-a textview for whatever title you want to put in.
-a button for the command button, for whatever it does in Iphone (if you tell me what it does, maybe i'll be able to give more details)
Then, as I take it, you want to have it available on all your pages, without having to request titlebar customization on every activity, I would recommend you to use the same trick as I did : Define a superclass, which all your activities will extend.
then you you requestwindowfeatures in this class, and do all your customization in this one.Finnaly, You just have to call the variable of your titlebar textview in the oncreate of all your subclasses to assign the string you want on each page. If your string is generated dynamically from, lets say a file name you load from the internetv in a background thread, you will need to define a handler to the main thread as you can't update a view from another thread than the one that has created it.
Hopes that helps. If you have any question about that, feel free to ask, i'll keep an eye on your topic, because I had quite a pain to make my titlebar work properly.
good luck