当前位置: 首页>>代码示例>>Java>>正文


Java ViewCompat.setAccessibilityDelegate方法代码示例

本文整理汇总了Java中android.support.v4.view.ViewCompat.setAccessibilityDelegate方法的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.setAccessibilityDelegate方法的具体用法?Java ViewCompat.setAccessibilityDelegate怎么用?Java ViewCompat.setAccessibilityDelegate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.view.ViewCompat的用法示例。


在下文中一共展示了ViewCompat.setAccessibilityDelegate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attrHandler

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void attrHandler(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    final Resources res = context.getResources();
    mDesiredMonthHeight = res.getDimensionPixelSize(R.dimen.date_picker_month_height);
    mDesiredDayOfWeekHeight = res.getDimensionPixelSize(R.dimen.date_picker_day_of_week_height);
    mDesiredDayHeight = res.getDimensionPixelSize(R.dimen.date_picker_day_height);
    mDesiredCellWidth = res.getDimensionPixelSize(R.dimen.date_picker_day_width);
    mDesiredDaySelectorRadius = res.getDimensionPixelSize(
            R.dimen.date_picker_day_selector_radius);

    // Set up accessibility components.
    mTouchHelper = new MonthViewTouchHelper(this);
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    mLocale = res.getConfiguration().locale;
    mCalendar = Calendar.getInstance(mLocale);

    mDayFormatter = NumberFormat.getIntegerInstance(mLocale);

    updateMonthYearLabel();
    updateDayOfWeekLabels();

    initPaints(res);
}
 
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:25,代码来源:SimpleMonthView.java

示例2: NestedScrollView

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public NestedScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.mTempRect = new Rect();
    this.mIsLayoutDirty = true;
    this.mIsLaidOut = false;
    this.mChildToScrollTo = null;
    this.mIsBeingDragged = false;
    this.mSmoothScrollingEnabled = true;
    this.mActivePointerId = -1;
    this.mScrollOffset = new int[2];
    this.mScrollConsumed = new int[2];
    initScrollView();
    TypedArray a = context.obtainStyledAttributes(attrs, SCROLLVIEW_STYLEABLE, defStyleAttr, 0);
    setFillViewport(a.getBoolean(0, false));
    a.recycle();
    this.mParentHelper = new NestedScrollingParentHelper(this);
    this.mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
    ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:21,代码来源:NestedScrollView.java

示例3: SlidingPaneLayout

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public SlidingPaneLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    this.mSliderFadeColor = DEFAULT_FADE_COLOR;
    this.mFirstLayout = true;
    this.mTmpRect = new Rect();
    this.mPostedRunnables = new ArrayList();
    float density = context.getResources().getDisplayMetrics().density;
    this.mOverhangSize = (int) ((32.0f * density) + 0.5f);
    ViewConfiguration viewConfig = ViewConfiguration.get(context);
    setWillNotDraw(false);
    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, 1);
    this.mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    this.mDragHelper.setMinVelocity(400.0f * density);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:16,代码来源:SlidingPaneLayout.java

示例4: initViewPager

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);

    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:28,代码来源:ViewPagerCompat.java

