IT練習ノート

IT関連で調べたこと(実際は嵌ったこと)を書いています。

AndroidのViewクラスを読んでみる

いつもお世話になっているViewクラスのコードを途中まで読んでみました。

http://tools.oesf.biz/android-4.4.0_r1.0/xref/frameworks/base/core/java/android/view/View.java#getListenerInfo

Viewクラスは19533行もあります。お酒の力をつかって読み始めました。。。

  • 継承関係はこうなっています。
public class View 
  implements Drawable.Callback
             KeyEvent.Callback,
             AccessibilityEventSource
  • インナークラスがあります。
 inner class
   ransformationInfo 
   ListenerInfo
3427     public View(Context context) {
3495 public View(Context context, AttributeSet attrs, int defStyleAttr)
3950
  • テスト用のコンストラクタがあります。テストクラス側のコードはどこにあるのでしょうか?
        /**
3952      * Non-public constructor for use in testing
3953      */
3954     View() {
3955         mResources = null;
3956     }
  • 色々情報がみれます。
3958     public String toString() {
  • 4200行目くらいからリスナ関連が続きます。 set / get / has

    getListenerInfo(); 呼び出しながらで色々してる。

  • フォーカス関連

4585     void handleFocusGainInternal(int direction, Rect previouslyFocusedRect) {
 8608     public boolean onTouchEvent(MotionEvent event) {
  • リスナがでてきました。
9045     public interface OnLayoutChangeListener {
  • 座標系がはじまります。
9102     public void setScrollX(int value) {
  • ローテーション関連
9516     public void setRotationY(float rotationY) {
  • 座標関連
 9947     public final void setTop(int top) {
  • スクロール系
10583     public void scrollTo(int x, int y) {
  • UIスレッド系
 11095     public boolean post(Runnable action) {
  • レイヤー系
   12883     public void setLayerType(int layerType, Paint paint) {
  • Bitmap作るところ。DnDの時のDragイメージに使えるかも。。
 13663     Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor, boolean skipChildren) {
  • 描画関連
13917     private boolean drawAnimation(ViewGroup parent, long drawingTime,
13918             Animation a, boolean scalingRequired) {

ここまでで断念しました。