android.widget.TextView#setImportantForAccessibility ( )源码实例Demo

下面列出了android.widget.TextView#setImportantForAccessibility ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public SwitchBar(Context context, AttributeSet attrs) {
    super(context, attrs);

    LayoutInflater.from(context).inflate(R.layout.switch_bar, this);

    mTextView = (TextView) findViewById(R.id.switch_text);
    if (SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
        mTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    }
    mLabel = getResources().getString(R.string.abc_capital_off);
    mSummarySpan = new TextAppearanceSpan(context, android.support.v7.appcompat.R.style.TextAppearance_AppCompat_Widget_Switch);
    updateText();

    mSwitch = (ToggleSwitch) findViewById(R.id.switch_widget);
    // Prevent onSaveInstanceState() to be called as we are managing the state of the Switch
    // on our own
    mSwitch.setSaveEnabled(false);
    if (SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        mSwitch.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    }

    addOnSwitchChangeListener(new OnSwitchChangeListener() {
        @Override
        public void onSwitchChanged(SwitchCompat switchView, boolean isChecked) {
            setTextViewLabel(isChecked);
        }
    });

    setOnClickListener(this);

    // Default is hide
    setVisibility(View.GONE);
}
 
源代码2 项目: Telegram-FOSS   文件: FloatingToolbar.java
private View createMenuItemButton(Context context, MenuItem menuItem, int iconTextSpacing) {
    LinearLayout menuItemButton = new LinearLayout(context);
    menuItemButton.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    menuItemButton.setOrientation(LinearLayout.HORIZONTAL);
    menuItemButton.setMinimumWidth(AndroidUtilities.dp(48));
    menuItemButton.setMinimumHeight(AndroidUtilities.dp(48));
    menuItemButton.setPaddingRelative(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0);

    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setFocusable(false);
    textView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
    textView.setFocusableInTouchMode(false);
    if (currentStyle == STYLE_DIALOG) {
        textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
        menuItemButton.setBackgroundDrawable(Theme.getSelectorDrawable(false));
    } else if (currentStyle == STYLE_BLACK) {
        textView.setTextColor(0xfffafafa);
        menuItemButton.setBackgroundDrawable(Theme.getSelectorDrawable(0x40ffffff, false));
    } else if (currentStyle == STYLE_THEME) {
        textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
        menuItemButton.setBackgroundDrawable(Theme.getSelectorDrawable(false));
    }
    textView.setPaddingRelative(AndroidUtilities.dp(11), 0, 0, 0);
    menuItemButton.addView(textView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, AndroidUtilities.dp(48)));
    if (menuItem != null) {
        updateMenuItemButton(menuItemButton, menuItem, iconTextSpacing);
    }
    return menuItemButton;
}
 
源代码3 项目: Telegram   文件: FloatingToolbar.java
private View createMenuItemButton(Context context, MenuItem menuItem, int iconTextSpacing) {
    LinearLayout menuItemButton = new LinearLayout(context);
    menuItemButton.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    menuItemButton.setOrientation(LinearLayout.HORIZONTAL);
    menuItemButton.setMinimumWidth(AndroidUtilities.dp(48));
    menuItemButton.setMinimumHeight(AndroidUtilities.dp(48));
    menuItemButton.setPaddingRelative(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0);

    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setFocusable(false);
    textView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
    textView.setFocusableInTouchMode(false);
    if (currentStyle == STYLE_DIALOG) {
        textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
        menuItemButton.setBackgroundDrawable(Theme.getSelectorDrawable(false));
    } else if (currentStyle == STYLE_BLACK) {
        textView.setTextColor(0xfffafafa);
        menuItemButton.setBackgroundDrawable(Theme.getSelectorDrawable(0x40ffffff, false));
    } else if (currentStyle == STYLE_THEME) {
        textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
        menuItemButton.setBackgroundDrawable(Theme.getSelectorDrawable(false));
    }
    textView.setPaddingRelative(AndroidUtilities.dp(11), 0, 0, 0);
    menuItemButton.addView(textView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, AndroidUtilities.dp(48)));
    if (menuItem != null) {
        updateMenuItemButton(menuItemButton, menuItem, iconTextSpacing);
    }
    return menuItemButton;
}
 
