diff --git a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebClient.kt b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebClient.kt index 3e3ad9d23140922d07beeff5bbaa25f442721674..f8cac2e1864ccb8186c303d5246e31053b74db66 100644 --- a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebClient.kt +++ b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebClient.kt @@ -18,7 +18,7 @@ class DocumentWebViewClient(private val webShare: DocumentWebShare): WebViewClie super.onPageStarted(view, url, favicon) webShare.presenter.showLoadingProgressBar() url?.let { - webShare.presenter.updateTitle(it) + webShare.presenter.saveLastUrl(it) } webShare.presenter.updateAutoReloadState(true) // 更新途中に読み込み失敗した場合、ネットワーク復帰時に自動リロードする } diff --git a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt index ac69bed7d7d343d77a212910eadb7547acfd6e02..6fe824773832bc605aeacc6b69ac21f5d532f655 100644 --- a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt +++ b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt @@ -216,7 +216,7 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { setAcceptThirdPartyCookies(it, true) } lasturl?.let { - updateTitle(lasturl) + saveLastUrl(lasturl) } applyCookieManager(url, urlLoading) } @@ -371,23 +371,22 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { } // ツールバー部分のタイトルを更新する関数 - override fun updateTitle(url: String) { + override fun saveLastUrl(url: String) { try { if (!isAdded) { return } - // Titleを設定する URL を定義 - val urlToTitle: Map = hashMapOf( + // 保存する LastURL を定義 + val setLastUrl: Map = hashMapOf( "Mobile#home" to requireActivity().baseContext.getString(R.string.main_label_home), "Mobile#work" to requireActivity().baseContext.getString(R.string.main_label_work), "Mobile#formSelection" to requireActivity().baseContext.getString(R.string.main_label_create_document), "Mobile#agileWorksSearch" to requireActivity().baseContext.getString(R.string.main_label_search) ) requireActivity().runOnUiThread { - urlToTitle.forEach { (k, v) -> + setLastUrl.forEach { (k, v) -> if (url.contains(k)) { lastUrl = url - setTitle(v) } } } @@ -395,18 +394,7 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { // WebView が表示しているページによっては普通に起こり得るため単に握り潰す。 } } - private fun setTitle(title: String) { - val activity = requireActivity() - val titleView = activity.findViewById(R.id.toolbar_title) - if (titleView == null) { - // メイン表示: ツールバーのタイトルとして設定 - val toolbar = activity.findViewById(R.id.toolbar) - toolbar?.title = title - } else { - // 通知からの表示: 得られた TextView に設定 - titleView.text = title - } - } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when (requestCode) { diff --git a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebPresenter.kt b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebPresenter.kt index daaf6faa95ad6bd82475c76b05f96e99217f7450..71468c2d4f8df2d3d973c5dfcc43329a7b1c8d39 100644 --- a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebPresenter.kt +++ b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebPresenter.kt @@ -25,7 +25,7 @@ interface DocumentWebPresenter { /** * 現在開かれているページのタイトルを必要に応じて更新する。 */ - fun updateTitle(url: String) + fun saveLastUrl(url: String) // ネットワーク接続/切断関連 /** diff --git a/app/src/main/res/navigation/nav_create_document.xml b/app/src/main/res/navigation/nav_create_document.xml index 6a397e55401b05239b4378413bdd50647543e612..d6e6e28f3f26760fe9481e7db1afb8002b823a09 100644 --- a/app/src/main/res/navigation/nav_create_document.xml +++ b/app/src/main/res/navigation/nav_create_document.xml @@ -7,11 +7,7 @@ - + android:label="@string/main_label_create_document"> - + android:label="@string/main_label_home"> - + android:label="@string/main_label_search"> - + android:label="@string/main_label_work">