Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Talk:Creating LCDUI Custom Components: SearchBar

From Wiki
Jump to: navigation, search

Contents

Hamishwillee - Thanks!

Hi Tomi

I've given this a basic subedit. Didn't need to do much as it is pretty well structured and makes sense "as a document". A couple of points for the article "as it is":

  1. I would like to differentiate LCDUI articles from LWUIT articles. We have a LCDUIUtils category - is that the same thing - is there are JSR we should be using for the category instead?
  2. Was this tested on a device? If so, please list that in the ArticleMetaData. If not, please add the SDK Emulator as test device.
  3. You marked as being valid for Series 40. What version(s). Was it tested on any?
  4. Can you see if Stratos can give this a quick review. It makes sense, but I don't know enough about Java to know if there is "a better way" to do this.

OK, in terms of "room for improvement".

  1. The Virtual Keyboard stuff looks interesting. Are there other wiki articles or documents you can/should link to for this. If there isn't anything that really shows this then I'd be tempted to split that section out into a second article on how to create VBKs for Form-based custom LCDUI Custom components.
  2. On the same topic, the UI is not as pretty as the native one - T9 style vs Qwerty. Is this a result of the limitations of the platform/approach or just because you wanted to save time. Either way I think its worth explaining this difference with the original.
  3. More generally, explain any difference in between the two cases. ie why list different etc.
  4. I strongly believe you should add some examples and/or links of using the platform APIs to get colours for the component as well. As you mention this will be more future proof. Particularly on older devices I presume that for themes to work you'll need to get colours from the platform.

I really like the article. Particularly the challenges section.

Thank you

Regards

Hamish

hamishwillee 08:39, 11 June 2013 (EEST)

Tomi - Good points and questions

Answers for "as it is": 1. LCDUIUtils might point to a specific package in Nokia UI API: com.nokia.mid.ui.LCDUIUtil. I'm not really an expert when it comes to JSRs, but I think LCDUI stuff can be found in more than one JSR. Would make sense to have a "LCDUI" as a category. 2. This was tested with a device. 3. This was not tested with Series 40, but the virtual keyboard handling *should* work with full touch since the API is not Nokia Asha platform specific. 4. Will ask Stratos.

Answers for "room for improvement": 1. I tried (briefly) to search other articles. Few came up, they were pretty old and were no use to me. Splitting would make sense but then we need to add more beef into the VKB story. 2. The reason is very briefly explained in the article: "There is no API to open the native virtual keyboard. Instead, you're stuck with the ITUT keyboard." 3. The list of items in the demo isn't polished/decorated at all. It there just to show how you integrate the search functionality to your app. 4. I don't yet know what APIs you can use to get some platform colours etc. I just think I've seen one at some point, but don't remember where. I'll look into this when I have time.

Thanks!

Tomi_ 09:02, 11 June 2013 (EEST)

Hamishwillee - OK - thanks

Cool. I've added LCDUI, and will try to go through and add others in the near future. Lets see what Stratos has to suggest for the rest. Might have some pointers for you to get the colours.

hamishwillee 09:38, 11 June 2013 (EEST)

Skalogir -

I have tried to alternatively launch the keyboard from the pointerPressed method and use the nokia.ui.s40.item.direct_touch trait, but the erroneous behavior of the keyboard is still the same (it’s not the trigger event, but rather the VKB launch that is broken)

1. I think TO_UPPER_KEY_CODE should be -15 in order for the shift key on the virtual keyboard to properly work (though on different devices a different code is needed, e.g. on full touch this is 35 – I will add this info to the porting article) private static final int TO_UPPER_KEY_CODE = -15; 2. I would put public methods at the top of the code then protected then private (with the exception of the constructor that goes first) in SearchBar.java 3. We typically try to have one exit point for methods So this one

  private final boolean contains(final String whole, final String part) {
       final int wholeLength = whole.length();
       final int partLength = part.length();
       
       if (partLength > wholeLength) {
           return false;
       }
       
       for (int i = 0; i < wholeLength - partLength; ++i) {
           final String temp = whole.substring(i, i + partLength);
           
           if (temp.equalsIgnoreCase(part)) {
               return true;
           }
       }
       
       return false;

could be re-written as follows:

   private final boolean contains(final String whole, final String part) {
       final int wholeLength = whole.length();
       final int partLength = part.length();
       boolean containsPart = false;
       
       if (partLength <= wholeLength) {
           
             for (int i = 0; i < wholeLength - partLength; ++i) {
                    final String temp = whole.substring(i, i + partLength);
           
                    if (temp.equalsIgnoreCase(part)) {
                          containsPart = true;
                          break;
                    }
             }
       }
       return containsPart;
   }

4. Also it would be good if the same method was not final, because I cannot take your code and override your filtering mechanism, i.e. change the method so that it only displays matches that start with a certain text. 5. Class names are typically nouns or compound nouns, not verbs. ViewManager is a bit ambiguous, it could be renamed to ManagerViewer or ManagerView

Regarding platform colors, you can get some colors, but not all. I believe the code is this:

Display.getDisplay(this).getColor(int code);

where code can be

Display.COLOR_BACKGROUND Display.COLOR_HIGHLIGHTED_FOREGROUND Display.COLOR_BORDER Display.COLOR_HIGHLIGHTED_BORDER Display.COLOR_HIGHLIGHTED_BACKGROUND

though, not sure if all return a valid value.

This seems to be Asha software platform only. The StringItem might not render properly on Series 40 full touch (at least it doesn't on the SDK 2.0 emulator), though replacing any instances of append(new StringItem(null, BUNCH_OF_WORDS[i]));

with

append(BUNCH_OF_WORDS[i] + "\n");

seems to somehow fix the problem (though it's not ideal in terms of spacing between the lines).

We could probably add a See also and mention the three part article series:

http://www.developer.nokia.com/Community/Wiki/How_to_filter_a_list_dynamically_while_typing_with_LCDUI_-_Part_3_(CustomItem_List)

skalogir 11:37, 11 June 2013 (EEST)

Tomi - Excellent points!

Thanks Stratos for the review! Very comprehensive as usual. I'll try to address these soon. That said, the list of words itself was just something I quickly pieced together just for proof-of-concept. The search bar itself is the thing here, but it wouldn't hurt to create a prettier list - especially considering it's not a big deal to do. Also, would improve the backwards compatibility although I'm targetting only Nokia Asha platform. Series 40 compatibility, at the moment, is based on the content of keyPressed() method implementation.

Cheers!

Tomi_ 16:43, 11 June 2013 (EEST)

Hamishwillee - Suggest remove "series 40" category

And just add a note somewhere stating that this is expected to work. Saves you having to verify.

Can we get VKB launch fixed? Would seem like a pretty obvious and important use case.

Thanks guys.

H

hamishwillee 09:09, 12 June 2013 (EEST)

Tomi - Updates

I added a pointer to the Canvas based search bar in PicasaViewer, updated few screenshots and removed the Series 40 category.

The VKB launch will be fixed in the very near future.

Tomi_ 17:50, 27 June 2013 (EEST)

Hamishwillee - Minor subedit

Hi Tomi

Thanks. I gave it a minor update for wiki style - e.g. using thumb for image rather than gallery, and fixing up an internal link. Also watered down some of the language - its important to be honest about the limitations, but "Fail" is a very negative word.

I'm happy with this. Plan to remove comments on next round I visit.

regards

H

hamishwillee 03:08, 28 June 2013 (EEST)

 

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×