convert kotlin code to java online
when (intent.action) {
Constants.ACTIVITY_STUFF -> {
onHandleActivity()
}
}
convert kotlin code to java online
when (intent.action) {
Constants.ACTIVITY_STUFF -> {
onHandleActivity()
}
}
convert kotlin code to java online
package br.com.treinaweb.springbootapi.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Pessoa
{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(nullable = false)
private String nome;
public long getId() {
return id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public void setId(long id) {
this.id = id;
}
}
convert kotlin code to java online
private fun emitBubbles() {
// It will create a thread and attach it to
// the main thread
Handler().postDelayed({
// Random is used to select random bubble
// size
val size = Random.nextInt(20, 80)
bubbleEmitter.emitBubble(size)
bubbleEmitter.setColors(android.R.color.black,
android.R.color.black,
android.R.color.black);
emitBubbles()
}, Random.nextLong(100, 500))
}
convert kotlin code to java online
private fun loading(view: View, loading: Boolean) {
view.takeIf { view is ViewGroup }?.let {
for (i in 0 until (view as ViewGroup).childCount) {
val childAt = view.getChildAt(i)
(childAt as? ISkeletonDrawer)?.let {
if (!loading) {
it.startLoading()
} else {
it.stopLoading()
}
}
run { loading(childAt, loading) }
}
}
}
convert kotlin code to java online
private fun startUpdateTimer() {
timer = Timer()
timer?.scheduleAtFixedRate(object : TimerTask() {
override fun run() {
// only the UI thread can edit the activity appearance
[email protected] {
updateUI()
if (!countdownServiceRunning) {
stopUpdateTimer()
}
}
}
}, 100, 1000)
}
convert kotlin code to java online
private fun imageToByteBuffer(image: Image, outputBuffer: ByteArray) {
assert(image.format == ImageFormat.YUV_420_888)
val imageCrop = image.cropRect
val imagePlanes = image.planes
imagePlanes.forEachIndexed { planeIndex, plane ->
convert kotlin code to java online
data class UserModel(
var userName: String = "",
var userType: Int = 0
)
convert kotlin code to java online
val networkCallback = object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
super.onAvailable(network)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// To make sure that requests don't go over mobile data
connectivityManager.bindProcessToNetwork(network)
} else {
connectivityManager.setProcessDefaultNetwork(network)
}
}
override fun onLost(network: Network) {
super.onLost(network)
// This is to stop the looping request for OnePlus & Xiaomi models
connectivityManager.bindProcessToNetwork(null)
connectivityManager.unregisterNetworkCallback(networkCallback)
// Here you can have a fallback option to show a 'Please connect manually' page with an Intent to the Wifi settings
}
}
convert kotlin code to java online
var currentFragmentWeakReference: WeakReference<Fragment>? = null
convert kotlin code to java online
private fun countWordExtEmbeddedImage(`is`: InputStream?): Int {
try {
// https://www.baeldung.com/java-microsoft-word-with-apache-poi
// 重複的圖片不會計算在內
val doc = XWPFDocument(`is`)
val pics:List<XWPFPictureData> = doc.getAllPictures()
var embed_cnt = 0
for (pic in pics) {
embed_cnt ++
}
doc.close()
return embed_cnt
} catch (ex: Exception) {
LOG.error(ex.message)
}
return -1
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us