File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
app/src/main/java/com/github/mobile/ui/comment Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1515 */
1616package com .github .mobile .ui .comment ;
1717
18+ import static android .os .Build .VERSION .SDK_INT ;
19+ import static android .os .Build .VERSION_CODES .HONEYCOMB_MR1 ;
1820import static com .github .mobile .Intents .EXTRA_COMMENT ;
1921import static com .github .mobile .util .TypefaceUtils .ICON_EDIT ;
2022import static com .github .mobile .util .TypefaceUtils .ICON_WATCH ;
2123import android .content .Intent ;
2224import android .os .Bundle ;
2325import android .text .TextUtils ;
26+ import android .view .View ;
2427
2528import com .actionbarsherlock .view .Menu ;
2629import com .actionbarsherlock .view .MenuItem ;
@@ -52,6 +55,20 @@ protected void onCreate(Bundle savedInstanceState) {
5255 super .onCreate (savedInstanceState );
5356
5457 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+ });
5572 }
5673
5774 @ Override
Original file line number Diff line number Diff line change 1818import android .os .Bundle ;
1919import android .text .Editable ;
2020import android .view .LayoutInflater ;
21+ import android .view .MotionEvent ;
2122import android .view .View ;
2223import android .view .ViewGroup ;
2324import android .widget .EditText ;
@@ -49,6 +50,14 @@ public void afterTextChanged(Editable s) {
4950 activity .invalidateOptionsMenu ();
5051 }
5152 });
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+ });
5261 }
5362
5463 @ Override
You can’t perform that action at this time.
0 commit comments