YuhanXu / omnidroid

Automatically exported from code.google.com/p/omnidroid
Apache License 2.0
0 stars 0 forks source link

Only show paramater button when appropriate #63

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When adding an action, the "Params" button should only be displayed if
parameters are available for the selected action.

Original issue reported on code.google.com by case.and...@gmail.com on 20 May 2010 at 4:59

GoogleCodeExporter commented 8 years ago
I'll take a crack at this...

Original comment by c.r.dow...@gmail.com on 8 Jun 2010 at 1:55

GoogleCodeExporter commented 8 years ago
this also applies to the contacts button

Original comment by c.r.dow...@gmail.com on 8 Jun 2010 at 11:36

GoogleCodeExporter commented 8 years ago
We could use the existing layout and make the param button grayed out 
(disabled) when appropriate, or we could remove the button altogether. 
preferences on this?

Original comment by c.r.dow...@gmail.com on 21 Jun 2010 at 3:25

GoogleCodeExporter commented 8 years ago
You should be able to use the existing layout, just hide the button.  Something 
like this should do the trick (assuming you write paramsAvailable():

if (!paramsAvailable()) {
   findViewById(R.id.ID_FROM_LAYOUT).setVisibility(false);
}

Original comment by case.and...@gmail.com on 21 Jun 2010 at 3:37

GoogleCodeExporter commented 8 years ago
actually instead of false it would be View.GONE or View.INVISIBLE 
(http://developer.android.com/reference/android/view/View.html#setVisibility%28i
nt%29)

Original comment by case.and...@gmail.com on 21 Jun 2010 at 3:39

GoogleCodeExporter commented 8 years ago
yes i think GONE is the ticket, I had tried INVISIBLE but that still leaves the 
space of the button as if it were there. thanks, code coming soon

Original comment by c.r.dow...@gmail.com on 21 Jun 2010 at 3:48

GoogleCodeExporter commented 8 years ago
Actually, I am also handling a similar case - issue 87. It never occurred to me 
to disable the button instead; but I like the idea, since it makes the layout 
consistent on all screens. INVISIBLE also preserves the layout, but it looks 
like a sore in the eye. I'll just follow what you'll end up with to make the UI 
design consistent.

Original comment by renc...@gmail.com on 21 Jun 2010 at 4:20

GoogleCodeExporter commented 8 years ago
Actually I think keeping the layout consistent is a good idea.  And if setting 
it to INVISIBLE makes it look bad, then perhaps graying it out is the best 
option.  Or maybe it should be handled differently depending on the context.  
For example parameters may look better with it using GONE, but the "+Filter" 
button from issue 87 should definitely use a grayed out option since you go 
back to that activity in between adding actions/filters.

Original comment by case.and...@gmail.com on 21 Jun 2010 at 4:48

GoogleCodeExporter commented 8 years ago
For some screens, the param button may work for one of the fields but not the 
other. For example, if you're setting a rule based on "Time Is", and you take 
an action such as sending an SMS, the param button should not and is not 
applicable to the 'Phone Number' field, but is for the 'Text Message' field. 
I'm thinking the best thing to do may be to use an OnFocusChangeListener and 
grey out the button depending on which field is selected. This way we don't 
need the error message about no params available, and making the button appear 
dynamically on the same screen may be confusing. If we do this, it might make 
sense to use the grayed out param button across all screens like you were 
saying, for consistency. Thoughts?

Original comment by c.r.dow...@gmail.com on 22 Jun 2010 at 4:39

GoogleCodeExporter commented 8 years ago
If that's the case, I think it makes sense to disable the button.

Original comment by renc...@gmail.com on 22 Jun 2010 at 5:12

GoogleCodeExporter commented 8 years ago
I still think you have to get rid of the button whenever you can. so if there 
is no field that param is applicable on you load different layout. because 
personally I would say param button, when it's not needed looks more confusing 
than consistent.

Original comment by sv767%ny...@gtempaccount.com on 1 Jul 2010 at 6:21

GoogleCodeExporter commented 8 years ago

Original comment by case.and...@gmail.com on 6 Jul 2010 at 2:21

GoogleCodeExporter commented 8 years ago
Here is the code review for reference:

http://codereview.appspot.com/1702046/show

Original comment by c.r.dow...@gmail.com on 9 Jul 2010 at 9:39

GoogleCodeExporter commented 8 years ago
fix committed, r799

Original comment by c.r.dow...@gmail.com on 9 Jul 2010 at 9:44