Titanium - Developing a Dictionary - android

i'm using Titanium to develop a dictionary. I have a Tableview and the values of the rows are loaded from SQLite local database. I used the "SearchBar" component of Titanium and linked it to the tableview using the native property in Titanium. But the problem is: the filter is not anchored to the beginning of the string. So typing "ha" in the text box will include rows titled 'Harold' and 'Harvard', but also 'Sharon' and 'Jonathan'. And this was mentioned in the API docs of Appcelerator (http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.TableView.filterAttribute-property.html)
Any ideas to resolve that?

You need to implement custom search code for quick solution. So, do not use TableView's "search" and "filterAttribute" property. You can create a SearchBar on TableView's headerView and make custom search function with using SearchBar "return" and "change" events.

Related

Is it possible to add custom interactive UI elements to EditText?

A bit of context here. I'm an iOS developer with no knowledge on Android development.
I need to know whether it's feasible in Android to embed custom interactive UI elements (in iOS that'd be a UIView) inside of EditText.
A library I found to do this in iOS is: https://github.com/vlas-voloshin/SubviewAttachingTextView
You can see a GIF in that link showcasing the kind of behavior I'm looking for.
Is there built in support, or any third party library I can use to achieve something similar in Android?
in normal way this is not possible in android and we don't have any standard component or any library (that i know) for doing such a thing but we can create something similar to this (for this you should search about custom Views in android !) and also there is other way and easier way to achieve something similar to this is using the container layouts in android like LinearLayout and adding all your component to that container layout in run-time base on your text ! for example in your code you can dive in to your text and find tags like or and create appropriate view for your tag and add it to your container layout and at the end your layout looks like that gif wich is in your question ! and also in android we can show some basic html code in textView

Custom memo or text selection in Delphi Firemonkey for mobile?

Is it possible to create a custom memo in firemonkey to implement things like syntax highlighting?
I wrote my own component on a Frame but it doesnt support mobile text selecting on android... Is there any way to create a custom memo or implement the native text selection into my own component on a TFrame?
What i mean is this:
Hold touch to select text, selected text gets hovered with blue background and on top the toolbar comes down.
There is one full native android TMemo with the design you post available for Delphi. You can find the source code here: https://svn.code.sf.net/p/alcinoe/code/ (i gave the link because the code is too big to be post on SO)
You can also download the demo apk to see it in action:
https://svn.code.sf.net/p/alcinoe/code/demos/ALFmxControls/Android/Release/ALFmxControls/bin/ALFmxControls.apk

How to touch and hold to select text in React Native

I'm new to Android and trying to implement a rich editor using Text component of React Native.
However when I touch the text and hold for a moment, the text was not highlighted and the top bar with selection actions was not shown like what behaves in a webview or other applications.
What am I missing or do I need to implement this feature by myself? If so could you point a direction?
As of now it is supported by react-native as well by adding props selectable={true}. Also on Android you can change the selected text color with selectionColor='orange'.
Example:
<Text selectable={true} selectionColor='orange'>You can select me</Text>
If you want click-and-hold-to-select-text using a Text component, this feature does not currently exist in React Native for iOS. You probably want to upvote https://react-native.canny.io/feature-requests/p/support-selecting-text-within-text-elements-for-copypaste-etc to suggest Facebook add support for this.
However, I've submitted support for on Android, as of React 0.30. But React iOS is drawing characters directly to the screen (and not using the native UITextView that supports a selectable property), so it is not supported there, and likely won't be for a long time.
RN 0.39 adds support to copy the entire text field, but does not yet include support for selecting a subset of the text field for copying.
Be careful if the text is nested you should add selectable attribute to the top `
<Text selectable>
<Text>
some selectable text
</Text>
</Text>
use onPress={this.onPressTitle()} inside Text
and Declare
onPressTitle:function(){
/* Your Actions on OnPress */
}

How do I go about making a custom Android UI element reusable outside project?

I have a fairly simple Android UI element that I created locally inside of a application project. This element is a EditText/Label combination that displays the hint text in the EditText but when the user starts to type in the field it floats the hint text as a label above the field.
I would like to be able to use this component in other projects. I've been unable to find any useful information about how to package separately from application so that I can reuse it in other places.
Thanks.
You need to create a library project. You can add to a library any classes that you want, including User Interface elements.
On your projects, you just add a reference to you library project to reuse it.
Check this link.

Android interface : show form like the grouped listview style?

I'm building an App for Android that already exists for iOS. On iOS, we really like to use the listview grouped style to show details and forms. It is really useful to show details of objects that we don't know how much properties they have before loading it.
I know that Android doesn't have a similar tableview style. And I don't want to use a custom library to recreate it, because I don't want to force an iOS like interface to my Android's users.
But how would you create a consistent Android interface that show similar information? Do you have example for me?
First of all, your instinct to not force iOS style UI onto Android users is correct and I respect you for it.
Android's ListView is roughly the equivalent of iOS's UITableView. There are important differences. For instance, you should never use a ListView inside another scrollable container. If a ListView is in a particular layout, it should (usually) be the only scrollable component. If you want multiple ListViews in a layout, you probably don't want ListViews at all. You should instead use (vertical) LinearLayouts and add the items in order.
Cyril Mottier writes excellent posts on implementing custom behavior for Android's ListView.
If you want to display data in a list then you can use the ListView. Here is a great article about how to use it.

Categories

Resources