зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1074570 - Dismiss start pane on touch. r=rnewman
This commit is contained in:
Родитель
f8cce50f62
Коммит
824b5f2735
|
@ -1,12 +1,16 @@
|
|||
package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.fxa.activities.FxAccountGetStartedActivity;
|
||||
import org.mozilla.gecko.util.HardwareUtils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnTouchListener;
|
||||
import android.widget.Button;
|
||||
|
||||
public class StartPane extends Activity {
|
||||
|
@ -35,6 +39,10 @@ public class StartPane extends Activity {
|
|||
showBrowser();
|
||||
}
|
||||
});
|
||||
|
||||
if (!HardwareUtils.isTablet() && !HardwareUtils.isTelevision()) {
|
||||
addDismissHandler();
|
||||
}
|
||||
}
|
||||
|
||||
private void showBrowser() {
|
||||
|
@ -48,4 +56,22 @@ public class StartPane extends Activity {
|
|||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
// Add handler for dismissing the StartPane on a single click.
|
||||
private void addDismissHandler() {
|
||||
final GestureDetector gestureDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
|
||||
@Override
|
||||
public boolean onSingleTapUp(MotionEvent e) {
|
||||
StartPane.this.finish();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.onboard_content).setOnTouchListener(new OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return gestureDetector.onTouchEvent(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
android:background="@color/onboard_start"
|
||||
android:windowIsFloating="true">
|
||||
|
||||
<ScrollView android:layout_width="match_parent"
|
||||
<ScrollView android:id="@+id/onboard_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true" >
|
||||
|
|
Загрузка…
Ссылка в новой задаче