List of usage examples for android.support.v4.view ViewCompat setAccessibilityDelegate
public static void setAccessibilityDelegate(View v, AccessibilityDelegateCompat delegate)
From source file:com.actionbarsherlock.custom.widget.ContentDrawerLayout.java
public ContentDrawerLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); 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, 0.5f, mLeftCallback); //mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT); mLeftDragger.setMinVelocity(minVel); mLeftCallback.setDragger(mLeftDragger); mRightDragger = ViewDragHelper.create(this, 0.5f, mRightCallback); //mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT); mRightDragger.setMinVelocity(minVel); mRightCallback.setDragger(mRightDragger); // So that we can catch the back button setFocusableInTouchMode(true);/* w w w . java2s . c o m*/ ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate()); ViewGroupCompat.setMotionEventSplittingEnabled(this, false); }
From source file:com.borax12.materialdaterangepicker.multi.date.MonthView.java
public MonthView(Context context, AttributeSet attr, DatePickerController controller) { super(context, attr); mController = controller;/*from ww w .j av a 2s.c o m*/ Resources res = context.getResources(); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); 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 = res.getColor(R.color.mdtp_date_picker_text_normal_dark_theme); mMonthDayTextColor = res.getColor(R.color.mdtp_date_picker_month_day_dark_theme); mDisabledDayTextColor = res.getColor(R.color.mdtp_date_picker_text_disabled_dark_theme); mHighlightedDayTextColor = res.getColor(R.color.mdtp_date_picker_text_highlighted_dark_theme); } else { mDayTextColor = res.getColor(R.color.mdtp_date_picker_text_normal); mMonthDayTextColor = res.getColor(R.color.mdtp_date_picker_month_day); mDisabledDayTextColor = res.getColor(R.color.mdtp_date_picker_text_disabled); mHighlightedDayTextColor = res.getColor(R.color.mdtp_date_picker_text_highlighted); } mSelectedDayTextColor = res.getColor(R.color.mdtp_white); mTodayNumberColor = res.getColor(R.color.mdtp_accent_color); mMonthTitleColor = res.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(); }
From source file:com.borax12.materialdaterangepicker.date.MonthView.java
public MonthView(Context context, AttributeSet attr, DatePickerController controller) { super(context, attr); mController = controller;/*from w w w. j a va2s .co m*/ Resources res = context.getResources(); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); mDayOfWeekTypeface = res.getString(R.string.mdtrp_day_of_week_label_typeface); mMonthTitleTypeface = res.getString(R.string.mdtrp_sans_serif); boolean darkTheme = mController != null && mController.isThemeDark(); if (darkTheme) { mDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_normal_dark_theme); mMonthDayTextColor = res.getColor(R.color.mdtrp_date_picker_month_day_dark_theme); mDisabledDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_disabled_dark_theme); mHighlightedDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_highlighted_dark_theme); } else { mDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_normal); mMonthDayTextColor = res.getColor(R.color.mdtrp_date_picker_month_day); mDisabledDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_disabled); mHighlightedDayTextColor = res.getColor(R.color.mdtrp_date_picker_text_highlighted); } mSelectedDayTextColor = res.getColor(R.color.mdtrp_white); mTodayNumberColor = res.getColor(R.color.mdtrp_accent_color); mMonthTitleColor = res.getColor(R.color.mdtrp_white); mStringBuilder = new StringBuilder(50); mFormatter = new Formatter(mStringBuilder, Locale.getDefault()); MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtrp_day_number_size); MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtrp_month_label_size); MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtrp_month_day_label_text_size); MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.mdtrp_month_list_item_header_height); DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.mdtrp_day_number_select_circle_radius); mRowHeight = (res.getDimensionPixelOffset(R.dimen.mdtrp_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(); }
From source file:com.codetroopers.betterpickers.calendardatepicker.MonthView.java
public MonthView(Context context) { super(context); Resources res = context.getResources(); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); mDayOfWeekTypeface = res.getString(R.string.day_of_week_label_typeface); mMonthTitleTypeface = res.getString(R.string.sans_serif); mDayTextColorEnabled = res.getColor(R.color.date_picker_text_normal); mDayTextColorDisabled = res.getColor(R.color.date_picker_text_disabled); mTodayNumberColor = res.getColor(R.color.bpBlue); mDayBackgroundColorDisabled = res.getColor(R.color.bpDarker_red); mMonthTitleColor = res.getColor(R.color.date_picker_text_normal); mStringBuilder = new StringBuilder(50); mFormatter = new Formatter(mStringBuilder, Locale.getDefault()); MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.day_number_size); MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_label_size); MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_day_label_text_size); MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.month_list_item_header_height); DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.day_number_select_circle_radius); mRowHeight = (res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - MONTH_HEADER_SIZE) / MAX_NUM_ROWS;//from w w w .j a v a 2 s . c o m // Set up accessibility components. mTouchHelper = new MonthViewTouchHelper(this); ViewCompat.setAccessibilityDelegate(this, mTouchHelper); ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); mLockAccessibilityDelegate = true; // Sets up any standard paints that will be used initView(); }
From source file:com.leavjenn.smoothdaterangepicker.date.MonthView.java
public MonthView(Context context, AttributeSet attr, SmoothDateRangePickerController controller) { super(context, attr); mController = controller;/* ww w .j a va 2 s. c o m*/ Resources res = context.getResources(); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); 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 = res.getColor(R.color.mdtp_date_picker_text_normal_dark_theme); mMonthDayTextColor = res.getColor(R.color.mdtp_date_picker_month_day_dark_theme); mDisabledDayTextColor = res.getColor(R.color.mdtp_date_picker_text_disabled_dark_theme); mHighlightedDayTextColor = res.getColor(R.color.mdtp_date_picker_text_highlighted_dark_theme); } else { mDayTextColor = res.getColor(R.color.mdtp_date_picker_text_normal); mMonthDayTextColor = res.getColor(R.color.mdtp_date_picker_month_day); mDisabledDayTextColor = res.getColor(R.color.mdtp_date_picker_text_disabled); mHighlightedDayTextColor = res.getColor(R.color.mdtp_date_picker_text_highlighted); } mSelectedDayTextColor = res.getColor(R.color.mdtp_white); mTodayNumberColor = res.getColor(R.color.mdtp_accent_color); mMonthTitleColor = res.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(); }
From source file:com.mattfred.betterpickers.calendardatepicker.MonthView.java
public MonthView(Context context) { super(context); Resources res = context.getResources(); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); mDayOfWeekTypeface = res.getString(R.string.day_of_week_label_typeface); mMonthTitleTypeface = res.getString(R.string.sans_serif); mDayTextColorEnabled = res.getColor(R.color.date_picker_text_normal); mDayTextColorDisabled = res.getColor(R.color.date_picker_text_disabled); mTodayNumberColor = res.getColor(R.color.bpBlue); mDisabledDayColor = res.getColor(R.color.bpDarker_red); mMonthTitleColor = res.getColor(R.color.date_picker_text_normal); mMonthTitleBGColor = res.getColor(R.color.circle_background); mStringBuilder = new StringBuilder(50); mFormatter = new Formatter(mStringBuilder, Locale.getDefault()); MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.day_number_size); MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_label_size); MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_day_label_text_size); MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.month_list_item_header_height); DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.day_number_select_circle_radius); mRowHeight = (res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - MONTH_HEADER_SIZE) / MAX_NUM_ROWS;/* w w w . j a v a2s . c om*/ // Set up accessibility components. mTouchHelper = new MonthViewTouchHelper(this); ViewCompat.setAccessibilityDelegate(this, mTouchHelper); ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); mLockAccessibilityDelegate = true; // Sets up any standard paints that will be used initView(); }
From source file:com.jarklee.materialdatetimepicker.date.MonthView.java
public MonthView(Context context, AttributeSet attr, DatePickerController controller) { super(context, attr); mController = controller;/*w w w . j ava 2 s .co m*/ Resources res = context.getResources(); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); 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 = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_normal_dark_theme); mMonthDayTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_month_day_dark_theme); mDisabledDayTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_disabled_dark_theme); mHighlightedDayTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_highlighted_dark_theme); } else { mDayTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_normal); mMonthDayTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_month_day); mDisabledDayTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_disabled); mHighlightedDayTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_highlighted); } mSelectedDayTextColor = ContextCompat.getColor(context, R.color.mdtp_white); mTodayNumberColor = mController.getAccentColor(); mMonthTitleColor = ContextCompat.getColor(context, R.color.mdtp_white); mStringBuilder = new StringBuilder(50); 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(); }
From source file:com.actionbarsherlock.custom.widget.VerticalDrawerLayout.java
public VerticalDrawerLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); final float density = getResources().getDisplayMetrics().density; mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f); final float minVel = MIN_FLING_VELOCITY * density; mTopCallback = new ViewDragCallback(Gravity.TOP); mBottomCallback = new ViewDragCallback(Gravity.BOTTOM); mTopDragger = ViewDragHelper.create(this, 0.5f, mTopCallback); mTopDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_TOP); mTopDragger.setMinVelocity(minVel);/* ww w .j av a2 s . co m*/ mTopCallback.setDragger(mTopDragger); mBottomDragger = ViewDragHelper.create(this, 0.5f, mBottomCallback); mBottomDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_BOTTOM); mBottomDragger.setMinVelocity(minVel); mBottomCallback.setDragger(mBottomDragger); // So that we can catch the back button setFocusableInTouchMode(true); ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate()); ViewGroupCompat.setMotionEventSplittingEnabled(this, false); }
From source file:com.abewy.android.apps.klyph.widget.KlyphDrawerLayout.java
public KlyphDrawerLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); 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, 0.5f, mLeftCallback); mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT); mLeftDragger.setMinVelocity(minVel); mLeftCallback.setDragger(mLeftDragger); mRightDragger = ViewDragHelper.create(this, 0.5f, mRightCallback); mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT); mRightDragger.setMinVelocity(minVel); mRightCallback.setDragger(mRightDragger); // So that we can catch the back button setFocusableInTouchMode(true);/* w w w. j a va 2s. c om*/ ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate()); ViewGroupCompat.setMotionEventSplittingEnabled(this, false); }
From source file:opt.android.datetimepicker.date.MonthView.java
public MonthView(Context context, AttributeSet attr) { super(context, attr); Resources res = context.getResources(); mDayLabelCalendar = Calendar.getInstance(); mCalendar = Calendar.getInstance(); mDayOfWeekTypeface = res.getString(R.string.day_of_week_label_typeface); mMonthTitleTypeface = res.getString(R.string.sans_serif); mDayTextColor = res.getColor(R.color.opt_dtpicker_date_picker_text_normal); mTodayNumberColor = res.getColor(R.color.opt_dtpicker_blue); mDisabledDayTextColor = res.getColor(R.color.opt_dtpicker_date_picker_text_disabled); mMonthTitleColor = res.getColor(R.color.opt_dtpicker_white); // mMonthTitleBGColor = res.getColor(R.color.circle_background); // kman/*from w ww . ja va 2 s . c o m*/ final TypedArray a = context.obtainStyledAttributes(Utils.COLOR_ATTRS); final ColorStateList colorPrimary = a.getColorStateList(0); final ColorStateList colorSecondary = a.getColorStateList(1); a.recycle(); mMonthTitleColor = colorPrimary.getColorForState(ENABLED_STATE_SET, colorPrimary.getDefaultColor()); mDayTextColor = colorSecondary.getColorForState(ENABLED_STATE_SET, colorSecondary.getDefaultColor()); mDisabledDayTextColor = colorSecondary.getColorForState(Utils.DISABLED_STATE_SET, mDayTextColor); final boolean isDarkTheme = Utils.isThemeDark(mMonthTitleColor); if (isDarkTheme) { mTodayNumberColor = res.getColor(R.color.opt_dtpicker_blue_dark); } // kman end mStringBuilder = new StringBuilder(50); mFormatter = new Formatter(mStringBuilder, Locale.getDefault()); MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.opt_dtpicker_day_number_size); MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.opt_dtpicker_month_label_size); MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.opt_dtpicker_month_day_label_text_size); MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.opt_dtpicker_month_list_item_header_height); DAY_SELECTED_CIRCLE_SIZE = res.getDimensionPixelSize(R.dimen.opt_dtpicker_day_number_select_circle_radius); mRowHeight = (res.getDimensionPixelOffset(R.dimen.opt_dtpicker_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(); }