源代码4 项目: ProjectX   文件: SubLayout.java
SubLayout(Context context) {
    super(context);
    setWillNotDraw(false);
    final Resources resources = context.getResources();
    int size = resources.getDimensionPixelOffset(R.dimen.floatingActionModeItemSize);
    int textColor = resources.getColor(R.color.floatingActionModeSubTitleTextColor);
    float textSize = resources.getDimension(R.dimen.floatingActionModeSubTitleTextSize);
    @SuppressLint("CustomViewStyleable") final TypedArray custom =
            context.obtainStyledAttributes(R.styleable.FloatingActionMode);
    size = custom.getDimensionPixelOffset(
            R.styleable.FloatingActionMode_floatingActionModeItemSize, size);
    final int textAppearance = custom.getResourceId(
            R.styleable.FloatingActionMode_floatingActionModeSubTitleTextAppearance, 0);
    textColor = custom.getColor(
            R.styleable.FloatingActionMode_floatingActionModeSubTitleTextColor, textColor);
    textSize = custom.getDimension(
            R.styleable.FloatingActionMode_floatingActionModeSubTitleTextSize, textSize);
    custom.recycle();
    setOrientation(VERTICAL);
    mTitle = new TextView(context);
    if (textAppearance != 0)
        mTitle.setTextAppearance(context, textAppearance);
    else {
        final TypedArray a = context.obtainStyledAttributes(
                new int[]{android.R.attr.textAppearanceListItemSmall});
        mTitle.setTextAppearance(context, a.getResourceId(0, 0));
        a.recycle();
    }
    mTitle.setBackgroundDrawable(null);
    mTitle.setEllipsize(TextUtils.TruncateAt.END);
    mTitle.setFocusable(false);
    mTitle.setFocusableInTouchMode(false);
    mTitle.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));
    mTitle.setGravity(Gravity.CENTER);
    mTitle.setSingleLine();
    mTitle.setTextColor(textColor);
    mTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    mTitle.setMinimumHeight(size);
    mTitle.setPadding(size, 0, size, 0);
    if (Build.VERSION.SDK_INT >= 16)
        mTitle.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    mTitle.setLayoutParams(new LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    mList = new SubListView(context);
    mListMaxHeight = mList.getMaxHeight();
    mParams = new LayoutParams(LayoutParams.MATCH_PARENT, 0);
    mParams.weight = 1;
    mCornerCrop.setFillType(Path.FillType.EVEN_ODD);
    mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
    mCropPath.setFillType(Path.FillType.EVEN_ODD);
    mList.setOnItemClickListener(this);
}
 
源代码5 项目: Telegram-FOSS   文件: PhotoPickerPhotoCell.java
public PhotoPickerPhotoCell(Context context) {
    super(context);
    setWillNotDraw(false);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(4));
    addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    checkFrame = new FrameLayout(context);
    addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.RIGHT | Gravity.TOP));

    videoInfoContainer = new FrameLayout(context) {

        private Path path = new Path();
        float[] radii = new float[8];
        private RectF rect = new RectF();
        private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);

        @Override
        protected void onDraw(Canvas canvas) {
            rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
            radii[0] = radii[1] = radii[2] = radii[3] = 0;
            radii[4] = radii[5] = radii[6] = radii[7] = AndroidUtilities.dp(4);
            path.reset();
            path.addRoundRect(rect, radii, Path.Direction.CW);
            path.close();
            paint.setColor(0x7f000000);
            canvas.drawPath(path, paint);
        }
    };
    videoInfoContainer.setWillNotDraw(false);
    videoInfoContainer.setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0);
    addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 16, Gravity.BOTTOM | Gravity.LEFT));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.ic_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, -0.7f, 0, 0));

    checkBox = new CheckBox2(context, 24);
    checkBox.setDrawBackgroundAsArc(11);
    checkBox.setColor(Theme.key_chat_attachCheckBoxBackground, Theme.key_chat_attachPhotoBackground, Theme.key_chat_attachCheckBoxCheck);
    addView(checkBox, LayoutHelper.createFrame(26, 26, Gravity.LEFT | Gravity.TOP, 55, 4, 0, 0));
    checkBox.setVisibility(VISIBLE);

    setFocusable(true);
}
 
