Skip to content

Commit

Permalink
htmlgames: smoother games (fixes #4927)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avinash-Codes committed Jan 3, 2025
1 parent 70d3fa6 commit 0f27640
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package org.ole.planet.myplanet.ui.viewer

import android.content.pm.ActivityInfo
import android.graphics.Bitmap
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.webkit.*
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -25,9 +27,21 @@ class WebViewActivity : AppCompatActivity() {
val dataFromDeepLink = intent.dataString
fromDeepLink = !TextUtils.isEmpty(dataFromDeepLink)
val title: String? = intent.getStringExtra("title")
Log.d("WebViewActivity", "onCreate: $title")
link = intent.getStringExtra("link") ?: ""
val resourceId = intent.getStringExtra("RESOURCE_ID")

val hasIndexHtml = resourceId?.let {
val directory = File(getExternalFilesDir(null), "ole/$resourceId")
File(directory, "index.html").exists()
} ?: false

requestedOrientation = if (hasIndexHtml) {
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
} else {
ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
}

clearCookie()
if (!TextUtils.isEmpty(title)) {
activityWebViewBinding.contentWebView.webTitle.text = title
Expand Down

0 comments on commit 0f27640

Please sign in to comment.