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


Java LocaleController.isRTL方法代码示例

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


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

示例1: onResume

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    if (justCreated) {
        if (LocaleController.isRTL) {
            viewPager.setCurrentItem(6);
            lastPage = 6;
        } else {
            viewPager.setCurrentItem(0);
            lastPage = 0;
        }
        justCreated = false;
    }
    AndroidUtilities.checkForCrashes(this);
    AndroidUtilities.checkForUpdates(this);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:17,代码来源:IntroActivity.java

示例2: onDraw

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    if (needDivider) {
        canvas.drawLine(getPaddingLeft(), getHeight() - 1, getWidth() - getPaddingRight(), getHeight() - 1, paint);
    }
    if (currentColor != 0 && colorDrawable != null) {
        int x;
        int y = (getMeasuredHeight() - colorDrawable.getMinimumHeight()) / 2;
        if (!LocaleController.isRTL) {
            x = getMeasuredWidth() - colorDrawable.getIntrinsicWidth() - AndroidUtilities.dp(14.5f);
        } else {
            x = AndroidUtilities.dp(14.5f);
        }
        colorDrawable.setBounds(x, y, x + colorDrawable.getIntrinsicWidth(), y + colorDrawable.getIntrinsicHeight());
        colorDrawable.draw(canvas);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:18,代码来源:TextColorCell.java

示例3: onLayout

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    int height = bottom - top;
    int width = right - left;

    int viewTop = (height - valueTextView.getTextHeight()) / 2;
    int viewLeft = LocaleController.isRTL ? AndroidUtilities.dp(24) : 0;
    valueTextView.layout(viewLeft, viewTop, viewLeft + valueTextView.getMeasuredWidth(), viewTop + valueTextView.getMeasuredHeight());

    viewTop = (height - textView.getTextHeight()) / 2;
    viewLeft = !LocaleController.isRTL ? AndroidUtilities.dp(71) : AndroidUtilities.dp(24);
    textView.layout(viewLeft, viewTop, viewLeft + textView.getMeasuredWidth(), viewTop + textView.getMeasuredHeight());

    viewTop = AndroidUtilities.dp(5);
    viewLeft = !LocaleController.isRTL ? AndroidUtilities.dp(16) : width - imageView.getMeasuredWidth() - AndroidUtilities.dp(16);
    imageView.layout(viewLeft, viewTop, viewLeft + imageView.getMeasuredWidth(), viewTop + imageView.getMeasuredHeight());

    viewTop = (height - valueImageView.getMeasuredHeight()) / 2;
    viewLeft = LocaleController.isRTL ? AndroidUtilities.dp(24) : width - valueImageView.getMeasuredWidth() - AndroidUtilities.dp(24);
    valueImageView.layout(viewLeft, viewTop, viewLeft + valueImageView.getMeasuredWidth(), viewTop + valueImageView.getMeasuredHeight());
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:22,代码来源:TextCell.java

示例4: stopDrag

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
private void stopDrag(MotionEvent ev) {
    mTouchMode = TOUCH_MODE_IDLE;

    final boolean commitChange = ev.getAction() == MotionEvent.ACTION_UP && isEnabled();
    final boolean newState;
    if (commitChange) {
        mVelocityTracker.computeCurrentVelocity(1000);
        final float xvel = mVelocityTracker.getXVelocity();
        if (Math.abs(xvel) > mMinFlingVelocity) {
            newState = LocaleController.isRTL ? (xvel < 0) : (xvel > 0);
        } else {
            newState = getTargetCheckedState();
        }
    } else {
        newState = isChecked();
    }

    setChecked(newState);
    cancelSuperTouch(ev);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:21,代码来源:Switch.java

示例5: setData

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
public void setData(TLObject user, CharSequence name, CharSequence status, int resId) {
    if (user == null) {
        currrntStatus = null;
        currentName = null;
        currentObject = null;
        statusTextView.setText("");
        avatarImageView.setImageDrawable(null);
        if (name == null)
            nameTextView.setText("");
        else {
            String spaceStr = LocaleController.isRTL ?"  ":"";

            nameTextView.setText(spaceStr+String.valueOf(name.toString()));
            update(0);
        }


        return;
    }

    currrntStatus = status;
    currentName = name;
    currentObject = user;
    currentDrawable = resId;
    update(0);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:27,代码来源:UserCell.java

示例6: getCompoundPaddingLeft

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
@Override
public int getCompoundPaddingLeft() {
    if (!LocaleController.isRTL) {
        return super.getCompoundPaddingLeft();
    }
    return super.getCompoundPaddingLeft() + mSwitchWidth;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:8,代码来源:Switch.java

示例7: getCompoundPaddingRight

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
@Override
public int getCompoundPaddingRight() {
    if (LocaleController.isRTL) {
        return super.getCompoundPaddingRight();
    }
    return super.getCompoundPaddingRight() + mSwitchWidth;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:8,代码来源:Switch.java

示例8: getThumbOffset

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
private int getThumbOffset() {
    final float position;
    if (LocaleController.isRTL) {
        position = 1 - thumbPosition;
    } else {
        position = thumbPosition;
    }
    return (int) (position * getThumbScrollRange() + 0.5f);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:10,代码来源:Switch.java

示例9: UserCell

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
public UserCell(Context context, int padding, int checkbox, boolean admin) {
    super(context);

    avatarDrawable = new AvatarDrawable();

    avatarImageView = new BackupImageView(context);
    avatarImageView.setRoundRadius(AndroidUtilities.dp(24));
    int avLeftMargin=LocaleController.isRTL ? 0 : 0 + padding;
    int avRightMargin=LocaleController.isRTL ? 0 + padding : 0;
    int gravity=(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP;
    addView(avatarImageView, LayoutHelper.createFrame(48, 48, gravity, avLeftMargin, 8, avRightMargin, 0));

    mutualView=new ImageView(context);
    mutualView.setVisibility(GONE);
    addView(mutualView, LayoutHelper.createFrame(22, 22, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL,
            LocaleController.isRTL ? 16 : 0
            ,
            0
            ,
            /*LocaleController.isRTL ?
                    AndroidUtilities.dp(65f) + avLeftMargin
                    : avLeftMargin - AndroidUtilities.dp(25f)*/
            LocaleController.isRTL ? 0 : 16
            , 0));
    mutualView.setImageResource(R.drawable.party);
    mutualView.setColorFilter(SkinMan.currentSkin.actionbarColor());



    nameTextView = new SimpleTextView(context);
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(17);
    nameTextView.setTypeface(FontManager.instance().getTypeface());
    nameTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 28 + (checkbox == 2 ? 18 : 0) : (68 + padding), 11.5f, LocaleController.isRTL ? (68 + padding) : 28 + (checkbox == 2 ? 18 : 0), 0));

    statusTextView = new SimpleTextView(context);
    statusTextView.setTextSize(14);
    statusTextView.setTypeface(FontManager.instance().getTypeface());
    statusTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
    addView(statusTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 28 : (68 + padding), 34.5f, LocaleController.isRTL ? (68 + padding) : 28, 0));

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    imageView.setVisibility(GONE);
    addView(imageView, LayoutHelper.createFrame(LayoutParams.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));

    if (checkbox == 2) {
        checkBoxBig = new CheckBoxSquare(context);
        addView(checkBoxBig, LayoutHelper.createFrame(18, 18, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 19 : 0, 0, LocaleController.isRTL ? 0 : 19, 0));
    } else if (checkbox == 1) {
        checkBox = new CheckBox(context, R.drawable.round_check2);
        checkBox.setVisibility(INVISIBLE);
        addView(checkBox, LayoutHelper.createFrame(22, 22, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 37 + padding, 38, LocaleController.isRTL ? 37 + padding : 0, 0));
    }

    if (admin) {
        adminImage = new ImageView(context);
        addView(adminImage, LayoutHelper.createFrame(16, 16, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, LocaleController.isRTL ? 24 : 0, 13.5f, LocaleController.isRTL ? 0 : 24, 0));
    }
    statusOnlineColor= SkinMan.currentSkin.actionbarColor();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:63,代码来源:UserCell.java

示例10: onDraw

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    if (user == null && chat == null && encryptedChat == null) {
        return;
    }

    if (useSeparator) {
        if (LocaleController.isRTL) {
            canvas.drawLine(0, getMeasuredHeight() - 1, getMeasuredWidth() - AndroidUtilities.dp(AndroidUtilities.leftBaseline), getMeasuredHeight() - 1, linePaint);
        } else {
            canvas.drawLine(AndroidUtilities.dp(AndroidUtilities.leftBaseline), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight() - 1, linePaint);
        }
    }

    if (drawAlpha != 1) {
        canvas.saveLayerAlpha(0, 0, canvas.getWidth(), canvas.getHeight(), (int)(255 * drawAlpha), Canvas.HAS_ALPHA_LAYER_SAVE_FLAG);
    }

    if (drawNameLock) {
        setDrawableBounds(lockDrawable, nameLockLeft, nameLockTop);
        lockDrawable.draw(canvas);
    } else if (drawNameGroup) {
        setDrawableBounds(groupDrawable, nameLockLeft, nameLockTop);
        groupDrawable.draw(canvas);
    } else if (drawNameBroadcast) {
        setDrawableBounds(broadcastDrawable, nameLockLeft, nameLockTop);
        broadcastDrawable.draw(canvas);
    } else if (drawNameBot) {
        setDrawableBounds(botDrawable, nameLockLeft, nameLockTop);
        botDrawable.draw(canvas);
    }

    if (nameLayout != null) {
        canvas.save();
        canvas.translate(nameLeft, nameTop);
        nameLayout.draw(canvas);
        canvas.restore();
        if (drawCheck) {
            if (LocaleController.isRTL) {
                setDrawableBounds(checkDrawable, nameLeft - AndroidUtilities.dp(4) - checkDrawable.getIntrinsicWidth(), nameLockTop);
            } else {
                setDrawableBounds(checkDrawable, nameLeft + (int) nameLayout.getLineWidth(0) + AndroidUtilities.dp(4), nameLockTop);
            }
            checkDrawable.draw(canvas);
        }
    }

    if (onlineLayout != null) {
        canvas.save();
        canvas.translate(onlineLeft, AndroidUtilities.dp(40));
        onlineLayout.draw(canvas);
        canvas.restore();
    }

    if (countLayout != null) {
        if (MessagesController.getInstance().isDialogMuted(dialog_id)) {
            setDrawableBounds(countDrawableGrey, countLeft - AndroidUtilities.dp(5.5f), countTop, countWidth + AndroidUtilities.dp(11), countDrawableGrey.getIntrinsicHeight());
            countDrawableGrey.draw(canvas);
        } else {
            setDrawableBounds(countDrawable, countLeft - AndroidUtilities.dp(5.5f), countTop, countWidth + AndroidUtilities.dp(11), countDrawable.getIntrinsicHeight());
            countDrawable.draw(canvas);
        }
        canvas.save();
        canvas.translate(countLeft, countTop + AndroidUtilities.dp(4));
        countLayout.draw(canvas);
        canvas.restore();
    }

    avatarImage.draw(canvas);

    isOnline= OnlineDrawableHelper.isOnline(user);
    if(BuildConfig.DEBUG)
    if(isOnline && drawOnline){
        if(BuildConfig.DEBUG)
        OnlineDrawableHelper.draw(this, canvas, avatarTop,avatarLeft);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:78,代码来源:ProfileSearchCell.java

示例11: onDraw

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    if (titleLayout != null) {
        canvas.save();
        canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), titleY);
        titleLayout.draw(canvas);
        canvas.restore();
    }

    if (descriptionLayout != null) {
        descriptionTextPaint.setColor(0xff212121);
        canvas.save();
        canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), descriptionY);
        descriptionLayout.draw(canvas);
        canvas.restore();
    }

    if (descriptionLayout2 != null) {
        descriptionTextPaint.setColor(0xff212121);
        canvas.save();
        canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), description2Y);
        descriptionLayout2.draw(canvas);
        canvas.restore();
    }

    if (!linkLayout.isEmpty()) {
        descriptionTextPaint.setColor(Theme.MSG_LINK_TEXT_COLOR);
        int offset = 0;
        for (int a = 0; a < linkLayout.size(); a++) {
            StaticLayout layout = linkLayout.get(a);
            if (layout.getLineCount() > 0) {
                canvas.save();
                canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), linkY + offset);
                if (pressedLink == a) {
                    canvas.drawPath(urlPath, urlPaint);
                }
                layout.draw(canvas);
                canvas.restore();
                offset += layout.getLineBottom(layout.getLineCount() - 1);
            }
        }
    }

    letterDrawable.draw(canvas);
    if (drawLinkImageView) {
        linkImageView.draw(canvas);
    }

    if (needDivider) {
        if (LocaleController.isRTL) {
            canvas.drawLine(0, getMeasuredHeight() - 1, getMeasuredWidth() - AndroidUtilities.dp(AndroidUtilities.leftBaseline), getMeasuredHeight() - 1, paint);
        } else {
            canvas.drawLine(AndroidUtilities.dp(AndroidUtilities.leftBaseline), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight() - 1, paint);
        }
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:57,代码来源:SharedLinkCell.java

示例12: addSubItem

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
public TextView addSubItem(int id, String text, int icon) {
    if (popupLayout == null) {
        rect = new Rect();
        location = new int[2];
        popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getContext());
        popupLayout.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
                    if (popupWindow != null && popupWindow.isShowing()) {
                        v.getHitRect(rect);
                        if (!rect.contains((int) event.getX(), (int) event.getY())) {
                            popupWindow.dismiss();
                        }
                    }
                }
                return false;
            }
        });
        popupLayout.setDispatchKeyEventListener(new ActionBarPopupWindow.OnDispatchKeyEventListener() {
            @Override
            public void onDispatchKeyEvent(KeyEvent keyEvent) {
                if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK && keyEvent.getRepeatCount() == 0 && popupWindow != null && popupWindow.isShowing()) {
                    popupWindow.dismiss();
                }
            }
        });
    }
    TextView textView = new TextView(getContext());
    textView.setTypeface(FontManager.instance().getTypeface());
    textView.setTextColor(0xff212121);
    textView.setBackgroundResource(R.drawable.list_selector);
    if (!LocaleController.isRTL) {
        textView.setGravity(Gravity.CENTER_VERTICAL);
    } else {
        textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
    }
    textView.setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    textView.setMinWidth(AndroidUtilities.dp(196));
    textView.setTag(id);
    textView.setText(text);
    if (icon != 0) {
        textView.setCompoundDrawablePadding(AndroidUtilities.dp(12));
        if (!LocaleController.isRTL) {
            textView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(icon), null, null, null);
        } else {
            textView.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(icon), null);
        }
    }
    popupLayout.setShowedFromBotton(showFromBottom);
    popupLayout.addView(textView);
    LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) textView.getLayoutParams();
    if (LocaleController.isRTL) {
        layoutParams.gravity = Gravity.RIGHT;
    }
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = AndroidUtilities.dp(48);
    textView.setLayoutParams(layoutParams);
    textView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (popupWindow != null && popupWindow.isShowing()) {
                if (processedPopupClick) {
                    return;
                }
                processedPopupClick = true;
                popupWindow.dismiss(allowCloseAnimation);
            }
            if (parentMenu != null) {
                parentMenu.onItemClick((Integer) view.getTag());
            } else if (delegate != null) {
                delegate.onItemClick((Integer) view.getTag());
            }
        }
    });
    menuHeight += layoutParams.height;
    return textView;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:80,代码来源:ActionBarMenuItem.java

