Java Code Examples for android.view.View.setImportantForAccessibility()

The following are Jave code examples for showing how to use setImportantForAccessibility() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: chromium-for-android-56-debug-video   File: Tab.java   Source Code and License Vote up 7 votes
/**
 * Update whether or not the current native tab and/or web contents are
 * currently visible (from an accessibility perspective), or whether
 * they're obscured by another view.
 */
public void updateAccessibilityVisibility() {
    View view = getView();
    if (view != null) {
        int importantForAccessibility = isObscuredByAnotherViewForAccessibility()
                ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
                : View.IMPORTANT_FOR_ACCESSIBILITY_YES;
        if (view.getImportantForAccessibility() != importantForAccessibility) {
            view.setImportantForAccessibility(importantForAccessibility);
            view.sendAccessibilityEvent(
                    AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        }
    }

    ContentViewCore cvc = getContentViewCore();
    if (cvc != null) {
        boolean isWebContentObscured = isObscuredByAnotherViewForAccessibility()
                || isShowingSadTab();
        cvc.setObscuredByAnotherView(isWebContentObscured);
    }
}
 
Example 2
Project: exciting-app   File: AdapterView.java   Source Code and License Vote up 6 votes
/**
 * Sets the view to show if the adapter is empty
 */
@TargetApi(16)
public void setEmptyView( View emptyView ) {
	mEmptyView = emptyView;

	if( android.os.Build.VERSION.SDK_INT >= 16 ) {
		// If not explicitly specified this view is important for accessibility.
		if ( emptyView != null && emptyView.getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO ) {
			emptyView.setImportantForAccessibility( IMPORTANT_FOR_ACCESSIBILITY_YES );
		}
	}

	final T adapter = getAdapter();
	final boolean empty = ( ( adapter == null ) || adapter.isEmpty() );
	updateEmptyStatus( empty );
}
 
Example 3
Project: iosched-reader   File: UIUtils.java   Source Code and License Vote up 6 votes
public static void setAccessibilityIgnore(View view) {
    view.setClickable(false);
    view.setFocusable(false);
    view.setContentDescription("");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
    }
}
 
Example 4
Project: LaunchEnr   File: NotificationFooterLayout.java   Source Code and License Vote up 5 votes
/**
 * Creates an icon for the given NotificationInfo, and adds it to the icon row.
 * @return the icon view that was added
 */
private View addNotificationIconForInfo(NotificationInfo info) {
    View icon = new View(getContext());
    icon.setBackground(info.getIconForBackground(getContext(), mBackgroundColor));
    icon.setOnClickListener(info);
    icon.setTag(info);
    icon.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    mIconRow.addView(icon, 0, mIconLayoutParams);
    return icon;
}
 
Example 5
Project: RxJanDan   File: UIUtil.java   Source Code and License Vote up 5 votes
public static void setAccessiblityIgnore(View view) {
	view.setClickable(false);
	view.setFocusable(false);
	view.setContentDescription("");
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
		view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
	}
}
 
Example 6
Project: ucar-weex-core   File: WXComponent.java   Source Code and License Vote up 5 votes
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
protected void setAriaHidden(boolean isHidden) {
  View host = getHostView();
  if(host != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
    host.setImportantForAccessibility(isHidden?View.IMPORTANT_FOR_ACCESSIBILITY_NO:View.IMPORTANT_FOR_ACCESSIBILITY_YES);
  }
}
 
Example 7
Project: letv   File: AdapterView.java   Source Code and License Vote up 5 votes
@TargetApi(16)
public void setEmptyView(View emptyView) {
    boolean empty = true;
    this.mEmptyView = emptyView;
    if (VERSION.SDK_INT >= 16 && emptyView != null && emptyView.getImportantForAccessibility() == 0) {
        emptyView.setImportantForAccessibility(1);
    }
    T adapter = getAdapter();
    if (!(adapter == null || adapter.isEmpty())) {
        empty = false;
    }
    updateEmptyStatus(empty);
}
 
Example 8
Project: GitHub   File: HostListActivity.java   Source Code and License Vote up 4 votes
@TargetApi(16)
private void hideFromAccessibility(View view, boolean hide) {
	view.setImportantForAccessibility(hide ?
			View.IMPORTANT_FOR_ACCESSIBILITY_NO : View.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
 
Example 9
Project: letv   File: ViewCompatJB.java   Source Code and License Vote up 4 votes
public static void setImportantForAccessibility(View view, int mode) {
    view.setImportantForAccessibility(mode);
}
 
Example 10
Project: boohee_v5.6   File: ViewCompatJB.java   Source Code and License Vote up 4 votes
public static void setImportantForAccessibility(View view, int mode) {
    view.setImportantForAccessibility(mode);
}