1
0
Fork 0

Add Snackbar to link testers to Github issue for features

master
Emily Kager 2019-03-21 17:08:03 -07:00 committed by Colin Lee
parent a0cfedeeca
commit 4963f7ccdb
9 changed files with 94 additions and 24 deletions

View File

@ -39,6 +39,7 @@ import org.mozilla.fenix.BrowsingModeManager
import org.mozilla.fenix.DefaultThemeManager
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.IntentReceiverActivity
import org.mozilla.fenix.utils.ItsNotBrokenSnack
import org.mozilla.fenix.R
import org.mozilla.fenix.components.FindInPageIntegration
import org.mozilla.fenix.components.toolbar.SearchAction
@ -307,7 +308,8 @@ class BrowserFragment : Fragment(), BackHandler {
sessionUseCases.loadUrl.invoke(reportUrl)
}
ToolbarMenu.Item.Help -> {
// TODO Help
// TODO Help #1016
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "1016")
}
ToolbarMenu.Item.NewTab -> {
val directions = BrowserFragmentDirections

View File

@ -33,6 +33,7 @@ import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.BrowsingModeManager
import org.mozilla.fenix.DefaultThemeManager
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.utils.ItsNotBrokenSnack
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.archive
import org.mozilla.fenix.ext.requireComponents
@ -250,6 +251,8 @@ class HomeFragment : Fragment(), CoroutineScope {
}
is SessionsAction.MenuTapped ->
openSessionMenu(SessionBottomSheetFragment.SessionType.Archived(it.archivedSession))
is SessionsAction.ShareTapped ->
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "244")
}
}
}

View File

@ -11,6 +11,7 @@ import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.session_bottom_sheet.view.*
import org.mozilla.fenix.utils.ItsNotBrokenSnack
import org.mozilla.fenix.R
import org.mozilla.fenix.home.sessions.ArchivedSession
@ -51,6 +52,10 @@ class SessionBottomSheetFragment : BottomSheetDialogFragment(), LayoutContainer
}
}
view.send_and_share_session_button.setOnClickListener {
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "244")
}
view.delete_session_button.setOnClickListener {
sessionType?.apply { onDelete?.invoke(this) }
dismiss()

View File

@ -116,6 +116,7 @@ sealed class SessionsAction : Action {
data class Select(val archivedSession: ArchivedSession) : SessionsAction()
data class Delete(val archivedSession: ArchivedSession) : SessionsAction()
data class MenuTapped(val archivedSession: ArchivedSession) : SessionsAction()
data class ShareTapped(val archivedSession: ArchivedSession) : SessionsAction()
}
sealed class SessionsChange : Change {

View File

@ -15,6 +15,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.navigation.Navigation
import kotlinx.android.synthetic.main.fragment_library.*
import org.mozilla.fenix.utils.ItsNotBrokenSnack
import org.mozilla.fenix.R
class LibraryFragment : Fragment() {
@ -40,10 +41,27 @@ class LibraryFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
libraryHistory.setOnClickListener(Navigation.createNavigateOnClickListener(
LibraryFragmentDirections.actionLibraryFragmentToHistoryFragment().actionId,
null)
libraryHistory.setOnClickListener(
Navigation.createNavigateOnClickListener(
LibraryFragmentDirections.actionLibraryFragmentToHistoryFragment().actionId,
null
)
)
libraryDownloads.setOnClickListener {
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "348")
}
libraryScreenshots.setOnClickListener {
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "89")
}
libraryFavorites.setOnClickListener {
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "90")
}
libraryReadingList.setOnClickListener {
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "913")
}
librarySessions.setOnClickListener {
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "637")
}
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
@ -58,6 +76,7 @@ class LibraryFragment : Fragment() {
}
R.id.librarySearch -> {
// TODO Library Search
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "1118")
true
}
else -> super.onOptionsItemSelected(item)

View File

@ -21,6 +21,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import mozilla.components.support.base.feature.BackHandler
import org.mozilla.fenix.utils.ItsNotBrokenSnack
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.mvi.ActionBusFactory
@ -117,7 +118,8 @@ class HistoryFragment : Fragment(), CoroutineScope, BackHandler {
true
}
R.id.librarySearch -> {
// TODO Library Search
// TODO Library Search #1118
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "1118")
true
}
else -> super.onOptionsItemSelected(item)

View File

