Skip to content

Commit

Permalink
Survey feedback link (#2027)
Browse files Browse the repository at this point in the history
* Survey feedback link

* Separate link from text
  • Loading branch information
keianhzo authored and bluemarvin committed Oct 22, 2019
1 parent e88e7b8 commit 72a2790
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

package org.mozilla.vrbrowser.ui.widgets.settings;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Point;
import android.text.Html;
import android.util.AttributeSet;
import android.util.Log;
import android.view.GestureDetector;
Expand All @@ -23,8 +25,8 @@
import org.mozilla.vrbrowser.BuildConfig;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.audio.AudioEngine;
import org.mozilla.vrbrowser.browser.engine.SessionStore;
import org.mozilla.vrbrowser.browser.engine.SessionStack;
import org.mozilla.vrbrowser.browser.engine.SessionStore;
import org.mozilla.vrbrowser.ui.views.HoneycombButton;
import org.mozilla.vrbrowser.ui.widgets.UIWidget;
import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate;
Expand Down Expand Up @@ -78,6 +80,7 @@ public SettingsWidget(Context aContext, AttributeSet aAttrs, int aDefStyle) {
initialize(aContext);
}

@SuppressLint("ClickableViewAccessibility")
private void initialize(Context aContext) {
inflate(aContext, R.layout.settings, this);

Expand Down Expand Up @@ -138,7 +141,12 @@ private void initialize(Context aContext) {
TextView versionText = findViewById(R.id.versionText);
try {
PackageInfo pInfo = getContext().getPackageManager().getPackageInfo(getContext().getPackageName(), 0);
versionText.setText(String.format(getResources().getString(R.string.settings_version), pInfo.versionName));
String app_name = getResources().getString(R.string.app_name);
String[] app_name_parts = app_name.split(" ");
versionText.setText(Html.fromHtml("<b>" + app_name_parts[0] + "</b>" +
" " + app_name_parts[1] + " " +
" <b>" + pInfo.versionName + "</b>",
Html.FROM_HTML_MODE_LEGACY));

} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
Expand All @@ -147,7 +155,7 @@ private void initialize(Context aContext) {
mBuildText = findViewById(R.id.buildText);
mBuildText.setText(versionCodeToDate(BuildConfig.VERSION_CODE));

ViewGroup settingsMasthead = findViewById(R.id.settingsMasthead);
TextView settingsMasthead = findViewById(R.id.buildText);
final GestureDetector gd = new GestureDetector(getContext(), new VersionGestureListener());
settingsMasthead.setOnTouchListener((view, motionEvent) -> {
if (gd.onTouchEvent(motionEvent)) {
Expand All @@ -156,6 +164,12 @@ private void initialize(Context aContext) {
return view.performClick();
});

TextView surveyLink = findViewById(R.id.surveyLink);
surveyLink.setOnClickListener(v -> {
mWidgetManager.getFocusedWindow().getSessionStack().newSessionWithUrl(getResources().getString(R.string.survey_link));
exitWholeSettings();
});

HoneycombButton reportButton = findViewById(R.id.helpButton);
reportButton.setOnClickListener(view -> {
if (mAudio != null) {
Expand Down
Binary file removed app/src/debug/res/drawable/ff_logo_settings.png
Binary file not shown.
Binary file removed app/src/main/res/drawable/ff_logo_settings.png
Binary file not shown.
24 changes: 20 additions & 4 deletions app/src/main/res/layout/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
android:clickable="true"
android:contextClickable="false"
android:focusable="true"
android:gravity="center_horizontal"
android:orientation="vertical"
android:contentDescription="Firefox logo"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -98,23 +99,38 @@
android:layout_gravity="center"
android:clickable="false"
android:scaleType="fitCenter"
android:src="@drawable/ff_logo_settings" />
android:src="@drawable/ff_logo" />

<TextView
android:id="@+id/versionText"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:clickable="false"
android:fontFamily="sans-serif"
android:gravity="center"
android:text="@string/settings_version"
android:textColor="@color/white"
android:text="@string/app_name"
android:textSize="@dimen/text_big_size" />

<TextView
android:id="@+id/surveyLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:fontFamily="sans-serif"
android:gravity="center"
android:text="@string/settings_send_your_feedback"
android:textColorHighlight="@android:color/transparent"
android:textColorLink="@color/azure"
android:textColor="@color/azure"
android:autoLink="all"
android:textStyle="bold"
android:textSize="@dimen/text_smaller_size" />

<TextView
android:id="@+id/buildText"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:fontFamily="sans-serif"
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/non_L10n.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,7 @@
<string name="search_yandex_by" translatable="false">https://yandex.by/search</string>
<string name="search_yandex_tr" translatable="false">https://yandex.com.tr/search</string>
<string name="search_yandex_kz" translatable="false">https://yandex.kz/search</string>

<!-- Settings Survey link -->
<string name="survey_link" translatable="false">https://qsurvey.mozilla.com/s3/FxR</string>
</resources>
9 changes: 4 additions & 5 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@
sdcard. '%1$s' will be replaced at runtime with the website's domain name. -->
<string name="permission_persistent_storage">Will you allow %1$s to store data in persistent storage?</string>

<!-- This string is displayed in the Settings dialog box and how
the user can know which version of the application they are currently running.
'%1$s' will be replaced at runtime with the application version number. -->
<string name="settings_version">version %1$s</string>

<!-- This string is displayed in the Settings dialog box and is used to label an
On/Off switch which toggles whether an application crash is reported without first
prompting the user. -->
Expand Down Expand Up @@ -271,6 +266,10 @@
opens the Firfox Reality support web site in the browser window. -->
<string name="settings_help">Help</string>

<!-- This string is displayed in the settings header under the Firefox Reality logo. When clicked the settings panel is closed
a the survey web site in opened in the currently focused window -->
<string name="settings_send_your_feedback">Send us Your Feedback</string>

<!-- This string is the title of a dialog box shown to the user when a settings
change requires the application to restart. -->
<string name="restart_dialog_restart">Restart Required</string>
Expand Down

0 comments on commit 72a2790

Please sign in to comment.