示例5: DebugDrawerLayout

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public DebugDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
  super(context, attrs, defStyle);
  setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
  final float density = getResources().getDisplayMetrics().density;
  mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
  final float minVel = MIN_FLING_VELOCITY * density;

  mLeftCallback = new ViewDragCallback(Gravity.LEFT);
  mRightCallback = new ViewDragCallback(Gravity.RIGHT);

  mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
  mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
  mLeftDragger.setMinVelocity(minVel);
  mLeftCallback.setDragger(mLeftDragger);

  mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
  mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
  mRightDragger.setMinVelocity(minVel);
  mRightCallback.setDragger(mRightDragger);

  // So that we can catch the back button
  setFocusableInTouchMode(true);

  ViewCompat.setImportantForAccessibility(this,
      ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

  ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
  ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
  if (ViewCompat.getFitsSystemWindows(this)) {
    IMPL.configureApplyInsets(this);
    mStatusBarBackground = IMPL.getDefaultStatusBarBackground(context);
  }
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:34,代码来源:DebugDrawerLayout.java

示例6: attachAccessibilityDelegate

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void attachAccessibilityDelegate(View itemView) {
    if (isAccessibilityEnabled()) {
        if (ViewCompat.getImportantForAccessibility(itemView) ==
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
            ViewCompat.setImportantForAccessibility(itemView,
                    ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
        }
        if (!ViewCompat.hasAccessibilityDelegate(itemView)) {
            ViewCompat.setAccessibilityDelegate(itemView,
                    mAccessibilityDelegate.getItemDelegate());
        }
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:14,代码来源:RecyclerView.java

示例7: initViewPager

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new VelocityScroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);

    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
 
开发者ID:reyanshmishra,项目名称:Rey-MusicPlayer,代码行数:28,代码来源:VelocityViewPager.java

示例8: addView

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void addView(View child, int index, android.view.ViewGroup.LayoutParams params) {
    super.addView(child, index, params);
    if (findOpenDrawer() != null || isDrawerView(child)) {
        ViewCompat.setImportantForAccessibility(child, 4);
    } else {
        ViewCompat.setImportantForAccessibility(child, 1);
    }
    if (!CAN_HIDE_DESCENDANTS) {
        ViewCompat.setAccessibilityDelegate(child, this.mChildAccessibilityDelegate);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:12,代码来源:DrawerLayout.java

示例9: MonthView

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public MonthView(Context context, AttributeSet attr, DatePickerController controller) {
    super(context, attr);
    mController = controller;
    Resources res = context.getResources();

    mDayLabelCalendar = Calendar.getInstance(mController.getTimeZone());
    mCalendar = Calendar.getInstance(mController.getTimeZone());

    mDayOfWeekTypeface = res.getString(R.string.mdtp_day_of_week_label_typeface);
    mMonthTitleTypeface = res.getString(R.string.mdtp_sans_serif);

    boolean darkTheme = mController != null && mController.isThemeDark();
    if(darkTheme) {
        mDayTextColor = getResources().getColor(R.color.mdtp_date_picker_text_normal_dark_theme);
        mMonthDayTextColor = getResources().getColor(R.color.mdtp_date_picker_month_day_dark_theme);
        mDisabledDayTextColor = getResources().getColor( R.color.mdtp_date_picker_text_disabled_dark_theme);
        mHighlightedDayTextColor = getResources().getColor(R.color.mdtp_date_picker_text_highlighted_dark_theme);
    }
    else {
        mDayTextColor = getResources().getColor(R.color.mdtp_date_picker_text_normal);
        mMonthDayTextColor = getResources().getColor(R.color.mdtp_date_picker_month_day);
        mDisabledDayTextColor = getResources().getColor(R.color.mdtp_date_picker_text_disabled);
        mHighlightedDayTextColor = getResources().getColor(R.color.mdtp_date_picker_text_highlighted);
    }
    mSelectedDayTextColor = getResources().getColor(R.color.mdtp_white);
    mTodayNumberColor = mController.getAccentColor();
    mMonthTitleColor = getResources().getColor(R.color.mdtp_white);

    mStringBuilder = new StringBuilder(50);
    mFormatter = new Formatter(mStringBuilder, Locale.getDefault());

    MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_day_number_size);
    MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_label_size);
    MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_day_label_text_size);
    MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.mdtp_month_list_item_header_height);
    DAY_SELECTED_CIRCLE_SIZE = res
            .getDimensionPixelSize(R.dimen.mdtp_day_number_select_circle_radius);

    mRowHeight = (res.getDimensionPixelOffset(R.dimen.mdtp_date_picker_view_animator_height)
            - getMonthHeaderSize()) / MAX_NUM_ROWS;

    // Set up accessibility components.
    mTouchHelper = getMonthViewTouchHelper();
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    mLockAccessibilityDelegate = true;

    // Sets up any standard paints that will be used
    initView();
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:51,代码来源:MonthView.java

示例10: setAccessibilityDelegateCompat

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * Sets the accessibility delegate compatibility implementation used by RecyclerView.
 * @param accessibilityDelegate The accessibility delegate to be used by RecyclerView.
 */
public void setAccessibilityDelegateCompat(
        RecyclerViewAccessibilityDelegate accessibilityDelegate) {
    mAccessibilityDelegate = accessibilityDelegate;
    ViewCompat.setAccessibilityDelegate(this, mAccessibilityDelegate);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:10,代码来源:RecyclerView.java

示例11: addViewHolderToRecycledViewPool

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
void addViewHolderToRecycledViewPool(ViewHolder holder) {
    ViewCompat.setAccessibilityDelegate(holder.itemView, null);
    dispatchViewRecycled(holder);
    holder.mOwnerRecyclerView = null;
    getRecycledViewPool().putRecycledView(holder);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:7,代码来源:RecyclerView.java

示例12: ResideLayout

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public ResideLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = context.getResources().getDisplayMetrics().density;
    mOverhangSize = (int) (DEFAULT_OVERHANG_SIZE * density + 0.5f);

    final ViewConfiguration viewConfig = ViewConfiguration.get(context);

    setWillNotDraw(false);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
    mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * density);
}
 
开发者ID:Jusenr,项目名称:RX_Demo,代码行数:17,代码来源:ResideLayout.java

示例13: initViewPager

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = configuration.getScaledPagingTouchSlop();
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);
    mTopEdge = new EdgeEffectCompat(context);
    mBottomEdge = new EdgeEffectCompat(context);

    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new YViewPagerOrigin.MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }

    ViewCompat.setOnApplyWindowInsetsListener(this,
            new android.support.v4.view.OnApplyWindowInsetsListener() {
                private final Rect mTempRect = new Rect();

                @Override
                public WindowInsetsCompat onApplyWindowInsets(final View v,
                                                              final WindowInsetsCompat originalInsets) {
                    // First let the ViewPager itself try and consume them...
                    final WindowInsetsCompat applied =
                            ViewCompat.onApplyWindowInsets(v, originalInsets);
                    if (applied.isConsumed()) {
                        // If the ViewPager consumed all insets, return now
                        return applied;
                    }

                    // Now we'll manually dispatch the insets to our children. Since ViewPager
                    // children are always full-height, we do not want to use the standard
                    // ViewGroup dispatchApplyWindowInsets since if child 0 consumes them,
                    // the rest of the children will not receive any insets. To workaround this
                    // we manually dispatch the applied insets, not allowing children to
                    // consume them from each other. We do however keep track of any insets
                    // which are consumed, returning the union of our children's consumption
                    final Rect res = mTempRect;
                    res.left = applied.getSystemWindowInsetLeft();
                    res.top = applied.getSystemWindowInsetTop();
                    res.right = applied.getSystemWindowInsetRight();
                    res.bottom = applied.getSystemWindowInsetBottom();

                    for (int i = 0, count = getChildCount(); i < count; i++) {
                        final WindowInsetsCompat childInsets = ViewCompat
                                .dispatchApplyWindowInsets(getChildAt(i), applied);
                        // Now keep track of any consumed by tracking each dimension's min
                        // value
                        res.left = Math.min(childInsets.getSystemWindowInsetLeft(),
                                res.left);
                        res.top = Math.min(childInsets.getSystemWindowInsetTop(),
                                res.top);
                        res.right = Math.min(childInsets.getSystemWindowInsetRight(),
                                res.right);
                        res.bottom = Math.min(childInsets.getSystemWindowInsetBottom(),
                                res.bottom);
                    }

                    // Now return a new WindowInsets, using the consumed window insets
                    return applied.replaceSystemWindowInsets(
                            res.left, res.top, res.right, res.bottom);
                }
            });
}
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:79,代码来源:YViewPagerOrigin.java

