TerminalView.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:connectbot 作者:
public TerminalView(Context context, TerminalBridge bridge) {
    super(context);

    this.context = context;
    this.bridge = bridge;
    paint = new Paint();

    setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    setFocusable(true);
    setFocusableInTouchMode(true);

    cursorPaint = new Paint();
    cursorPaint.setColor(bridge.color[bridge.defaultFg]);
    cursorPaint.setXfermode(new PixelXorXfermode(bridge.color[bridge.defaultBg]));
    cursorPaint.setAntiAlias(true);

    cursorStrokePaint = new Paint(cursorPaint);
    cursorStrokePaint.setStrokeWidth(0.1f);
    cursorStrokePaint.setStyle(Paint.Style.STROKE);

    /*
     * Set up our cursor indicators on a 1x1 Path object which we can later
     * transform to our character width and height
     */
    // TODO make this into a resource somehow
    shiftCursor = new Path();
    shiftCursor.lineTo(0.5f, 0.33f);
    shiftCursor.lineTo(1.0f, 0.0f);

    altCursor = new Path();
    altCursor.moveTo(0.0f, 1.0f);
    altCursor.lineTo(0.5f, 0.66f);
    altCursor.lineTo(1.0f, 1.0f);

    ctrlCursor = new Path();
    ctrlCursor.moveTo(0.0f, 0.25f);
    ctrlCursor.lineTo(1.0f, 0.5f);
    ctrlCursor.lineTo(0.0f, 0.75f);

    // For creating the transform when the terminal resizes
    tempSrc = new RectF();
    tempSrc.set(0.0f, 0.0f, 1.0f, 1.0f);
    tempDst = new RectF();
    scaleMatrix = new Matrix();

    bridge.addFontSizeChangedListener(this);

    // connect our view up to the bridge
    setOnKeyListener(bridge.getKeyHandler());

    mAccessibilityBuffer = new StringBuffer();

    // Enable accessibility features if a screen reader is active.
    new AccessibilityStateTester().execute((Void) null);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号