源代码6 项目: Telegram-FOSS   文件: SharedPhotoVideoCell.java
public PhotoVideoView(Context context) {
    super(context);

    setWillNotDraw(false);

    container = new FrameLayout(context);
    addView(container, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    imageView = new BackupImageView(context);
    imageView.getImageReceiver().setNeedsQualityThumb(true);
    imageView.getImageReceiver().setShouldGenerateQualityThumb(true);
    container.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    videoInfoContainer = new FrameLayout(context) {

        private RectF rect = new RectF();

        @Override
        protected void onDraw(Canvas canvas) {
            rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
            canvas.drawRoundRect(rect, AndroidUtilities.dp(4), AndroidUtilities.dp(4), Theme.chat_timeBackgroundPaint);
        }
    };
    videoInfoContainer.setWillNotDraw(false);
    videoInfoContainer.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), 0);
    container.addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 17, Gravity.BOTTOM | Gravity.LEFT, 4, 0, 0, 4));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.play_mini_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 13, -0.7f, 0, 0));

    selector = new View(context);
    selector.setBackgroundDrawable(Theme.getSelectorDrawable(false));
    addView(selector, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    checkBox = new CheckBox2(context, 21);
    checkBox.setVisibility(INVISIBLE);
    checkBox.setColor(null, Theme.key_sharedMedia_photoPlaceholder, Theme.key_checkboxCheck);
    checkBox.setDrawUnchecked(false);
    checkBox.setDrawBackgroundAsArc(1);
    addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.RIGHT | Gravity.TOP, 0, 1, 1, 0));
}
 
源代码7 项目: Telegram-FOSS   文件: PhotoAttachPhotoCell.java
public PhotoAttachPhotoCell(Context context) {
    super(context);

    setWillNotDraw(false);

    container = new FrameLayout(context);
    addView(container, LayoutHelper.createFrame(80, 80));

    imageView = new BackupImageView(context);
    container.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    videoInfoContainer = new FrameLayout(context) {

        private RectF rect = new RectF();

        @Override
        protected void onDraw(Canvas canvas) {
            rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
            canvas.drawRoundRect(rect, AndroidUtilities.dp(4), AndroidUtilities.dp(4), Theme.chat_timeBackgroundPaint);
        }
    };
    videoInfoContainer.setWillNotDraw(false);
    videoInfoContainer.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), 0);
    container.addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 17, Gravity.BOTTOM | Gravity.LEFT, 4, 0, 0, 4));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.play_mini_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 13, -0.7f, 0, 0));

    checkBox = new CheckBox2(context, 24);
    checkBox.setDrawBackgroundAsArc(7);
    checkBox.setColor(Theme.key_chat_attachCheckBoxBackground, Theme.key_chat_attachPhotoBackground, Theme.key_chat_attachCheckBoxCheck);
    addView(checkBox, LayoutHelper.createFrame(26, 26, Gravity.LEFT | Gravity.TOP, 52, 4, 0, 0));
    checkBox.setVisibility(VISIBLE);
    setFocusable(true);

    checkFrame = new FrameLayout(context);
    addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.LEFT | Gravity.TOP, 38, 0, 0, 0));

    itemSize = AndroidUtilities.dp(80);
}
 
