Activity or Fragment or? - android-fragments

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.

Related

How to edit Teaser's Tab options order on AEM?

I'm (trying) customizing the Teaser component on .content.xml to reach out to my requirements but I don't understand how I can set up an order to tabs options. The best solution would be to write some logic to hide/unhide the Teaser's fields based on the parent component, but I don't know how to do it yet. Meanwhile, I'm editing the XML file.
Options:
Image
Metadata
Text
Link & Actions
The first thing stranger is that I've written the code to show only three options but on AEM Editor keeping showing all options, with "Link & Actions" not declared on .XML. As you can see in the print below.
Path file: ui.apps/.../components/teaser/_cq_dialog/.content.xml
The second thing is that I want to put "Link & Actions" options as the last option on the tab bar. So, how make it?
The following print is my current behavior.
The behaviour you notice is due to Sling's Resource Merger feature. The same feature can be leveraged to achieve everything that you want to do.
To answer your question in parts
You see Links & Actions tab even though you've not defined it in your dialog because your component extends the OOB teaser component and the Sling Resource Merger would merge the options in the parent and the child dialogs to create the final dialog that is presented to the author.
This allows easily extending the features of the parent and only defining the custom properties within your dialog. For e.g. If you only need to add a new tab called Metadata in your teaser component it is enough to just create configurations for that new tab in your custom component and the rest of the configs will flow through from your parent component.
<tabs
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/tabs">
<items jcr:primaryType="nt:unstructured">
<metadata ...>
</items>
</tabs>
You can then use the following properties provided by Sling to further customise the ordering of the properties / tabs or remove / hide some properties.
sling:hideProperties - Specifies the property, or list of properties, to hide. The wildcard * hides all.
sling:hideResource - Indicates whether the resources should be completely hidden, including its children.
sling:hideChildren - Contains the child node, or list of child nodes, to hide. The properties of the node will be maintained. The wildcard * hides all.
sling:orderBefore - Contains the name of the sibling node that the current node should be positioned in front of.
Now to answer your second part, if you want to hide the Links & Actions tab completely in your component, then create a node called actions (same name as parent) and then set the property sling:hideResource to true
<tabs
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/tabs">
<items jcr:primaryType="nt:unstructured">
<metadata ...>
<actions
jcr:primaryType="nt:unstructured"
sling:hideResource="{Boolean}true"/>
</items>
</tabs>
Alternatively, if you don't want it removed but just moved to the end, just create a node called actions and place it after all the other nodes or use the sling:orderBefore property to specify the order of the tabs. An example of order before shown below where metadata tab appears second, followed by text and then links and actions.
<tabs
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/tabs">
<items jcr:primaryType="nt:unstructured">
<metadata
jcr:primaryType="nt:unstructured"
sling:orderBefore="text"
...>
<text
jcr:primaryType="nt:unstructured"
sling:orderBefore="actions"/>
</items>
</tabs>
EDIT: How do you know what tab names to use?:
Sling Resource Merger works when you overlay a component (think of it like inheritance in Java where you are extending another class).
You can overlay an existing component using the property sling:resourceSuperType on the component node. For e.g., this is the screenshot of my teaser component which is overlaying the OOB teaser component core/wcm/components/teaser/v1/teaser.
Since it is not an absolute path, the order of preference for seaching the component in the repository is /libs/ followed by /apps/
So, searching under /libs/ I was able to find the component at /libs/core/wcm/components/teaser/v1/teaser and expanding the dialog showed the following tabs. The same names need to be used in our component to override the position or visibility or any other sling merger features.
I would recommend understanding the inheritance concepts of Sling in general to make it easier working with AEM.

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.

Maximo anywhere apps how to configure

Im new to Maximo. I already have maximo anywhere work execution app. Please let me know how to add new button in it through worklight.
Open the index.html file and add a <button> element.
If this does not help you, please learn how to ask questions first.
You can Edit the app.xml in <: Install Root :>/apps/<: app :>/antifact, like IBM MAXIMO Anywhere guide.
link: https://www.ibm.com/developerworks/community/blogs/a9ba1efe-b731-4317-9724-a181d6155e3a/entry/Adding_Custom_Fields_to_a_Maximo_Anywhere_application?lang=en
Before you embark on that Journey, be sure to back up the default app.xml. In order to add a button you first need to modify the Application UI, changes are made in the app.xml file .\MaximoAnywhere\apps\WorkExecution\artifact\app.xml. You can add additional tags to the file, which builds the UI and makes the app.
<button border="false" cssClass="statusIcon" id="WorkExecution.WorkDetailView_status_button_1" layoutInsertAt="item3" resourceAttribute="returnActive">
<states id="WorkExecution.WorkDetailView_status_buttons_return">
<state id="WorkExecution.WorkOrderDetail_ReturnButton_render_active" image="/images/RETURNED.png" label="Return" value="true"/>
<state default="true" id="WorkExecution.WorkOrderDetail_ReturnButton_render_inactive" image="/images/RETURNED_INACTIVE.png" label="Return" value="false"/>
</states>
<eventHandlers id="WorkExecution.WorkDetailView_status_button_eventHandlers_1">
<eventHandler class="application.handlers.Custom.WODetailHandler" event="render" id="WorkExecution.WorkOrderDetail_ReturnButton_render" method="renderReturnedIcon"/>
<eventHandler class="application.handlers.Custom.WODetailHandler" event="click" id="WorkExecution.WorkDetailView_status_button_1_eventHandlers" method="onReturnStatusIconClicked"/>
</eventHandlers>
</button>
Thats an example of a button we use in the app on the Work Details screen. Notice it has a CSS class that we've added, as well as a resourceAttribute that manages the state of the button. Putting a state on the button tells the app when to render which of the images. Lastly, we have event handlers that are tied to the button, with corresponding code written in the Custom.WODetailHandler file.

Unstyling the contact-info popup in plone.app.theming on Plone 4.1

I am creating a new plone.app.theming (Diazo) theme for my site. My rules.xml has the rule:
<theme href="theme.html" css:if-content="#visual-portal-wrapper" />
This unstyles many popups, but not the contact-info AJAX popup box, which is empty. I can unstyle it using the following rule:
<notheme css:if-content="body.template-contact-info"/>
but this means that any user visiting that page, and not rendering it in a popup, will see it unstyled.
How can I successfully unstyle the contact-info popup box?
The login form popup is wrapped inside a <div class="pb-ajax">. Just look at the generated HTML that creates the popup and you will find a class or identifier that you can use to select that particular popup.
On the other hand you can also customize the Plone view that creates this piece of HTML. Though it will be much easier to try to get a class or identifier.

Android Layout: Consistent visible Button Bar

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"-->

Resources