Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Commit

Permalink
Version 4.8 with in-app product deprecation banner.
Browse files Browse the repository at this point in the history
  • Loading branch information
st3fan authored Apr 8, 2021
1 parent 57cf826 commit b8bc163
Show file tree
Hide file tree
Showing 18 changed files with 213 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {
targetSdkVersion 28
versionCode 11 // This versionCode is "frozen" for local builds. For "release" builds we
// override this with a generated versionCode at build time.
versionName "4.7.2"
versionName "4.8"
testInstrumentationRunner "org.mozilla.tv.firefox.FirefoxOnDeviceTestRunner"
testInstrumentationRunnerArguments clearPackageData: 'true'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@
import org.junit.Test;
import org.mozilla.tv.firefox.MainActivity;
import org.mozilla.tv.firefox.R;
import org.mozilla.tv.firefox.components.locale.LocaleManager;
import org.mozilla.tv.firefox.helpers.MainActivityTestRule;

import java.util.Locale;

import tools.fastlane.screengrab.Screengrab;
import tools.fastlane.screengrab.locale.LocaleTestRule;

Expand Down Expand Up @@ -64,9 +61,6 @@ public void tearDown() {
public void unpinTileFromContextMenu() {
onView(allOf(withId(R.id.navUrlInput), isDisplayed(), hasFocus()));

final Locale currentLocale = LocaleManager.getInstance()
.getCurrentLocale(mActivityTestRule.getActivity());

mDevice.pressDPadDown();

onView(withText(R.string.homescreen_unpin_tutorial_toast))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.ScrollView
import androidx.annotation.VisibleForTesting
import androidx.annotation.VisibleForTesting.NONE
Expand All @@ -29,12 +30,9 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
import io.reactivex.rxkotlin.addTo
import kotlinx.android.synthetic.main.fragment_navigation_overlay_orig.channelsContainer
import kotlinx.android.synthetic.main.fragment_navigation_overlay_orig.navUrlInput
import kotlinx.android.synthetic.main.fragment_navigation_overlay_orig.settingsTileContainer
import kotlinx.android.synthetic.main.fragment_navigation_overlay_top_nav.exitButton
import kotlinx.android.synthetic.main.fragment_navigation_overlay_top_nav.fxaButton
import kotlinx.android.synthetic.main.hint_bar.hintBarContainer
import kotlinx.android.synthetic.main.fragment_navigation_overlay_orig.*
import kotlinx.android.synthetic.main.fragment_navigation_overlay_top_nav.*
import kotlinx.android.synthetic.main.hint_bar.*
import kotlinx.coroutines.Job
import org.mozilla.tv.firefox.MainActivity
import org.mozilla.tv.firefox.R
Expand All @@ -58,6 +56,7 @@ import org.mozilla.tv.firefox.telemetry.UrlTextInputLocation
import org.mozilla.tv.firefox.utils.RoundCornerTransformation
import org.mozilla.tv.firefox.utils.ServiceLocator
import org.mozilla.tv.firefox.utils.Settings
import org.mozilla.tv.firefox.utils.SupportUtils
import org.mozilla.tv.firefox.utils.ViewUtils
import org.mozilla.tv.firefox.widget.InlineAutocompleteEditText
import java.lang.ref.WeakReference
Expand Down Expand Up @@ -170,6 +169,15 @@ class NavigationOverlayFragment : Fragment() {
).apply {
onCreateView(view)
}

val bannerLayout: View = view.findViewById(R.id.bannerLayout)

val bannerMoreInfoButton: Button = bannerLayout.findViewById(R.id.bannerMoreInfoButton)
bannerMoreInfoButton.setOnClickListener {
(activity as MainActivity).onNonTextInputUrlEntered(SupportUtils.getSumoURLForTopic(this.context, "amazon-end-support"))
context?.serviceLocator?.screenController?.showNavigationOverlay(fragmentManager, false)
}

return view
}

Expand Down Expand Up @@ -406,7 +414,7 @@ class NavigationOverlayFragment : Fragment() {
}
},
onTileFocused = {
val prefInt = android.preference.PreferenceManager.getDefaultSharedPreferences(context).getInt(
val prefInt = PreferenceManager.getDefaultSharedPreferences(context).getInt(
SHOW_UNPIN_TOAST_COUNTER_PREF, 0)
if (prefInt < MAX_UNPIN_TOAST_COUNT && canShowUnpinToast) {
PreferenceManager.getDefaultSharedPreferences(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.Button
import android.widget.FrameLayout
import androidx.core.view.isGone
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
import io.reactivex.rxkotlin.addTo
import kotlinx.android.synthetic.main.fragment_browser.cursorView
import kotlinx.android.synthetic.main.fragment_browser.progressBar
import kotlinx.android.synthetic.main.fragment_browser.view.browserFragmentRoot
import kotlinx.android.synthetic.main.fragment_browser.view.engineView
import kotlinx.android.synthetic.main.fragment_browser.view.progressBar
import kotlinx.android.synthetic.main.hint_bar.hintBarContainer
import kotlinx.android.synthetic.main.fragment_browser.*
import kotlinx.android.synthetic.main.fragment_browser.view.*
import kotlinx.android.synthetic.main.hint_bar.*
import mozilla.components.browser.session.Session
import mozilla.components.concept.engine.EngineSession
import mozilla.components.concept.engine.EngineView
Expand Down Expand Up @@ -53,6 +52,7 @@ import org.mozilla.tv.firefox.ext.webRenderComponents
import org.mozilla.tv.firefox.hint.HintBinder
import org.mozilla.tv.firefox.hint.InactiveHintViewModel
import org.mozilla.tv.firefox.session.SessionRepo
import org.mozilla.tv.firefox.utils.SupportUtils
import org.mozilla.tv.firefox.utils.URLs

private const val ARGUMENT_SESSION_UUID = "sessionUUID"
Expand Down Expand Up @@ -116,6 +116,9 @@ class WebRenderFragment : EngineViewLifecycleFragment(), Session.Observer {
serviceLocator?.experimentsProvider?.shouldUseMp4VideoWorkaround() == true) {
engineView?.updateFullscreenScrollPosition()
}

val bannerLayout: View = window.findViewById(R.id.bannerLayout)
bannerLayout.isGone = enabled
}

override fun onUrlChanged(session: Session, url: String) {
Expand Down Expand Up @@ -153,6 +156,16 @@ class WebRenderFragment : EngineViewLifecycleFragment(), Session.Observer {
}
context.serviceLocator.cursorModel.webViewCouldScrollInDirectionProvider = layout.engineView::couldScrollInDirection

// Setup the banner

val bannerLayout: View = layout.findViewById(R.id.bannerLayout)

val moreInfoButton: Button = bannerLayout.findViewById(R.id.bannerMoreInfoButton)
moreInfoButton.setOnClickListener {
(activity as MainActivity).onNonTextInputUrlEntered(SupportUtils.getSumoURLForTopic(this.context, "amazon-end-support"))
context?.serviceLocator?.screenController?.showNavigationOverlay(fragmentManager, false)
}

layout.progressBar.initialize(this)

// We break encapsulation here: we should use the super.engineView reference but it's not init until
Expand Down
Binary file added app/src/main/res/drawable-nodpi/warning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions app/src/main/res/drawable/dismiss_button_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true">
<shape>
<solid android:color="@color/photonGrey90"/>
<corners android:radius="4dp"/>
</shape>
</item>

<item android:state_focused="true">
<shape>
<solid android:color="@color/photonGrey90"/>
<stroke
android:width="4dp"
android:color="@color/photonBlue50"
/>
<corners android:radius="4dp"/>
</shape>
</item>

<item>
<shape>
<solid android:color="@color/photonGrey90"/>
<corners android:radius="4dp"/>
</shape>
</item>
</selector>
42 changes: 42 additions & 0 deletions app/src/main/res/layout/fragment_browser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,48 @@
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
android:id="@+id/bannerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#2A2A2E"
android:gravity="center">

<ImageView
android:contentDescription="@null"
android:layout_width="80sp"
android:layout_height="64sp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:src="@drawable/warning"/>

<TextView
android:id="@+id/bannerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@string/font_ember_regular"
android:textSize="18sp"
android:lineSpacingExtra="6sp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:text="@string/banner_text"
android:textColor="#FBFBFE" />

<Button
android:id="@+id/bannerMoreInfoButton"
style="@style/BannerConfirmButton"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:layout_weight="0"
android:text="@string/banner_more_info_button"
android:textSize="18sp"
android:fontFamily="@string/font_ember_regular"/>
</LinearLayout>

<org.mozilla.tv.firefox.widget.ResizableKeyboardCoordinatorLayout
app:viewToHideWhenActivated="@+id/erase"
android:layout_marginTop="0dp"
Expand Down
50 changes: 47 additions & 3 deletions app/src/main/res/layout/fragment_navigation_overlay_orig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,49 @@
<!-- This background color is necessary otherwise the browser shows through -->


<LinearLayout
android:id="@+id/bannerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2A2A2E"
android:gravity="center"
android:orientation="horizontal">

<ImageView
android:contentDescription="@null"
android:layout_width="80sp"
android:layout_height="64sp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:src="@drawable/warning"/>

<TextView
android:id="@+id/bannerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="@string/font_ember_regular"
android:textSize="18sp"
android:lineSpacingExtra="6sp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:text="@string/banner_text"
android:textColor="#FBFBFE" />

<Button
android:id="@+id/bannerMoreInfoButton"
style="@style/BannerConfirmButton"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="0"
android:nextFocusDown="@+id/exitButton"
android:text="@string/banner_more_info_button"
android:textSize="18sp"
android:fontFamily="@string/font_ember_regular" />
</LinearLayout>

<org.mozilla.tv.firefox.navigationoverlay.BrowserNavigationOverlayScrollView
android:id="@+id/overlayScrollView"
android:layout_width="match_parent"
Expand Down Expand Up @@ -64,6 +107,7 @@
android:cursorVisible="false"
android:drawableStart="@drawable/mozac_ic_search"
android:drawablePadding="10dp"
android:fontFamily="@string/font_ember_regular"
android:hint="@string/urlbar_hint"
android:imeOptions="actionGo|flagNoExtractUi|flagNoFullscreen"
android:importantForAutofill="no"
Expand All @@ -76,8 +120,8 @@
android:textColor="@color/photonGrey10"
android:textColorHint="@color/photonGrey10_a80p"
android:textIsSelectable="false"
android:fontFamily="@string/font_ember_regular"
tools:ignore="UnusedAttribute" >
tools:ignore="UnusedAttribute">

<requestFocus />

</org.mozilla.tv.firefox.widget.InlineAutocompleteEditText>
Expand Down Expand Up @@ -106,7 +150,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/overlay_margin_channel_start"
android:layout_marginEnd="@dimen/overlay_margin_end"/>
android:layout_marginEnd="@dimen/overlay_margin_end" />

</LinearLayout>
</androidx.core.widget.NestedScrollView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,41 @@
android:id="@+id/navButtonBack"
style="@style/NavigationButton"
android:src="@drawable/mozac_ic_back"
android:nextFocusUp="@+id/bannerMoreInfoButton"
android:contentDescription="@string/content_description_back"/>

<ImageButton
android:id="@+id/navButtonForward"
style="@style/NavigationButton"
android:src="@drawable/mozac_ic_forward"
android:nextFocusUp="@+id/bannerMoreInfoButton"
android:contentDescription="@string/content_description_forward"/>

<ImageButton
android:id="@+id/navButtonReload"
style="@style/NavigationButton"
android:src="@drawable/mozac_ic_refresh"
android:nextFocusUp="@+id/bannerMoreInfoButton"
android:contentDescription="@string/content_description_reload"/>

<org.mozilla.tv.firefox.widget.CheckableImageButton
android:id="@+id/pinButton"
style="@style/NavigationButton"
android:src="@drawable/pin_selector"
android:nextFocusUp="@+id/bannerMoreInfoButton"
android:contentDescription="@string/pin_label"/>

<!-- src and content description set programmatically -->
<org.mozilla.tv.firefox.widget.CheckableImageButton
android:id="@+id/turboButton"
android:nextFocusUp="@+id/bannerMoreInfoButton"
style="@style/NavigationButton" />

<org.mozilla.tv.firefox.widget.CheckableImageButton
android:id="@+id/desktopModeButton"
style="@style/NavigationButton"
android:src="@drawable/mozac_ic_device_desktop"
android:nextFocusUp="@+id/bannerMoreInfoButton"
android:contentDescription="@string/request_desktop_site_a11y"/>

<View
Expand All @@ -56,6 +62,7 @@
android:scaleType="fitXY"
android:src="@drawable/ic_fxa_login"
android:visibility="gone"
android:nextFocusUp="@+id/bannerMoreInfoButton"
android:tint="@null"/>

<!-- Content description is set programmatically.-->
Expand All @@ -64,6 +71,7 @@
android:id="@+id/exitButton"
style="@style/NavigationButton"
android:src="@drawable/ic_home"
android:nextFocusUp="@+id/bannerMoreInfoButton"
android:nextFocusRight="@id/exitButton"/>

<ImageView
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,8 @@
<string name="update_prompt_primary_button">Aktualisieren</string>
<!-- Button text to dismiss the prompt to update the app. -->
<string name="update_prompt_secondary_button">Nicht jetzt</string>

<!-- Text for the banner. -->
<string name="banner_text">Firefox hat den Support auf Amazon Fire TV beendet. Die App funktioniert weiter, erhält aber ab dem 30. April 2021 keine Sicherheits- oder andere Updates mehr.</string>
<string name="banner_more_info_button">Mehr erfahren</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values-es-rES/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,8 @@
<string name="update_prompt_primary_button">Actualizar</string>
<!-- Button text to dismiss the prompt to update the app. -->
<string name="update_prompt_secondary_button">Ahora no</string>

<!-- Text for the banner. -->
<string name="banner_text">Firefox ha finalizado el soporte para Amazon Fire TV. La aplicación seguirá funcionando, pero no recibirá actualizaciones a partir del 30 de abril, 2021.</string>
<string name="banner_more_info_button">Más información</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,8 @@
<string name="update_prompt_primary_button">Mettre à jour</string>
<!-- Button text to dismiss the prompt to update the app. -->
<string name="update_prompt_secondary_button">Pas maintenant</string>

<!-- Text for the banner. -->
<string name="banner_text">Firefox n’assure plus la prise en charge des appareils Amazon Fire TV. L’application peut fonctionner, mais ne sera plus mise à jour dès le 30 avril 2021.</string>
<string name="banner_more_info_button">En savoir plus</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,8 @@
<string name="update_prompt_primary_button">Aggiorna</string>
<!-- Button text to dismiss the prompt to update the app. -->
<string name="update_prompt_secondary_button">Non ora</string>

<!-- Text for the banner. -->
<string name="banner_text">Firefox ha terminato il supporto per Fire TV di Amazon. L\'app continuerà a operare, ma dal 30 aprile 2021 non riceverà aggiornamenti di sicurezza.</string>
<string name="banner_more_info_button">Scopri di più</string>
</resources>
Loading

0 comments on commit b8bc163

Please sign in to comment.