diff --git a/app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/SettingsWidget.java b/app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/SettingsWidget.java index 0255f5a62e..04cb38eb29 100644 --- a/app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/SettingsWidget.java +++ b/app/src/common/shared/com/igalia/wolvic/ui/widgets/settings/SettingsWidget.java @@ -15,9 +15,8 @@ import android.text.Html; import android.util.AttributeSet; import android.util.Log; -import android.view.GestureDetector; +import android.util.Pair; import android.view.LayoutInflater; -import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -42,6 +41,7 @@ import com.igalia.wolvic.ui.widgets.UIWidget; import com.igalia.wolvic.ui.widgets.WidgetPlacement; import com.igalia.wolvic.ui.widgets.WindowWidget; +import com.igalia.wolvic.ui.widgets.Windows; import com.igalia.wolvic.ui.widgets.dialogs.ClearUserDataDialogWidget; import com.igalia.wolvic.ui.widgets.dialogs.RestartDialogWidget; import com.igalia.wolvic.ui.widgets.dialogs.UIDialog; @@ -74,22 +74,11 @@ public class SettingsWidget extends UIDialog implements SettingsView.Delegate { private SettingsView.SettingViewType mOpenDialog; private SettingsViewModel mSettingsViewModel; private boolean mAreMozillaAccountsDisabled; + private final Pair mVersionDetail = new Pair<>( + "versionCode " + BuildConfig.VERSION_CODE, + BuildConfig.GIT_HASH + " (AC " + Build.version + ")"); + private boolean mIsFirstVersionDetail; - class VersionGestureListener extends GestureDetector.SimpleOnGestureListener { - - private boolean mIsHash; - - @Override - public boolean onDown (MotionEvent e) { - mBinding.buildText.setText(mIsHash ? - "versionCode " + BuildConfig.VERSION_CODE : - BuildConfig.GIT_HASH + " (AC " + Build.version + ")"); - - mIsHash = !mIsHash; - - return true; - } - } public SettingsWidget(Context aContext) { super(aContext); @@ -193,18 +182,19 @@ public void updateUI() { Html.FROM_HTML_MODE_LEGACY)); } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); + Log.e(LOGTAG, "Error when getting package info:" + e.getMessage()); + mBinding.versionText.setText(R.string.app_name); } - mBinding.buildText.setText("versionCode " + BuildConfig.VERSION_CODE); + mIsFirstVersionDetail = false; + mBinding.buildText.setText(mVersionDetail.first); - final GestureDetector gd = new GestureDetector(getContext(), new VersionGestureListener()); - mBinding.settingsMasthead.setOnTouchListener((view, motionEvent) -> { - if (gd.onTouchEvent(motionEvent)) { - return true; - } - return view.performClick(); - }); + OnClickListener updateVersionDetail = v -> { + mIsFirstVersionDetail = !mIsFirstVersionDetail; + mBinding.buildText.setText(mIsFirstVersionDetail ? mVersionDetail.first : mVersionDetail.second); + }; + mBinding.ffLogoSettings.setOnClickListener(updateVersionDetail); + mBinding.versionText.setOnClickListener(updateVersionDetail); if (DeviceType.getStoreType() == DeviceType.StoreType.MAINLAND_CHINA) { mBinding.chinaLicenseNumber.setOnClickListener(v -> { @@ -224,6 +214,14 @@ public void updateUI() { }); } + mBinding.addonsButton.setOnClickListener(view -> { + if (mAudio != null) { + mAudio.playSound(AudioEngine.Sound.CLICK); + } + mWidgetManager.getFocusedWindow().showPanel(Windows.ContentType.ADDONS); + onDismiss(); + }); + mBinding.helpButton.setOnClickListener(view -> { if (mAudio != null) { mAudio.playSound(AudioEngine.Sound.CLICK); @@ -263,9 +261,13 @@ public void updateUI() { SettingsStore.getInstance(getContext()).setRemotePropsVersionName(BuildConfig.VERSION_NAME); RemoteProperties props = mSettingsViewModel.getProps().getValue().get(BuildConfig.VERSION_NAME); + String whatsNewUrl; if (props != null) { - mWidgetManager.openNewTabForeground(props.getWhatsNewUrl()); + whatsNewUrl = props.getWhatsNewUrl(); + } else { + whatsNewUrl = getContext().getString(R.string.home_page_url); } + mWidgetManager.openNewTabForeground(whatsNewUrl); onDismiss(); }); diff --git a/app/src/main/res/layout/settings.xml b/app/src/main/res/layout/settings.xml index bcb9209081..8b76c88395 100644 --- a/app/src/main/res/layout/settings.xml +++ b/app/src/main/res/layout/settings.xml @@ -1,6 +1,7 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> - + + - - - - - - - - - - - + app:layout_constraintTop_toBottomOf="@id/ff_logo_settings" /> + + + + + + + + + app:layout_constraintTop_toBottomOf="@id/buildText"> + + - - - - - diff --git a/app/src/main/res/values/dimen.xml b/app/src/main/res/values/dimen.xml index 2ec690d259..d93f6866d1 100644 --- a/app/src/main/res/values/dimen.xml +++ b/app/src/main/res/values/dimen.xml @@ -75,6 +75,7 @@ 680dp 490dp 125dp + 26dp 100dp diff --git a/app/src/main/res/values/non_L10n.xml b/app/src/main/res/values/non_L10n.xml index 61506d2f87..8c3e6f9298 100644 --- a/app/src/main/res/values/non_L10n.xml +++ b/app/src/main/res/values/non_L10n.xml @@ -225,6 +225,9 @@ uúüûùūůų ìíiïîįī + + https://wolvic.com/ + https://github.com/Igalia/wolvic/issues/ https://wolvic.com/en/feedback/index.html?version=%1$s&device=%2$d diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 78160152d5..3b3e3a2d01 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -305,6 +305,23 @@ true + +