Mercurial > dwindows
comparison android/DWindows.kt @ 2542:bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
Minor code cleanup in dwtest and ios.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 13 May 2021 07:43:31 +0000 |
parents | 822f814a54f4 |
children | f9367eb9a6e7 |
comparison
equal
deleted
inserted
replaced
2541:2ee4df2c50bf | 2542:bb75e64e6138 |
---|---|
1817 dimensions = pixmap.width.toLong() or (pixmap.height.toLong() shl 32) | 1817 dimensions = pixmap.width.toLong() or (pixmap.height.toLong() shl 32) |
1818 } | 1818 } |
1819 return dimensions | 1819 return dimensions |
1820 } | 1820 } |
1821 | 1821 |
1822 fun screenGetDimensions(): Long | |
1823 { | |
1824 val dm = resources.displayMetrics | |
1825 return dm.widthPixels.toLong() or (dm.heightPixels.toLong() shl 32) | |
1826 } | |
1827 | |
1822 fun renderNew(cid: Int): DWRender? | 1828 fun renderNew(cid: Int): DWRender? |
1823 { | 1829 { |
1824 var render: DWRender? = null | 1830 var render: DWRender? = null |
1825 | 1831 |
1826 waitOnUiThread { | 1832 waitOnUiThread { |
2252 waitOnUiThread { | 2258 waitOnUiThread { |
2253 this.finishAffinity() | 2259 this.finishAffinity() |
2254 } | 2260 } |
2255 } | 2261 } |
2256 | 2262 |
2257 fun dwInit(appid: String, appname: String) | 2263 fun dwInit(appid: String, appname: String): Int |
2258 { | 2264 { |
2259 waitOnUiThread { | 2265 waitOnUiThread { |
2260 // Create the notification channel in dw_init() | 2266 // Create the notification channel in dw_init() |
2261 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | 2267 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
2262 // Create the NotificationChannel | 2268 // Create the NotificationChannel |
2267 val notificationManager = | 2273 val notificationManager = |
2268 getSystemService(NOTIFICATION_SERVICE) as NotificationManager | 2274 getSystemService(NOTIFICATION_SERVICE) as NotificationManager |
2269 notificationManager.createNotificationChannel(mChannel) | 2275 notificationManager.createNotificationChannel(mChannel) |
2270 } | 2276 } |
2271 } | 2277 } |
2278 return Build.VERSION.SDK_INT | |
2279 } | |
2280 | |
2281 fun androidGetRelease(): String | |
2282 { | |
2283 return Build.VERSION.RELEASE | |
2272 } | 2284 } |
2273 | 2285 |
2274 fun notificationNew(title: String, imagepath: String, text: String, appid: String): NotificationCompat.Builder? | 2286 fun notificationNew(title: String, imagepath: String, text: String, appid: String): NotificationCompat.Builder? |
2275 { | 2287 { |
2276 var builder: NotificationCompat.Builder? = null | 2288 var builder: NotificationCompat.Builder? = null |