源代码8 项目: Telegram   文件: PhotoPickerPhotoCell.java
public PhotoPickerPhotoCell(Context context) {
    super(context);
    setWillNotDraw(false);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(4));
    addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    checkFrame = new FrameLayout(context);
    addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.RIGHT | Gravity.TOP));

    videoInfoContainer = new FrameLayout(context) {

        private Path path = new Path();
        float[] radii = new float[8];
        private RectF rect = new RectF();
        private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);

        @Override
        protected void onDraw(Canvas canvas) {
            rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
            radii[0] = radii[1] = radii[2] = radii[3] = 0;
            radii[4] = radii[5] = radii[6] = radii[7] = AndroidUtilities.dp(4);
            path.reset();
            path.addRoundRect(rect, radii, Path.Direction.CW);
            path.close();
            paint.setColor(0x7f000000);
            canvas.drawPath(path, paint);
        }
    };
    videoInfoContainer.setWillNotDraw(false);
    videoInfoContainer.setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0);
    addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 16, Gravity.BOTTOM | Gravity.LEFT));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.ic_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, -0.7f, 0, 0));

    checkBox = new CheckBox2(context, 24);
    checkBox.setDrawBackgroundAsArc(11);
    checkBox.setColor(Theme.key_chat_attachCheckBoxBackground, Theme.key_chat_attachPhotoBackground, Theme.key_chat_attachCheckBoxCheck);
    addView(checkBox, LayoutHelper.createFrame(26, 26, Gravity.LEFT | Gravity.TOP, 55, 4, 0, 0));
    checkBox.setVisibility(VISIBLE);

    setFocusable(true);
}
 
源代码9 项目: Telegram   文件: SharedPhotoVideoCell.java
public PhotoVideoView(Context context) {
    super(context);

    setWillNotDraw(false);

    container = new FrameLayout(context);
    addView(container, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    imageView = new BackupImageView(context);
    imageView.getImageReceiver().setNeedsQualityThumb(true);
    imageView.getImageReceiver().setShouldGenerateQualityThumb(true);
    container.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    videoInfoContainer = new FrameLayout(context) {

        private RectF rect = new RectF();

        @Override
        protected void onDraw(Canvas canvas) {
            rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
            canvas.drawRoundRect(rect, AndroidUtilities.dp(4), AndroidUtilities.dp(4), Theme.chat_timeBackgroundPaint);
        }
    };
    videoInfoContainer.setWillNotDraw(false);
    videoInfoContainer.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), 0);
    container.addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 17, Gravity.BOTTOM | Gravity.LEFT, 4, 0, 0, 4));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.play_mini_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 13, -0.7f, 0, 0));

    selector = new View(context);
    selector.setBackgroundDrawable(Theme.getSelectorDrawable(false));
    addView(selector, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    checkBox = new CheckBox2(context, 21);
    checkBox.setVisibility(INVISIBLE);
    checkBox.setColor(null, Theme.key_sharedMedia_photoPlaceholder, Theme.key_checkboxCheck);
    checkBox.setDrawUnchecked(false);
    checkBox.setDrawBackgroundAsArc(1);
    addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.RIGHT | Gravity.TOP, 0, 1, 1, 0));
}
 
源代码10 项目: Telegram   文件: PhotoAttachPhotoCell.java
public PhotoAttachPhotoCell(Context context) {
    super(context);

    setWillNotDraw(false);

    container = new FrameLayout(context);
    addView(container, LayoutHelper.createFrame(80, 80));

    imageView = new BackupImageView(context);
    container.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    videoInfoContainer = new FrameLayout(context) {

        private RectF rect = new RectF();

        @Override
        protected void onDraw(Canvas canvas) {
            rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
            canvas.drawRoundRect(rect, AndroidUtilities.dp(4), AndroidUtilities.dp(4), Theme.chat_timeBackgroundPaint);
        }
    };
    videoInfoContainer.setWillNotDraw(false);
    videoInfoContainer.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), 0);
    container.addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 17, Gravity.BOTTOM | Gravity.LEFT, 4, 0, 0, 4));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.play_mini_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoTextView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 13, -0.7f, 0, 0));

    checkBox = new CheckBox2(context, 24);
    checkBox.setDrawBackgroundAsArc(7);
    checkBox.setColor(Theme.key_chat_attachCheckBoxBackground, Theme.key_chat_attachPhotoBackground, Theme.key_chat_attachCheckBoxCheck);
    addView(checkBox, LayoutHelper.createFrame(26, 26, Gravity.LEFT | Gravity.TOP, 52, 4, 0, 0));
    checkBox.setVisibility(VISIBLE);
    setFocusable(true);

    checkFrame = new FrameLayout(context);
    addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.LEFT | Gravity.TOP, 38, 0, 0, 0));

    itemSize = AndroidUtilities.dp(80);
}
 
 方法所在类
 同类方法