示例14: MonthView

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public MonthView(Context context, AttributeSet attr, DatePickerController controller) {
    boolean darkTheme = false;
    super(context, attr);
    this.mEdgePadding = 0;
    this.mFirstJulianDay = -1;
    this.mFirstMonth = -1;
    this.mLastMonth = -1;
    this.mRowHeight = DEFAULT_HEIGHT;
    this.mHasToday = false;
    this.mSelectedDay = -1;
    this.mToday = -1;
    this.mWeekStart = 1;
    this.mNumDays = 7;
    this.mNumCells = this.mNumDays;
    this.mSelectedLeft = -1;
    this.mSelectedRight = -1;
    this.mNumRows = 6;
    this.mDayOfWeekStart = 0;
    this.mController = controller;
    Resources res = context.getResources();
    this.mDayLabelCalendar = Calendar.getInstance();
    this.mCalendar = Calendar.getInstance();
    this.mDayOfWeekTypeface = res.getString(R.string.mdtp_day_of_week_label_typeface);
    this.mMonthTitleTypeface = res.getString(R.string.mdtp_sans_serif);
    if (this.mController != null && this.mController.isThemeDark()) {
        darkTheme = true;
    }
    if (darkTheme) {
        this.mDayTextColor = res.getColor(R.color.mdtp_date_picker_text_normal_dark_theme);
        this.mMonthDayTextColor = res.getColor(R.color.mdtp_date_picker_month_day_dark_theme);
        this.mDisabledDayTextColor = res.getColor(R.color
                .mdtp_date_picker_text_disabled_dark_theme);
        this.mHighlightedDayTextColor = res.getColor(R.color
                .mdtp_date_picker_text_highlighted_dark_theme);
    } else {
        this.mDayTextColor = res.getColor(R.color.mdtp_date_picker_text_normal);
        this.mMonthDayTextColor = res.getColor(R.color.mdtp_date_picker_month_day);
        this.mDisabledDayTextColor = res.getColor(R.color.mdtp_date_picker_text_disabled);
        this.mHighlightedDayTextColor = res.getColor(R.color.mdtp_date_picker_text_highlighted);
    }
    this.mSelectedDayTextColor = res.getColor(R.color.mdtp_white);
    this.mTodayNumberColor = this.mController.getAccentColor();
    this.mMonthTitleColor = res.getColor(R.color.mdtp_white);
    this.mStringBuilder = new StringBuilder(50);
    this.mFormatter = new Formatter(this.mStringBuilder, Locale.getDefault());
    MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_day_number_size);
    MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_label_size);
    MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen
            .mdtp_month_day_label_text_size);
    MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.mdtp_month_list_item_header_height);
    DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen
            .mdtp_day_number_select_circle_radius);
    this.mRowHeight = (res.getDimensionPixelOffset(R.dimen
            .mdtp_date_picker_view_animator_height) - getMonthHeaderSize()) / 6;
    this.mTouchHelper = getMonthViewTouchHelper();
    ViewCompat.setAccessibilityDelegate(this, this.mTouchHelper);
    ViewCompat.setImportantForAccessibility(this, 1);
    this.mLockAccessibilityDelegate = true;
    initView();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:61,代码来源:MonthView.java

