Android Layout: Consistent visible Button Bar - button

In my main Activity I have created a bar with buttons on it. Now , I would like the "Button Bar" to always show regardless of what Activity I'm showing. Basically I need the handle the Button events from the "Button Bar" across all Activities. Is this possible, and what best practice to achieve this?

Use includes inside a Merge. The includes can be re used inside any view.
<com.testmerge.TitleBar
id="#+id/titlebar"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_gravity="top"
android:paddingTop="0dip"
android:background="#drawable/title_bar"
/>
<com.testmerge.OkCancelBar
android:layout_width="fill_parent"
android:layout_height="60dip"
android:layout_gravity="bottom"
android:paddingTop="0dip"
android:background="#drawable/header_bkgrnd"
/>
<!--"#AA000000"-->

Related

Force the screen reader to read a label

I am developing an application using accessibility properties. I have some buttons that increment and decrement some values showed in labels. Is it possible somehow force the screen reader to read a label when a blind user changes the values?
Support for aria-live is spotty.
Seeing a code example would be handy, but if you are always putting focus on the field then perhaps you want to use aria-label with some good messaging instead as this is better supported and will be spoken when the field gets focus.
<label for="foo">Field Label</label>
<input type="text" id="foo" aria-label="Field Label. Note: If you are using a screen reader…">
Note: The screen reader reads the value when ever there is focus so after clicking the button check where your focus resides.
1. Probably worth a read: https://developer.paciellogroup.com/blog/2014/03/screen-reader-support-aria-live-regions/
2. An example from JAWS: ARIA https://www.freedomscientific.com/SurfsUp/AriaLiveRegions.htm
OR
Accessibility - live region in Xamarin.Forms
<TextView
android:id="#+id/feedback_text_view"
android:accessibilityLiveRegion="polite" />
Please follow for more help = https://codelabs.developers.google.com/codelabs/basic-android-accessibility/#6
Hope will help you

Add button inside AndroidXMapFragment in here maps

I'm using the here android SDK and started with the BasicMapSolution tutorial.
Now I want to add buttons on top of the map (zoom in/zoom out/center view to my position).
Unfortunately I did not figure out how to do it.
I tried adding a button in activity_main.xml like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<!-- Map Fragment embedded with the map object -->
<fragment
android:id="#+id/mapfragment"
class="com.here.android.mpa.mapping.AndroidXMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="#layout/activity_main">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|top"
android:text="Demo Button"
android:padding="10dp"
android:layout_marginTop="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"/>
</fragment>
</LinearLayout>
But the button is not shown in the app. Can anyone help please. Just to make it clear, I want to achieve something like this:
Are you not able to do a zoom using 2 finger tap ? https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/map-gestures.html
Map gesture customisation can also be done. In case adding zoom controls is requirement then you can add a map marker object of unknown type, and pass zoom in min max range on its listener in premium SDK. As of now, traditional zoom in/zoom button add on controls are not available. you can refer below API documentation to check for mapobject and zoom range in details.
https://developer.here.com/documentation/android-premium/3.15/api_reference_java/index.html
Also refer to our github example for map marker objects and gestures that are already available >
https://github.com/heremaps/here-android-sdk-examples/blob/master/map-objects/app/src/main/java/com/here/android/example/map/objects/MapFragmentView.java

Android scratch View 2 Layers

I'm using Android-WScratchView to implement a scratch effect in my app.
What my app does is a "cleaning" effect. I have a picture of a clean t-shirt and another picture of the same t-shirt but dirty (with some mud).
Android-WScratchView works great for the normal case, a background Image (clean t-shirt) and an overlay Image (dirty t-shirt).
The problem is now, I need to add a second overlay Image, which is a "less" dirty t-shirt so the user has to "clean" the t-shirt in 2 steps.
Once the first layer has been erased, I need to be able to erase the second layer but only where it is visible.
I've implemented it using 2 WScratchView objects, one behind another, like this:
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/shirt_clean" />
<com.winsontan520.WScratchView
xmlns:wsv="http://schemas.android.com/apk/res-auto"
android:id="#+id/scratch_view_layer_1"
android:layout_width="300dp"
android:layout_height="300dp"
wsv:antiAlias="true"
wsv:revealSize="20dp"
wsv:scratchDrawable="#drawable/shirt_less_dirty"
wsv:scratchable="true" />
<com.winsontan520.WScratchView
xmlns:wsv="http://schemas.android.com/apk/res-auto"
android:id="#+id/scratch_view_layer_2"
android:layout_width="300dp"
android:layout_height="300dp"
wsv:antiAlias="true"
wsv:revealSize="20dp"
wsv:scratchDrawable="#drawable/shirt_dirty"
wsv:scratchable="true" />
The problem is that after the "most dirty" layer is "erased" (it gets transparent) I cannot delete the "less dirty" layer because the second layer is getting the onTouch event.
My idea is parsing somehow the onTouch event through the second WScratchView to the first one. But still would have the problem that I don't know which area has already been deleted and which not.
I would appreciate any help, also a different way to implement it will be accepted.

