Skip to content

Commit

Permalink
Fix Bug When Installing RootFS (closes #78), And Small Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
KreitinnSoftware committed Jan 19, 2025
1 parent fec36ea commit 61b335a
Showing 1 changed file with 2 additions and 42 deletions.
44 changes: 2 additions & 42 deletions app/src/main/java/com/micewine/emu/activities/EmulationActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.os.RemoteException
import android.util.DisplayMetrics
import android.util.Log
Expand Down Expand Up @@ -64,16 +65,12 @@ import com.micewine.emu.input.TouchInputHandler
import com.micewine.emu.views.OverlayView
import kotlinx.coroutines.launch


@SuppressLint("ApplySharedPref")
@Suppress("deprecation", "unused")
class EmulationActivity : AppCompatActivity(), View.OnApplyWindowInsetsListener {
private var frm: FrameLayout? = null
private var mInputHandler: TouchInputHandler? = null
var service: ICmdEntryInterface? = null
private var mLorieKeyListener: View.OnKeyListener? = null
private var filterOutWinKey = false
private var useTermuxEKBarBehaviour = false

private val preferencesChangedListener =
SharedPreferences.OnSharedPreferenceChangeListener { _: SharedPreferences?, _: String? ->
Expand Down Expand Up @@ -393,15 +390,6 @@ class EmulationActivity : AppCompatActivity(), View.OnApplyWindowInsetsListener
super.onDestroy()
}

private fun setSize(v: View, width: Int, height: Int) {
val p = v.layoutParams
p.width = (width * resources.displayMetrics.density).toInt()
p.height = (height * resources.displayMetrics.density).toInt()
v.layoutParams = p
v.minimumWidth = (width * resources.displayMetrics.density).toInt()
v.minimumHeight = (height * resources.displayMetrics.density).toInt()
}

fun onReceiveConnection(intent: Intent?) {
val bundle = intent?.getBundleExtra(null)
val ibinder = bundle?.getBinder(null) ?: return
Expand Down Expand Up @@ -587,15 +575,11 @@ class EmulationActivity : AppCompatActivity(), View.OnApplyWindowInsetsListener
const val ACTION_STOP: String = "com.micewine.emu.ACTION_STOP"
const val ACTION_CUSTOM: String = "com.micewine.emu.ACTION_CUSTOM"

@JvmField
var handler: Handler = Handler()
var handler: Handler = Handler(Looper.getMainLooper())
var inputMethodManager: InputMethodManager? = null
private var showIMEWhileExternalConnected = false
private var externalKeyboardConnected = false

private var oldFullscreen = false
private var oldHideCutout = false

@SuppressLint("StaticFieldLeak")
private lateinit var instance: EmulationActivity

Expand All @@ -604,24 +588,6 @@ class EmulationActivity : AppCompatActivity(), View.OnApplyWindowInsetsListener
return instance
}

@JvmStatic
fun toggleKeyboardVisibility() {
Log.d("EmulationActivity", "Toggling keyboard visibility")
if (inputMethodManager != null) {
Log.d(
"toggleKeyboardVisibility",
"externalKeyboardConnected $externalKeyboardConnected showIMEWhileExternalConnected $showIMEWhileExternalConnected"
)
if (!externalKeyboardConnected || showIMEWhileExternalConnected) {
inputMethodManager!!.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)
} else {
inputMethodManager!!.hideSoftInputFromWindow(getInstance().window.decorView.rootView.windowToken, 0)
}

getInstance().lorieView!!.requestFocus()
}
}

@JvmStatic
val isConnected: Boolean
get() {
Expand All @@ -633,12 +599,6 @@ class EmulationActivity : AppCompatActivity(), View.OnApplyWindowInsetsListener
if (getInstance().lorieView != null && getInstance().lorieView!!.display != null) getInstance().lorieView!!.display.getRealMetrics(m)
}

fun setCapturingEnabled(enabled: Boolean) {
if (getInstance().mInputHandler == null) return

getInstance().mInputHandler!!.setCapturingEnabled(enabled)
}

var sharedLogs: ShellLoader.ViewModelAppLogs? = null

fun initSharedLogs(supportFragmentManager: FragmentManager) {
Expand Down

0 comments on commit 61b335a

Please sign in to comment.