Java Code Examples for android.view.ViewDebug#ExportedProperty

The following examples show how to use android.view.ViewDebug#ExportedProperty . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewDescriptor.java    From stetho with MIT License 5 votes vote down vote up
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);
  }
}
 
Example 2
Source File: RIViewDescriptor.java    From ResourceInspector with Apache License 2.0 5 votes vote down vote up
public MethodBackedCSSProperty(
        Method method,
        String cssName,
        @Nullable ViewDebug.ExportedProperty annotation) {
    super(cssName, annotation);
    mMethod = method;
    mMethod.setAccessible(true);
}
 
Example 3
Source File: ViewDescriptor.java    From stetho with MIT License 5 votes vote down vote up
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;
  }
}
 
Example 4
Source File: ViewDescriptor.java    From weex with Apache License 2.0 5 votes vote down vote up
public MethodBackedCSSProperty(
    Method method,
    String cssName,
    @Nullable ViewDebug.ExportedProperty annotation) {
  super(cssName, annotation);
  mMethod = method;
  mMethod.setAccessible(true);
}
 
Example 5
Source File: IntegerFormatter.java    From weex with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 6
Source File: ViewDescriptor.java    From weex with Apache License 2.0 5 votes vote down vote up
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;
  }
}
 
Example 7
Source File: ZrcAbsListView.java    From AndroidStudyDemo with GNU General Public License v2.0 4 votes vote down vote up
@ViewDebug.ExportedProperty
public boolean isScrollingCacheEnabled() {
    return mScrollingCacheEnabled;
}
 
Example 8
Source File: BaseRadioLayout.java    From NestedSelectionRadioGroup with Apache License 2.0 4 votes vote down vote up
@Override
@ViewDebug.ExportedProperty
public boolean isChecked() {
    return this.mChecked;
}
 
Example 9
Source File: WebView.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the height of the HTML content.
 *
 * @return the height of the HTML content
 */
@ViewDebug.ExportedProperty(category = "webview")
public int getContentHeight() {
    checkThread();
    return mProvider.getContentHeight();
}
 
Example 10
Source File: ViewDescriptor.java    From stetho with MIT License 4 votes vote down vote up
public ViewCSSProperty(String cssName, @Nullable ViewDebug.ExportedProperty annotation) {
  mCSSName = cssName;
  mAnnotation = annotation;
}
 
Example 11
Source File: ZrcAbsListView.java    From ZrcListView with MIT License 4 votes vote down vote up
@ViewDebug.ExportedProperty
public boolean isSmoothScrollbarEnabled() {
	return mSmoothScrollbarEnabled;
}
 
Example 12
Source File: ZrcAbsListView.java    From ZrcListView with MIT License 4 votes vote down vote up
@ViewDebug.ExportedProperty(category = "drawing")
public int getCacheColorHint() {
	return mCacheColorHint;
}
 
Example 13
Source File: IcsProgressBar.java    From zhangshangwuda with Apache License 2.0 2 votes vote down vote up
/**
 * <p>Return the upper limit of this progress bar's range.</p>
 *
 * @return a positive integer
 *
 * @see #setMax(int)
 * @see #getProgress()
 * @see #getSecondaryProgress()
 */
@ViewDebug.ExportedProperty(category = "progress")
public synchronized int getMax() {
    return mMax;
}
 
Example 14
Source File: TwoWayAbsListView.java    From recent-images with MIT License 2 votes vote down vote up
/**
 * Returns the current state of the fast scroll feature.
 *
 * @return True if smooth scrollbar is enabled is enabled, false otherwise.
 *
 * @see #setSmoothScrollbarEnabled(boolean)
 */
@ViewDebug.ExportedProperty
public boolean isSmoothScrollbarEnabled() {
	return mSmoothScrollbarEnabled;
}
 
Example 15
Source File: IcsProgressBar.java    From Libraries-for-Android-Developers with MIT License 2 votes vote down vote up
/**
 * <p>Get the progress bar's current level of secondary progress. Return 0 when the
 * progress bar is in indeterminate mode.</p>
 *
 * @return the current secondary progress, between 0 and {@link #getMax()}
 *
 * @see #setIndeterminate(boolean)
 * @see #isIndeterminate()
 * @see #setSecondaryProgress(int)
 * @see #setMax(int)
 * @see #getMax()
 */
@ViewDebug.ExportedProperty(category = "progress")
public synchronized int getSecondaryProgress() {
    return mIndeterminate ? 0 : mSecondaryProgress;
}
 
Example 16
Source File: PLAListView.java    From SimplifyReader with Apache License 2.0 2 votes vote down vote up
/**
 * @return True to recycle the views used to measure this ListView in
 *         UNSPECIFIED/AT_MOST modes, false otherwise.
 * @hide
 */
@ViewDebug.ExportedProperty(category = "list")
protected boolean recycleOnMeasure() {
    return true;
}
 
Example 17
Source File: IcsProgressBar.java    From Libraries-for-Android-Developers with MIT License 2 votes vote down vote up
/**
 * <p>Get the progress bar's current level of progress. Return 0 when the
 * progress bar is in indeterminate mode.</p>
 *
 * @return the current progress, between 0 and {@link #getMax()}
 *
 * @see #setIndeterminate(boolean)
 * @see #isIndeterminate()
 * @see #setProgress(int)
 * @see #setMax(int)
 * @see #getMax()
 */
@ViewDebug.ExportedProperty(category = "progress")
public synchronized int getProgress() {
    return mIndeterminate ? 0 : mProgress;
}
 
Example 18
Source File: PLA_ListView.java    From EverMemo with MIT License 2 votes vote down vote up
/**
 * @return True to recycle the views used to measure this ListView in
 *         UNSPECIFIED/AT_MOST modes, false otherwise.
 * @hide
 */
@ViewDebug.ExportedProperty(category = "list")
protected boolean recycleOnMeasure() {
	return true;
}
 
Example 19
Source File: PLAAbsListView.java    From Lay-s with MIT License 2 votes vote down vote up
/**
 * Indicates whether the children's drawing cache is used during a scroll.
 * By default, the drawing cache is enabled but this will consume more memory.
 *
 * @return true if the scrolling cache is enabled, false otherwise
 *
 * @see #setScrollingCacheEnabled(boolean)
 * @see View#setDrawingCacheEnabled(boolean)
 */
@ViewDebug.ExportedProperty
public boolean isScrollingCacheEnabled() {
    return mScrollingCacheEnabled;
}
 
Example 20
Source File: WebView.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the URL for the current page. This is not always the same as the URL
 * passed to WebViewClient.onPageStarted because although the load for
 * that URL has begun, the current page may not have changed.
 *
 * @return the URL for the current page
 */
@ViewDebug.ExportedProperty(category = "webview")
public String getUrl() {
    checkThread();
    return mProvider.getUrl();
}