Example usage for android.view View IMPORTANT_FOR_ACCESSIBILITY_AUTO

List of usage examples for android.view View IMPORTANT_FOR_ACCESSIBILITY_AUTO

Introduction

In this page you can find the example usage for android.view View IMPORTANT_FOR_ACCESSIBILITY_AUTO.

Prototype

int IMPORTANT_FOR_ACCESSIBILITY_AUTO

To view the source code for android.view View IMPORTANT_FOR_ACCESSIBILITY_AUTO.

Click Source Link

Document

Automatically determine whether a view is important for accessibility.

Usage

From source file:com.zyk.launcher.AsyncTaskCallback.java

public AppsCustomizePagedView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mLayoutInflater = LayoutInflater.from(context);
    mPackageManager = context.getPackageManager();
    mApps = new ArrayList<ItemInfo>();
    mWidgets = new ArrayList<Object>();
    mIconCache = (LauncherAppState.getInstance()).getIconCache();
    mRunningTasks = new ArrayList<AppsCustomizeAsyncTask>();

    // Save the default widget preview background
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AppsCustomizePagedView, 0, 0);
    mWidgetCountX = a.getInt(R.styleable.AppsCustomizePagedView_widgetCountX, 2);
    mWidgetCountY = a.getInt(R.styleable.AppsCustomizePagedView_widgetCountY, 2);
    a.recycle();/*from  w  w w  . j a  v a  2  s .co m*/
    mWidgetSpacingLayout = new PagedViewCellLayout(getContext());

    // The padding on the non-matched dimension for the default widget preview icons
    // (top + bottom)
    mFadeInAdjacentScreens = false;

    // Unless otherwise specified this view is important for accessibility.
    if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
    setSinglePageInViewport();
    DeviceProfile grid = LauncherAppState.getInstance().getDynamicGrid().getDeviceProfile();
    mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx);
    mDragUtils = new DragUtils(mLauncher, this);
    mDragEnforcer = new DropTarget.DragEnforcer(context);
}

From source file:com.phonemetra.turbo.launcher.AsyncTaskCallback.java

public AppsCustomizePagedView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mLayoutInflater = LayoutInflater.from(context);
    mPackageManager = context.getPackageManager();
    mApps = new ArrayList<AppInfo>();
    mFilteredApps = new ArrayList<AppInfo>();
    mWidgets = new ArrayList<Object>();
    mFilteredWidgets = new ArrayList<Object>();
    mIconCache = (LauncherAppState.getInstance()).getIconCache();
    mCanvas = new Canvas();
    mRunningTasks = new ArrayList<AppsCustomizeAsyncTask>();

    // Save the default widget preview background
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AppsCustomizePagedView, 0, 0);
    LauncherAppState app = LauncherAppState.getInstance();
    DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
    mWidgetWidthGap = mWidgetHeightGap = grid.edgeMarginPx;
    mWidgetCountX = a.getInt(R.styleable.AppsCustomizePagedView_widgetCountX, 2);
    mWidgetCountY = a.getInt(R.styleable.AppsCustomizePagedView_widgetCountY, 2);
    a.recycle();/*  www  .ja  va2  s.  c  o m*/
    mWidgetSpacingLayout = new PagedViewCellLayout(getContext());

    // The padding on the non-matched dimension for the default widget preview icons
    // (top + bottom)
    mAppsCustomizeFadeInAdjacentScreens = SettingsProvider.getBoolean(context,
            SettingsProvider.SETTINGS_UI_DRAWER_SCROLLING_FADE_ADJACENT,
            R.bool.preferences_interface_drawer_scrolling_fade_adjacent_default);

    TransitionEffect.setFromString(this,
            SettingsProvider.getString(context, SettingsProvider.SETTINGS_UI_DRAWER_SCROLLING_TRANSITION_EFFECT,
                    R.string.preferences_interface_drawer_scrolling_transition_effect));

    // Unless otherwise specified this view is important for accessibility.
    if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }

    updateProtectedAppsList(context);
}

From source file:com.android.launcher2.AsyncTaskCallback.java

public AppsCustomizePagedView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mLayoutInflater = LayoutInflater.from(context);
    mPackageManager = context.getPackageManager();
    mApps = new ArrayList<ApplicationInfo>();
    mWidgets = new ArrayList<Object>();
    mIconCache = ((LauncherApplication) context.getApplicationContext()).getIconCache();
    mCanvas = new Canvas();
    mRunningTasks = new ArrayList<AppsCustomizeAsyncTask>();

    // Save the default widget preview background
    Resources resources = context.getResources();
    mAppIconSize = resources.getDimensionPixelSize(R.dimen.app_icon_size);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AppsCustomizePagedView, 0, 0);
    mMaxAppCellCountX = a.getInt(R.styleable.AppsCustomizePagedView_maxAppCellCountX, -1);
    mMaxAppCellCountY = a.getInt(R.styleable.AppsCustomizePagedView_maxAppCellCountY, -1);
    mWidgetWidthGap = a.getDimensionPixelSize(R.styleable.AppsCustomizePagedView_widgetCellWidthGap, 0);
    mWidgetHeightGap = a.getDimensionPixelSize(R.styleable.AppsCustomizePagedView_widgetCellHeightGap, 0);
    mWidgetCountX = a.getInt(R.styleable.AppsCustomizePagedView_widgetCountX, 2);
    mWidgetCountY = a.getInt(R.styleable.AppsCustomizePagedView_widgetCountY, 2);
    mClingFocusedX = a.getInt(R.styleable.AppsCustomizePagedView_clingFocusedX, 0);
    mClingFocusedY = a.getInt(R.styleable.AppsCustomizePagedView_clingFocusedY, 0);
    a.recycle();/*ww  w.j  ava 2 s .co  m*/
    mWidgetSpacingLayout = new PagedViewCellLayout(getContext());

    // The padding on the non-matched dimension for the default widget preview icons
    // (top + bottom)
    mFadeInAdjacentScreens = false;

    // Unless otherwise specified this view is important for accessibility.
    if (ViewCompat.getImportantForAccessibility(this) == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this, View.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}