示例15: RadialTimePickerView

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public RadialTimePickerView(
        Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)  {
    super(context, attrs);

    applyAttributes(attrs, defStyleAttr, defStyleRes);

    // Pull disabled alpha from theme.
    final TypedValue outValue = new TypedValue();
    context.getTheme().resolveAttribute(android.R.attr.disabledAlpha, outValue, true);
    mDisabledAlpha = outValue.getFloat();

    mTypeface = Typeface.create("sans-serif", Typeface.NORMAL);

    mPaint[HOURS] = new Paint();
    mPaint[HOURS].setAntiAlias(true);
    mPaint[HOURS].setTextAlign(Paint.Align.CENTER);

    mPaint[MINUTES] = new Paint();
    mPaint[MINUTES].setAntiAlias(true);
    mPaint[MINUTES].setTextAlign(Paint.Align.CENTER);

    mPaintCenter.setAntiAlias(true);

    mPaintSelector[SELECTOR_CIRCLE] = new Paint();
    mPaintSelector[SELECTOR_CIRCLE].setAntiAlias(true);

    mPaintSelector[SELECTOR_DOT] = new Paint();
    mPaintSelector[SELECTOR_DOT].setAntiAlias(true);

    mPaintSelector[SELECTOR_LINE] = new Paint();
    mPaintSelector[SELECTOR_LINE].setAntiAlias(true);
    mPaintSelector[SELECTOR_LINE].setStrokeWidth(2);

    mPaintBackground.setAntiAlias(true);

    final Resources res = getResources();
    mSelectorRadius = res.getDimensionPixelSize(R.dimen.timepicker_selector_radius);
    mSelectorStroke = res.getDimensionPixelSize(R.dimen.timepicker_selector_stroke);
    mSelectorDotRadius = res.getDimensionPixelSize(R.dimen.timepicker_selector_dot_radius);
    mCenterDotRadius = res.getDimensionPixelSize(R.dimen.timepicker_center_dot_radius);

    mTextSize[HOURS] = res.getDimensionPixelSize(R.dimen.timepicker_text_size_normal);
    mTextSize[MINUTES] = res.getDimensionPixelSize(R.dimen.timepicker_text_size_normal);
    mTextSize[HOURS_INNER] = res.getDimensionPixelSize(R.dimen.timepicker_text_size_inner);

    mTextInset[HOURS] = res.getDimensionPixelSize(R.dimen.timepicker_text_inset_normal);
    mTextInset[MINUTES] = res.getDimensionPixelSize(R.dimen.timepicker_text_inset_normal);
    mTextInset[HOURS_INNER] = res.getDimensionPixelSize(R.dimen.timepicker_text_inset_inner);

    mShowHours = true;
    mHoursToMinutes = HOURS;
    mIs24HourMode = false;
    mAmOrPm = AM;

    // Set up accessibility components.
    mTouchHelper = new RadialPickerTouchHelper();
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);
    //setAccessibilityDelegate(mTouchHelper);

    if(ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO){
        ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
    /*if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
    }*/

    initHoursAndMinutesText();
    initData();

    // Initial values
    final Calendar calendar = Calendar.getInstance(Locale.getDefault());
    final int currentHour = calendar.get(Calendar.HOUR_OF_DAY);
    final int currentMinute = calendar.get(Calendar.MINUTE);

    setCurrentHourInternal(currentHour, false, false);
    setCurrentMinuteInternal(currentMinute, false);

    setHapticFeedbackEnabled(true);
}
 
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:80,代码来源:RadialTimePickerView.java


注:本文中的android.support.v4.view.ViewCompat.setAccessibilityDelegate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。