android
Android kara_mara 6 months ago 100%
How to start an overlay activity over *other* apps?

I have an Android app which needs to run an overlay activity with some content in it over other apps on the phone at the moment they start or get focused. For this, I use `AccessiblityService`: ``` override fun onAccessibilityEvent(event: AccessibilityEvent) { if (event.eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) { if (cond1) { // (!) // this will get triggered properly // val intent = Intent(this, MyOverlayActivity::class.java) intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP startActivity(intent) } } } ``` However, it'll only get *launched properly* whenever I switch to my own activity - `MainActivity`. **What's the matter?** MyOverlayActivity: ``` class MyOverlayActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // 1 // window.setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY) // val layoutParams = WindowManager.LayoutParams( // WindowManager.LayoutParams.MATCH_PARENT, // WindowManager.LayoutParams.MATCH_PARENT, // WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, // WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, // PixelFormat.TRANSLUCENT // ) // window.attributes = layoutParams // // 2 window.setFlags( WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE ) window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) window.setLayout( WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT ) window.setGravity(Gravity.BOTTOM) // setContentView(R.layout.activity_my_overlay_layout) } } ``` Manifest ``` <!-- [.............] --> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <!-- [.............] --> <activity android:name=".MyOverlayActivity" android:exported="true" android:theme="@style/AppTheme.TranslucentNoTitleBarFullscreen" android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboardHidden|keyboard|navigation"> </activity> ``` Note I've given the permission required to my app in Acessibility.

12
0
windows Microsoft Windows How to install Windows 8 or 10 on an exteranl SSD or pen-drive?
Jump
"Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearWI
Microsoft Windows kara_mara 6 months ago 57%
How to install Windows 8 or 10 on an exteranl SSD or pen-drive?

That is, a Windows must be booted and run **completely** from an external drive, be able** to save settings** and data, and all other stuff -- perform all the things that a Windows installed normally, on an internal drive, does. As far as I know, WinToGo doesn't work anymore. And I even have never used it anyway. What works nowadays? Will Rufus be able to do this?

1
3
cryptocurrency
CryptoCurrency kara_mara 6 months ago 50%
[dev] What's the value of "gasLimit = 21000" of Ethereum in Polygon?

In Ethereum the gasLimit is 21000. **The constant.** I haven't found anywhere the value of it for Polygon, though. How much is it? For a token as well as for MATIC itself. I've found the number 57000 on an explorer in a real TX. Yet I haven't been able to find a confirmation for it elsewhere. --- What I need is to specify a limit in my codebase for **transfers** of MATIC and tokens only. There won't be any calls to smart-contracts. What number should I put there?

0
2