示例13: onLayout

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    super.onLayout(changed, left, top, right, bottom);

    wasLayout = true;
    int opticalInsetLeft = 0;
    int opticalInsetRight = 0;
    if (mThumbDrawable != null) {
        final Rect trackPadding = mTempRect;
        if (mTrackDrawable != null) {
            mTrackDrawable.getPadding(trackPadding);
        } else {
            trackPadding.setEmpty();
        }

        final Insets insets = Insets.NONE;
        opticalInsetLeft = Math.max(0, insets.left - trackPadding.left);
        opticalInsetRight = Math.max(0, insets.right - trackPadding.right);
    }

    final int switchRight;
    final int switchLeft;
    if (LocaleController.isRTL) {
        switchLeft = getPaddingLeft() + opticalInsetLeft;
        switchRight = switchLeft + mSwitchWidth - opticalInsetLeft - opticalInsetRight;
    } else {
        switchRight = getWidth() - getPaddingRight() - opticalInsetRight;
        switchLeft = switchRight - mSwitchWidth + opticalInsetLeft + opticalInsetRight;
    }

    final int switchTop;
    final int switchBottom;
    switch (getGravity() & Gravity.VERTICAL_GRAVITY_MASK) {
        default:
        case Gravity.TOP:
            switchTop = getPaddingTop();
            switchBottom = switchTop + mSwitchHeight;
            break;

        case Gravity.CENTER_VERTICAL:
            switchTop = (getPaddingTop() + getHeight() - getPaddingBottom()) / 2 - mSwitchHeight / 2;
            switchBottom = switchTop + mSwitchHeight;
            break;

        case Gravity.BOTTOM:
            switchBottom = getHeight() - getPaddingBottom();
            switchTop = switchBottom - mSwitchHeight;
            break;
    }

    mSwitchLeft = switchLeft;
    mSwitchTop = switchTop;
    mSwitchBottom = switchBottom;
    mSwitchRight = switchRight;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:56,代码来源:Switch.java

