From 158df24341f938d95f6bd58711d2674028a9b852 Mon Sep 17 00:00:00 2001 From: Christopher Robert Van Wiemeersch Date: Thu, 11 Apr 2019 05:37:59 -0700 Subject: [PATCH] fix Version toggle: show git sha on long-pressing Version string (fixes issue #1041); improve click target (#1073) --- .../ui/widgets/dialogs/SettingsWidget.java | 17 +++++--------- app/src/main/res/layout/settings.xml | 22 +++++++++++-------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/SettingsWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/SettingsWidget.java index e18f3adaa..8c8af61fe 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/SettingsWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/SettingsWidget.java @@ -58,21 +58,14 @@ class VersionGestureListener extends GestureDetector.SimpleOnGestureListener { private boolean mIsHash; @Override - public boolean onDoubleTap(MotionEvent event) { - if (mIsHash) - mBuildText.setText(versionCodeToDate(BuildConfig.VERSION_CODE)); - else - mBuildText.setText(BuildConfig.GIT_HASH); + public boolean onDown (MotionEvent e) { + mBuildText.setText(mIsHash ? versionCodeToDate(BuildConfig.VERSION_CODE) : BuildConfig.GIT_HASH); mIsHash = !mIsHash; return true; } - @Override - public boolean onDown(MotionEvent e) { - return true; - } } public SettingsWidget(Context aContext) { @@ -173,13 +166,13 @@ private void initialize(Context aContext) { mBuildText = findViewById(R.id.buildText); mBuildText.setText(versionCodeToDate(BuildConfig.VERSION_CODE)); - ViewGroup versionLayout = findViewById(R.id.optionsLayout); + ViewGroup settingsMasthead = findViewById(R.id.settingsMasthead); final GestureDetector gd = new GestureDetector(getContext(), new VersionGestureListener()); - versionLayout.setOnTouchListener((view, motionEvent) -> { + settingsMasthead.setOnTouchListener((view, motionEvent) -> { if (gd.onTouchEvent(motionEvent)) { return true; } - return view.onTouchEvent(motionEvent); + return view.performClick(); }); HoneycombButton reportButton = findViewById(R.id.reportButton); diff --git a/app/src/main/res/layout/settings.xml b/app/src/main/res/layout/settings.xml index 4356ca0dd..44510ac0e 100644 --- a/app/src/main/res/layout/settings.xml +++ b/app/src/main/res/layout/settings.xml @@ -10,9 +10,12 @@ android:orientation="vertical"> @@ -182,4 +186,4 @@ android:src="@drawable/ic_icon_dialog_cancel" app:tintColorList="@drawable/main_button_icon_color" /> - \ No newline at end of file +