|
|
|
@ -10,8 +10,9 @@ import android.view.View
|
|
|
|
|
import android.view.ViewGroup
|
|
|
|
|
import androidx.fragment.app.DialogFragment
|
|
|
|
|
import kotlinx.android.synthetic.main.fragment_create_shortcut.*
|
|
|
|
|
import kotlinx.coroutines.MainScope
|
|
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.ext.increaseTapArea
|
|
|
|
|
import org.mozilla.fenix.ext.loadIntoView
|
|
|
|
|
import org.mozilla.fenix.ext.requireComponents
|
|
|
|
|
|
|
|
|
@ -25,10 +26,7 @@ class CreateShortcutFragment : DialogFragment() {
|
|
|
|
|
inflater: LayoutInflater,
|
|
|
|
|
container: ViewGroup?,
|
|
|
|
|
savedInstanceState: Bundle?
|
|
|
|
|
): View? {
|
|
|
|
|
val view = inflater.inflate(R.layout.fragment_create_shortcut, container, false)
|
|
|
|
|
return view
|
|
|
|
|
}
|
|
|
|
|
): View? = inflater.inflate(R.layout.fragment_create_shortcut, container, false)
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
|
super.onViewCreated(view, savedInstanceState)
|
|
|
|
@ -36,7 +34,12 @@ class CreateShortcutFragment : DialogFragment() {
|
|
|
|
|
requireComponents.core.icons.loadIntoView(favicon_image, session.url)
|
|
|
|
|
shortcut_text.setText(session.title)
|
|
|
|
|
|
|
|
|
|
add_button.increaseTapArea(32)
|
|
|
|
|
cancel_button.increaseTapArea(32)
|
|
|
|
|
cancel_button.setOnClickListener { dismiss() }
|
|
|
|
|
add_button.setOnClickListener {
|
|
|
|
|
val text = shortcut_text.text.toString()
|
|
|
|
|
MainScope().launch {
|
|
|
|
|
requireComponents.useCases.webAppUseCases.addToHomescreen(text)
|
|
|
|
|
}.invokeOnCompletion { dismiss() }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|