示例14: onDraw

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    if (user == null && chat == null && encryptedChat == null) {
        return;
    }

    if (useSeparator) {
        if (LocaleController.isRTL) {
            canvas.drawLine(0, getMeasuredHeight() - 1, getMeasuredWidth() - AndroidUtilities.dp(AndroidUtilities.leftBaseline), getMeasuredHeight() - 1, linePaint);
        } else {
            canvas.drawLine(AndroidUtilities.dp(AndroidUtilities.leftBaseline), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight() - 1, linePaint);
        }
    }

    if (drawAlpha != 1) {
        canvas.saveLayerAlpha(0, 0, canvas.getWidth(), canvas.getHeight(), (int)(255 * drawAlpha), Canvas.HAS_ALPHA_LAYER_SAVE_FLAG);
    }

    if (drawNameLock) {
        setDrawableBounds(lockDrawable, nameLockLeft, nameLockTop);
        lockDrawable.draw(canvas);
    } else if (drawNameGroup) {
        //setDrawableBounds(groupDrawable, nameLockLeft, nameLockTop);
        //groupDrawable.draw(canvas);
        if(chat.megagroup){
            setDrawableBounds(superGroupDrawable, nameLockLeft, nameLockTop);
            superGroupDrawable.draw(canvas);
        }else{
            setDrawableBounds(groupDrawable, nameLockLeft, nameLockTop);
            groupDrawable.draw(canvas);
        }
    } else if (drawNameBroadcast) {
        setDrawableBounds(broadcastDrawable, nameLockLeft, nameLockTop);
        broadcastDrawable.draw(canvas);
    } else if (drawNameBot) {
        setDrawableBounds(botDrawable, nameLockLeft, nameLockTop);
        botDrawable.draw(canvas);
    }

    if (nameLayout != null) {
    canvas.save();
    canvas.translate(nameLeft, nameTop);
    nameLayout.draw(canvas);
    canvas.restore();
        if (drawCheck) {
            if (LocaleController.isRTL) {
                setDrawableBounds(checkDrawable, nameLeft - AndroidUtilities.dp(4) - checkDrawable.getIntrinsicWidth(), nameLockTop);
            } else {
                setDrawableBounds(checkDrawable, nameLeft + (int) nameLayout.getLineWidth(0) + AndroidUtilities.dp(4), nameLockTop);
            }
            checkDrawable.draw(canvas);
        }
    }

    if (onlineLayout != null) {
        canvas.save();
        canvas.translate(onlineLeft, AndroidUtilities.dp(40));
        onlineLayout.draw(canvas);
        canvas.restore();
    }

    if (countLayout != null) {
        if (MessagesController.getInstance().isDialogMuted(dialog_id)) {
            setDrawableBounds(countDrawableGrey, countLeft - AndroidUtilities.dp(5.5f), countTop, countWidth + AndroidUtilities.dp(11), countDrawableGrey.getIntrinsicHeight());
            countDrawableGrey.draw(canvas);
        } else {
        setDrawableBounds(countDrawable, countLeft - AndroidUtilities.dp(5.5f), countTop, countWidth + AndroidUtilities.dp(11), countDrawable.getIntrinsicHeight());
        countDrawable.draw(canvas);
        }
        canvas.save();
        canvas.translate(countLeft, countTop + AndroidUtilities.dp(4));
        countLayout.draw(canvas);
        canvas.restore();
    }

    avatarImage.draw(canvas);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:78,代码来源:ProfileSearchCell.java

