blob: 4b48f5f611a0b4c98a9c9771151a27593b68c3d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
package org.happysanta.gd.Menu.Views;
import android.content.Context;
import android.graphics.Typeface;
import android.widget.TextView;
import static org.happysanta.gd.Helpers.runOnUiThread;
public class MenuTextView extends TextView {
protected boolean isAttached = false;
public MenuTextView(Context context) {
super(context);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
isAttached = true;
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
isAttached = false;
}
@Override
public boolean isAttachedToWindow() {
return isAttached;
}
public void setTextOnUiThread(final CharSequence sequence) {
runOnUiThread(new Runnable() {
@Override
public void run() {
MenuTextView.super.setText(sequence);
}
});
}
@Override
public void setTextSize(final float size) {
runOnUiThread(new Runnable() {
@Override
public void run() {
MenuTextView.super.setTextSize(size);
}
});
}
@Override
public void setTypeface(final Typeface typeface) {
runOnUiThread(new Runnable() {
@Override
public void run() {
MenuTextView.super.setTypeface(typeface);
}
});
}
@Override
public void setVisibility(final int visibility) {
runOnUiThread(new Runnable() {
@Override
public void run() {
MenuTextView.super.setVisibility(visibility);
}
});
}
}
|