Search in sources :

Example 36 with SuppressLint

use of android.annotation.SuppressLint in project HoloEverywhere by Prototik.

the class SwitchScreenPreference method sendAccessibilityEvent.

@SuppressLint("NewApi")
void sendAccessibilityEvent(View view) {
    try {
        AccessibilityManager accessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
        if (mSendClickAccessibilityEvent && accessibilityManager.isEnabled()) {
            AccessibilityEvent event = AccessibilityEvent.obtain();
            event.setEventType(AccessibilityEvent.TYPE_VIEW_CLICKED);
            if (VERSION.SDK_INT >= 14) {
                view.onInitializeAccessibilityEvent(event);
            }
            view.dispatchPopulateAccessibilityEvent(event);
            accessibilityManager.sendAccessibilityEvent(event);
        }
    } catch (Exception e) {
    }
    mSendClickAccessibilityEvent = false;
}
Also used : AccessibilityManager(android.view.accessibility.AccessibilityManager) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) SuppressLint(android.annotation.SuppressLint)

Example 37 with SuppressLint

use of android.annotation.SuppressLint in project HoloEverywhere by Prototik.

the class AbsSpinner method onMeasure.

@SuppressLint("NewApi")
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int widthMode = MeasureSpec.getMode(widthMeasureSpec);
    int widthSize;
    int heightSize;
    mSpinnerPadding.left = getPaddingLeft() > mSelectionLeftPadding ? getPaddingLeft() : mSelectionLeftPadding;
    mSpinnerPadding.top = getPaddingTop() > mSelectionTopPadding ? getPaddingTop() : mSelectionTopPadding;
    mSpinnerPadding.right = getPaddingRight() > mSelectionRightPadding ? getPaddingRight() : mSelectionRightPadding;
    mSpinnerPadding.bottom = getPaddingBottom() > mSelectionBottomPadding ? getPaddingBottom() : mSelectionBottomPadding;
    if (mDataChanged) {
        handleDataChanged();
    }
    int preferredHeight = 0;
    int preferredWidth = 0;
    boolean needsMeasuring = true;
    int selectedPosition = getSelectedItemPosition();
    if (selectedPosition >= 0 && mAdapter != null && selectedPosition < mAdapter.getCount()) {
        View view = mRecycler.get(selectedPosition);
        if (view == null) {
            view = mAdapter.getView(selectedPosition, null, this);
            if (VERSION.SDK_INT >= 16 && view.getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
                view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
            }
        }
        if (view != null) {
            mRecycler.put(selectedPosition, view);
        }
        if (view != null) {
            if (view.getLayoutParams() == null) {
                mBlockLayoutRequests = true;
                view.setLayoutParams(generateDefaultLayoutParams());
                mBlockLayoutRequests = false;
            }
            measureChild(view, widthMeasureSpec, heightMeasureSpec);
            preferredHeight = getChildHeight(view) + mSpinnerPadding.top + mSpinnerPadding.bottom;
            preferredWidth = getChildWidth(view) + mSpinnerPadding.left + mSpinnerPadding.right;
            needsMeasuring = false;
        }
    }
    if (needsMeasuring) {
        preferredHeight = mSpinnerPadding.top + mSpinnerPadding.bottom;
        if (widthMode == MeasureSpec.UNSPECIFIED) {
            preferredWidth = mSpinnerPadding.left + mSpinnerPadding.right;
        }
    }
    preferredHeight = Math.max(preferredHeight, getSuggestedMinimumHeight());
    preferredWidth = Math.max(preferredWidth, getSuggestedMinimumWidth());
    heightSize = ViewCompat.resolveSizeAndState(preferredHeight, heightMeasureSpec, 0);
    widthSize = ViewCompat.resolveSizeAndState(preferredWidth, widthMeasureSpec, 0);
    setMeasuredDimension(widthSize, heightSize);
    mHeightMeasureSpec = heightMeasureSpec;
    mWidthMeasureSpec = widthMeasureSpec;
}
Also used : View(android.view.View) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 38 with SuppressLint

use of android.annotation.SuppressLint in project HoloEverywhere by Prototik.

the class AdapterView method onRequestSendAccessibilityEvent.

@SuppressLint("NewApi")
@Override
public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
    if (super.onRequestSendAccessibilityEvent(child, event)) {
        AccessibilityEvent record = AccessibilityEvent.obtain();
        onInitializeAccessibilityEvent(record);
        child.dispatchPopulateAccessibilityEvent(record);
        event.appendRecord(record);
        return true;
    }
    return false;
}
Also used : AccessibilityEvent(android.view.accessibility.AccessibilityEvent) SuppressLint(android.annotation.SuppressLint)

Example 39 with SuppressLint

use of android.annotation.SuppressLint in project HoloEverywhere by Prototik.

the class AdapterView method onInitializeAccessibilityEvent.

@SuppressLint("NewApi")
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(AdapterView.class.getName());
    event.setScrollable(isScrollableForAccessibility());
    View selectedView = getSelectedView();
    if (selectedView != null) {
        event.setEnabled(selectedView.isEnabled());
    }
    event.setCurrentItemIndex(getSelectedItemPosition());
    event.setFromIndex(getFirstVisiblePosition());
    event.setToIndex(getLastVisiblePosition());
    event.setItemCount(getCount());
}
Also used : View(android.view.View) SuppressLint(android.annotation.SuppressLint)

Example 40 with SuppressLint

use of android.annotation.SuppressLint in project HoloEverywhere by Prototik.

the class ThemeManager method startActivity.

/**
     * Only for system use
     */
@SuppressLint("NewApi")
public static void startActivity(Context context, Intent intent, int requestCode, Bundle options) {
    final Activity activity = context instanceof Activity ? (Activity) context : null;
    if (activity != null && HoloEverywhere.ALWAYS_USE_PARENT_THEME) {
        ThemeManager.cloneTheme(activity.getIntent(), intent, true);
    }
    final int parentColorScheme = ThemeManager.getThemeType(activity);
    if (parentColorScheme != INVALID) {
        intent.putExtra(_PARENT_SCHEME_TAG, parentColorScheme);
    }
    if (context instanceof SuperStartActivity) {
        ((SuperStartActivity) context).superStartActivity(intent, requestCode, options);
    } else if (VERSION.SDK_INT >= 16) {
        context.startActivity(intent, options);
    } else {
        context.startActivity(intent);
    }
}
Also used : Activity(org.holoeverywhere.app.Activity) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)671 View (android.view.View)141 TextView (android.widget.TextView)89 Intent (android.content.Intent)71 Paint (android.graphics.Paint)61 ImageView (android.widget.ImageView)42 WebView (android.webkit.WebView)33 Bitmap (android.graphics.Bitmap)30 ListView (android.widget.ListView)30 File (java.io.File)28 ViewGroup (android.view.ViewGroup)26 AdapterView (android.widget.AdapterView)25 AlertDialog (android.app.AlertDialog)23 DialogInterface (android.content.DialogInterface)22 TypedArray (android.content.res.TypedArray)22 Uri (android.net.Uri)22 OnClickListener (android.view.View.OnClickListener)22 LayoutInflater (android.view.LayoutInflater)21 Point (android.graphics.Point)20 ArrayList (java.util.ArrayList)20