示例15: addSubItem

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
public TextView addSubItem(int id, String text, int icon) {
    if (popupLayout == null) {
        rect = new Rect();
        location = new int[2];
        popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getContext());
        popupLayout.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
                    if (popupWindow != null && popupWindow.isShowing()) {
                        v.getHitRect(rect);
                        if (!rect.contains((int) event.getX(), (int) event.getY())) {
                            popupWindow.dismiss();
                        }
                    }
                }
                return false;
            }
        });
        popupLayout.setDispatchKeyEventListener(new ActionBarPopupWindow.OnDispatchKeyEventListener() {
            @Override
            public void onDispatchKeyEvent(KeyEvent keyEvent) {
                if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK && keyEvent.getRepeatCount() == 0 && popupWindow != null && popupWindow.isShowing()) {
                    popupWindow.dismiss();
                }
            }
        });
    }
    TextView textView = new TextView(getContext());
    textView.setTextColor(0xff212121);
    textView.setBackgroundResource(R.drawable.list_selector);
    if (!LocaleController.isRTL) {
        textView.setGravity(Gravity.CENTER_VERTICAL);
    } else {
        textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
    }
    textView.setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    textView.setMinWidth(AndroidUtilities.dp(196));
    textView.setTag(id);
    textView.setText(text);
    if (icon != 0) {
        textView.setCompoundDrawablePadding(AndroidUtilities.dp(12));
        if (!LocaleController.isRTL) {
            textView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(icon), null, null, null);
        } else {
            textView.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(icon), null);
        }
    }
    popupLayout.setShowedFromBotton(showFromBottom);
    popupLayout.addView(textView);
    LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) textView.getLayoutParams();
    if (LocaleController.isRTL) {
        layoutParams.gravity = Gravity.RIGHT;
    }
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = AndroidUtilities.dp(48);
    textView.setLayoutParams(layoutParams);
    textView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (popupWindow != null && popupWindow.isShowing()) {
                if (processedPopupClick) {
                    return;
                }
                processedPopupClick = true;
                popupWindow.dismiss(allowCloseAnimation);
            }
            if (parentMenu != null) {
                parentMenu.onItemClick((Integer) view.getTag());
            } else if (delegate != null) {
                delegate.onItemClick((Integer) view.getTag());
            }
        }
    });
    menuHeight += layoutParams.height;
    return textView;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:79,代码来源:ActionBarMenuItem.java


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