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 import com.google.common.annotations.Beta;
     20 
     21 
     22 /**
     23  * A {@link MarginType} indicates whether a {@link Segment} corresponds to the visual edge
     24  * of the node, or whether it is offset by a margin in the edge's direction, or whether
     25  * it's both (which is the case when the margin is 0).
     26  * <p>
     27  * We need to keep track of the distinction because different constraints apply
     28  * differently w.r.t. margins. Let's say you have a target node with a 50 dp margin in all
     29  * directions. If you layout_alignTop with this node, the match will be on the visual
     30  * bounds of the target node (ignoring the margin). If you layout_above this node, you
     31  * will be offset by the margin on the target node. Therefore, we have to add <b>both</b>
     32  * edges (the bounds of the target node with and without edges) and check for matches on
     33  * each edge depending on the constraint being considered.
     34  * <p>
     35  * <b>NOTE: This is not a public or final API; if you rely on this be prepared
     36  * to adjust your code for the next tools release.</b>
     37  */
     38 @Beta
     39 public enum MarginType {
     40     /**
     41      * This margin type is used for nodes that have margins, and this segment includes the
     42      * margin distance
     43      */
     44     WITH_MARGIN,
     45 
     46     /**
     47      * This margin type is used for nodes that have margins, and this segment does not
     48      * include the margin distance
     49      */
     50     WITHOUT_MARGIN,
     51 
     52     /**
     53      * This margin type is used for nodes that do not have margins, so margin edges and
     54      * non-margin edges are the same
     55      */
     56     NO_MARGIN;
     57 }
     58