Activity or Fragment or?

I have the the following Activity LinearLayout.
<!-- Main LinearLayout -->
<LinearLayout
...
android:orientation="vertical"
tools:context=".MainActivity">
<!-- Inner LinearLayout -->
<LinearLayout... />
<!-- Fragment holding Google Map Fragment -->
<fragment android:name=".MainMapFragment"
android:id="#+id/map_fragment"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="match_parent" />
<!-- Inner LinearLayout -->
<LinearLayout... />
</LinearLayout/>
I have some Google Map Markers displayed in the MainMapFragment showing that around that location there are some specific related business to look into.
Once a User clicks on any of those Markers on the Map... I need to display a LIST of all those Business associated to that MARKER and allow the User to Tag/Mark the business as FAVORITE or NOT.
I have everything done in relation to the Google Map, Markers, InfoWindow, etc... however... I would like to know what should be a good way/design/layout to DISPLAY the Business List (ListView is ok) detail information and allow the User to MARK AS FAVORITE any of the business in the list using a REGULAR BUTTON (or TOGGLE BUTTON) display within the Business Information Details.
Although I already thought on some choices (see below), I am not sure which one to go for it.
Launch a new Activity, once back (new activity finished) update the information within the Map, Markers, etc.
Add a new Fragment to the current Layout and SWITCH (hide/show) between the one with the Map and the one with the Business Information.
A Modal Dialog (DialogInterface, AlertDialog, etc)
Once again I am not sure where to go and so my question... what will be a good design/model to approach this request?
Sorry for my english, i think that you should use an activity, If I understood correctly on click event you should display details of the related place, a good habit of mobile programming is to display details in other activity with the back button in the action bar.
I ended up extending DialogFragment, not only works OK but also allowed me to work with anything in a custom/complex layout inside the Dialog.

XUL button looks like disabled and is not "pushable" (but onclick function is invoked)

I'm developing a Firefox extension. I'm familiar with JS, CSS, XML but new to XUL.
I want to override Downloads in the way that adds a button next to each downloaded file to rename it. I've already done it (placing a button and handling rename logic).
The thing that left is UI. The button looks like disabled, but apparently is not, because I can click it and the popup appears.
Here it is how it looks now:
and the corresponding code:
<xul:button label="Rename" tabindex="1" onclick="foo()"/>
Adding disabled="false" doesn't help. I can add style="color:black; text-shadow:0 0;" and this makes it look like intended, but there are several problems (and I guess disabled-like look might be the cause):
The button I added is not "pushable" in the manner like the native "Clear list" button (pushing it doesn't change its look, i.e. it doesn't "go down"). However, foo() is invoked.
I can't navigate to the button with Tab from keyboard.
I've read one should prefer command / oncommand instead of onclick (because of Tab navigation for instance), but in my example, only onclick invokes foo(). The two other don't work.
In case more detailed code is needed (I borrowed it entirely from some other extension):
<binding id="download-done" extends="chrome://mozapps/content/downloads/download.xml#download-base">
<content>
<xul:hbox flex="1">
...
<xul:vbox pack="start" flex="1">
...
<xul:hbox align="center" flex="1">
<xul:label xbl:inherits="value=status,tooltiptext=statusTip" crop="end" flex="1" class="status"/>
<xul:button label="Rename" tabindex="1" onclick="foo()"/>
</xul:hbox>
</xul:vbox>
</xul:hbox>
</content>
</binding>
Help greatly appreciated.
Edit 1
The code I presented above was taken from original Firefox download.xml (<binding id="download-done">) and changed only by adding my <xul:button>.
For the things to be even more weird, I've taken, from the same file, two another bindings ( <binding id="download-paused"> and <binding id="download-downloading">) and added exactly the same <xul:button> to them, and in both cases, the button is both "pushable" and black (in short, normal, as it should be). It is also navigable from keyboard with Tab, even without setting tabindex explicitly.

Resources