From source file:com.android.launcher2.Workspace.java

/**
 * Used to inflate the Workspace from XML.
 *
 * @param context The application's context.
 * @param attrs The attributes set containing the Workspace's customization values.
 * @param defStyle Unused.//from   www . j av  a2 s.co m
 */
public Workspace(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mContentIsRefreshable = false;
    mOriginalPageSpacing = mPageSpacing;

    mDragEnforcer = new DropTarget.DragEnforcer(context);
    // With workspace, data is available straight from the get-go
    setDataIsReady();

    mLauncher = (Launcher) context;
    final Resources res = getResources();
    mWorkspaceFadeInAdjacentScreens = res.getBoolean(R.bool.config_workspaceFadeAdjacentScreens);
    mFadeInAdjacentScreens = false;
    mWallpaperManager = WallpaperManager.getInstance(context);

    int cellCountX = DEFAULT_CELL_COUNT_X;
    int cellCountY = DEFAULT_CELL_COUNT_Y;

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Workspace, defStyle, 0);

    if (LauncherApplication.isScreenLarge()) {
        // Determine number of rows/columns dynamically
        // TODO: This code currently fails on tablets with an aspect ratio < 1.3.
        // Around that ratio we should make cells the same size in portrait and
        // landscape
        TypedArray actionBarSizeTypedArray = context
                .obtainStyledAttributes(new int[] { android.R.attr.actionBarSize });
        final float actionBarHeight = actionBarSizeTypedArray.getDimension(0, 0f);

        Point minDims = new Point();
        Point maxDims = new Point();
        DisplayCompt.getCurrentSizeRange(mLauncher.getWindowManager().getDefaultDisplay(), minDims, maxDims);

        cellCountX = 1;
        while (CellLayout.widthInPortrait(res, cellCountX + 1) <= minDims.x) {
            cellCountX++;
        }

        cellCountY = 1;
        while (actionBarHeight + CellLayout.heightInLandscape(res, cellCountY + 1) <= minDims.y) {
            cellCountY++;
        }
    }

    mSpringLoadedShrinkFactor = res.getInteger(R.integer.config_workspaceSpringLoadShrinkPercentage) / 100.0f;
    mSpringLoadedPageSpacing = res.getDimensionPixelSize(R.dimen.workspace_spring_loaded_page_spacing);
    mCameraDistance = res.getInteger(R.integer.config_cameraDistance);

    // if the value is manually specified, use that instead
    cellCountX = a.getInt(R.styleable.Workspace_cellCountX, cellCountX);
    cellCountY = a.getInt(R.styleable.Workspace_cellCountY, cellCountY);
    mDefaultPage = a.getInt(R.styleable.Workspace_defaultScreen, 1);
    a.recycle();

    setOnHierarchyChangeListener(this);

    LauncherModel.updateWorkspaceLayoutCells(cellCountX, cellCountY);
    setHapticFeedbackEnabled(false);

    initWorkspace();

    // Disable multitouch across the workspace/all apps/customize tray
    setMotionEventSplittingEnabled(true);

    // Unless otherwise specified this view is important for accessibility.
    if (ViewCompat.getImportantForAccessibility(this) == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this, View.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}

From source file:org.chromium.chrome.browser.autofill.CardUnmaskPrompt.java

/**
 * Updates the verification overlay and main contents such that the overlay has |visibility|.
 * @param visibility A View visibility enumeration value.
 *//*ww  w. j  a  va  2s .  c o m*/
