Skip to content

Instantly share code, notes, and snippets.

View toastkidjp's full-sized avatar
💻

Toast kid toastkidjp

💻
View GitHub Profile
//Create a new CefAppBuilder instance
val builder = CefAppBuilder();
builder.setInstallDir(File("jcef-bundle")); //Default
builder.setProgressHandler(ConsoleProgressHandler()); //Default
builder.addJcefArgs("--disable-gpu"); //Just an example
builder.cefSettings.windowless_rendering_enabled = false; //Default - select OSR mode
val cefApp = builder.build()
CefApp.addAppHandler(object : CefAppHandlerAdapter(null) {
override fun stateHasChanged(state: CefAppState) {
val sizePx = with(LocalDensity.current) { 100.dp.toPx() }
val anchors = mapOf(-sizePx to 1, sizePx to 0)
val swipeableState = rememberSwipeableState(
initialValue = 0,
confirmStateChange = {
if (it == 1) {
viewModel.index.value--
} else if (it == 0) {
viewModel.index.value++
}
val image = ImageIO.read(Files.newInputStream(Paths.get("C:/Users/toastkidjp/Pictures/mikaKunimoto_20201114_43.png")))
val w1 = image.getWidth()
val h1 = image.getHeight()
val im2 = BufferedImage(w1, h1, BufferedImage.TYPE_INT_ARGB)
val g2 = im2.createGraphics()
val rect = Rectangle2D.Double(0.0, 0.0, w1.toDouble(), h1.toDouble())
g2.drawImage(image, 0, 0, null)
g2.color = Color(220, 220, 220, 230)
g2.fill(rect)
g2.dispose()
/*
* Copyright (c) 2020 toastkidjp.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
*/
import android.hardware.Sensor
import android.hardware.SensorEvent
/*
* Copyright (c) 2019 toastkidjp.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
*/
package jp.toastkid.yobidashi.libs.view
import android.content.Context
@toastkidjp
toastkidjp / ArticleFileRenaming.kt
Created March 24, 2020 00:50
Article File Migration
package jp.toastkid.yobidashi.compact.migration
import jp.toastkid.yobidashi.compact.NameDecoder
import java.io.IOException
import java.nio.file.Files
import java.nio.file.Paths
object ArticleFileRenaming {
private val nameDecoder = NameDecoder()
/*
* Copyright (c) 2019 toastkidjp.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
*/
package jp.toastkid.yobidashi.browser.floating
import android.annotation.SuppressLint
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
val consumerIrManager =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
activitySupplier().getSystemService(Context.CONSUMER_IR_SERVICE) as? ConsumerIrManager
} else {
null
}
if (consumerIrManager?.hasIrEmitter() == true) {
consumerIrManager.transmit(
38000,
/*
* Copyright (c) 2019 toastkidjp.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
*/
package jp.toastkid.yobidashi.main
import android.view.GestureDetector
var ps = document.getElementsByTagName('p');
var arry = [];
for (var i = 0; i < ps.length; i++) {
arry[i] = ps[i].textContent;
}
arry;