@ -16,6 +16,7 @@ import mozilla.components.feature.search.SearchUseCases
import mozilla.components.feature.session.SessionUseCases
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.utils.ItsNotBrokenSnack
import org.mozilla.fenix.R
import org.mozilla.fenix.components.toolbar.SearchAction
import org.mozilla.fenix.components.toolbar.SearchState
@ -50,6 +51,10 @@ class SearchFragment : Fragment() {
}
} ?: ""
view.search_scan_button.setOnClickListener {
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "113")
}
toolbarComponent = ToolbarComponent(
view.toolbar_wrapper,
ActionBusFactory.get(this),

View File

@ -24,32 +24,32 @@ import kotlinx.coroutines.launch
import mozilla.components.concept.sync.AccountObserver
import mozilla.components.concept.sync.OAuthAccount
import mozilla.components.concept.sync.Profile
import kotlin.coroutines.CoroutineContext
import java.io.File
import mozilla.components.service.fxa.FxaUnauthorizedException
import mozilla.components.support.ktx.android.graphics.toDataUri
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.FenixApplication
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.R
import org.mozilla.fenix.R.string.pref_key_about
import org.mozilla.fenix.R.string.pref_key_accessibility
import org.mozilla.fenix.R.string.pref_key_account
import org.mozilla.fenix.R.string.pref_key_account_category
import org.mozilla.fenix.R.string.pref_key_data_choices
import org.mozilla.fenix.R.string.pref_key_feedback
import org.mozilla.fenix.R.string.pref_key_help
import org.mozilla.fenix.R.string.pref_key_language
import org.mozilla.fenix.R.string.pref_key_leakcanary
import org.mozilla.fenix.R.string.pref_key_make_default_browser
import org.mozilla.fenix.R.string.pref_key_rate
import org.mozilla.fenix.R.string.pref_key_remote_debugging
import org.mozilla.fenix.R.string.pref_key_search_engine_settings
import org.mozilla.fenix.R.string.pref_key_sign_in
import org.mozilla.fenix.R.string.pref_key_site_permissions
import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.ext.requireComponents
import java.io.File
import kotlin.coroutines.CoroutineContext
import org.mozilla.fenix.R.string.pref_key_leakcanary
import org.mozilla.fenix.R.string.pref_key_feedback
import org.mozilla.fenix.R.string.pref_key_help
import org.mozilla.fenix.R.string.pref_key_make_default_browser
import org.mozilla.fenix.R.string.pref_key_rate
import org.mozilla.fenix.R.string.pref_key_site_permissions
import org.mozilla.fenix.R.string.pref_key_accessibility
import org.mozilla.fenix.R.string.pref_key_language
import org.mozilla.fenix.R.string.pref_key_data_choices
import org.mozilla.fenix.R.string.pref_key_about
import org.mozilla.fenix.R.string.pref_key_sign_in
import org.mozilla.fenix.R.string.pref_key_account
import org.mozilla.fenix.R.string.pref_key_account_category
import org.mozilla.fenix.R.string.pref_key_search_engine_settings
import org.mozilla.fenix.utils.ItsNotBrokenSnack
@SuppressWarnings("TooManyFunctions")
class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObserver {
@ -98,7 +98,8 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
navigateToAccessibility()
}
resources.getString(pref_key_language) -> {
// TODO open language switcher
// TODO #220
ItsNotBrokenSnack(context!!).showSnackbar(activity = activity!!, issueNumber = "220")
}
resources.getString(pref_key_data_choices) -> {
navigateToDataChoices()

View File

@ -0,0 +1,32 @@
/* 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/. */
package org.mozilla.fenix.utils
import android.app.Activity
import android.content.Context
import android.view.View
import com.google.android.material.snackbar.Snackbar
import org.mozilla.fenix.ext.components
class ItsNotBrokenSnack(val context: Context) {
fun getSnackbar(issueNumber: String, view: View): Snackbar {
val snackbar = Snackbar.make(view, message.replace("%", issueNumber), Snackbar.LENGTH_SHORT)
snackbar.setAction("Add Tab to Issue", {
context.components.useCases.tabsUseCases.addTab
.invoke(issues + issueNumber)
})
return snackbar
}
fun showSnackbar(issueNumber: String, activity: Activity) {
val rootView = activity.window.decorView.findViewById<View>(android.R.id.content)
getSnackbar(issueNumber, rootView).show()
}
companion object {
const val issues = "https://github.com/mozilla-mobile/fenix/issues/"
const val message = "Feature is not implemented, Issue #%"
}
}