design-guidelines

What should be the color of the Ripple, colorPrimary or colorAccent? (Material Design)

心不动则不痛 提交于 2019-12-17 08:30:00
问题 I have reading Material Design Guidelines but I don't know what should be the color of the Ripple if it isn't black (with alpha). For example, I have an app with colorPrimary = blue, and colorAccent = red. Actually I am using the colorAccent (with alpha), I should use colorPrimary (with alpha) if I want a color different of black to the ripple? I checked all app of Google but they never use ripples with color. An image like I have now: 回答1: Use 26% alpha for colored ripples. Android L doesn't

What layout is better for a UI with two card cells per row?

白昼怎懂夜的黑 提交于 2019-12-14 02:24:32
问题 What is an optimal way to create a grid view for iOS with two columns per row as shown in the screenshot? I am currently using tableview with static cells, but the UI gets distorted on some iPad. Also how best to arrange the grid border? Currently I use imageview of center ones, and a new cell for the horizontal ones with an imageview. But this does not feel right. 回答1: That should be made with an UICollectionView , it has a specific delegate which is UICollectionViewDelegateFlowLayout that

When should I separately implement IEnumerator<T>?

风格不统一 提交于 2019-12-12 12:06:07
问题 In the framework classes of collections I have often seen IEnumerator<T> separately implemented as an inner class and an instance of it is returned in the GetEnumerator method. Now suppose I'm writing my own collection classes which will have an inbuilt collection like List<T> or T[] act as the holder internally, say like this: public class SpecialCollection<T> : IEnumerable<T> { List<T> list; public SpecialCollection<T>() { } public IEnumerator<T> GetEnumerator() { return list.GetEnumerator(

What behaviour is pereferable for Apple Pay button if no cards in the wallet?

谁说胖子不能爱 提交于 2019-12-11 17:12:59
问题 I was looked through the apple guidelines but did not found anything about this question. Additional info: I have added Apple Pay button to app and hide it if there are no capabilities (e.g., cards) to pay with. But customer does not like it and wants some other approach. I think we may open wallet like asking user to add a card, but I am not sure what Apple guidelines think about it. Is there any explicit recommendation about it? 回答1: Here is Apple's guidelines on implementing Apple Pay.

Elegant and maintainable way of populating Tree structures in c#

笑着哭i 提交于 2019-12-07 20:43:32
问题 I have a Tree. class TreeNode { public TreeNode(string name, string description) { Name = name; Description = description; } string Name { get; set; } string Description { get; set; } public List<TreeNode> Children = new List<TreeNode>(); } I would like to populate a large one for unit testing purposes. I would really like to keep stuff DRY. Say for illustration purposes my tree has the following structure Parent,desc Child 1, desc1 Grandchild 1, desc1 Child 2, desc2 How would you go about

Elegant and maintainable way of populating Tree structures in c#

陌路散爱 提交于 2019-12-06 07:38:33
I have a Tree. class TreeNode { public TreeNode(string name, string description) { Name = name; Description = description; } string Name { get; set; } string Description { get; set; } public List<TreeNode> Children = new List<TreeNode>(); } I would like to populate a large one for unit testing purposes. I would really like to keep stuff DRY. Say for illustration purposes my tree has the following structure Parent,desc Child 1, desc1 Grandchild 1, desc1 Child 2, desc2 How would you go about populating the tree in an elegant an maintainable way? I find this code quite repetitious and error prone

Abstract Class Design: Why not define public constructores?

你。 提交于 2019-12-06 04:23:01
问题 Look here (Abstract Class Design): http://msdn.microsoft.com/en-us/library/ms229047.aspx It says: (1) Do not define public or protected internal (Protected Friend in Visual Basic) constructors in abstract types. In C#, we are not able to instantiate an abstract class. So, does it still matter to define public constructors for abstract classes in C# ? Or not writing public constructors for abstract classes because of semantic meaning? It also says: (2) Do define a protected or an internal

Abstract Class Design: Why not define public constructores?

纵然是瞬间 提交于 2019-12-04 10:05:33
Look here (Abstract Class Design): http://msdn.microsoft.com/en-us/library/ms229047.aspx It says: (1) Do not define public or protected internal (Protected Friend in Visual Basic) constructors in abstract types. In C#, we are not able to instantiate an abstract class. So, does it still matter to define public constructors for abstract classes in C# ? Or not writing public constructors for abstract classes because of semantic meaning? It also says: (2) Do define a protected or an internal constructor in abstract classes. Define internal constructors ?? In (1), it tells us that not defining

Creating a single SmartTV app for multiple platforms?

你离开我真会死。 提交于 2019-12-02 19:39:44
I want to develop a SmartTV application for the GoogleTV platform and i've been browsing trough the GoogleTV Guidelines ( https://developers.google.com/tv/android/ ). However, i don't want GoogleTV to be my only platform. I also want the same app to work on devices like Samsung SmartTV and/or LG SmartTV. But do the guidelines from Google conflict with Samsung guidelines and does the code of my application need a lot of rework to work on other devices? I'm editing my answer. I just checked the Samsung website and, I'm happy to say, they threw out all the junk. They use to have a number of

Best way of protect a backing field from mistaken use in C#

假如想象 提交于 2019-12-01 19:25:10
I have a class (Foo) which lazy loads a property named (Bar). What is your preferred way to protect against mistaken use (due to intellisense or inexperienced staff) of the uninitialized backing field? I can think of 3 options: class Foo { // option 1 - Easy to use this.bar by mistake. string bar; string Bar { get { // logic to lazy load bar return bar; } } // option 2 - Harder to use this._bar by mistake. It is more obscure. string _bar2; string Bar2 { get { // logic to lazy load bar2 return _bar2; } } //option 3 - Very hard to use the backing field by mistake. class BackingFields { public