I am using a Recycler View in my app and the user can add items to the list via speech to text or manually via text.
For the speech to text I have set it up so that list items are seperate by the word and.
For example fish and chips adds the items "fish" and "chips" to the recycler view.
But if someone says fish and chips and chips, how can I prevent chips being added twice?
I'm thinking I need to add something in the OnActivityResults method?
The same as if the item is already in the list how can I prevent it being added again?
Thanks
Related
I'm trying to implement an e-commerce based app using React Native and need some pointers in regards to building a multi step ListView with multiple selection options. For example, a user wants to purchase a t-shirt. Once they click 'add to cart' I need the component to load several options i.e. shirt size, color etc. Is there a component like this?
What you are probably looking for here is an accordion or collapsible view. There are a few out there now, including:
https://github.com/naoufal/react-native-accordion
https://github.com/oblador/react-native-collapsible
Perhaps these don't exactly meet your needs, but they are a good starting point.
If you take react-native-accordion as an example, you could have your initial product view and purchase button visible inside a view and designate the purchase button as the header component that, when pressed, will reveal the shirt size and colour pickers. That should do it.
More generally, whenever you need a component you can check here (there are other resources too):
https://github.com/jondot/awesome-react-native#components
https://js.coach/react-native
I want to develop a simple dictionary application which is like the Search tab of AppStore on iPhone:
The 1st screen have a SeachBar on top, the bottom is "History words" (such as "Trending Searches" on AppStore).
When user touches the SearchBar, the bottom view is gray. Touching the gray area to leave the Seach text-box and my user is able to click on one of history words.
If he/she types on SearchBar, the suggestion words list appears and he/she can click a word to see its definition with the SearchBar containing the word there (I don't want my users having to go to 2nd view to see word's definition because if so, they must click Back button to touch and type on Seach text-box. It's likely that, my application has only 1 ViewController).
I know how to work with SearchBar and TableView to display the suggestion words list but don't know what to do to implement other things:
Make a view gray; touching on the gray area to leave the Search text-box
Hide the suggestion words list (TableView) -> user can see "History words" again
Keep the SearchBar -> user can type immediately to search other word when he/she is seeing current word definition
Thanks for reading and please show me some keywords, clues to solve three issues above.
Many thanks!
Use UISearchController to create a page like you wanted.
It has dimsBackgroundDuringPresentation property to make a backgroundView gray when user is typing.
It has - (instancetype)initWithSearchResultsController:(UIViewController *)searchResultsController method. You can initialize the UISearchController with resultsController. For results you can do whatever you want.
Lastly, you can set a custom view to see "History words" to UISearchController
How can you add or replace a view within a view with code? I'm programming for OSX, not IOS.
I am using a drawer that utilizes a custom view. In the custom view I have two boxes, one with a custom set of icons that I want to stay static and another box that has the information related to that button. What I want to do is when a user clicks one of the buttons that the 2nd box view changes to reflect the info for that button.
For example, I have five buttons and the default 2nd box is "Info", if the user clicks the 2nd button in the first box view I want to change the 2nd box to be the "List" box instead while the 1st box with the buttons stays intact.
I'm not sure how this would impact constraints since while the first box is a fixed size, the 2nd box needs to be dynamic so that it fills in the "rest of the space" so that when the drawer size changes with the window size that the 2nd box is taking up the remaining real estate.
Thank you!
I have implemented such a scenario in the past using a tabless NSTabView, and an NSSegmentedControl (for the buttons). The NSTabView has it's -takeSelectedTabViewItemFromSender: action connected to the NSSegmentedControl, using Interface Builder.
In the Connections Inspector, this shows up like so:
This has the effect that the index of the selected NSTabViewItem in your NSTabView will correspond to the index of the selected segment in the NSSegmentedControl.
I am working on a windows phone app. I want to make a list whose items are draggable anywhere horizontally or vertically. List items are of image types.
Basically I want this like windows phone main page that contains tiles. When we hold a tile for some time it popups and can be draggable to anywhere in page.
have a look at Blend Interaction behaviours. I did a sample a while back
http://invokeit.wordpress.com/2012/02/10/wp7-drag-drop-example/
What I'm looking to do is create some kind of master view, that would have the same header (with a logo), footer (with some text and a button), background image and navigation (not a navigation bar, just a few buttons) on every view.
You could think of what I'm after doing is like a PowerPoint presentation. Create a master slide that's layout is used through every slide, you create a new slide and it takes across all the masters properties (header, footer, background etc) and then it's just the content that changes on each new slide.
However, I'm not too sure how I would do this in an iOS application. I've had a look on Google searching many different phrases but all seem to be about iPad split views and using cells of a tableview, which isn't what I'm after.
All I can think to do is create a single view controller class, with a view, and then add a sub UIView for each page I want (about 15-20), but with the one class, and every page having different content and a lot of code required for each one, that's going to get messy! Or I simply recreate the footer and header etc on every view controller, so if there were to be a change, then I'd have 20 views (more if it grows) to edit! So I'm just wondering if there's a simple way of getting what I'm after.
The app will be for iPad only, and I can use any OS up to 5, so xibs or storyboards are fine. And this won't be on the app store if that helps.
I've done a quick drawing below. The master view with all my bits to be used on each page, and then content slides that will slot in and out of the mater's content area.
Check out Containment View Controllers. This kind of presentation is exactly what they are designed to handle. There is a really nice WWDC presentation from 2012 I believe that illustrates how these work. There are also several tutorials online if you search.
maybe the best option is to create a master detail page. Then for each new page, call the master?
If u want to show header and footer view in whole apps then add header and footer view in window not in view controller i think it will work