File tree 2 files changed +26
-0
lines changed
app/src/main/java/com/github/mobile/ui/comment
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 15
15
*/
16
16
package com .github .mobile .ui .comment ;
17
17
18
+ import static android .os .Build .VERSION .SDK_INT ;
19
+ import static android .os .Build .VERSION_CODES .HONEYCOMB_MR1 ;
18
20
import static com .github .mobile .Intents .EXTRA_COMMENT ;
19
21
import static com .github .mobile .util .TypefaceUtils .ICON_EDIT ;
20
22
import static com .github .mobile .util .TypefaceUtils .ICON_WATCH ;
21
23
import android .content .Intent ;
22
24
import android .os .Bundle ;
23
25
import android .text .TextUtils ;
26
+ import android .view .View ;
24
27
25
28
import com .actionbarsherlock .view .Menu ;
26
29
import com .actionbarsherlock .view .MenuItem ;
@@ -52,6 +55,20 @@ protected void onCreate(Bundle savedInstanceState) {
52
55
super .onCreate (savedInstanceState );
53
56
54
57
configureTabPager ();
58
+
59
+ // prevent TabHost from stealing focus when using hardware keyboard
60
+ if (SDK_INT >= HONEYCOMB_MR1 )
61
+ host .addOnAttachStateChangeListener (new View .OnAttachStateChangeListener () {
62
+
63
+ @ Override
64
+ public void onViewAttachedToWindow (View v ) {
65
+ host .getViewTreeObserver ().removeOnTouchModeChangeListener (host );
66
+ }
67
+
68
+ @ Override
69
+ public void onViewDetachedFromWindow (View v ) {
70
+ }
71
+ });
55
72
}
56
73
57
74
@ Override
Original file line number Diff line number Diff line change 18
18
import android .os .Bundle ;
19
19
import android .text .Editable ;
20
20
import android .view .LayoutInflater ;
21
+ import android .view .MotionEvent ;
21
22
import android .view .View ;
22
23
import android .view .ViewGroup ;
23
24
import android .widget .EditText ;
@@ -49,6 +50,14 @@ public void afterTextChanged(Editable s) {
49
50
activity .invalidateOptionsMenu ();
50
51
}
51
52
});
53
+ commentText .setOnTouchListener (new View .OnTouchListener () {
54
+
55
+ @ Override
56
+ public boolean onTouch (View v , MotionEvent event ) {
57
+ commentText .requestFocusFromTouch ();
58
+ return false ;
59
+ }
60
+ });
52
61
}
53
62
54
63
@ Override
You can’t perform that action at this time.
0 commit comments