• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.development;
18 
19 import android.widget.TextView;
20 import android.content.Context;
21 import android.text.method.ScrollingMovementMethod;
22 import android.text.method.MovementMethod;
23 import android.text.method.KeyListener;
24 import android.text.method.TransformationMethod;
25 import android.text.Editable;
26 import android.util.AttributeSet;
27 
28 
29 /**
30  * This is a TextView that is Editable and by default scrollable,
31  * like EditText without a cursor.
32  *
33  * <p>
34  * <b>XML attributes</b>
35  * <p>
36  * See
37  * {@link android.R.styleable#TextView TextView Attributes},
38  * {@link android.R.styleable#View View Attributes}
39  */
40 public class LogTextBox extends TextView {
LogTextBox(Context context)41     public LogTextBox(Context context) {
42         this(context, null);
43     }
44 
LogTextBox(Context context, AttributeSet attrs)45     public LogTextBox(Context context, AttributeSet attrs) {
46         this(context, attrs, android.R.attr.textViewStyle);
47     }
48 
LogTextBox(Context context, AttributeSet attrs, int defStyle)49     public LogTextBox(Context context, AttributeSet attrs, int defStyle) {
50         super(context, attrs, defStyle);
51     }
52 
53     @Override
getDefaultEditable()54     protected boolean getDefaultEditable() {
55         return true;
56     }
57 
58     @Override
getDefaultMovementMethod()59     protected MovementMethod getDefaultMovementMethod() {
60         return ScrollingMovementMethod.getInstance();
61     }
62 
63     @Override
getText()64     public Editable getText() {
65         return (Editable) super.getText();
66     }
67 
68     @Override
setText(CharSequence text, BufferType type)69     public void setText(CharSequence text, BufferType type) {
70         super.setText(text, BufferType.EDITABLE);
71     }
72 }
73