當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewDebug.ExportedProperty方法代碼示例

本文整理匯總了Java中android.view.ViewDebug.ExportedProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewDebug.ExportedProperty方法的具體用法?Java ViewDebug.ExportedProperty怎麽用?Java ViewDebug.ExportedProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.ViewDebug的用法示例。


在下文中一共展示了ViewDebug.ExportedProperty方法的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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: getStyleFromFloat

import android.view.ViewDebug; //導入方法依賴的package包/類
private void getStyleFromFloat(
    String name,
    Float value,
    @Nullable ViewDebug.ExportedProperty annotation,
    StyleAccumulator styles) {
  styles.store(name, String.valueOf(value), isDefaultValue(value));
}
 
開發者ID:Laisly,項目名稱:weex,代碼行數:8,代碼來源:ViewDescriptor.java

示例9: 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

示例10: 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

示例11: 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:Laisly,項目名稱:weex,代碼行數:9,代碼來源:ViewDescriptor.java

示例12: 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:facebook,項目名稱:stetho,代碼行數:32,代碼來源:ViewDescriptor.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:facebook,項目名稱:stetho,代碼行數:10,代碼來源:IntegerFormatter.java

示例14: canIntBeMappedToString

import android.view.ViewDebug; //導入方法依賴的package包/類
private static boolean canIntBeMappedToString(@Nullable ViewDebug.ExportedProperty annotation) {
    return annotation != null
            && annotation.mapping() != null
            && annotation.mapping().length > 0;
}
 
開發者ID:nekocode,項目名稱:ResourceInspector,代碼行數:6,代碼來源:RIViewDescriptor.java

示例15: canFlagsBeMappedToString

import android.view.ViewDebug; //導入方法依賴的package包/類
private static boolean canFlagsBeMappedToString(@Nullable ViewDebug.ExportedProperty annotation) {
    return annotation != null
            && annotation.flagMapping() != null
            && annotation.flagMapping().length > 0;
}
 
開發者ID:nekocode,項目名稱:ResourceInspector,代碼行數:6,代碼來源:RIViewDescriptor.java


注:本文中的android.view.ViewDebug.ExportedProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。