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;
}
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;
}
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;
}
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());
}
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);
}
}
Aggregations