@@ -76,7 +76,7 @@ public class StripeActivity extends BaseVisualActivity implements StripeContentV
76
76
@ Bind (R .id .toolbar )
77
77
CustomTitleToolbar mToolbar ;
78
78
@ Bind (R .id .navigation )
79
- NavigationLinearLayout mNavigation ;
79
+ NavigationLinearLayout mNavigationLayout ;
80
80
@ Bind (R .id .progress_bar )
81
81
View mLoading ;
82
82
@ Bind (R .id .retry )
@@ -116,7 +116,7 @@ private void setupToolbar() {
116
116
117
117
private void setupNavigationLayout () {
118
118
final RelativeLayout .LayoutParams navigationLayoutLp =
119
- (RelativeLayout .LayoutParams ) mNavigation .getLayoutParams ();
119
+ (RelativeLayout .LayoutParams ) mNavigationLayout .getLayoutParams ();
120
120
final boolean isLandscape =
121
121
getResources ().getConfiguration ().orientation == Configuration .ORIENTATION_LANDSCAPE ;
122
122
@@ -127,7 +127,7 @@ private void setupNavigationLayout() {
127
127
navigationLayoutLp .addRule (RelativeLayout .ALIGN_PARENT_RIGHT );
128
128
}
129
129
130
- mNavigation .setLayoutParams (navigationLayoutLp );
130
+ mNavigationLayout .setLayoutParams (navigationLayoutLp );
131
131
}
132
132
133
133
private void setupLoading () {
@@ -141,7 +141,19 @@ private void setupLoading() {
141
141
142
142
@ Override
143
143
public boolean onTouchEvent (final @ NonNull MotionEvent event ) {
144
- return this .mGestureDetector .onTouchEvent (event ) || super .onTouchEvent (event );
144
+ return handleTriplePointerMenuToggle (event ) || this .mGestureDetector .onTouchEvent (event ) || super .onTouchEvent (event );
145
+ }
146
+
147
+ private boolean handleTriplePointerMenuToggle (final @ NonNull MotionEvent event ) {
148
+ if (event .getPointerCount () == 3 && event .getActionMasked () == MotionEvent .ACTION_POINTER_UP ) {
149
+ if (mNavigationLayout .isExpanded ()) {
150
+ mNavigationLayout .hide ();
151
+ } else {
152
+ mNavigationLayout .show ();
153
+ }
154
+ return true ;
155
+ }
156
+ return false ;
145
157
}
146
158
147
159
@ Override
@@ -207,7 +219,7 @@ private void openModelInBrowser() {
207
219
protected void createComponentAndInjectSelf () {
208
220
DaggerStripeComponent .builder ()
209
221
.applicationComponent (getApplicationComponent ())
210
- .stripeModule (new StripeModule (mNavigation , mToolbar , mRetry ))
222
+ .stripeModule (new StripeModule (mNavigationLayout , mToolbar , mRetry ))
211
223
.build ()
212
224
.inject (this );
213
225
}
@@ -253,7 +265,7 @@ private void initializeStripePresenter() {
253
265
}
254
266
255
267
private void initializeNavigation () {
256
- this .mNavigation .setStripePresenter (this .mStripePresenter );
268
+ this .mNavigationLayout .setStripePresenter (this .mStripePresenter );
257
269
}
258
270
259
271
private void initializeRetry () {
@@ -321,23 +333,23 @@ private void showNavigationTutorial() {
321
333
322
334
if (isLandscape ) {
323
335
if (!P .tutorialShownLandscape .get ()) {
324
- mNavigation .showTutorial ();
336
+ mNavigationLayout .showTutorial ();
325
337
new Handler (Looper .getMainLooper ()).postDelayed (new Runnable () {
326
338
@ Override
327
339
public void run () {
328
340
P .tutorialShownLandscape .put (true ).apply ();
329
- mNavigation .hideTutorial ();
341
+ mNavigationLayout .hideTutorial ();
330
342
}
331
343
}, resources .getInteger (R .integer .tutorial_show_duration_milliseconds ));
332
344
}
333
345
} else {
334
346
if (!P .tutorialShownPortrait .get ()) {
335
- mNavigation .showTutorial ();
347
+ mNavigationLayout .showTutorial ();
336
348
new Handler (Looper .getMainLooper ()).postDelayed (new Runnable () {
337
349
@ Override
338
350
public void run () {
339
351
P .tutorialShownPortrait .put (true ).apply ();
340
- mNavigation .hideTutorial ();
352
+ mNavigationLayout .hideTutorial ();
341
353
}
342
354
}, resources .getInteger (R .integer .tutorial_show_duration_milliseconds ));
343
355
}
@@ -389,7 +401,7 @@ public void hideLoading() {
389
401
390
402
@ Override
391
403
public void showRetry (final @ NonNull Throwable throwable ) {
392
- mNavigation .hide ();
404
+ mNavigationLayout .hide ();
393
405
mToolbar .setTitle (getString (R .string .content_error_title ));
394
406
mContent .setBackgroundColor (
395
407
ResourceUtil .getColor (this , R .color .content_background_empty , getTheme ()));
@@ -438,13 +450,13 @@ public boolean dispatchKeyEvent(final @NonNull KeyEvent event) {
438
450
case KeyEvent .KEYCODE_VOLUME_UP :
439
451
if (event .getAction () == KeyEvent .ACTION_UP ) {
440
452
mStripePresenter .actionPrevious ();
441
- mNavigation .hide ();
453
+ mNavigationLayout .hide ();
442
454
}
443
455
return true ;
444
456
case KeyEvent .KEYCODE_VOLUME_DOWN :
445
457
if (event .getAction () == KeyEvent .ACTION_UP ) {
446
458
mStripePresenter .actionNext ();
447
- mNavigation .hide ();
459
+ mNavigationLayout .hide ();
448
460
}
449
461
return true ;
450
462
default :
0 commit comments