HandlerDelegateは呼び出しでしょうか?
public class WebViewActivity(var uri: Uri? = null): DefaultActivity() {
private class WebViewFragment():
WebFragment(),
AdEventHandlerDelegate,
FavorEventHandlerDelegate,
ShareEventHandlerDelegate,
NewPageEventHandlerDelegate,
LoginPageEventHandlerDelegate,
LogoutPageEventHandlerDelegate
{
private object KeyName {
val Uri = "Uri"
}
public companion object {
//Function型 fun
public fun newFragment(uri: Uri): WebViewFragment {
val fragment = WebViewFragment()
val args = Bundle()
args.putString(KeyName.Uri, uri.toString())
fragment.setArguments(args)
return fragment
}
}
private fun getWebViewActivity(): WebViewActivity {
return getActivity() as WebViewActivity
}
override fun getEventHandlers(): Collection<EventHandler> {
return arrayListOf(
AdEventHandler(this),
FavorEventHandler(this),
ShareEventHandler(this),
CurrentPageEventHandler(this),
NewPageEventHandler(this),
LoginPageEventHandler(this),
LogoutPageEventHandler(this)
)
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
override fun onCreate(savedInstanceState: Bundle?) {
super<DefaultActivity>.onCreate(savedInstanceState)
setContentView(R.layout.activity_webview)
//
setupUri()
if (savedInstanceState == null) {
val newFragment = WebViewFragment.newFragment(uri!!)
getFragmentManager()
.beginTransaction()
.add(R.id.web_view_container, newFragment)
.commit()
}
getSupportActionBar().hide()
}
}
この場合ですと、
val newFragment = WebViewFragment.newFragment(uri!!)
の部分でHandlerDelegateが全て呼び出されているのでしょうか?
EventHandler(this)の部分は何を行っているんでしょうか?
EventHandlerにWebViewでリクエストをフックして強制的に任意のURLに遷移させる処理を入れることは可能ですか?