private void setOverlayVisibility(int visibility) {
    mVerificationOverlay.setVisibility(visibility);
    mControlsContainer.setAlpha(1f);
    boolean contentsShowing = visibility == View.GONE;
    if (!contentsShowing) {
        int durationMs = 250;
        mVerificationOverlay.setAlpha(0f);
        mVerificationOverlay.animate().alpha(1f).setDuration(durationMs);
        mControlsContainer.animate().alpha(0f).setDuration(durationMs);
    }
    ViewCompat.setImportantForAccessibility(mControlsContainer,
            contentsShowing ? View.IMPORTANT_FOR_ACCESSIBILITY_AUTO
                    : View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
    mControlsContainer.setDescendantFocusability(
            contentsShowing ? ViewGroup.FOCUS_BEFORE_DESCENDANTS : ViewGroup.FOCUS_BLOCK_DESCENDANTS);
}

From source file:com.klinker.android.launcher.launcher3.Launcher.java

public boolean setLauncherCallbacks(LauncherCallbacks callbacks) {
    mLauncherCallbacks = callbacks;/* ww w.  j ava2s  . com*/
    mLauncherCallbacks.setLauncherSearchCallback(new Launcher.LauncherSearchCallbacks() {
        private boolean mWorkspaceImportanceStored = false;
        private boolean mHotseatImportanceStored = false;
        private int mWorkspaceImportanceForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
        private int mHotseatImportanceForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;

        @Override
        public void onSearchOverlayOpened() {
            if (mWorkspaceImportanceStored || mHotseatImportanceStored) {
                return;
            }
            // The underlying workspace and hotseat are temporarily suppressed by the search
            // overlay. So they sholudn't be accessible.
            if (mWorkspace != null) {
                mWorkspaceImportanceForAccessibility = mWorkspace.getImportantForAccessibility();
                mWorkspace.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
                mWorkspaceImportanceStored = true;
            }
            if (mHotseat != null) {
                mHotseatImportanceForAccessibility = mHotseat.getImportantForAccessibility();
                mHotseat.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
                mHotseatImportanceStored = true;
            }
        }

        @Override
        public void onSearchOverlayClosed() {
            if (mWorkspaceImportanceStored && mWorkspace != null) {
                mWorkspace.setImportantForAccessibility(mWorkspaceImportanceForAccessibility);
            }
            if (mHotseatImportanceStored && mHotseat != null) {
                mHotseat.setImportantForAccessibility(mHotseatImportanceForAccessibility);
            }
            mWorkspaceImportanceStored = false;
            mHotseatImportanceStored = false;
        }
    });
    return true;
}

From source file:com.android.launcher3.Launcher.java

public boolean setLauncherCallbacks(LauncherCallbacks callbacks) {
    mLauncherCallbacks = callbacks;/*  w w w. ja v  a  2 s.  co  m*/
    mLauncherCallbacks.setLauncherSearchCallback(new Launcher.LauncherSearchCallbacks() {
        private boolean mWorkspaceImportanceStored = false;
        private boolean mHotseatImportanceStored = false;
        private int mWorkspaceImportanceForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
        private int mHotseatImportanceForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;

        @Override
        public void onSearchOverlayOpened() {
            if (mWorkspaceImportanceStored || mHotseatImportanceStored) {
                return;
            }
            // The underlying workspace and hotseat are temporarily suppressed by the search
            // overlay. So they shouldn't be accessible.
            if (mWorkspace != null) {
                mWorkspaceImportanceForAccessibility = mWorkspace.getImportantForAccessibility();
                mWorkspace.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
                mWorkspaceImportanceStored = true;
            }
            if (mHotseat != null) {
                mHotseatImportanceForAccessibility = mHotseat.getImportantForAccessibility();
                mHotseat.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
                mHotseatImportanceStored = true;
            }
        }

        @Override
        public void onSearchOverlayClosed() {
            if (mWorkspaceImportanceStored && mWorkspace != null) {
                mWorkspace.setImportantForAccessibility(mWorkspaceImportanceForAccessibility);
            }
            if (mHotseatImportanceStored && mHotseat != null) {
                mHotseat.setImportantForAccessibility(mHotseatImportanceForAccessibility);
            }
            mWorkspaceImportanceStored = false;
            mHotseatImportanceStored = false;
        }
    });
    return true;
}

From source file:com.android.dialer.DialtactsActivity.java

/**
 * Initiates animations and other visual updates to hide the dialpad. The fragment is hidden in
 * a callback after the hide animation ends.
 * @see #commitDialpadFragmentHide//from w ww  .  ja v  a 2 s  .  c om
 */
public void hideDialpadFragment(boolean animate, boolean clearDialpad) {
    if (mDialpadFragment == null || mDialpadFragment.getView() == null) {
        return;
    }
    if (clearDialpad) {
        // Temporarily disable accessibility when we clear the dialpad, since it should be
        // invisible and should not announce anything.
        mDialpadFragment.getDigitsWidget().setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
        mDialpadFragment.clearDialpad();
        mDialpadFragment.getDigitsWidget().setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
    }
    if (!mIsDialpadShown) {
        return;
    }
    mIsDialpadShown = false;
    mDialpadFragment.setAnimate(animate);
    mListsFragment.setUserVisibleHint(true);
    mListsFragment.sendScreenViewForCurrentPosition();

    updateSearchFragmentPosition();

    mFloatingActionButtonController.align(getFabAlignment(), animate);
    if (animate) {
        mDialpadFragment.getView().startAnimation(mSlideOut);
    } else {
        commitDialpadFragmentHide();
    }

    mActionBarController.onDialpadDown();

    if (isInSearchUi()) {
        if (TextUtils.isEmpty(mSearchQuery)) {
            exitSearchUi();
        }
    }
    //reset the title to normal.
    setTitle(R.string.launcherActivityLabel);
}