I am searching for a design pattern i can use so i can feature toggle UI elements.
I have a simple screen that has a horizonal list at the bottom and at the top is a photo. clicking the list updates the photo. Anyway, thats not
the issue. This screen and code already exist. I have a task to change what the list items look like.
I have a task to create a toggle such that the business can test this feature out, if they dont like it they want to revert back to the old design
by simply using a feature toggle.
I dont want to copy all the files and make duplicates with a if else condition on the files if i can avoid it, (if you think its the better way let me know)
i was thinking there is a design pattern something like a strategy pattern i could use to do this more cleanly. even chain of responsilbity could be used.
but anyway, im not sure the best way to do this, how have you all handled feature toggles on UI elements ?
You could use a toggle router, like here.
https://martinfowler.com/articles/feature-toggles.html
Related
It probably will be an opinion based answers rather than fixed ones, but I thoughts it wouldn't be bad to ask this question and get opinions from more experienced developers.
I am implementing in my app recycler view, that each item in the recycler view should have some actions, for example
delete, reminders, spinners, change icons and some others.
Currently I implemented the delete and change icon logic with both swipe action, and contextual action mode(on click the app bar changed to "new" app bar with delete button)
I thought to continue to implement all the other actions, like reminders and spinners in the item itself but I don't know if it's a good idea.
After some research I have several approaches in my mind:
throw all the actions right in the item view itself, which mean the user see right away all the possible actions.
use popup menu(three dots on the item, and open little menu with actions)
expand the contextual action mode that will include all actions
Maybe even completely different approach and put all the actions inside the item detail screen
What do you think is a better approach?
For what it's worth, the Material Design specs (scroll down to List Controls, I can't get a link to it HOW IRONIC) recommend a primary and (optional) secondary action, with possible left and right swipe gestures (which are usually understood to be "get rid of this item" in some way, like archive and delete)
Personally I think that's a good way to go (and you don't need to follow MD but it's a good base set of principles, especially if you're not a designer or UX person yourself) - it avoids clutter, and makes it clearer to users what their main options are.
You can implement tap behaviour on the list item to bring up a dialog (fullscreen or otherwise) where you have room to add lots of other options, labels to explain them, etc. You're not limited to the size of a list item, and you can easily add to it in future if you need to, instead of being committed to trying to fit everything into a list item.
Plus there's accessibility to think about - list items are small, you don't get much space (especially on smaller devices, where the user has large fonts enabled) so where are you gonna put all that stuff? Moving some to a contextual action mode works, but there's not much space there either, and the user has to realise they need to look up there. Will it work well for blind users relying on linear navigation?
Basically you can avoid a lot of these troubles by following established patterns, where other people have done the work to make it all "just work". My own personal experience has been trying to do things in a different way, and eventually coming back to the "recommended" way and wishing I'd done that to begin with!
I'm trying to design an app with a layout that will roughly look like this (don't mind the color):
How can I achieve something like that? I'm thinking of using a CardView for that bottom panel (I don't know what it's really called).
Furthermore, I want to hide it (animating it) when the use scrolls on the content. I have tried many codes but they won't work so I won't put them here anyway (like what's suggested here). Thanks for the help.
Whenever I have a question along the lines of "How do I do this neat UI thing I saw once?", I always start by checking out wasabeef's amazing UI library collection. In your case I might start by looking at bottomsheet or AndroidSweetSheet.
Essentially I'm asking what techniques to use in Eclipse/Android Studio to make a UI that looks like the FaceBook UI withtabs on the bottom and their typical action bar on the top with content in the middle.
I've been kind of dealing with this issue for quite some time now and as I have a project deadline coming up figured it was finally time to get stackoverflow's opinion. What would be the best way of creating a social media app that models FaceBook's user interface. By this I am referring to something with the four tabs on bottom and search/back and profile buttons at the top, with some sort of fragment changing in the middle.
The solutions I have currently tried are using a split actionbar by forcing the top into a custom layout and the bottom into an options menu; however, this resulted in giving the options menu the drop down option instead of tabs (if there's a quick fix for this like setting a custom layout to it please lmk because this is my current setup).
For the main content view I originally tried using fragments and then switching between fragments by using functions and buttons inside the fragment class to switch views; however, this required childfragment manager, and for some reason that never worked properly, so instead I ended up switching activities instead of fragments which was horribly slow.
If you guys have any suggestions on how to do this properly please please either tell me how I would go about this, or better yet please show me some very good examples on how to do these things.
Thanks :)
u can use any proto typing tools to create UI . Some tools include Proto.io , Fluid ui etc
I'm looking to implement pull to refresh on a ViewPager, and I'm curious what the best way to go about it is.
It looks like just setting a page transformation on the ViewPager wouldn't really do the trick, as you really want things like onAbsorb, which is available in EdgeEffect.
Just implementing an EdgeEffect doesn't seem like the right choice, since AFAICT, it won't move any of the existing children around.
I'd rather not use the PullToRefresh library (since it isn't being maintained), and would prefer to do mostly custom stuff -
Any advice on what approach is the most promising way to proceed?
Don't try to implement the pull to refresh by yourself, there are several good 3rd party libraries which are very easy to use.
But pull to refresh maybe not a good choice on android, a refresh action button is better.
A widely used pulltorefresh library.
It is slide to refresh that you want, as it is ViewPager. Detect a swipe (left on first element and right on last) and request for new data, when the detection is positive. For that you want onInterceptTouch over a Custom ViewPager, and a SwipeGesture detector. After that you can try other custom features that you suggest in your question.
I'm looking to implement pull to refresh on a ViewPager, and I'm
curious what the best way to go about it is.
You sited you didn't want to use the PullToRefresh library, and I get that. But I would start your research/exploration there if you are looking for similar behavior. Chris' repos have a healthy commit history, and from those you can infer some decisions regarding design choices, pitfalls, and fixes.
https://github.com/chrisbanes/Android-PullToRefresh
https://github.com/chrisbanes/ActionBar-PullToRefresh
With something like a scroll view, I imagine you can have EdgeEffects and PTR in the actionbar and not worry about moving children at all (with it working right out of the box - His google play sample app has that behavior). But I'm not sure if that is the exact effect you are looking for.
Don't implement pull to refresh on Android. I know it's not the answer, but pull to refresh is an iOS convention, not an Android one.
I need some way to edit an item in my multi-line ListView - and it's just two text fields that need editing.
What would be the best way, design-wise, go about this? I feel that a whole new activity would waste too much screen space and look off, yet just a popup with the two fields and some confirm button might look off as well.
It's pretty subjective as to what's the best design for this, especially without knowing more about your specific use, however there are definitely a few possibilities that come to mind.
The new activity option that you noted is actually quite standard. You can see a similar paradigm used in Gmail, Google Talk, Messaging, etc. If your text fields expect to have something like a single word in each though, I can understand how that might feel like a waste of space to create a new activity. I wouldn't necessarily rule it out though; you can probably play around with styling to make it feel less empty (include labels, short descriptions, etc.). Also consider that most users nowadays have soft keyboards. That can take up a significant amount of space and make the view feel less empty.
The popup option seems less standard, but again if you styled it correctly I could see it working OK. What don't you like about this option?
Another option is to do a multi-pane layout of sorts which is far less common for a phone-sized layout but not out of the question. You could have a pane with two text boxes which is for the current item above your list view and have the contents change when you select an item in the list view. This is also a less standard UI.
You could also have an alternate view actually within the list item. In addition to your current (I'm assuming) two TextViews, you could have two EditTexts and maybe an OK and cancel button that are hidden. The visibility of all of these views would be toggled when you select the item.
There are more options too, I'm sure, but hopefully this will give you a little to think about at least.
I would use a separate activity for several reasons:
1) It's what users would expect. I can't recall any apps that use a pop up to edit contents of a listview
2) It'll be much easier to manage state in a separate activity e.g. when a user starts to enter some text and then gets interrupted by a call or email notification etc
3) If you're editing text then the keyboard wil take up most of the screen so you're activity won't look sparse.
you need to update in list view and add more items in list view???????