-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Add log cat to check webview delay loading #960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -43,28 +43,63 @@ class WebViewFragment : Fragment(), EmptyViewListener { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| override fun onCreate(savedInstanceState: Bundle?) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| super.onCreate(savedInstanceState) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val startTime = System.currentTimeMillis() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 8: WebViewFragment.onCreate() STARTED") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parseArguments() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 8 DONE: WebViewFragment.onCreate() completed in ${System.currentTimeMillis() - startTime}ms") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| override fun onCreateView( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inflater: LayoutInflater, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| container: ViewGroup?, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| savedInstanceState: Bundle? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): View? { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val startTime = System.currentTimeMillis() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 9: WebViewFragment.onCreateView() STARTED") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _layout = WebviewFragmentBinding.inflate(inflater, container, false) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 9 DONE: WebViewFragment.onCreateView() completed in ${System.currentTimeMillis() - startTime}ms") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+61
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This debugging code should be removed before merging. It adds noise to the logs and is not necessary for production builds.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return layout.root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| super.onViewCreated(view, savedInstanceState) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val startTime = System.currentTimeMillis() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 10: WebViewFragment.onViewCreated() STARTED") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| showLoading() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", " Showing loading spinner... (${System.currentTimeMillis() - startTime}ms)") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initializedSwipeRefresh() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", " Initialized swipe refresh (${System.currentTimeMillis() - startTime}ms)") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initializeEmptyViewFragment() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", " Initialized empty view fragment (${System.currentTimeMillis() - startTime}ms)") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| webView = layout.webView | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| listener?.onWebViewInitializationSuccess() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", " WebView reference obtained (${System.currentTimeMillis() - startTime}ms)") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 11: Calling setupWebView()...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val setupStart = System.currentTimeMillis() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setupWebView() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 11 DONE: setupWebView() completed in ${System.currentTimeMillis() - setupStart}ms") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 12: Calling populateInstituteSettings()...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val settingsStart = System.currentTimeMillis() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| populateInstituteSettings() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 12 DONE: populateInstituteSettings() completed in ${System.currentTimeMillis() - settingsStart}ms") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 13: Calling loadContent() - NETWORK REQUEST STARTS HERE...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val loadStart = System.currentTimeMillis() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| loadContent() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 13 DONE: loadContent() initiated in ${System.currentTimeMillis() - loadStart}ms (network request continues in background)") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 10 DONE: WebViewFragment.onViewCreated() completed in ${System.currentTimeMillis() - startTime}ms total") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+73
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The extensive timing logs in this method are useful for debugging but should not be part of the production code. Please remove them to improve readability and avoid log spam.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| override fun onDestroy() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ import android.webkit.* | |
| class CustomWebViewClient(val fragment: WebViewFragment) : WebViewClient() { | ||
|
|
||
| private var errorList = linkedMapOf<WebResourceRequest?,WebResourceResponse?>() | ||
| private var pageLoadStartTime: Long = 0 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean { | ||
| val url = request?.url.toString() | ||
|
|
@@ -36,10 +37,23 @@ class CustomWebViewClient(val fragment: WebViewFragment) : WebViewClient() { | |
| } | ||
|
|
||
| override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { | ||
| pageLoadStartTime = System.currentTimeMillis() | ||
| android.util.Log.d("AI_TIMING", "🟦 STEP 14: WebView.onPageStarted() - URL loading started") | ||
| android.util.Log.d("AI_TIMING", " Loading URL: $url") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if (fragment.showLoadingBetweenPages) fragment.showLoading() | ||
| } | ||
|
|
||
| override fun onPageFinished(view: WebView?, url: String?) { | ||
| val totalLoadTime = System.currentTimeMillis() - pageLoadStartTime | ||
| android.util.Log.d("AI_TIMING", "✅ STEP 14 DONE: WebView.onPageFinished() - Page loaded!") | ||
| android.util.Log.d("AI_TIMING", " Loaded URL: $url") | ||
| android.util.Log.d("AI_TIMING", " ⏱️ TOTAL PAGE LOAD TIME: ${totalLoadTime}ms") | ||
| android.util.Log.d("AI_TIMING", "") | ||
| android.util.Log.d("AI_TIMING", "========================================") | ||
| android.util.Log.d("AI_TIMING", "🎉 AI WEBVIEW FULLY LOADED AND VISIBLE!") | ||
| android.util.Log.d("AI_TIMING", "⏱️ Total time from button click: ${totalLoadTime}ms") | ||
| android.util.Log.d("AI_TIMING", "========================================") | ||
|
|
||
|
Comment on lines
+129
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| fragment.hideLoading() | ||
| fragment.hideEmptyViewShowWebView() | ||
| checkWebViewHasError() | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,31 +25,52 @@ class AIChatPdfFragment : Fragment() { | |||||||||||||||||
| container: ViewGroup?, | ||||||||||||||||||
| savedInstanceState: Bundle? | ||||||||||||||||||
| ): View? { | ||||||||||||||||||
| return inflater.inflate(R.layout.ai_pdf_fragment, container, false) | ||||||||||||||||||
| val startTime = System.currentTimeMillis() | ||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 4: AIChatPdfFragment.onCreateView() STARTED") | ||||||||||||||||||
|
|
||||||||||||||||||
| val view = inflater.inflate(R.layout.ai_pdf_fragment, container, false) | ||||||||||||||||||
|
|
||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 4 DONE: AIChatPdfFragment.onCreateView() completed in ${System.currentTimeMillis() - startTime}ms") | ||||||||||||||||||
| return view | ||||||||||||||||||
|
Comment on lines
+28
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove the debug timing logs and revert to the original concise implementation.
Suggested change
|
||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||||||||||||||||||
| super.onViewCreated(view, savedInstanceState) | ||||||||||||||||||
|
|
||||||||||||||||||
| val startTime = System.currentTimeMillis() | ||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 5: AIChatPdfFragment.onViewCreated() STARTED") | ||||||||||||||||||
|
|
||||||||||||||||||
| val contentId = requireArguments().getLong(ARG_CONTENT_ID, -1L) | ||||||||||||||||||
| val courseId = requireArguments().getLong(ARG_COURSE_ID, -1L) | ||||||||||||||||||
|
|
||||||||||||||||||
| if (contentId == -1L || courseId == -1L) { | ||||||||||||||||||
| throw IllegalArgumentException("Required arguments (contentId, courseId) are missing or invalid.") | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 6: Creating WebViewFragment...") | ||||||||||||||||||
| val webViewCreateStart = System.currentTimeMillis() | ||||||||||||||||||
|
|
||||||||||||||||||
| val webViewFragment = WebViewFragment() | ||||||||||||||||||
|
|
||||||||||||||||||
| val pdfUrl = getPdfUrl(courseId, contentId) | ||||||||||||||||||
| android.util.Log.d("AI_TIMING", " URL to load: $pdfUrl") | ||||||||||||||||||
|
|
||||||||||||||||||
| webViewFragment.arguments = Bundle().apply { | ||||||||||||||||||
| putString(URL_TO_OPEN, pdfUrl) | ||||||||||||||||||
| putBoolean(IS_AUTHENTICATION_REQUIRED, true) | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 6 DONE: WebViewFragment created in ${System.currentTimeMillis() - webViewCreateStart}ms") | ||||||||||||||||||
|
|
||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 7: Committing WebViewFragment transaction...") | ||||||||||||||||||
| val transactionStart = System.currentTimeMillis() | ||||||||||||||||||
|
|
||||||||||||||||||
| childFragmentManager.beginTransaction() | ||||||||||||||||||
| .replace(R.id.aiPdf_view_fragment, webViewFragment) | ||||||||||||||||||
| .commit() | ||||||||||||||||||
|
|
||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 7 DONE: WebView transaction committed in ${System.currentTimeMillis() - transactionStart}ms") | ||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 5 DONE: AIChatPdfFragment.onViewCreated() completed in ${System.currentTimeMillis() - startTime}ms total") | ||||||||||||||||||
|
Comment on lines
+40
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This extensive debug logging should be removed from the production code. Please revert the body of this method to its original state. val contentId = requireArguments().getLong(ARG_CONTENT_ID, -1L)
val courseId = requireArguments().getLong(ARG_COURSE_ID, -1L)
if (contentId == -1L || courseId == -1L) {
throw IllegalArgumentException("Required arguments (contentId, courseId) are missing or invalid.")
}
val webViewFragment = WebViewFragment()
val pdfUrl = getPdfUrl(courseId, contentId)
webViewFragment.arguments = Bundle().apply {
putString(URL_TO_OPEN, pdfUrl)
putBoolean(IS_AUTHENTICATION_REQUIRED, true)
}
childFragmentManager.beginTransaction()
.replace(R.id.aiPdf_view_fragment, webViewFragment)
.commit() |
||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| private fun getPdfUrl(courseId: Long, contentId: Long): String { | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -114,22 +114,36 @@ class DocumentViewerFragment : BaseContentDetailFragment(), PdfDownloadListener, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private fun showAIView() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val startTime = System.currentTimeMillis() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 1: showAIView() STARTED at ${startTime}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (aiChatFragment == null) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 2: Creating AIChatPdfFragment...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val fragmentCreateStart = System.currentTimeMillis() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aiChatFragment = AIChatPdfFragment() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val args = Bundle() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args.putLong("contentId", contentId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args.putLong("courseId", content.courseId ?: -1L) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aiChatFragment?.arguments = args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 2 DONE: Fragment created in ${System.currentTimeMillis() - fragmentCreateStart}ms") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| binding.pdfView.visibility = View.GONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| binding.bottomNavigationFragment.visibility = View.GONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| binding.askAiFab.visibility = View.GONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| binding.aiPdfViewFragment.visibility = View.VISIBLE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "🟦 STEP 3: Committing fragment transaction...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val transactionStart = System.currentTimeMillis() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| childFragmentManager.beginTransaction() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(R.id.aiPdf_view_fragment, aiChatFragment!!) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .commit() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ STEP 3 DONE: Transaction committed in ${System.currentTimeMillis() - transactionStart}ms") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| android.util.Log.d("AI_TIMING", "✅ showAIView() COMPLETED in ${System.currentTimeMillis() - startTime}ms total") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+117
to
+146
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove the debug logging from this method and restore its original implementation.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isAIView = true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| activity?.invalidateOptionsMenu() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These timing logs appear to be for debugging purposes. They should be removed from the final code to keep the codebase clean and avoid unnecessary logging in production.