|
|
|
@ -16,7 +16,6 @@ import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory
|
|
|
|
|
import androidx.lifecycle.lifecycleScope
|
|
|
|
|
import androidx.navigation.fragment.findNavController
|
|
|
|
|
import androidx.navigation.fragment.navArgs
|
|
|
|
|
import kotlinx.android.synthetic.main.fragment_share.view.*
|
|
|
|
|
import mozilla.components.browser.state.action.ContentAction
|
|
|
|
|
import mozilla.components.browser.state.selector.findTabOrCustomTab
|
|
|
|
|
import mozilla.components.concept.engine.prompt.PromptRequest
|
|
|
|
@ -24,6 +23,7 @@ import mozilla.components.feature.accounts.push.SendTabUseCases
|
|
|
|
|
import mozilla.components.feature.share.RecentAppsStorage
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.components.FenixSnackbar
|
|
|
|
|
import org.mozilla.fenix.databinding.FragmentShareBinding
|
|
|
|
|
import org.mozilla.fenix.ext.getRootView
|
|
|
|
|
import org.mozilla.fenix.ext.requireComponents
|
|
|
|
|
|
|
|
|
@ -58,8 +58,12 @@ class ShareFragment : AppCompatDialogFragment() {
|
|
|
|
|
inflater: LayoutInflater,
|
|
|
|
|
container: ViewGroup?,
|
|
|
|
|
savedInstanceState: Bundle?
|
|
|
|
|
): View? {
|
|
|
|
|
val view = inflater.inflate(R.layout.fragment_share, container, false)
|
|
|
|
|
): View {
|
|
|
|
|
val binding = FragmentShareBinding.inflate(
|
|
|
|
|
inflater,
|
|
|
|
|
container,
|
|
|
|
|
false
|
|
|
|
|
)
|
|
|
|
|
val shareData = args.data.toList()
|
|
|
|
|
|
|
|
|
|
val accountManager = requireComponents.backgroundServices.accountManager
|
|
|
|
@ -89,24 +93,24 @@ class ShareFragment : AppCompatDialogFragment() {
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
view.shareWrapper.setOnClickListener { shareInteractor.onShareClosed() }
|
|
|
|
|
binding.shareWrapper.setOnClickListener { shareInteractor.onShareClosed() }
|
|
|
|
|
shareToAccountDevicesView =
|
|
|
|
|
ShareToAccountDevicesView(view.devicesShareLayout, shareInteractor)
|
|
|
|
|
ShareToAccountDevicesView(binding.devicesShareLayout, shareInteractor)
|
|
|
|
|
|
|
|
|
|
if (args.showPage) {
|
|
|
|
|
// Show the previous fragment underneath the share background scrim
|
|
|
|
|
// by making it translucent.
|
|
|
|
|
view.closeSharingScrim.alpha = SHOW_PAGE_ALPHA
|
|
|
|
|
view.shareWrapper.setOnClickListener { shareInteractor.onShareClosed() }
|
|
|
|
|
binding.closeSharingScrim.alpha = SHOW_PAGE_ALPHA
|
|
|
|
|
binding.shareWrapper.setOnClickListener { shareInteractor.onShareClosed() }
|
|
|
|
|
} else {
|
|
|
|
|
// Otherwise, show a list of tabs to share.
|
|
|
|
|
view.closeSharingScrim.alpha = 1.0f
|
|
|
|
|
shareCloseView = ShareCloseView(view.closeSharingContent, shareInteractor)
|
|
|
|
|
binding.closeSharingScrim.alpha = 1.0f
|
|
|
|
|
shareCloseView = ShareCloseView(binding.closeSharingContent, shareInteractor)
|
|
|
|
|
shareCloseView.setTabs(shareData)
|
|
|
|
|
}
|
|
|
|
|
shareToAppsView = ShareToAppsView(view.appsShareLayout, shareInteractor)
|
|
|
|
|
shareToAppsView = ShareToAppsView(binding.appsShareLayout, shareInteractor)
|
|
|
|
|
|
|
|
|
|
return view
|
|
|
|
|
return binding.root
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
|