Home | History | Annotate | Download | only in api
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.eclipse.org/org/documents/epl-v10.php
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.ide.common.api;
     18 
     19 
     20 /**
     21  * A {@link MarginType} indicates whether a {@link Segment} corresponds to the visual edge
     22  * of the node, or whether it is offset by a margin in the edge's direction, or whether
     23  * it's both (which is the case when the margin is 0).
     24  * <p>
     25  * We need to keep track of the distinction because different constraints apply
     26  * differently w.r.t. margins. Let's say you have a target node with a 50 dp margin in all
     27  * directions. If you layout_alignTop with this node, the match will be on the visual
     28  * bounds of the target node (ignoring the margin). If you layout_above this node, you
     29  * will be offset by the margin on the target node. Therefore, we have to add <b>both</b>
     30  * edges (the bounds of the target node with and without edges) and check for matches on
     31  * each edge depending on the constraint being considered.
     32  */
     33 public enum MarginType {
     34     /**
     35      * This margin type is used for nodes that have margins, and this segment includes the
     36      * margin distance
     37      */
     38     WITH_MARGIN,
     39 
     40     /**
     41      * This margin type is used for nodes that have margins, and this segment does not
     42      * include the margin distance
     43      */
     44     WITHOUT_MARGIN,
     45 
     46     /**
     47      * This margin type is used for nodes that do not have margins, so margin edges and
     48      * non-margin edges are the same
     49      */
     50     NO_MARGIN;
     51 }
     52