[JavaScript] 纯文本查看 复制代码 package com.sonelli.juicessh.views;
import android.content.Context;
import android.graphics.Typeface;
import android.util.DisplayMetrics;
import android.view.GestureDetector.OnGestureListener;
import android.view.KeyEvent;
import android.view.MotionEvent;
import com.sonelli.adj;
import com.sonelli.aip;
import com.sonelli.aiq;
import com.sonelli.anw;
import jackpal.androidterm.emulatorview.EmulatorView;
import jackpal.androidterm.emulatorview.TermSession;
public class TerminalView extends EmulatorView {
private OnResizeListener a;
private OnBackListener b;
private OnEscListener c;
private OnGestureListener d;
public interface OnBackListener {
boolean a();
}
public interface OnEscListener {
boolean a();
}
public interface OnResizeListener {
void a(int i, int i2, int i3, int i4);
}
protected void onSizeChanged(int i, int i2, int i3, int i4) {
super.onSizeChanged(i, i2, i3, i4);
if (this.a != null) {
this.a.a(i, i2, i3, i4);
}
}
public void setTextSize(int i) {
super.setTextSize(i);
if (this.a != null) {
this.a.a(getWidth(), getHeight(), getWidth(), getHeight());
}
}
protected void onWindowVisibilityChanged(int i) {
super.onWindowVisibilityChanged(i);
switch (i) {
case 0:
postDelayed(new aip(this), 200);
return;
default:
return;
}
}
public TerminalView(int i, Context context, TermSession termSession, DisplayMetrics displayMetrics) {
super(context, termSession, displayMetrics);
setUseCookedIME(true);
setOnFocusChangeListener(new aiq(this));
}
public void a(OnEscListener onEscListener) {
this.c = onEscListener;
}
public void a(OnResizeListener onResizeListener) {
this.a = onResizeListener;
}
public boolean dispatchKeyEventPreIme(KeyEvent keyEvent) {
switch (keyEvent.getKeyCode()) {
case 4:
if (keyEvent.getAction() != 0) {
return false;
}
if (keyEvent.getDevice() == null || keyEvent.getDeviceId() < 0 || keyEvent.getDevice().getKeyboardType() != 2) {
if (this.b != null) {
return this.b.a();
}
return false;
} else if (this.c != null) {
return this.c.a();
} else {
return false;
}
case 111:
if (keyEvent.getAction() != 0 || this.c == null) {
return false;
}
return this.c.a();
default:
return false;
}
}
public Typeface getFont() {
adj.c("Views/TerminalView", "Setting font to embedded monospace font");
return Typeface.createFromAsset(getContext().getAssets(), "fonts/DroidSansMono.ttf");
}
public void setColors(int[] iArr) {
super.setColors(iArr);
if (this.a != null) {
this.a.a(getWidth(), getHeight(), getWidth(), getHeight());
}
}
public boolean onKeyDown(int i, KeyEvent keyEvent) {
boolean onKeyDown = super.onKeyDown(i, keyEvent);
if (this.mKeyPressListener != null) {
this.mKeyPressListener.onKeyPressed(i);
}
return onKeyDown;
}
public void setExtGestureListener(OnGestureListener onGestureListener) {
this.d = onGestureListener;
super.setExtGestureListener(onGestureListener);
}
public boolean onTouchEvent(MotionEvent motionEvent) {
if (this.d == null || !(this.d instanceof anw)) {
return super.onTouchEvent(motionEvent);
}
return ((anw) this.d).a(motionEvent) || super.onTouchEvent(motionEvent);
}
public void onLongPress(MotionEvent motionEvent) {
}
}
smali里面看目录这一段是terminalview.java,我就看出来get字体,set大小。 |