How can I enhance my usage of a menu layout? - google-glass

How can I create a settings menu for my application that let's me show more information about the current status? With the menu layout it appears that I can only set these attributes:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/bot_engine"
android:title="#string/menu_settings_bot_engine" />
<item
android:id="#+id/text_to_speech"
android:title="#string/menu_settings_text_speech" />
</menu>
And It displays as follows:
But I want something like this:
This is how Google Glass display It's settings menu.
I want the user to be able to tab over the settings to toggle them between (Active/Inactive), displaying a message:
Active (In green) or Inactive (in red).
How can I do that?

The GDK menu works in the same way as the android context menu's on a phone.
It's designed for simple menus with just text and an optional icon. If you want to do something more complex (Like the glass settings) you would need to use a CardScrollView and add your own cards to it, then you can have as much flexibility as you like.
Hope that helps.

Related

Prevent menu text from ellipsizing

I have a fairly straightforward menu that I am showing in an Activity, but some of the menu items have text that is too long to fit on screen. The default behavior for menus appears to be ellipsizing the text, as shown below.
Menu XML that I'm inflating in onCreateOptionsMenu():
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/menu_too_long"
android:title="This text is a tad too long"
android:icon="#drawable/ic_glass_logo"/>
</menu>
Is it possible to get the menu item text to adjust its size or wrap to a second line when it is too long? In other words, I would like menus inflated from XML to behave more like CardBuilder.Layout TEXT.
I would like to avoid creating my own menu and continue using Glass's built-in menu APIs.
Changing the formatting of the menu labels is not possible through public APIs. From a UX point of view, menu labels longer than two or three words seems undesirable. Consider that if you enable voice menus in your application, those commands should be brief that the user can speak them conveniently.
If the length of your menu text is because there is supplemental information that you can separate from the "action" that the menu performs, consider using MenuUtils.setDescription to move the supplemental information into the footer of the menu item, which can hold more content. You can call this method from within onCreateOptionsMenu or onPrepareOptionsMenu.

how to set the rights for placeholder ribbon

beginner question for sitecore about settings the right.
So I have an item is open in the page editor.
The renderings on the page has bunch of icons on the ribbon. One of them called 'select the parent element (element name)'.
In my case when I click on it, I am presented with the placeholder with button 'add here' and the ribbon with some component buttons that a user can use to add the controls.
So, QUESTION:
"how I add access to the button on that ribbon for certain role? Where do I set it up? "
For some certain role that placeholder's ribbon is completely empty, including there is no button 'select the parent element' even though
i know there is a parent element.
thank you very much for help,
HF
Here are the screenshots (no icons on the placeholder ribbon, and the user's rights:
enter image description here
And here is how that looks for the admin:
All the settings for the Page Editor are held in the Core database. So in the Sitecore Desktop, switch to the core database and open up the Content Editor.
Navigate to : /sitecore/content/Applications/WebEdit
This item holds the items that make up the page editor. To edit the ribbon menues, go to:
/sitecore/content/Applications/WebEdit/Ribbons
I don't remember seeing that particular button in the Core database, so this is likely a built-in feature that requires the user to have one of the built-in permissions.
The first thing I would check is that Designing is turned on. Have the user go to the 'View' tab in Page Editor and make sure they have checked the 'Designing' checkbox.
If that doesn't work, it sounds like the user you have does not have design access to the page. I would examine the inherited roles using the User Manager and check if they have the Sitecore Designer role inherited.
It is possible they just need to be provided the correct role in the system so that they can access the buttons.
Have you tried the "Sitecore Client developing role"?
Also, for the blue arrow drop list location, in order for the rendering button to show up in that location, you have to check whether the button in the webedit folder under core database(/sitecore/content/Applications/WebEdit/Default Rendering Buttons). The Type field needs to be "Common" in order to show up in the blue arrow droplist.
Example can be the "Edit related item" (/sitecore/content/Applications/WebEdit/Default Rendering Buttons/Edit related item) shows up in the blue arrow droplist.

Android action bar 'overlay'

Im working on an android application that uses an action bar - which all works well.
One thing I would like to do is to display the 'underscore' of the icon that has been selected - I believe a kind of a graphic overlay so that the user knows what section they are in. This has been done in many apps but I'm not sure if its possible with the action bar .
This image shows a bar under the home icon in use on the twitter app, can it be done?
Overlaying action bar provide great effect on layouts,
Use android:windowActionBarOverlay for name keyword in item tag
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#android:style/Theme.Holo">
<item name="android:windowActionBarOverlay">true</item>
</style>

Change ActionBar tabs color

I am using the appcompat support library and I want to change the color of the action bar tabs. I found these instructions in which the customize tab indicator section suggests creating a file res/drawable/actionbar_tab_indicator.xml declaring a specific background image for several different states of an action bar tab.
actionbar_tab_indicator.xml looks like :
<!-- STATES WHEN BUTTON IS NOT PRESSED -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false"
android:state_pressed="false"
android:drawable="#drawable/tab_unselected" />
...
The #drawable/* images are nine patches.
However, i do not want to get involved in creating nine-patches images. Is there another way to change the actionbar tab's color?
I wrote an answer to that question 1 year ago.
You can find in here:
Change Color TabSelector on v4 ViewPager

Android: How to write text under the icon in the actionbar

I would like to write under the text in the action bar so i use this xml:
<item
android:id="#+id/Home"
android:icon="#drawable/ic_action_home"
android:showAsAction="always|withText"
android:title="home"/>
<item
android:id="#+id/Refresh"
android:icon="#drawable/ic_action_refresh"
android:orderInCategory="100"
android:showAsAction="always|withText"
android:title="refresh"/>
although i write:
android:showAsAction="always|withText"
this what i get :
How could I write text under the icons ?
'always|withText' only works if there is sufficient room. Else, it will only place icon. In your case, you've got several icons there which does not leave any spare room for text.
You've got two options:
Reduce the icons by moving them either to an overflow menu or somewhere else in your UI.
Design images which consist both icon and text and use them as your icons.
Edit: Well, here's a lot better answer: https://stackoverflow.com/a/12225863/2511884