当前位置: 首页>>代码示例>>Java>>正文


Java ViewDebug类代码示例

本文整理汇总了Java中android.view.ViewDebug的典型用法代码示例。如果您正苦于以下问题:Java ViewDebug类的具体用法?Java ViewDebug怎么用?Java ViewDebug使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ViewDebug类属于android.view包,在下文中一共展示了ViewDebug类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mapIntToStringUsingAnnotation

import android.view.ViewDebug; //导入依赖的package包/类
private static String mapIntToStringUsingAnnotation(
        int value,
        @Nullable ViewDebug.ExportedProperty annotation) {
    if (!canIntBeMappedToString(annotation)) {
        throw new IllegalStateException("Cannot map using this annotation");
    }

    for (ViewDebug.IntToString map : annotation.mapping()) {
        if (map.from() == value) {
            return map.to();
        }
    }

    // no mapping was found even though one was expected ):
    return NONE_MAPPING;
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:17,代码来源:RIViewDescriptor.java

示例2: mapIntToStringUsingAnnotation

import android.view.ViewDebug; //导入依赖的package包/类
private static String mapIntToStringUsingAnnotation(
    int value,
    @Nullable ViewDebug.ExportedProperty annotation) {
  if (!canIntBeMappedToString(annotation)) {
    throw new IllegalStateException("Cannot map using this annotation");
  }

  for (ViewDebug.IntToString map : annotation.mapping()) {
    if (map.from() == value) {
      return map.to();
    }
  }

  // no mapping was found even though one was expected ):
  return NONE_MAPPING;
}
 
开发者ID:Laisly,项目名称:weex,代码行数:17,代码来源:ViewDescriptor.java

示例3: getStyleFromValue

import android.view.ViewDebug; //导入依赖的package包/类
private void getStyleFromValue(
    View element,
    String name,
    Object value,
    @Nullable ViewDebug.ExportedProperty annotation,
    StyleAccumulator styles) {

  if (name.equals(ID_NAME)) {
    getIdStyle(element, styles);
  } else if (value instanceof Integer) {
    getStyleFromInteger(name, (Integer) value, annotation, styles);
  } else if (value instanceof Float) {
    getStyleFromFloat(name, (Float) value, annotation, styles);
  } else {
    getStylesFromObject(element, name, value, annotation, styles);
  }
}
 
开发者ID:Laisly,项目名称:weex,代码行数:18,代码来源:ViewDescriptor.java

示例4: getStyleFromInteger

import android.view.ViewDebug; //导入依赖的package包/类
private void getStyleFromInteger(
    String name,
    Integer value,
    @Nullable ViewDebug.ExportedProperty annotation,
    StyleAccumulator styles) {

  String intValueStr = IntegerFormatter.getInstance().format(value, annotation);

  if (canIntBeMappedToString(annotation)) {
    styles.store(
        name,
        intValueStr + " (" + mapIntToStringUsingAnnotation(value, annotation) + ")",
        false);
  } else if (canFlagsBeMappedToString(annotation)) {
    styles.store(
        name,
        intValueStr + " (" + mapFlagsToStringUsingAnnotation(value, annotation) + ")",
        false);
  } else {
    styles.store(name, intValueStr, isDefaultValue(value, annotation));
  }
}
 
开发者ID:Laisly,项目名称:weex,代码行数:23,代码来源:ViewDescriptor.java

示例5: mapFlagsToStringUsingAnnotation

import android.view.ViewDebug; //导入依赖的package包/类
private static String mapFlagsToStringUsingAnnotation(
        int value,
        @Nullable ViewDebug.ExportedProperty annotation) {
    if (!canFlagsBeMappedToString(annotation)) {
        throw new IllegalStateException("Cannot map using this annotation");
    }

    StringBuilder stringBuilder = null;
    boolean atLeastOneFlag = false;

    for (ViewDebug.FlagToString flagToString : annotation.flagMapping()) {
        if (flagToString.outputIf() == ((value & flagToString.mask()) == flagToString.equals())) {
            if (stringBuilder == null) {
                stringBuilder = new StringBuilder();
            }

            if (atLeastOneFlag) {
                stringBuilder.append(" | ");
            }

            stringBuilder.append(flagToString.name());
            atLeastOneFlag = true;
        }
    }

    if (atLeastOneFlag) {
        return stringBuilder.toString();
    } else {
        return NONE_MAPPING;
    }
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:32,代码来源:RIViewDescriptor.java

示例6: getStyleFromValue

import android.view.ViewDebug; //导入依赖的package包/类
private void getStyleFromValue(
        View element,
        String name,
        Object value,
        @Nullable ViewDebug.ExportedProperty annotation,
        StyleAccumulator styles) {

    if (name.equals(ID_NAME)) {
        getIdStyle(element, styles);
    } else if (value instanceof Integer) {
        getStyleFromInteger(name, (Integer) value, annotation, styles);
    } else if (value instanceof Float) {
        styles.store(name, String.valueOf(value), ((Float) value) == 0.0f);
    } else if (value instanceof Boolean) {
        styles.store(name, String.valueOf(value), false);
    } else if (value instanceof Short) {
        styles.store(name, String.valueOf(value), ((Short) value) == 0);
    } else if (value instanceof Long) {
        styles.store(name, String.valueOf(value), ((Long) value) == 0);
    } else if (value instanceof Double) {
        styles.store(name, String.valueOf(value), ((Double) value) == 0.0d);
    } else if (value instanceof Byte) {
        styles.store(name, String.valueOf(value), ((Byte) value) == 0);
    } else if (value instanceof Character) {
        styles.store(name, String.valueOf(value), ((Character) value) == Character.MIN_VALUE);
    } else if (value instanceof CharSequence) {
        styles.store(name, String.valueOf(value), ((CharSequence) value).length() == 0);
    } else {
        getStylesFromObject(element, name, value, annotation, styles);
    }
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:32,代码来源:RIViewDescriptor.java

示例7: getStyleFromInteger

import android.view.ViewDebug; //导入依赖的package包/类
private void getStyleFromInteger(
        String name,
        Integer value,
        @Nullable ViewDebug.ExportedProperty annotation,
        StyleAccumulator styles) {

    String intValueStr = IntegerFormatter.getInstance().format(value, annotation);

    if (canIntBeMappedToString(annotation)) {
        styles.store(
                name,
                intValueStr + " (" + mapIntToStringUsingAnnotation(value, annotation) + ")",
                false);
    } else if (canFlagsBeMappedToString(annotation)) {
        styles.store(
                name,
                intValueStr + " (" + mapFlagsToStringUsingAnnotation(value, annotation) + ")",
                false);
    } else {
        Boolean defaultValue = true;
        // Mappable ints should always be shown, because enums don't necessarily have
        // logical "default" values. Thus we mark all of them as not default, so that they
        // show up in the inspector.
        if (value != 0 ||
                canFlagsBeMappedToString(annotation) ||
                canIntBeMappedToString(annotation)) {
            defaultValue = false;
        }
        styles.store(name, intValueStr, defaultValue);
    }
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:32,代码来源:RIViewDescriptor.java

示例8: FieldBackedCSSProperty

import android.view.ViewDebug; //导入依赖的package包/类
public FieldBackedCSSProperty(
        Field field,
        String cssName,
        @Nullable ViewDebug.ExportedProperty annotation) {
    super(cssName, annotation);
    mField = field;
    mField.setAccessible(true);
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:9,代码来源:RIViewDescriptor.java

示例9: MethodBackedCSSProperty

import android.view.ViewDebug; //导入依赖的package包/类
public MethodBackedCSSProperty(
        Method method,
        String cssName,
        @Nullable ViewDebug.ExportedProperty annotation) {
    super(cssName, annotation);
    mMethod = method;
    mMethod.setAccessible(true);
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:9,代码来源:RIViewDescriptor.java

示例10: getSelectedView

import android.view.ViewDebug; //导入依赖的package包/类
@Override
@ViewDebug.ExportedProperty
public View getSelectedView() {
	if (mItemCount > 0 && mSelectedPosition >= 0) {
		return getChildAt(mSelectedPosition - mFirstPosition);
	} else {
		return null;
	}
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:10,代码来源:AbsHListView.java

示例11: makeAndAddView

import android.view.ViewDebug; //导入依赖的package包/类
/**
 * Obtain the view and add it to our list of children. The view can be made
 * fresh, converted from an unused view, or used as is if it was in the
 * recycle bin.
 *
 * @param position Logical position in the list
 * @param childrenBottomOrTop Top or bottom edge of the view to add
 * @param flow If flow is true, align top edge to y. If false, align bottom
 *        edge to y.
 * @param selected Is this position selected?
 * @return View that was added
 */
@SuppressWarnings("deprecation")
private View makeAndAddView(int position, int childrenBottomOrTop, boolean flow,
        boolean selected) {
    View child;

    int childrenLeft;
    if (!mDataChanged) {
        // Try to use an exsiting view for this position
        child = mRecycler.getActiveView(position);
        if (child != null) {

            if (ViewDebug.TRACE_RECYCLER) {
                ViewDebug.trace(child, ViewDebug.RecyclerTraceType.RECYCLE_FROM_ACTIVE_HEAP,
                        position, getChildCount());
            }

            // Found it -- we're using an existing child
            // This just needs to be positioned
            childrenLeft = getItemLeft(position);
            setupChild(child, position, childrenBottomOrTop, flow, childrenLeft, selected, true);
            return child;
        }
    }

    //Notify new item is added to view.

    onItemAddedToList( position, flow );
    childrenLeft = getItemLeft( position );

    // Make a new view for this position, or convert an unused view if possible
    DebugUtil.i("makeAndAddView:" + position);
    child = obtainView(position, mIsScrap);

    // This needs to be positioned and measured
    setupChild(child, position, childrenBottomOrTop, flow, childrenLeft, selected, mIsScrap[0]);

    return child;
}
 
开发者ID:Shmilyz,项目名称:Swap,代码行数:51,代码来源:PLA_ListView.java

示例12: makeAndAddView

import android.view.ViewDebug; //导入依赖的package包/类
/**
 * Obtain the view and add it to our list of children. The view can be made
 * fresh, converted from an unused view, or used as is if it was in the
 * recycle bin.
 * 
 * @param position
 *            Logical position in the list
 * @param childrenBottomOrTop
 *            Top or bottom edge of the view to add
 * @param flow
 *            If flow is true, align top edge to y. If false, align bottom
 *            edge to y.
 * @param childrenLeft
 *            Left edge where children should be positioned
 * @param selected
 *            Is this position selected?
 * @return View that was added
 */
@SuppressWarnings("deprecation")
private View makeAndAddView(int position, int childrenBottomOrTop, boolean flow, boolean selected) {
    View child;

    int childrenLeft;
    if (!mDataChanged) {
        // Try to use an exsiting view for this position
        child = mRecycler.getActiveView(position);
        if (child != null) {

            if (ViewDebug.TRACE_RECYCLER) {
                ViewDebug.trace(child, ViewDebug.RecyclerTraceType.RECYCLE_FROM_ACTIVE_HEAP, position, getChildCount());
            }

            // Found it -- we're using an existing child
            // This just needs to be positioned
            childrenLeft = getItemLeft(position);
            setupChild(child, position, childrenBottomOrTop, flow, childrenLeft, selected, true);
            return child;
        }
    }

    // Notify new item is added to view.

    onItemAddedToList(position, flow);
    childrenLeft = getItemLeft(position);

    // Make a new view for this position, or convert an unused view if
    // possible
    child = obtainView(position, mIsScrap);

    // This needs to be positioned and measured
    setupChild(child, position, childrenBottomOrTop, flow, childrenLeft, selected, mIsScrap[0]);

    return child;
}
 
开发者ID:ysYvonne,项目名称:KitchenSecret_Android,代码行数:55,代码来源:PLA_ListView.java

示例13: format

import android.view.ViewDebug; //导入依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public String format(Integer integer, @Nullable ViewDebug.ExportedProperty annotation) {
  if (annotation != null && annotation.formatToHexString()) {
    return "0x" + Integer.toHexString(integer);
  }

  return super.format(integer, annotation);
}
 
开发者ID:Laisly,项目名称:weex,代码行数:10,代码来源:IntegerFormatter.java

示例14: mapFlagsToStringUsingAnnotation

import android.view.ViewDebug; //导入依赖的package包/类
private static String mapFlagsToStringUsingAnnotation(
    int value,
    @Nullable ViewDebug.ExportedProperty annotation) {
  if (!canFlagsBeMappedToString(annotation)) {
    throw new IllegalStateException("Cannot map using this annotation");
  }

  StringBuilder stringBuilder = null;
  boolean atLeastOneFlag = false;

  for (ViewDebug.FlagToString flagToString : annotation.flagMapping()) {
    if (flagToString.outputIf() == ((value & flagToString.mask()) == flagToString.equals())) {
      if (stringBuilder == null) {
        stringBuilder = new StringBuilder();
      }

      if (atLeastOneFlag) {
        stringBuilder.append(" | ");
      }

      stringBuilder.append(flagToString.name());
      atLeastOneFlag = true;
    }
  }

  if (atLeastOneFlag) {
    return stringBuilder.toString();
  } else {
    return NONE_MAPPING;
  }
}
 
开发者ID:Laisly,项目名称:weex,代码行数:32,代码来源:ViewDescriptor.java

示例15: isDefaultValue

import android.view.ViewDebug; //导入依赖的package包/类
private static boolean isDefaultValue(
    Integer value,
    @Nullable ViewDebug.ExportedProperty annotation) {
  // Mappable ints should always be shown, because enums don't necessarily have
  // logical "default" values. Thus we mark all of them as not default, so that they
  // show up in the inspector.
  if (canFlagsBeMappedToString(annotation) || canIntBeMappedToString(annotation)) {
    return false;
  }

  return value == 0;
}
 
开发者ID:Laisly,项目名称:weex,代码行数:13,代码来源:ViewDescriptor.java


注:本文中的android.view.ViewDebug类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。